diff --git a/build.gradle b/build.gradle index b63371f..e31f602 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ // @file build.gradle -// Engineer's decor mod gradle build relay (mc1.15.1) +// Engineer's decor mod gradle build. import net.minecraftforge.gradle.common.task.SignJar buildscript { repositories { @@ -31,7 +31,7 @@ minecraft { runs { client { workingDirectory project.file('run') - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + property 'forge.logging.markers', '' // SCAN,REGISTRIES,REGISTRYDUMP property 'forge.logging.console.level', 'debug' mods { engineersdecor { @@ -41,7 +41,7 @@ minecraft { } server { workingDirectory project.file('run') - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + property 'forge.logging.markers', '' // SCAN,REGISTRIES,REGISTRYDUMP property 'forge.logging.console.level', 'debug' mods { engineersdecor { @@ -51,7 +51,7 @@ minecraft { } data { workingDirectory project.file('run') - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + property 'forge.logging.markers', '' // SCAN,REGISTRIES,REGISTRYDUMP property 'forge.logging.console.level', 'debug' args '--mod', 'engineersdecor', '--all', '--output', file('src/generated/resources/') mods { diff --git a/gradle.properties b/gradle.properties index b1c9dde..5a8e5ca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,4 @@ version_minecraft=1.16.4 version_forge_minecraft=1.16.4-35.1.10 version_fml_mappings=20201028-1.16.3 version_jei=1.16.4:7.6.1.63 -version_engineersdecor=1.1.11 +version_engineersdecor=1.1.12 diff --git a/meta/update.json b/meta/update.json index 5f2fc7d..bca0582 100644 --- a/meta/update.json +++ b/meta/update.json @@ -1,6 +1,7 @@ { "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "1.16.4": { + "1.1.12": "[F] Chisels&Bits compatibility addressed (issue #172, ty rodg88).\n[F] Labeled Crate drop list made stateless (issue #173, ty HopsandBarley && Harmonised).", "1.1.11": "[F] Fixed Window placement dupe (issue #170, ty NillerMedDild).", "1.1.10": "[A] Added Small Lab Furnace config for accepted speed-boost heaters (PR#165, ty mrh0).\n[F] Fixed Labeled Crate mouse scrolling crash (issue #169, ty vaelzan).", "1.1.9": "[A] Dark Shingle Roof Wire Conduit recipe added.\n[F] Fixed Ladder climbing (affects forge>=36.0.45, issue #167, thx ZED).", @@ -31,7 +32,7 @@ "1.1.2-b1": "[U] Ported to MC1.16.2." }, "promos": { - "1.16.4-recommended": "1.1.11", - "1.16.4-latest": "1.1.11" + "1.16.4-recommended": "1.1.12", + "1.16.4-latest": "1.1.12" } } \ No newline at end of file diff --git a/readme.md b/readme.md index 52297eb..f9590dc 100644 --- a/readme.md +++ b/readme.md @@ -11,6 +11,9 @@ Mod sources for Minecraft version 1.16.x. ## Version history + - v1.1.12 [F] Chisels&Bits compatibility addressed (issue #172, ty rodg88). + [F] Labeled Crate drop list made stateless (issue #173, ty HopsandBarley && Harmonised). + - v1.1.11 [F] Fixed Window placement dupe (issue #170, ty NillerMedDild). - v1.1.10 [A] Added Small Lab Furnace config for accepted speed-boost heaters (PR#165, ty mrh0). diff --git a/src/main/java/wile/engineersdecor/blocks/DecorBlock.java b/src/main/java/wile/engineersdecor/blocks/DecorBlock.java index 1b490cc..d5a596b 100644 --- a/src/main/java/wile/engineersdecor/blocks/DecorBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/DecorBlock.java @@ -44,15 +44,21 @@ public class DecorBlock public static class Normal extends StandardBlocks.BaseBlock implements IDecorBlock { public Normal(long conf, Block.Properties properties) + { super(conf, properties); } + } + + public static class Cutout extends StandardBlocks.Cutout implements IDecorBlock + { + public Cutout(long conf, Block.Properties properties) { super(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); } - public Normal(long conf, Block.Properties properties, AxisAlignedBB aabb) + public Cutout(long conf, Block.Properties properties, AxisAlignedBB aabb) { super(conf, properties, aabb);} - public Normal(long conf, Block.Properties properties, VoxelShape voxel_shape) + public Cutout(long conf, Block.Properties properties, VoxelShape voxel_shape) { super(conf, properties, voxel_shape); } - public Normal(long conf, Block.Properties properties, AxisAlignedBB[] aabbs) + public Cutout(long conf, Block.Properties properties, AxisAlignedBB[] aabbs) { super(conf, properties, aabbs); } } diff --git a/src/main/java/wile/engineersdecor/blocks/EdCatwalkBlock.java b/src/main/java/wile/engineersdecor/blocks/EdCatwalkBlock.java index 31a0bf7..ae4e329 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdCatwalkBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdCatwalkBlock.java @@ -68,6 +68,7 @@ public class EdCatwalkBlock extends DecorBlock.HorizontalFourWayWaterLoggable im } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { final Item item = player.getHeldItem(hand).getItem(); diff --git a/src/main/java/wile/engineersdecor/blocks/EdCatwalkStairsBlock.java b/src/main/java/wile/engineersdecor/blocks/EdCatwalkStairsBlock.java index b085594..821e6ff 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdCatwalkStairsBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdCatwalkStairsBlock.java @@ -96,6 +96,7 @@ public class EdCatwalkStairsBlock extends DecorBlock.HorizontalWaterLoggable imp { return super.getStateForPlacement(context); } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { final Item item = player.getHeldItem(hand).getItem(); diff --git a/src/main/java/wile/engineersdecor/blocks/EdCatwalkTopAlignedBlock.java b/src/main/java/wile/engineersdecor/blocks/EdCatwalkTopAlignedBlock.java index 414f445..ca6cd79 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdCatwalkTopAlignedBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdCatwalkTopAlignedBlock.java @@ -70,6 +70,7 @@ public class EdCatwalkTopAlignedBlock extends DecorBlock.WaterLoggable implement } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { final Item item = player.getHeldItem(hand).getItem(); diff --git a/src/main/java/wile/engineersdecor/blocks/EdChair.java b/src/main/java/wile/engineersdecor/blocks/EdChair.java index 164017f..f0fc775 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdChair.java +++ b/src/main/java/wile/engineersdecor/blocks/EdChair.java @@ -53,6 +53,7 @@ public class EdChair { super(config, builder.tickRandomly(), unrotatedAABBs); } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(!sitting_enabled) return ActionResultType.PASS; @@ -69,6 +70,7 @@ public class EdChair } @Override + @SuppressWarnings("deprecation") public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rnd) { if((!sitting_enabled) || (sitting_probability < 1e-6)) return; diff --git a/src/main/java/wile/engineersdecor/blocks/EdChimneyBlock.java b/src/main/java/wile/engineersdecor/blocks/EdChimneyBlock.java index 06f8240..6b71904 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdChimneyBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdChimneyBlock.java @@ -29,7 +29,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nullable; import java.util.Random; -public class EdChimneyBlock extends DecorBlock.Normal implements IDecorBlock +public class EdChimneyBlock extends DecorBlock.Cutout implements IDecorBlock { public static final IntegerProperty POWER = BlockStateProperties.POWER_0_15; diff --git a/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java b/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java index 2fea5dd..9e6151e 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java +++ b/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java @@ -105,6 +105,7 @@ public class EdCraftingTable { return new EdCraftingTable.CraftingTableTileEntity(); } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(world.isRemote()) return ActionResultType.SUCCESS; @@ -160,6 +161,7 @@ public class EdCraftingTable } @Override + @SuppressWarnings("deprecation") public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rand) { TileEntity te = world.getTileEntity(pos); @@ -806,6 +808,7 @@ public class EdCraftingTable } } if(recipe != null) { + sync(); onCraftMatrixChanged(); } } diff --git a/src/main/java/wile/engineersdecor/blocks/EdDropper.java b/src/main/java/wile/engineersdecor/blocks/EdDropper.java index 9658fd4..6b1e6f1 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdDropper.java +++ b/src/main/java/wile/engineersdecor/blocks/EdDropper.java @@ -170,6 +170,7 @@ public class EdDropper } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(world.isRemote()) return ActionResultType.SUCCESS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdFluidFunnel.java b/src/main/java/wile/engineersdecor/blocks/EdFluidFunnel.java index 24b8f1c..7c4cf35 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdFluidFunnel.java +++ b/src/main/java/wile/engineersdecor/blocks/EdFluidFunnel.java @@ -62,7 +62,7 @@ public class EdFluidFunnel // Block //-------------------------------------------------------------------------------------------------------------------- - public static class FluidFunnelBlock extends DecorBlock.Normal implements IDecorBlock + public static class FluidFunnelBlock extends DecorBlock.Cutout implements IDecorBlock { public static final int FILL_LEVEL_MAX = 3; public static final IntegerProperty FILL_LEVEL = IntegerProperty.create("level", 0, FILL_LEVEL_MAX); @@ -143,6 +143,7 @@ public class EdFluidFunnel } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(world.isRemote) return ActionResultType.SUCCESS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdFreezer.java b/src/main/java/wile/engineersdecor/blocks/EdFreezer.java index c02d981..0ebb282 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdFreezer.java +++ b/src/main/java/wile/engineersdecor/blocks/EdFreezer.java @@ -111,6 +111,7 @@ public class EdFreezer } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(player.isSneaking()) return ActionResultType.PASS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdFurnace.java b/src/main/java/wile/engineersdecor/blocks/EdFurnace.java index e2bb021..b8f9ec1 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdFurnace.java +++ b/src/main/java/wile/engineersdecor/blocks/EdFurnace.java @@ -169,6 +169,7 @@ public class EdFurnace } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(world.isRemote()) return ActionResultType.SUCCESS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdHatchBlock.java b/src/main/java/wile/engineersdecor/blocks/EdHatchBlock.java index 7b39d42..6e504a1 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdHatchBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdHatchBlock.java @@ -89,6 +89,7 @@ public class EdHatchBlock extends DecorBlock.HorizontalWaterLoggable implements { super.fillStateContainer(builder); builder.add(OPEN, POWERED); } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(world.isRemote()) return ActionResultType.SUCCESS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdHopper.java b/src/main/java/wile/engineersdecor/blocks/EdHopper.java index 72b3070..0fc601b 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdHopper.java +++ b/src/main/java/wile/engineersdecor/blocks/EdHopper.java @@ -142,6 +142,7 @@ public class EdHopper } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(world.isRemote()) return ActionResultType.SUCCESS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdHorizontalSupportBlock.java b/src/main/java/wile/engineersdecor/blocks/EdHorizontalSupportBlock.java index 4b8e629..cb13c7d 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdHorizontalSupportBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdHorizontalSupportBlock.java @@ -129,6 +129,7 @@ public class EdHorizontalSupportBlock extends DecorBlock.WaterLoggable implement { return temp_block_update_until_better(state, world, pos); } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { ItemStack held_stack = player.getHeldItem(hand); diff --git a/src/main/java/wile/engineersdecor/blocks/EdLabeledCrate.java b/src/main/java/wile/engineersdecor/blocks/EdLabeledCrate.java index 791f642..80ba43d 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdLabeledCrate.java +++ b/src/main/java/wile/engineersdecor/blocks/EdLabeledCrate.java @@ -135,11 +135,11 @@ public class EdLabeledCrate public List dropList(BlockState state, World world, final TileEntity te, boolean explosion) { final List stacks = new ArrayList(); - if(world.isRemote) return stacks; + if(world.isRemote()) return stacks; if(!(te instanceof LabeledCrateTileEntity)) return stacks; if(!explosion) { ItemStack stack = new ItemStack(this, 1); - CompoundNBT te_nbt = ((LabeledCrateTileEntity)te).reset_getnbt(); + CompoundNBT te_nbt = ((LabeledCrateTileEntity)te).getnbt(); CompoundNBT nbt = new CompoundNBT(); if(!te_nbt.isEmpty()) nbt.put("tedata", te_nbt); if(!nbt.isEmpty()) stack.setTag(nbt); @@ -147,7 +147,7 @@ public class EdLabeledCrate stacks.add(stack); } else { for(ItemStack stack: ((LabeledCrateTileEntity)te).main_inventory_) stacks.add(stack); - ((LabeledCrateTileEntity)te).reset_getnbt(); + ((LabeledCrateTileEntity)te).getnbt(); } return stacks; } @@ -253,16 +253,8 @@ public class EdLabeledCrate }); } - public CompoundNBT reset_getnbt() - { - CompoundNBT nbt = new CompoundNBT(); - writenbt(nbt); - reset(); - return nbt; - } - - protected void reset() - { main_inventory_.clear(); } + public CompoundNBT getnbt() + { return writenbt(new CompoundNBT()); } public CompoundNBT readnbt(CompoundNBT nbt) { diff --git a/src/main/java/wile/engineersdecor/blocks/EdMilker.java b/src/main/java/wile/engineersdecor/blocks/EdMilker.java index 36d05d5..ff1611d 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdMilker.java +++ b/src/main/java/wile/engineersdecor/blocks/EdMilker.java @@ -111,6 +111,7 @@ public class EdMilker { return new MilkerTileEntity(); } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { if(world.isRemote()) return ActionResultType.SUCCESS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdMineralSmelter.java b/src/main/java/wile/engineersdecor/blocks/EdMineralSmelter.java index b26c9f2..bac12c9 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdMineralSmelter.java +++ b/src/main/java/wile/engineersdecor/blocks/EdMineralSmelter.java @@ -124,6 +124,7 @@ public class EdMineralSmelter } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(player.isSneaking()) return ActionResultType.PASS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdPlacer.java b/src/main/java/wile/engineersdecor/blocks/EdPlacer.java index d7a96c5..9b918ef 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdPlacer.java +++ b/src/main/java/wile/engineersdecor/blocks/EdPlacer.java @@ -150,6 +150,7 @@ public class EdPlacer } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(world.isRemote()) return ActionResultType.SUCCESS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdRailingBlock.java b/src/main/java/wile/engineersdecor/blocks/EdRailingBlock.java index 130cc97..b875c3f 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdRailingBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdRailingBlock.java @@ -56,6 +56,7 @@ public class EdRailingBlock extends DecorBlock.HorizontalFourWayWaterLoggable im } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { if(player.getHeldItem(hand).getItem() != asItem()) return ActionResultType.PASS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdSolarPanel.java b/src/main/java/wile/engineersdecor/blocks/EdSolarPanel.java index 0c14317..48ed4e9 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdSolarPanel.java +++ b/src/main/java/wile/engineersdecor/blocks/EdSolarPanel.java @@ -51,7 +51,7 @@ public class EdSolarPanel // Block //-------------------------------------------------------------------------------------------------------------------- - public static class SolarPanelBlock extends DecorBlock.Normal implements IDecorBlock + public static class SolarPanelBlock extends DecorBlock.Cutout implements IDecorBlock { public static final IntegerProperty EXPOSITION = IntegerProperty.create("exposition", 0, 4); @@ -75,6 +75,7 @@ public class EdSolarPanel { return new EdSolarPanel.SolarPanelTileEntity(); } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { if(world.isRemote()) return ActionResultType.SUCCESS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdStraightPoleBlock.java b/src/main/java/wile/engineersdecor/blocks/EdStraightPoleBlock.java index 9b3432a..07098eb 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdStraightPoleBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdStraightPoleBlock.java @@ -51,6 +51,7 @@ public class EdStraightPoleBlock extends DecorBlock.DirectedWaterLoggable implem } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { if((hit.getFace().getAxis() == state.get(FACING).getAxis())) return ActionResultType.PASS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdTreeCutter.java b/src/main/java/wile/engineersdecor/blocks/EdTreeCutter.java index 5886a79..5411109 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdTreeCutter.java +++ b/src/main/java/wile/engineersdecor/blocks/EdTreeCutter.java @@ -93,6 +93,7 @@ public class EdTreeCutter } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { if(world.isRemote()) return ActionResultType.SUCCESS; diff --git a/src/main/java/wile/engineersdecor/blocks/EdWasteIncinerator.java b/src/main/java/wile/engineersdecor/blocks/EdWasteIncinerator.java index 1455a2b..1011caf 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdWasteIncinerator.java +++ b/src/main/java/wile/engineersdecor/blocks/EdWasteIncinerator.java @@ -72,7 +72,7 @@ public class EdWasteIncinerator // Block //-------------------------------------------------------------------------------------------------------------------- - public static class WasteIncineratorBlock extends DecorBlock.Normal implements IDecorBlock + public static class WasteIncineratorBlock extends DecorBlock.Cutout implements IDecorBlock { public static final BooleanProperty LIT = FurnaceBlock.LIT; @@ -136,7 +136,7 @@ public class EdWasteIncinerator if(!(te instanceof WasteIncineratorTileEntity)) return stacks; if(!explosion) { ItemStack stack = new ItemStack(this, 1); - CompoundNBT te_nbt = ((WasteIncineratorTileEntity) te).reset_getnbt(); + CompoundNBT te_nbt = ((WasteIncineratorTileEntity) te).getnbt(); if(!te_nbt.isEmpty()) { CompoundNBT nbt = new CompoundNBT(); nbt.put("tedata", te_nbt); @@ -145,12 +145,13 @@ public class EdWasteIncinerator stacks.add(stack); } else { for(ItemStack stack: ((WasteIncineratorTileEntity)te).stacks_) stacks.add(stack); - ((WasteIncineratorTileEntity)te).reset_getnbt(); + ((WasteIncineratorTileEntity)te).getnbt(); } return stacks; } @Override + @SuppressWarnings("deprecation") public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) { if(world.isRemote()) return ActionResultType.SUCCESS; @@ -214,13 +215,8 @@ public class EdWasteIncinerator public WasteIncineratorTileEntity(TileEntityType te_type) { super(te_type); reset(); } - public CompoundNBT reset_getnbt() - { - CompoundNBT nbt = new CompoundNBT(); - writenbt(nbt); - reset(); - return nbt; - } + public CompoundNBT getnbt() + { return writenbt(new CompoundNBT()); } protected void reset() { @@ -238,10 +234,11 @@ public class EdWasteIncinerator energy_stored_ = compound.getInt("Energy"); } - protected void writenbt(CompoundNBT compound) + protected CompoundNBT writenbt(CompoundNBT nbt) { - compound.putInt("Energy", MathHelper.clamp(energy_stored_,0 , MAX_ENERGY_BUFFER)); - ItemStackHelper.saveAllItems(compound, stacks_); + nbt.putInt("Energy", MathHelper.clamp(energy_stored_,0 , MAX_ENERGY_BUFFER)); + ItemStackHelper.saveAllItems(nbt, stacks_); + return nbt; } // TileEntity ------------------------------------------------------------------------------ @@ -252,7 +249,7 @@ public class EdWasteIncinerator @Override public CompoundNBT write(CompoundNBT nbt) - { super.write(nbt); writenbt(nbt); return nbt; } + { super.write(nbt); return writenbt(nbt); } @Override public void remove() diff --git a/src/main/java/wile/engineersdecor/libmc/blocks/StandardBlocks.java b/src/main/java/wile/engineersdecor/libmc/blocks/StandardBlocks.java index af7b3cd..b5b296d 100644 --- a/src/main/java/wile/engineersdecor/libmc/blocks/StandardBlocks.java +++ b/src/main/java/wile/engineersdecor/libmc/blocks/StandardBlocks.java @@ -20,7 +20,6 @@ import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.BooleanProperty; import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.world.IWorld; @@ -29,7 +28,6 @@ import net.minecraft.world.server.ServerWorld; import net.minecraft.loot.LootParameters; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; @@ -102,26 +100,13 @@ public class StandardBlocks public static class BaseBlock extends Block implements IStandardBlock { - public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public final long config; - private final VoxelShape vshape; public BaseBlock(long conf, Block.Properties properties) - { this(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); } - - public BaseBlock(long conf, Block.Properties properties, AxisAlignedBB aabb) - { this(conf, properties, VoxelShapes.create(aabb)); } - - public BaseBlock(long conf, Block.Properties properties, AxisAlignedBB[] aabbs) - { this(conf, properties, Arrays.stream(aabbs).map(aabb->VoxelShapes.create(aabb)).reduce(VoxelShapes.empty(), (shape, aabb)->VoxelShapes.combine(shape, aabb, IBooleanFunction.OR))); } - - public BaseBlock(long conf, Block.Properties properties, VoxelShape voxel_shape) { super(properties); config = conf; - vshape = voxel_shape; BlockState state = getStateContainer().getBaseState(); - if((conf & CFG_WATERLOGGABLE)!=0) state = state.with(WATERLOGGED, false); setDefaultState(state); } @@ -129,16 +114,6 @@ public class StandardBlocks public long config() { return config; } - @Override - @SuppressWarnings("deprecation") - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) - { return ActionResultType.PASS; } - - @Override - @SuppressWarnings("deprecation") - public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rnd) - {} - @Override @OnlyIn(Dist.CLIENT) public void addInformation(ItemStack stack, @Nullable IBlockReader world, List tooltip, ITooltipFlag flag) @@ -148,42 +123,11 @@ public class StandardBlocks public RenderTypeHint getRenderTypeHint() { return getRenderTypeHint(config); } - @Override - @SuppressWarnings("deprecation") - public VoxelShape getShape(BlockState state, IBlockReader source, BlockPos pos, ISelectionContext selectionContext) - { return vshape; } - - @Override - @SuppressWarnings("deprecation") - public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext) - { return vshape; } - @Override @SuppressWarnings("deprecation") public boolean allowsMovement(BlockState state, IBlockReader world, BlockPos pos, PathType type) { return ((config & CFG_AI_PASSABLE)==0) ? false : super.allowsMovement(state, world, pos, type); } - @Override - @Nullable - public BlockState getStateForPlacement(BlockItemUseContext context) - { - BlockState state = super.getStateForPlacement(context); - if((config & CFG_WATERLOGGABLE)!=0) { - FluidState fs = context.getWorld().getFluidState(context.getPos()); - state = state.with(WATERLOGGED,fs.getFluid()==Fluids.WATER); - } - return state; - } - - @Override - public boolean canSpawnInBlock() - { return false; } - - @Override - @SuppressWarnings("deprecation") - public PushReaction getPushReaction(BlockState state) - { return PushReaction.NORMAL; } - @Override @SuppressWarnings("deprecation") public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) @@ -205,6 +149,61 @@ public class StandardBlocks boolean is_explosion = (explosion_radius!=null) && (explosion_radius > 0); return dropList(state, world, te, is_explosion); } + } + + public static class Cutout extends BaseBlock implements IStandardBlock + { + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + private final VoxelShape vshape; + + public Cutout(long conf, Block.Properties properties) + { this(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); } + + public Cutout(long conf, Block.Properties properties, AxisAlignedBB aabb) + { this(conf, properties, VoxelShapes.create(aabb)); } + + public Cutout(long conf, Block.Properties properties, AxisAlignedBB[] aabbs) + { this(conf, properties, Arrays.stream(aabbs).map(aabb->VoxelShapes.create(aabb)).reduce(VoxelShapes.empty(), (shape, aabb)->VoxelShapes.combine(shape, aabb, IBooleanFunction.OR))); } + + public Cutout(long conf, Block.Properties properties, VoxelShape voxel_shape) + { + super(conf, properties); + vshape = voxel_shape; + BlockState state = getStateContainer().getBaseState(); + if((conf & CFG_WATERLOGGABLE)!=0) state = state.with(WATERLOGGED, false); + setDefaultState(state); + } + + @Override + @SuppressWarnings("deprecation") + public VoxelShape getShape(BlockState state, IBlockReader source, BlockPos pos, ISelectionContext selectionContext) + { return vshape; } + + @Override + @SuppressWarnings("deprecation") + public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext selectionContext) + { return vshape; } + + @Override + @Nullable + public BlockState getStateForPlacement(BlockItemUseContext context) + { + BlockState state = super.getStateForPlacement(context); + if((config & CFG_WATERLOGGABLE)!=0) { + FluidState fs = context.getWorld().getFluidState(context.getPos()); + state = state.with(WATERLOGGED,fs.getFluid()==Fluids.WATER); + } + return state; + } + + @Override + public boolean canSpawnInBlock() + { return false; } + + @Override + @SuppressWarnings("deprecation") + public PushReaction getPushReaction(BlockState state) + { return PushReaction.NORMAL; } @Override public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) @@ -236,7 +235,7 @@ public class StandardBlocks } } - public static class WaterLoggable extends BaseBlock implements IWaterLoggable, IStandardBlock + public static class WaterLoggable extends Cutout implements IWaterLoggable, IStandardBlock { public WaterLoggable(long config, Block.Properties properties) { super(config|CFG_WATERLOGGABLE, properties); } @@ -255,7 +254,7 @@ public class StandardBlocks { super.fillStateContainer(builder); builder.add(WATERLOGGED); } } - public static class Directed extends BaseBlock implements IStandardBlock + public static class Directed extends Cutout implements IStandardBlock { public static final DirectionProperty FACING = DirectionalBlock.FACING; protected final ArrayList vshapes; @@ -330,7 +329,7 @@ public class StandardBlocks } } - public static class Horizontal extends BaseBlock implements IStandardBlock + public static class Horizontal extends Cutout implements IStandardBlock { public static final DirectionProperty HORIZONTAL_FACING = HorizontalBlock.HORIZONTAL_FACING; protected final ArrayList vshapes; diff --git a/src/main/resources/assets/engineersdecor/blockstates/dark_shingle_roof_block.json b/src/main/resources/assets/engineersdecor/blockstates/dark_shingle_roof_block.json index 9458a9d..1e65d16 100644 --- a/src/main/resources/assets/engineersdecor/blockstates/dark_shingle_roof_block.json +++ b/src/main/resources/assets/engineersdecor/blockstates/dark_shingle_roof_block.json @@ -1,5 +1,5 @@ { "variants": { - "": [ { "model": "engineersdecor:block/roof/dark_shingle_roof_block_model" } ] + "": { "model": "engineersdecor:block/roof/dark_shingle_roof_block_model" } } -} +} \ No newline at end of file diff --git a/src/main/resources/assets/engineersdecor/blockstates/dark_shingle_roof_chimney.json b/src/main/resources/assets/engineersdecor/blockstates/dark_shingle_roof_chimney.json index a418fdf..07d991f 100644 --- a/src/main/resources/assets/engineersdecor/blockstates/dark_shingle_roof_chimney.json +++ b/src/main/resources/assets/engineersdecor/blockstates/dark_shingle_roof_chimney.json @@ -1,7 +1,5 @@ { "variants": { - "": [ - { "model": "engineersdecor:block/roof/dark_shingle_roof_chimney_model" } - ] + "": { "model": "engineersdecor:block/roof/dark_shingle_roof_chimney_model" } } } diff --git a/src/main/resources/assets/engineersdecor/blockstates/iron_hatch.json b/src/main/resources/assets/engineersdecor/blockstates/iron_hatch.json index 17687ad..b32d9c1 100644 --- a/src/main/resources/assets/engineersdecor/blockstates/iron_hatch.json +++ b/src/main/resources/assets/engineersdecor/blockstates/iron_hatch.json @@ -3,17 +3,14 @@ "facing=south,open=false,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":180 }, "facing=west,open=false,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":270 }, "facing=east,open=false,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":90 }, - "facing=north,open=true,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open" }, "facing=south,open=true,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open", "y":180 }, "facing=west,open=true,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open", "y":270 }, "facing=east,open=true,powered=false": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open", "y":90 }, - "facing=north,open=false,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed" }, "facing=south,open=false,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":180 }, "facing=west,open=false,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":270 }, "facing=east,open=false,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_closed", "y":90 }, - "facing=north,open=true,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open" }, "facing=south,open=true,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open", "y":180 }, "facing=west,open=true,powered=true": { "model": "engineersdecor:block/trapdoor/iron_hatch_model_open", "y":270 }, diff --git a/src/main/resources/assets/engineersdecor/blockstates/metal_sliding_door.json b/src/main/resources/assets/engineersdecor/blockstates/metal_sliding_door.json index 060cda7..c60ebe5 100644 --- a/src/main/resources/assets/engineersdecor/blockstates/metal_sliding_door.json +++ b/src/main/resources/assets/engineersdecor/blockstates/metal_sliding_door.json @@ -7,7 +7,6 @@ "facing=east,half=upper,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 270 }, "facing=east,half=upper,hinge=right,open=false": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_closed" , "y": 90 }, "facing=east,half=upper,hinge=right,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 90 }, - "facing=north,half=lower,hinge=left,open=false": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 180 }, "facing=north,half=lower,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_open" , "y": 180 }, "facing=north,half=lower,hinge=right,open=false":{ "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 0 }, @@ -16,7 +15,6 @@ "facing=north,half=upper,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 180 }, "facing=north,half=upper,hinge=right,open=false":{ "model": "engineersdecor:block/door/metal_sliding_door_model_top_closed" , "y": 0 }, "facing=north,half=upper,hinge=right,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 0 }, - "facing=south,half=lower,hinge=left,open=false": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 0 }, "facing=south,half=lower,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_open" , "y": 0 }, "facing=south,half=lower,hinge=right,open=false":{ "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 180 }, @@ -25,7 +23,6 @@ "facing=south,half=upper,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 0 }, "facing=south,half=upper,hinge=right,open=false":{ "model": "engineersdecor:block/door/metal_sliding_door_model_top_closed" , "y": 180 }, "facing=south,half=upper,hinge=right,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_top_open" , "y": 180 }, - "facing=west,half=lower,hinge=left,open=false": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 90 }, "facing=west,half=lower,hinge=left,open=true": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_open" , "y": 90 }, "facing=west,half=lower,hinge=right,open=false": { "model": "engineersdecor:block/door/metal_sliding_door_model_bottom_closed", "y": 270 }, diff --git a/src/main/resources/assets/engineersdecor/blockstates/steel_mesh_fence_gate.json b/src/main/resources/assets/engineersdecor/blockstates/steel_mesh_fence_gate.json index 65d6a4f..c3eff67 100644 --- a/src/main/resources/assets/engineersdecor/blockstates/steel_mesh_fence_gate.json +++ b/src/main/resources/assets/engineersdecor/blockstates/steel_mesh_fence_gate.json @@ -8,7 +8,6 @@ "facing=west,open=true,segment=0": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_bottom_model_open", "y":270 }, "facing=east,open=false,segment=0": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_bottom_model" , "y":90 }, "facing=east,open=true,segment=0": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_bottom_model_open", "y":90 }, - "facing=north,open=false,segment=1": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_top_model" }, "facing=north,open=true,segment=1": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_top_model_open" }, "facing=south,open=false,segment=1": { "model": "engineersdecor:block/fence/steel_mesh_fence_gate_top_model" , "y":180 },