From 3dbc31e264adec6951b52cb23b52e4019e260e2c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 11 Jun 2016 16:26:51 +0200 Subject: [PATCH] Made coal and oil generator not randomly appear on even though they're not --- .../mod/blocks/BlockCoalGenerator.java | 18 ++++++------------ .../mod/blocks/BlockOilGenerator.java | 17 +++++++---------- .../mod/tile/TileEntityCoalGenerator.java | 9 --------- .../mod/tile/TileEntityOilGenerator.java | 9 --------- .../blockstates/blockCoalGenerator.json | 6 +----- .../blockstates/blockOilGenerator.json | 6 +----- 6 files changed, 15 insertions(+), 50 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java index 02a1977df..1e80dd6d9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java @@ -37,8 +37,6 @@ import java.util.Random; public class BlockCoalGenerator extends BlockContainerBase{ - private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1); - public BlockCoalGenerator(String name){ super(Material.ROCK, name); this.setHarvestLevel("pickaxe", 0); @@ -57,11 +55,12 @@ public class BlockCoalGenerator extends BlockContainerBase{ @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){ - int meta = PosUtil.getMetadata(state); - - if(meta == 1){ - for(int i = 0; i < 5; i++){ - world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D); + TileEntity tile = world.getTileEntity(pos); + if(tile instanceof TileEntityCoalGenerator){ + if(((TileEntityCoalGenerator)tile).currentBurnTime > 0){ + for(int i = 0; i < 5; i++){ + world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D); + } } } } @@ -83,11 +82,6 @@ public class BlockCoalGenerator extends BlockContainerBase{ return EnumRarity.RARE; } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java index 7b024c838..9bcee2f6e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java @@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.SoundType; @@ -37,8 +38,6 @@ import java.util.Random; public class BlockOilGenerator extends BlockContainerBase{ - private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1); - public BlockOilGenerator(String name){ super(Material.ROCK, name); this.setHarvestLevel("pickaxe", 0); @@ -57,9 +56,12 @@ public class BlockOilGenerator extends BlockContainerBase{ @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){ - if(PosUtil.getMetadata(state) == 1){ - for(int i = 0; i < 5; i++){ - world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D); + TileEntity tile = world.getTileEntity(pos); + if(tile instanceof TileEntityOilGenerator){ + if(((TileEntityOilGenerator)tile).currentBurnTime > 0){ + for(int i = 0; i < 5; i++){ + world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D); + } } } } @@ -83,11 +85,6 @@ public class BlockOilGenerator extends BlockContainerBase{ return EnumRarity.RARE; } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java index 66f757f87..80a82ee82 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java @@ -89,15 +89,6 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements if(flag != this.currentBurnTime > 0){ this.markDirty(); - int meta = PosUtil.getMetadata(this.getPos(), this.worldObj); - if(meta == 1){ - if(!(this.currentBurnTime <= 0 && this.slots[0] != null && TileEntityFurnace.getItemBurnTime(this.slots[0]) > 0 && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored())){ - PosUtil.setMetadata(this.pos, this.worldObj, 0, 2); - } - } - else{ - PosUtil.setMetadata(this.pos, this.worldObj, 1, 2); - } } if((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java index 3a0e4e6fd..9f59130ba 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java @@ -105,15 +105,6 @@ public class TileEntityOilGenerator extends TileEntityBase implements IEnergyPro if(flag != this.currentBurnTime > 0){ this.markDirty(); - int meta = PosUtil.getMetadata(this.pos, this.worldObj); - if(meta == 1){ - if(!(ENERGY_PRODUCED*BURN_TIME <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored() && this.currentBurnTime <= 0 && this.tank.getFluidAmount() >= fuelUsed)){ - PosUtil.setMetadata(this.pos, this.worldObj, 0, 2); - } - } - else{ - PosUtil.setMetadata(this.pos, this.worldObj, 1, 2); - } } if((this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.lastBurnTime != this.currentBurnTime) && this.sendUpdateWithInterval()){ diff --git a/src/main/resources/assets/actuallyadditions/blockstates/blockCoalGenerator.json b/src/main/resources/assets/actuallyadditions/blockstates/blockCoalGenerator.json index 10559a6c3..d2c0683a5 100644 --- a/src/main/resources/assets/actuallyadditions/blockstates/blockCoalGenerator.json +++ b/src/main/resources/assets/actuallyadditions/blockstates/blockCoalGenerator.json @@ -11,10 +11,6 @@ }, "variants": { "normal": [{}], - "inventory": [{}], - "meta": { - "0": {}, - "1": {} - } + "inventory": [{}] } } \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/blockstates/blockOilGenerator.json b/src/main/resources/assets/actuallyadditions/blockstates/blockOilGenerator.json index bbf865d4b..03c8d6e46 100644 --- a/src/main/resources/assets/actuallyadditions/blockstates/blockOilGenerator.json +++ b/src/main/resources/assets/actuallyadditions/blockstates/blockOilGenerator.json @@ -11,10 +11,6 @@ }, "variants": { "normal": [{}], - "inventory": [{}], - "meta": { - "0": {}, - "1": {} - } + "inventory": [{}] } } \ No newline at end of file