diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java index 2cb2e162c..f16309246 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java @@ -251,32 +251,34 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB TileEntity tile = world.getTileEntity(pos); if(tile instanceof TileEntityBase){ TileEntityBase base = (TileEntityBase)tile; - NBTTagCompound data = new NBTTagCompound(); - base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK); + if(!base.stopFromDropping){ + NBTTagCompound data = new NBTTagCompound(); + base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK); - //Remove unnecessarily saved default values to avoid unstackability - List keysToRemove = new ArrayList(); - for(String key : data.getKeySet()){ - NBTBase tag = data.getTag(key); - //Remove only ints because they are the most common ones - //Add else if below here to remove more types - if(tag instanceof NBTTagInt){ - if(((NBTTagInt)tag).getInt() == 0){ - keysToRemove.add(key); + //Remove unnecessarily saved default values to avoid unstackability + List keysToRemove = new ArrayList(); + for(String key : data.getKeySet()){ + NBTBase tag = data.getTag(key); + //Remove only ints because they are the most common ones + //Add else if below here to remove more types + if(tag instanceof NBTTagInt){ + if(((NBTTagInt)tag).getInt() == 0){ + keysToRemove.add(key); + } } } - } - for(String key : keysToRemove){ - data.removeTag(key); - } + for(String key : keysToRemove){ + data.removeTag(key); + } - ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state)); - if(!data.hasNoTags()){ - stack.setTagCompound(new NBTTagCompound()); - stack.getTagCompound().setTag("Data", data); - } + ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state)); + if(!data.hasNoTags()){ + stack.setTagCompound(new NBTTagCompound()); + stack.getTagCompound().setTag("Data", data); + } - drops.add(stack); + drops.add(stack); + } } return drops; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index ed917e52b..001faabbb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -137,7 +137,7 @@ public final class InitBooklet{ } crystalPages.add(new PageCrafting(crystalPages.size()+1, MiscCrafting.RECIPES_CRYSTALS).setNoText()); crystalPages.add(new PageCrafting(crystalPages.size()+1, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).setNoText()); - chaptersIntroduction[2] = new BookletChapter("engineerHouse", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.EMERALD), new PageTextOnly(1), new PagePicture(2, "page_engineer_house", 0).setNoText()); + chaptersIntroduction[2] = new BookletChapter("engineerHouse", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.EMERALD), new PageTextOnly(1), new PagePicture(2, "page_engineer_house", 145)); chaptersIntroduction[6] = new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial(); chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).setWildcard().addTextReplacement("", TileEntityCoalGenerator.PRODUCE)); ArrayList empowererPages = new ArrayList(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentEngineerHouse.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentEngineerHouse.java index aaed0cf12..706fc3a75 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentEngineerHouse.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/village/component/VillageComponentEngineerHouse.java @@ -107,19 +107,23 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1 if(world.rand.nextBoolean()){ TileEntity compost = this.getTileAtPos(world, 6, 1, 2, sbb); if(compost instanceof TileEntityCompost){ - ((TileEntityCompost)compost).setInventorySlotContents(0, new ItemStack(InitItems.itemFertilizer, 10)); + TileEntityCompost tile = (TileEntityCompost)compost; + tile.stopFromDropping = true; + tile.setInventorySlotContents(0, new ItemStack(InitItems.itemFertilizer, 10)); } } TileEntity ferment = this.getTileAtPos(world, 11, 1, 0, sbb); if(ferment instanceof TileEntityFermentingBarrel){ TileEntityFermentingBarrel tile = (TileEntityFermentingBarrel)ferment; + tile.stopFromDropping = true; tile.canolaTank.setFluid(new FluidStack(InitFluids.fluidCanolaOil, world.rand.nextInt(1500)+200)); } TileEntity coffee = this.getTileAtPos(world, 4, 2, 6, sbb); if(coffee instanceof TileEntityCoffeeMachine){ TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine)coffee; + tile.stopFromDropping = true; tile.tank.setFluid(new FluidStack(FluidRegistry.WATER, world.rand.nextInt(3000)+500)); tile.coffeeCacheAmount = world.rand.nextInt(150); tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/2)); @@ -128,6 +132,7 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1 TileEntity press = this.getTileAtPos(world, 2, 1, 5, sbb); if(press instanceof TileEntityCanolaPress){ TileEntityCanolaPress tile = (TileEntityCanolaPress)press; + tile.stopFromDropping = true; tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/3)); tile.setInventorySlotContents(0, new ItemStack(InitItems.itemMisc, world.rand.nextInt(60)+1, TheMiscItems.CANOLA.ordinal())); } @@ -135,6 +140,7 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1 TileEntity crusher = this.getTileAtPos(world, 2, 1, 6, sbb); if(crusher instanceof TileEntityGrinder){ TileEntityGrinder tile = (TileEntityGrinder)crusher; + tile.stopFromDropping = true; tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/2)); if(world.rand.nextFloat() >= 0.25F){ tile.setInventorySlotContents(TileEntityGrinder.SLOT_INPUT_1, new ItemStack(InitBlocks.blockMisc, world.rand.nextInt(10)+1, TheMiscBlocks.ORE_QUARTZ.ordinal())); @@ -143,7 +149,14 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1 TileEntity coal = this.getTileAtPos(world, 5, 5, 6, sbb); if(coal instanceof TileEntityCoalGenerator){ - ((TileEntityCoalGenerator)coal).setInventorySlotContents(0, new ItemStack(Items.COAL, world.rand.nextInt(25)+3, 1)); + TileEntityCoalGenerator tile = (TileEntityCoalGenerator)coal; + tile.stopFromDropping = true; + tile.setInventorySlotContents(0, new ItemStack(Items.COAL, world.rand.nextInt(25)+3, 1)); + } + + TileEntity reconstructor = this.getTileAtPos(world, 8, 4, 3, sbb); + if(reconstructor instanceof TileEntityAtomicReconstructor){ + ((TileEntityAtomicReconstructor)reconstructor).stopFromDropping = true; } VillageComponentJamHouse.generateCrate(world, sbb, this.getXWithOffset(6, 4), this.getYWithOffset(4), this.getZWithOffset(6, 4), DungeonLoot.ENGINEER_HOUSE); @@ -152,6 +165,8 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1 TileEntity firstRelay = this.getTileAtPos(world, 6, 5, 6, sbb); TileEntity secondRelay = this.getTileAtPos(world, 8, 5, 3, sbb); if(firstRelay instanceof TileEntityLaserRelayEnergy && secondRelay instanceof TileEntityLaserRelayEnergy){ + ((TileEntityLaserRelayEnergy)firstRelay).stopFromDropping = true; + ((TileEntityLaserRelayEnergy)secondRelay).stopFromDropping = true; ActuallyAdditionsAPI.connectionHandler.addConnection(firstRelay.getPos(), secondRelay.getPos(), LaserType.ENERGY, world); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 57653d0d3..ce4f536c6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -41,10 +41,12 @@ import net.minecraftforge.fml.common.registry.GameRegistry; public abstract class TileEntityBase extends TileEntity implements ITickable{ + protected int ticksElapsed; + public final String name; public boolean isRedstonePowered; public boolean isPulseMode; - protected int ticksElapsed; + public boolean stopFromDropping; protected TileEntity[] tilesAround = new TileEntity[6]; protected boolean hasSavedDataOnChangeOrWorldStart; @@ -185,6 +187,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ if(type == NBTType.SAVE_TILE){ compound.setBoolean("Redstone", this.isRedstonePowered); compound.setInteger("TicksElapsed", this.ticksElapsed); + compound.setBoolean("StopDrop", this.stopFromDropping); } if(this.isRedstoneToggle() && (type != NBTType.SAVE_BLOCK || this.isPulseMode)){ compound.setBoolean("IsPulseMode", this.isPulseMode); @@ -199,6 +202,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ if(type == NBTType.SAVE_TILE){ this.isRedstonePowered = compound.getBoolean("Redstone"); this.ticksElapsed = compound.getInteger("TicksElapsed"); + this.stopFromDropping = compound.getBoolean("StopDrop"); } if(this.isRedstoneToggle()){ this.isPulseMode = compound.getBoolean("IsPulseMode"); diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 3a4072d21..c87070dd6 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -1105,4 +1105,5 @@ booklet.actuallyadditions.chapter.website.text.1=On the topic of self-advertisem booklet.actuallyadditions.chapter.website.button.1=View the Website booklet.actuallyadditions.chapter.engineerHouse.name=A visit to the Engineers -booklet.actuallyadditions.chapter.engineerHouse.text.1=If you want to know how to start in your world, you can always check out what the Engineers have been up to. They are two friendly villagers that sell you various goods: One is the Crystallizer, who will exchange Emeralds and Crystals with you, and the Engineer will trade various machines with you! On the next page, you can see the house they live in - which is also worth checking out! \ No newline at end of file +booklet.actuallyadditions.chapter.engineerHouse.text.1=If you want to know how to start, you can check out what the Engineers are up to. They are two friendly villagers that sell you various goods: One is the Crystallizer, who will exchange Emeralds and Crystals with you, and the Engineer will trade various machines with you! On the next page, you can see the house they live in - which is also worth checking out! But be careful, the machines inside the house are a little more fragile, meaning they will shatter once you try to break them. +booklet.actuallyadditions.chapter.engineerHouse.text.2= Machines Primus \ No newline at end of file