Some small changes
This commit is contained in:
parent
c5e73c6fc3
commit
7dced713ba
3 changed files with 13 additions and 6 deletions
|
@ -82,6 +82,7 @@ public class RecipeCrafter {
|
||||||
public int currentTickTime = 0;
|
public int currentTickTime = 0;
|
||||||
public int currentNeededTicks = 0;
|
public int currentNeededTicks = 0;
|
||||||
double lastEnergy;
|
double lastEnergy;
|
||||||
|
public boolean isactive = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this on the tile tick
|
* Call this on the tile tick
|
||||||
|
@ -102,6 +103,7 @@ public class RecipeCrafter {
|
||||||
if (canGiveInvAll) {
|
if (canGiveInvAll) {
|
||||||
currentRecipe = recipe;//Sets the current recipe then syncs
|
currentRecipe = recipe;//Sets the current recipe then syncs
|
||||||
this.currentNeededTicks = currentRecipe.tickTime();
|
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
|
if (!hasAllInputs()) {//If it doesn't have all the inputs reset
|
||||||
currentRecipe = null;
|
currentRecipe = null;
|
||||||
currentTickTime = 0;
|
currentTickTime = 0;
|
||||||
|
parentTile.syncWithAll();//update texture
|
||||||
}
|
}
|
||||||
if (currentRecipe != null && currentTickTime >= currentRecipe.tickTime()) {//If it has reached the recipe tick time
|
if (currentRecipe != null && currentTickTime >= currentRecipe.tickTime()) {//If it has reached the recipe tick time
|
||||||
boolean canGiveInvAll = true;
|
boolean canGiveInvAll = true;
|
||||||
|
@ -128,7 +131,7 @@ public class RecipeCrafter {
|
||||||
useAllInputs();//this uses all the inputs
|
useAllInputs();//this uses all the inputs
|
||||||
currentRecipe = null;//resets
|
currentRecipe = null;//resets
|
||||||
currentTickTime = 0;
|
currentTickTime = 0;
|
||||||
//Force sync after craft
|
//Force sync after craft to update texture
|
||||||
parentTile.syncWithAll();
|
parentTile.syncWithAll();
|
||||||
}
|
}
|
||||||
} else if (currentRecipe != null && currentTickTime < currentRecipe.tickTime()) {
|
} else if (currentRecipe != null && currentTickTime < currentRecipe.tickTime()) {
|
||||||
|
@ -226,6 +229,8 @@ public class RecipeCrafter {
|
||||||
NBTTagCompound data = tag.getCompoundTag("Crater");
|
NBTTagCompound data = tag.getCompoundTag("Crater");
|
||||||
|
|
||||||
currentTickTime = data.getInteger("currentTickTime");
|
currentTickTime = data.getInteger("currentTickTime");
|
||||||
|
|
||||||
|
isactive = data.getBoolean("isActive");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound tag) {
|
public void writeToNBT(NBTTagCompound tag) {
|
||||||
|
@ -233,11 +238,16 @@ public class RecipeCrafter {
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
|
||||||
data.setDouble("currentTickTime", currentTickTime);
|
data.setDouble("currentTickTime", currentTickTime);
|
||||||
|
data.setBoolean("isActive", isActiveServer());
|
||||||
|
|
||||||
tag.setTag("Crater", data);
|
tag.setTag("Crater", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive() {
|
private boolean isActiveServer() {
|
||||||
return currentRecipe != null && currentTickTime != 0;
|
return currentRecipe != null && currentTickTime != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return isactive;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class BlockImplosionCompressor extends BlockMachineBase{
|
||||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||||
TileImplosionCompressor tileImplosionCompressor = (TileImplosionCompressor) blockAccess.getTileEntity(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;
|
return this.iconFrontOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,6 @@ public class GuiImplosionCompressor extends GuiContainer{
|
||||||
j = this.containerImplosionCompressor.currentTickTime * 20 / this.containerImplosionCompressor.currentNeededTicks;
|
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);
|
this.drawTexturedModalRect(k + 60, l + 38, 176, 14, j + 1, 16);
|
||||||
|
|
||||||
j = this.containerImplosionCompressor.energy * 12 / this.compresser.energy.getCapacity();
|
j = this.containerImplosionCompressor.energy * 12 / this.compresser.energy.getCapacity();
|
||||||
|
|
Loading…
Add table
Reference in a new issue