Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Hook(at = @At(point = InjectionPoint.METHOD_CALL, target = "readFromNBT"),returnCondition = ReturnCondition.ALWAYS)
- public static void readFromNBT(TileEntityStructure tyu,NBTTagCompound compound)
- {
- // tyu.readFromNBT(compound);
- tyu.setName(compound.getString("name"));
- // tyu.author = compound.getString("author");
- tyu.setMetadata(compound.getString("metadata"));
- int i = MathHelper.clamp(compound.getInteger("posX"), -128, 128);
- int j = MathHelper.clamp(compound.getInteger("posY"), -128, 128);
- int k = MathHelper.clamp(compound.getInteger("posZ"), -128, 128);
- tyu.setPosition(new BlockPos(i, j, k));
- int l = MathHelper.clamp(compound.getInteger("sizeX"), 0, 128);
- int i1 = MathHelper.clamp(compound.getInteger("sizeY"), 0, 128);
- int j1 = MathHelper.clamp(compound.getInteger("sizeZ"), 0, 128);
- tyu.setSize(new BlockPos(l, i1, j1));
- try
- {
- tyu.setRotation(Rotation.valueOf(compound.getString("rotation")));
- }
- catch (IllegalArgumentException var11)
- {
- tyu.setRotation(Rotation.NONE);
- }
- try
- {
- tyu.setMirror(Mirror.valueOf(compound.getString("mirror")));
- }
- catch (IllegalArgumentException var10)
- {
- tyu.setMirror(Mirror.NONE);
- }
- try
- {
- tyu.setMode(TileEntityStructure.Mode.valueOf(compound.getString("mode")));
- }
- catch (IllegalArgumentException var9)
- {
- tyu.setMode(TileEntityStructure.Mode.DATA);
- }
- // tyu.ignoreEntities = compound.getBoolean("ignoreEntities");
- tyu.setPowered(compound.getBoolean("powered"));
- tyu.setShowAir(compound.getBoolean("showair"));
- tyu.setShowBoundingBox(compound.getBoolean("showboundingbox"));
- if (compound.hasKey("integrity"))
- {
- tyu.setIntegrity(compound.getFloat("integrity"));
- }
- else
- {
- tyu.setIntegrity(1.0F);
- }
- tyu.setSeed(compound.getLong("seed"));
- if (tyu.getWorld() != null)
- {
- BlockPos blockpos = tyu.getPos();
- IBlockState iblockstate = tyu.getWorld().getBlockState(blockpos);
- if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK)
- {
- tyu.getWorld().setBlockState(blockpos, iblockstate.withProperty(BlockStructure.MODE, tyu.getMode()), 2);
- }
- }
- }
- @Hook(injectOnExit=true,returnCondition = ReturnCondition.ALWAYS)
- public static void writeToNBT(TileEntityStructure tyu,NBTTagCompound compound)
- {
- System.out.println("write " + tyu.getStructureSize());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement