-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,864 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/me/ulrich/structure/BlockEntityTag/BannerTag.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,37 @@ | ||
package me.ulrich.structure.BlockEntityTag; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import me.ulrich.structure.GPattern; | ||
import me.ulrich.structure.nbt.tag.CompoundTag; | ||
import me.ulrich.structure.nbt.tag.ListTag; | ||
|
||
public class BannerTag extends BlockEntityTag { | ||
private List<GPattern> patterns; | ||
private String customName; | ||
|
||
public BannerTag() { | ||
patterns = new ArrayList<GPattern>(); | ||
} | ||
|
||
public List<GPattern> getPatterns() { | ||
return patterns; | ||
} | ||
|
||
public String getCustomName() { | ||
return customName; | ||
} | ||
|
||
public void read(CompoundTag tag) { | ||
super.read(tag); | ||
customName = tag.getString("CustomName"); | ||
|
||
if (tag.containsKey("Patterns")) { | ||
ListTag<CompoundTag> patterns = tag.getListTag("Patterns").asCompoundTagList(); | ||
patterns.forEach((pattern) -> { | ||
this.patterns.add(GPattern.readNewPattern(pattern)); | ||
}); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/me/ulrich/structure/BlockEntityTag/BeaconTag.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,34 @@ | ||
package me.ulrich.structure.BlockEntityTag; | ||
|
||
import me.ulrich.structure.nbt.tag.CompoundTag; | ||
|
||
public class BeaconTag extends BlockEntityTag { | ||
String lock; | ||
int levels; | ||
int primary; | ||
int secondary; | ||
|
||
public String getLock() { | ||
return lock; | ||
} | ||
|
||
public int getLevels() { | ||
return levels; | ||
} | ||
|
||
public int getPrimary() { | ||
return primary; | ||
} | ||
|
||
public int getSecondary() { | ||
return secondary; | ||
} | ||
|
||
public void read(CompoundTag tag) { | ||
super.read(tag); | ||
lock = tag.getString("Lock"); | ||
levels = tag.getInt("Levels"); | ||
primary = tag.getInt("Primary"); | ||
secondary = tag.getInt("Secondary"); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/me/ulrich/structure/BlockEntityTag/BeehiveTag.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,52 @@ | ||
package me.ulrich.structure.BlockEntityTag; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import me.ulrich.structure.GHiveEntity; | ||
import me.ulrich.structure.nbt.tag.CompoundTag; | ||
import me.ulrich.structure.nbt.tag.ListTag; | ||
|
||
public class BeehiveTag extends BlockEntityTag { | ||
private int flowerPosX; | ||
private int flowerPosY; | ||
private int flowerPosZ; | ||
private List<GHiveEntity> bees; | ||
|
||
public BeehiveTag() { | ||
bees = new ArrayList<GHiveEntity>(); | ||
} | ||
|
||
public int getFlowerPosX() { | ||
return flowerPosX; | ||
} | ||
|
||
public int getFlowerPosY() { | ||
return flowerPosY; | ||
} | ||
|
||
public int getFlowerPosZ() { | ||
return flowerPosZ; | ||
} | ||
|
||
public List<GHiveEntity> getBees() { | ||
return bees; | ||
} | ||
|
||
public void read(CompoundTag tag) { | ||
super.read(tag); | ||
if (tag.containsKey("FlowerPos")) { | ||
CompoundTag flowerPos = tag.getCompoundTag("FlowerPos"); | ||
flowerPosX = flowerPos.getInt("X"); | ||
flowerPosY = flowerPos.getInt("Y"); | ||
flowerPosZ = flowerPos.getInt("Z"); | ||
} | ||
|
||
if (tag.containsKey("Bees")) { | ||
ListTag<CompoundTag> bees = tag.getListTag("Bees").asCompoundTagList(); | ||
bees.forEach((bee) -> { | ||
this.bees.add(GHiveEntity.readNewEntity(bee)); | ||
}); | ||
} | ||
} | ||
} |
128 changes: 128 additions & 0 deletions
128
src/main/java/me/ulrich/structure/BlockEntityTag/BlockEntityTag.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,128 @@ | ||
package me.ulrich.structure.BlockEntityTag; | ||
|
||
import me.ulrich.structure.nbt.tag.CompoundTag; | ||
|
||
public class BlockEntityTag { | ||
String id = null; | ||
int x; | ||
int y; | ||
int z; | ||
byte keepPacked; | ||
|
||
public void read(CompoundTag tag) { | ||
if (tag.containsKey("id")) { | ||
this.id = tag.getString("id"); | ||
} | ||
this.x = tag.getInt("x"); | ||
this.y = tag.getInt("y"); | ||
this.z = tag.getInt("z"); | ||
this.keepPacked = tag.getByte("keepPacked"); | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public int getX() { | ||
return x; | ||
} | ||
|
||
public int getY() { | ||
return y; | ||
} | ||
|
||
public int getZ() { | ||
return z; | ||
} | ||
|
||
public byte getKeepPacked() { | ||
return keepPacked; | ||
} | ||
|
||
public static BlockEntityTag readNewEntity(CompoundTag tag, String id) { | ||
// determine type | ||
BlockEntityTag t = new BlockEntityTag(); | ||
if (id == null) { | ||
id = tag.getString("id"); | ||
} | ||
switch (id.replaceFirst("minecraft:", "")) { | ||
case "banner": | ||
t = new BannerTag(); | ||
break; | ||
case "chest": | ||
case "shulker_box": | ||
case "barrel": | ||
t = new ChestTag(); | ||
break; | ||
case "beacon": | ||
t = new BeaconTag(); | ||
break; | ||
case "beehive": | ||
t = new BeehiveTag(); | ||
break; | ||
case "furnace": | ||
case "smoker": | ||
case "blast_furnace": | ||
t = new FurnaceTag(); | ||
break; | ||
case "brewing_stand": | ||
t = new BrewingStandTag(); | ||
break; | ||
case "campfire": | ||
t = new CampfireTag(); | ||
break; | ||
case "cauldron": | ||
t = new CauldronTag(); | ||
break; | ||
case "comparator": | ||
t = new ComparatorTag(); | ||
break; | ||
case "command_block": | ||
t = new CommandBlockTag(); | ||
break; | ||
case "conduit": | ||
t = new ConduitTag(); | ||
break; | ||
case "dispenser": | ||
case "dropper": | ||
t = new DispenserTag(); | ||
break; | ||
case "enchanting_table": | ||
t = new EnchantingTableTag(); | ||
break; | ||
case "end_gateway": | ||
t = new EndGatewayTag(); | ||
break; | ||
case "hopper": | ||
t = new HopperTag(); | ||
break; | ||
case "jigsaw": | ||
t = new JigsawTag(); | ||
break; | ||
case "jukebox": | ||
t = new JukeboxTag(); | ||
break; | ||
case "lectern": | ||
t = new LecternTag(); | ||
break; | ||
case "mob_spawner": | ||
t = new MobSpawnerTag(); | ||
break; | ||
case "piston": | ||
t = new PistonTag(); | ||
break; | ||
case "sign": | ||
t = new SignTag(); | ||
break; | ||
// TODO skulltag | ||
case "structure_block": | ||
t = new StructureBlockTag(); | ||
break; | ||
} | ||
t.read(tag); | ||
if (t.id == null) { | ||
t.id = id; | ||
} | ||
return t; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/me/ulrich/structure/BlockEntityTag/BrewingStandTag.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,54 @@ | ||
package me.ulrich.structure.BlockEntityTag; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import me.ulrich.structure.GItem; | ||
import me.ulrich.structure.nbt.tag.CompoundTag; | ||
import me.ulrich.structure.nbt.tag.ListTag; | ||
|
||
public class BrewingStandTag extends BlockEntityTag { | ||
private String customName; | ||
private String lock; | ||
private List<GItem> items; | ||
private short brewTime; | ||
private byte fuel; | ||
|
||
public BrewingStandTag() { | ||
items = new ArrayList<GItem>(); | ||
} | ||
|
||
public String getCustomName() { | ||
return customName; | ||
} | ||
|
||
public String getLock() { | ||
return lock; | ||
} | ||
|
||
public List<GItem> getItems() { | ||
return items; | ||
} | ||
|
||
public short getBrewTime() { | ||
return brewTime; | ||
} | ||
|
||
public byte getFuel() { | ||
return fuel; | ||
} | ||
|
||
public void read(CompoundTag tag) { | ||
super.read(tag); | ||
customName = tag.getString("CustomName"); | ||
lock = tag.getString("Lock"); | ||
|
||
ListTag<CompoundTag> items = tag.getListTag("Items").asCompoundTagList(); | ||
items.forEach((item) -> { | ||
this.items.add(GItem.readNewItem(item)); | ||
}); | ||
|
||
brewTime = tag.getShort("BrewTime"); | ||
fuel = tag.getByte("Fuel"); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/me/ulrich/structure/BlockEntityTag/CampfireTag.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,41 @@ | ||
package me.ulrich.structure.BlockEntityTag; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import me.ulrich.structure.GItem; | ||
import me.ulrich.structure.nbt.tag.CompoundTag; | ||
import me.ulrich.structure.nbt.tag.ListTag; | ||
|
||
public class CampfireTag extends BlockEntityTag { | ||
private List<GItem> items; | ||
private int[] cookingTimes = {0,0,0,0}; | ||
private int[] cookingTotalTimes = {0,0,0,0}; | ||
|
||
public CampfireTag() { | ||
items = new ArrayList<GItem>(4); | ||
} | ||
|
||
public List<GItem> getItems() { | ||
return items; | ||
} | ||
|
||
public int[] getCookingTimes() { | ||
return cookingTimes; | ||
} | ||
|
||
public int[] getCookingTotalTimes() { | ||
return cookingTotalTimes; | ||
} | ||
|
||
public void read(CompoundTag tag) { | ||
super.read(tag); | ||
ListTag<CompoundTag> items = tag.getListTag("Items").asCompoundTagList(); | ||
items.forEach((item) -> { | ||
this.items.add(GItem.readNewItem(item)); | ||
}); | ||
|
||
cookingTimes = tag.getIntArray("CookingTimes"); | ||
cookingTotalTimes = tag.getIntArray("CookingTotalTimes"); | ||
} | ||
} |
Oops, something went wrong.