Some small changes

This commit is contained in:
modmuss50 2015-05-29 17:13:03 +01:00
parent c5e73c6fc3
commit 7dced713ba
3 changed files with 13 additions and 6 deletions

View file

@ -82,6 +82,7 @@ public class RecipeCrafter {
public int currentTickTime = 0;
public int currentNeededTicks = 0;
double lastEnergy;
public boolean isactive = false;
/**
* Call this on the tile tick
@ -102,6 +103,7 @@ public class RecipeCrafter {
if (canGiveInvAll) {
currentRecipe = recipe;//Sets the current recipe then syncs
this.currentNeededTicks = currentRecipe.tickTime();
parentTile.syncWithAll();//update texture
}
}
}
@ -109,6 +111,7 @@ public class RecipeCrafter {
if (!hasAllInputs()) {//If it doesn't have all the inputs reset
currentRecipe = null;
currentTickTime = 0;
parentTile.syncWithAll();//update texture
}
if (currentRecipe != null && currentTickTime >= currentRecipe.tickTime()) {//If it has reached the recipe tick time
boolean canGiveInvAll = true;
@ -128,7 +131,7 @@ public class RecipeCrafter {
useAllInputs();//this uses all the inputs
currentRecipe = null;//resets
currentTickTime = 0;
//Force sync after craft
//Force sync after craft to update texture
parentTile.syncWithAll();
}
} else if (currentRecipe != null && currentTickTime < currentRecipe.tickTime()) {
@ -226,6 +229,8 @@ public class RecipeCrafter {
NBTTagCompound data = tag.getCompoundTag("Crater");
currentTickTime = data.getInteger("currentTickTime");
isactive = data.getBoolean("isActive");
}
public void writeToNBT(NBTTagCompound tag) {
@ -233,11 +238,16 @@ public class RecipeCrafter {
NBTTagCompound data = new NBTTagCompound();
data.setDouble("currentTickTime", currentTickTime);
data.setBoolean("isActive", isActiveServer());
tag.setTag("Crater", data);
}
public boolean isActive() {
private boolean isActiveServer() {
return currentRecipe != null && currentTickTime != 0;
}
public boolean isActive() {
return isactive;
}
}

View file

@ -65,7 +65,7 @@ public class BlockImplosionCompressor extends BlockMachineBase{
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
TileImplosionCompressor tileImplosionCompressor = (TileImplosionCompressor) blockAccess.getTileEntity(x, y, z);
if(side == metadata && tileImplosionCompressor.crafter.currentRecipe != null){
if(side == metadata && tileImplosionCompressor.crafter.isActive()){
return this.iconFrontOn;
}

View file

@ -46,9 +46,6 @@ public class GuiImplosionCompressor extends GuiContainer{
j = this.containerImplosionCompressor.currentTickTime * 20 / this.containerImplosionCompressor.currentNeededTicks;
}
System.out.println(this.containerImplosionCompressor.currentTickTime);
this.drawTexturedModalRect(k + 60, l + 38, 176, 14, j + 1, 16);
j = this.containerImplosionCompressor.energy * 12 / this.compresser.energy.getCapacity();