mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Made coal and oil generator not randomly appear on even though they're not
This commit is contained in:
parent
3f00973f28
commit
3dbc31e264
6 changed files with 15 additions and 50 deletions
|
@ -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,14 +55,15 @@ 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){
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
|
||||
|
@ -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);
|
||||
|
|
|
@ -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,12 +56,15 @@ 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){
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
|
||||
|
@ -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);
|
||||
|
|
|
@ -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()){
|
||||
|
|
|
@ -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()){
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
},
|
||||
"variants": {
|
||||
"normal": [{}],
|
||||
"inventory": [{}],
|
||||
"meta": {
|
||||
"0": {},
|
||||
"1": {}
|
||||
}
|
||||
"inventory": [{}]
|
||||
}
|
||||
}
|
|
@ -11,10 +11,6 @@
|
|||
},
|
||||
"variants": {
|
||||
"normal": [{}],
|
||||
"inventory": [{}],
|
||||
"meta": {
|
||||
"0": {},
|
||||
"1": {}
|
||||
}
|
||||
"inventory": [{}]
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue