Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/1.0'
- Loading branch information
Showing
68 changed files
with
943 additions
and
558 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 18 additions & 16 deletions
34
api/src/main/java/com/voxelwind/api/game/level/block/BlockTypes.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
nbt/src/main/java/com/voxelwind/nbt/util/CompoundTagBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.voxelwind.nbt.util; | ||
|
||
import com.voxelwind.nbt.tags.*; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class CompoundTagBuilder { | ||
private final Map<String, Tag<?>> tagMap = new HashMap<>(); | ||
|
||
public static CompoundTagBuilder builder() { | ||
return new CompoundTagBuilder(); | ||
} | ||
|
||
public static CompoundTagBuilder from(CompoundTag tag) { | ||
CompoundTagBuilder builder = new CompoundTagBuilder(); | ||
builder.tagMap.putAll(tag.getValue()); | ||
return builder; | ||
} | ||
|
||
public CompoundTagBuilder tag(Tag<?> tag) { | ||
tagMap.put(tag.getName(), tag); | ||
return this; | ||
} | ||
|
||
public CompoundTagBuilder tagByte (String name, byte value) { | ||
return tag(new ByteTag(name, value)); | ||
} | ||
|
||
public CompoundTagBuilder tagByteArray (String name, byte [] value) { | ||
return tag(new ByteArrayTag(name, value)); | ||
} | ||
|
||
public CompoundTagBuilder tagDouble (String name, double value) { | ||
return tag(new DoubleTag(name, value)); | ||
} | ||
|
||
public CompoundTagBuilder tagFloat (String name, float value) { | ||
return tag(new FloatTag(name, value)); | ||
} | ||
|
||
public CompoundTagBuilder tagIntArray (String name, int[] value) { | ||
return tag(new IntArrayTag(name, value)); | ||
} | ||
|
||
public CompoundTagBuilder tagInt (String name, int value) { | ||
return tag(new IntTag(name, value)); | ||
} | ||
|
||
public CompoundTagBuilder tagLong (String name, long value) { | ||
return tag(new LongTag(name, value)); | ||
} | ||
|
||
public CompoundTagBuilder tagShort (String name, short value) { | ||
return tag(new ShortTag(name, value)); | ||
} | ||
|
||
public CompoundTagBuilder tagString (String name, String value) { | ||
return tag(new StringTag(name, value)); | ||
} | ||
|
||
public CompoundTagBuilder tagCompoundTag (String name, CompoundTag value) { | ||
tagMap.put(name, value); | ||
return this; | ||
} | ||
|
||
public CompoundTagBuilder tagListTag(String name, ListTag value) { | ||
tagMap.put(name, value); | ||
return this; | ||
} | ||
|
||
public CompoundTag buildRootTag() { | ||
return new CompoundTag("", tagMap); | ||
} | ||
|
||
public CompoundTag build(String tagName) { | ||
return new CompoundTag(tagName, tagMap); | ||
} | ||
} |
Oops, something went wrong.