Skip to content

Commit

Permalink
Sequential Program
Browse files Browse the repository at this point in the history
  • Loading branch information
RhysB committed Aug 4, 2024
1 parent 6112b48 commit 66e39f0
Show file tree
Hide file tree
Showing 26 changed files with 2,337 additions and 0 deletions.
222 changes: 222 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@

# Created by https://www.gitignore.io/api/java,intellij,intellij+all,intellij+iml
# Edit at https://www.gitignore.io/?templates=java,intellij,intellij+all,intellij+iml

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/**/sonarlint/

# SonarQube Plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator/

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff

# Generated files

# Sensitive or high-churn files

# Gradle

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake

# Mongo Explorer plugin

# File-based project format

# IntelliJ

# mpeltonen/sbt-idea plugin

# JIRA plugin

# Cursive Clojure plugin

# Crashlytics plugin (for Android Studio and IntelliJ)

# Editor-based Rest Client

# Android studio 3.1+ serialized cache file

### Intellij+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
.idea/sonarlint

### Intellij+iml ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff

# Generated files

# Sensitive or high-churn files

# Gradle

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake

# Mongo Explorer plugin

# File-based project format

# IntelliJ

# mpeltonen/sbt-idea plugin

# JIRA plugin

# Cursive Clojure plugin

# Crashlytics plugin (for Android Studio and IntelliJ)

# Editor-based Rest Client

# Android studio 3.1+ serialized cache file

### Intellij+iml Patch ###
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023


### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# End of https://www.gitignore.io/api/java,intellij,intellij+all,intellij+iml
22 changes: 22 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>Server</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
57 changes: 57 additions & 0 deletions src/main/java/com/mojang/nbt/ByteArrayTag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.mojang.nbt;

/**
* Copyright Mojang AB.
*
* Don't do evil.
*/

import java.io.*;

public class ByteArrayTag extends Tag {
public byte[] data;

public ByteArrayTag(String name) {
super(name);
}

public ByteArrayTag(String name, byte[] data) {
super(name);
this.data = data;
}

void write(DataOutput dos) throws IOException {
dos.writeInt(data.length);
dos.write(data);
}

void load(DataInput dis) throws IOException {
int length = dis.readInt();
data = new byte[length];
dis.readFully(data);
}

public byte getId() {
return TAG_Byte_Array;
}

public String toString() {
return "[" + data.length + " bytes]";
}

@Override
public boolean equals(Object obj) {
if (super.equals(obj)) {
ByteArrayTag o = (ByteArrayTag) obj;
return ((data == null && o.data == null) || (data != null && data.equals(o.data)));
}
return false;
}

@Override
public Tag copy() {
byte[] cp = new byte[data.length];
System.arraycopy(data, 0, cp, 0, data.length);
return new ByteArrayTag(getName(), cp);
}
}
52 changes: 52 additions & 0 deletions src/main/java/com/mojang/nbt/ByteTag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.mojang.nbt;

/**
* Copyright Mojang AB.
*
* Don't do evil.
*/

import java.io.*;

public class ByteTag extends Tag {
public byte data;

public ByteTag(String name) {
super(name);
}

public ByteTag(String name, byte data) {
super(name);
this.data = data;
}

void write(DataOutput dos) throws IOException {
dos.writeByte(data);
}

void load(DataInput dis) throws IOException {
data = dis.readByte();
}

public byte getId() {
return TAG_Byte;
}

public String toString() {
return "" + data;
}

@Override
public boolean equals(Object obj) {
if (super.equals(obj)) {
ByteTag o = (ByteTag) obj;
return data == o.data;
}
return false;
}

@Override
public Tag copy() {
return new ByteTag(getName(), data);
}
}
Loading

0 comments on commit 66e39f0

Please sign in to comment.