Greenhouse Glass Performance

This commit is contained in:
Ellpeck 2015-11-29 00:38:22 +01:00
parent f22d6ddfae
commit d57f60c829

View file

@ -27,23 +27,21 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
super.updateEntity(); super.updateEntity();
if(!worldObj.isRemote){ if(!worldObj.isRemote){
if(worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) && worldObj.isDaytime()){ if(worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) && worldObj.isDaytime()){
WorldPos blockToFert = this.blockToFertilize(); if(this.timeUntilNextFert > 0){
if(blockToFert != null){ this.timeUntilNextFert--;
if(this.timeUntilNextFert > 0){ if(timeUntilNextFert <= 0){
this.timeUntilNextFert--; WorldPos blockToFert = this.blockToFertilize();
if(timeUntilNextFert <= 0){ int metaBefore = blockToFert.getMetadata();
int metaBefore = blockToFert.getMetadata(); worldObj.getBlock(blockToFert.getX(), blockToFert.getY(), blockToFert.getZ()).updateTick(worldObj, blockToFert.getX(), blockToFert.getY(), blockToFert.getZ(), Util.RANDOM);
worldObj.getBlock(blockToFert.getX(), blockToFert.getY(), blockToFert.getZ()).updateTick(worldObj, blockToFert.getX(), blockToFert.getY(), blockToFert.getZ(), Util.RANDOM);
if(blockToFert.getMetadata() != metaBefore){ if(blockToFert.getMetadata() != metaBefore){
worldObj.playAuxSFX(2005, blockToFert.getX(), blockToFert.getY(), blockToFert.getZ(), 0); worldObj.playAuxSFX(2005, blockToFert.getX(), blockToFert.getY(), blockToFert.getZ(), 0);
}
} }
} }
else{ }
int time = 300; else{
this.timeUntilNextFert = time+Util.RANDOM.nextInt(time); int time = 300;
} this.timeUntilNextFert = time+Util.RANDOM.nextInt(time);
} }
} }
} }