Made coal and oil generator not randomly appear on even though they're not

This commit is contained in:
Ellpeck 2016-06-11 16:26:51 +02:00
parent 3f00973f28
commit 3dbc31e264
6 changed files with 15 additions and 50 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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()){

View file

@ -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()){

View file

@ -11,10 +11,6 @@
},
"variants": {
"normal": [{}],
"inventory": [{}],
"meta": {
"0": {},
"1": {}
}
"inventory": [{}]
}
}

View file

@ -11,10 +11,6 @@
},
"variants": {
"normal": [{}],
"inventory": [{}],
"meta": {
"0": {},
"1": {}
}
"inventory": [{}]
}
}