Commits
Martoph authored and md_5 committed f3828bbee61
1 1 | --- a/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java |
2 2 | +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java |
3 - | |
3 + | |
4 + | import net.minecraft.world.phys.shapes.VoxelShapeBitSet; |
5 + | import net.minecraft.world.phys.shapes.VoxelShapeDiscrete; |
6 + | |
7 + | +// CraftBukkit start |
8 + | +import net.minecraft.nbt.NBTBase; |
9 + | +import org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer; |
10 + | +import org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry; |
11 + | +// CraftBukkit end |
12 + | + |
13 + | public class DefinedStructure { |
14 + | |
15 + | public static final String PALETTE_TAG = "palette"; |
16 + | |
17 + | private BaseBlockPosition size; |
18 + | private String author; |
19 + | |
20 + | + // CraftBukkit start - data containers |
21 + | + private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); |
22 + | + public CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY); |
23 + | + // CraftBukkit end |
24 + | + |
25 + | public DefinedStructure() { |
26 + | this.size = BaseBlockPosition.ZERO; |
27 + | this.author = "?"; |
28 + | |
4 29 | } |
5 30 | |
6 31 | private static List<DefinedStructure.BlockInfo> buildInfoList(List<DefinedStructure.BlockInfo> list, List<DefinedStructure.BlockInfo> list1, List<DefinedStructure.BlockInfo> list2) { |
7 32 | - Comparator<DefinedStructure.BlockInfo> comparator = Comparator.comparingInt((definedstructure_blockinfo) -> { |
8 33 | + Comparator<DefinedStructure.BlockInfo> comparator = Comparator.<DefinedStructure.BlockInfo>comparingInt((definedstructure_blockinfo) -> { // CraftBukkit - decompile error |
9 34 | return definedstructure_blockinfo.pos.getY(); |
10 35 | }).thenComparingInt((definedstructure_blockinfo) -> { |
11 36 | return definedstructure_blockinfo.pos.getX(); |
12 - | |
37 + | |
13 38 | } |
14 39 | |
15 40 | private static Optional<Entity> createEntityIgnoreException(WorldAccess worldaccess, NBTTagCompound nbttagcompound) { |
16 41 | - try { |
17 42 | + // CraftBukkit start |
18 43 | + // try { |
19 44 | return EntityTypes.create(nbttagcompound, (World) worldaccess.getLevel()); |
20 45 | - } catch (Exception exception) { |
21 46 | - return Optional.empty(); |
22 47 | - } |
23 48 | + // } catch (Exception exception) { |
24 49 | + // return Optional.empty(); |
25 50 | + // } |
26 51 | + // CraftBukkit end |
27 52 | } |
28 53 | |
29 54 | public BaseBlockPosition getSize(EnumBlockRotation enumblockrotation) { |
30 - | |
55 + | |
56 + | nbttagcompound.put("entities", nbttaglist3); |
57 + | nbttagcompound.put("size", this.newIntegerList(this.size.getX(), this.size.getY(), this.size.getZ())); |
58 + | nbttagcompound.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion()); |
59 + | + |
60 + | + // CraftBukkit Start - PDC |
61 + | + if (!this.persistentDataContainer.isEmpty()) { |
62 + | + nbttagcompound.put("BukkitValues", this.persistentDataContainer.toTagCompound()); |
63 + | + } |
64 + | + // CraftBukkit end |
65 + | + |
66 + | return nbttagcompound; |
67 + | } |
68 + | |
69 + | |
70 + | } |
71 + | } |
72 + | |
73 + | + // CraftBukkit start - PDC |
74 + | + NBTBase base = nbttagcompound.get("BukkitValues"); |
75 + | + if (base instanceof NBTTagCompound) { |
76 + | + this.persistentDataContainer.putAll((NBTTagCompound) base); |
77 + | + } |
78 + | + // CraftBukkit end |
79 + | } |
80 + | |
81 + | private void loadPalette(NBTTagList nbttaglist, NBTTagList nbttaglist1) { |
82 + | |
31 83 | public IBlockData stateFor(int i) { |
32 84 | IBlockData iblockdata = (IBlockData) this.ids.byId(i); |
33 85 | |
34 86 | - return iblockdata == null ? DefinedStructure.b.DEFAULT_BLOCK_STATE : iblockdata; |
35 87 | + return iblockdata == null ? DEFAULT_BLOCK_STATE : iblockdata; // CraftBukkit - decompile error |
36 88 | } |
37 89 | |
38 90 | public Iterator<IBlockData> iterator() { |