Machines primus

This commit is contained in:
Ellpeck 2016-11-27 23:04:26 +01:00
parent 56898a95db
commit 38d0bb17f9
5 changed files with 48 additions and 26 deletions

View file

@ -251,6 +251,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityBase){ if(tile instanceof TileEntityBase){
TileEntityBase base = (TileEntityBase)tile; TileEntityBase base = (TileEntityBase)tile;
if(!base.stopFromDropping){
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK); base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
@ -278,6 +279,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
drops.add(stack); drops.add(stack);
} }
}
return drops; return drops;
} }

View file

@ -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_CRYSTALS).setNoText());
crystalPages.add(new PageCrafting(crystalPages.size()+1, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).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[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("<rf>", TileEntityCoalGenerator.PRODUCE)); chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).setWildcard().addTextReplacement("<rf>", TileEntityCoalGenerator.PRODUCE));
ArrayList<BookletPage> empowererPages = new ArrayList<BookletPage>(); ArrayList<BookletPage> empowererPages = new ArrayList<BookletPage>();

View file

@ -107,19 +107,23 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1
if(world.rand.nextBoolean()){ if(world.rand.nextBoolean()){
TileEntity compost = this.getTileAtPos(world, 6, 1, 2, sbb); TileEntity compost = this.getTileAtPos(world, 6, 1, 2, sbb);
if(compost instanceof TileEntityCompost){ 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); TileEntity ferment = this.getTileAtPos(world, 11, 1, 0, sbb);
if(ferment instanceof TileEntityFermentingBarrel){ if(ferment instanceof TileEntityFermentingBarrel){
TileEntityFermentingBarrel tile = (TileEntityFermentingBarrel)ferment; TileEntityFermentingBarrel tile = (TileEntityFermentingBarrel)ferment;
tile.stopFromDropping = true;
tile.canolaTank.setFluid(new FluidStack(InitFluids.fluidCanolaOil, world.rand.nextInt(1500)+200)); tile.canolaTank.setFluid(new FluidStack(InitFluids.fluidCanolaOil, world.rand.nextInt(1500)+200));
} }
TileEntity coffee = this.getTileAtPos(world, 4, 2, 6, sbb); TileEntity coffee = this.getTileAtPos(world, 4, 2, 6, sbb);
if(coffee instanceof TileEntityCoffeeMachine){ if(coffee instanceof TileEntityCoffeeMachine){
TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine)coffee; TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine)coffee;
tile.stopFromDropping = true;
tile.tank.setFluid(new FluidStack(FluidRegistry.WATER, world.rand.nextInt(3000)+500)); tile.tank.setFluid(new FluidStack(FluidRegistry.WATER, world.rand.nextInt(3000)+500));
tile.coffeeCacheAmount = world.rand.nextInt(150); tile.coffeeCacheAmount = world.rand.nextInt(150);
tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/2)); 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); TileEntity press = this.getTileAtPos(world, 2, 1, 5, sbb);
if(press instanceof TileEntityCanolaPress){ if(press instanceof TileEntityCanolaPress){
TileEntityCanolaPress tile = (TileEntityCanolaPress)press; TileEntityCanolaPress tile = (TileEntityCanolaPress)press;
tile.stopFromDropping = true;
tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/3)); 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())); 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); TileEntity crusher = this.getTileAtPos(world, 2, 1, 6, sbb);
if(crusher instanceof TileEntityGrinder){ if(crusher instanceof TileEntityGrinder){
TileEntityGrinder tile = (TileEntityGrinder)crusher; TileEntityGrinder tile = (TileEntityGrinder)crusher;
tile.stopFromDropping = true;
tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/2)); tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/2));
if(world.rand.nextFloat() >= 0.25F){ 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())); 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); TileEntity coal = this.getTileAtPos(world, 5, 5, 6, sbb);
if(coal instanceof TileEntityCoalGenerator){ 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); 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 firstRelay = this.getTileAtPos(world, 6, 5, 6, sbb);
TileEntity secondRelay = this.getTileAtPos(world, 8, 5, 3, sbb); TileEntity secondRelay = this.getTileAtPos(world, 8, 5, 3, sbb);
if(firstRelay instanceof TileEntityLaserRelayEnergy && secondRelay instanceof TileEntityLaserRelayEnergy){ 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); ActuallyAdditionsAPI.connectionHandler.addConnection(firstRelay.getPos(), secondRelay.getPos(), LaserType.ENERGY, world);
} }

View file

@ -41,10 +41,12 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public abstract class TileEntityBase extends TileEntity implements ITickable{ public abstract class TileEntityBase extends TileEntity implements ITickable{
protected int ticksElapsed;
public final String name; public final String name;
public boolean isRedstonePowered; public boolean isRedstonePowered;
public boolean isPulseMode; public boolean isPulseMode;
protected int ticksElapsed; public boolean stopFromDropping;
protected TileEntity[] tilesAround = new TileEntity[6]; protected TileEntity[] tilesAround = new TileEntity[6];
protected boolean hasSavedDataOnChangeOrWorldStart; protected boolean hasSavedDataOnChangeOrWorldStart;
@ -185,6 +187,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
if(type == NBTType.SAVE_TILE){ if(type == NBTType.SAVE_TILE){
compound.setBoolean("Redstone", this.isRedstonePowered); compound.setBoolean("Redstone", this.isRedstonePowered);
compound.setInteger("TicksElapsed", this.ticksElapsed); compound.setInteger("TicksElapsed", this.ticksElapsed);
compound.setBoolean("StopDrop", this.stopFromDropping);
} }
if(this.isRedstoneToggle() && (type != NBTType.SAVE_BLOCK || this.isPulseMode)){ if(this.isRedstoneToggle() && (type != NBTType.SAVE_BLOCK || this.isPulseMode)){
compound.setBoolean("IsPulseMode", this.isPulseMode); compound.setBoolean("IsPulseMode", this.isPulseMode);
@ -199,6 +202,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
if(type == NBTType.SAVE_TILE){ if(type == NBTType.SAVE_TILE){
this.isRedstonePowered = compound.getBoolean("Redstone"); this.isRedstonePowered = compound.getBoolean("Redstone");
this.ticksElapsed = compound.getInteger("TicksElapsed"); this.ticksElapsed = compound.getInteger("TicksElapsed");
this.stopFromDropping = compound.getBoolean("StopDrop");
} }
if(this.isRedstoneToggle()){ if(this.isRedstoneToggle()){
this.isPulseMode = compound.getBoolean("IsPulseMode"); this.isPulseMode = compound.getBoolean("IsPulseMode");

View file

@ -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.website.button.1=View the Website
booklet.actuallyadditions.chapter.engineerHouse.name=A visit to the Engineers 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 <imp>Engineers<r> have been up to. <n>They are two friendly <imp>villagers<r> that sell you various goods: One is the <item>Crystallizer<r>, who will exchange <imp>Emeralds and Crystals<r> with you, and the <item>Engineer<r> will trade <imp>various machines<r> with you! On the next page, you can see the <imp>house<r> they live in - which is also worth checking out! booklet.actuallyadditions.chapter.engineerHouse.text.1=If you want to know how to start, you can check out what the <imp>Engineers<r> are up to. <n>They are two friendly <imp>villagers<r> that sell you various goods: One is the <item>Crystallizer<r>, who will exchange <imp>Emeralds and Crystals<r> with you, and the <item>Engineer<r> will trade <imp>various machines<r> with you! <n>On the next page, you can see the <imp>house<r> they live in - which is also worth checking out! But be careful, the <imp>machines inside the house<r> are a little more <imp>fragile<r>, meaning they will shatter once you try to break them.
booklet.actuallyadditions.chapter.engineerHouse.text.2=<i> Machines Primus