This commit is contained in:
Shadows_of_Fire 2018-08-12 10:44:35 -04:00
parent 33d9cb9fdb
commit 9db46b9efc

View file

@ -76,31 +76,40 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
if (recipe != null) { if (recipe != null) {
this.recipeForRenderIndex = ActuallyAdditionsAPI.EMPOWERER_RECIPES.indexOf(recipe); this.recipeForRenderIndex = ActuallyAdditionsAPI.EMPOWERER_RECIPES.indexOf(recipe);
this.processTime++; boolean hasPower = true;
boolean done = this.processTime >= recipe.getTime();
for (TileEntityDisplayStand stand : stands) { for (TileEntityDisplayStand stand : stands) {
stand.storage.extractEnergyInternal(recipe.getEnergyPerStand() / recipe.getTime(), false); if (stand.storage.getEnergyStored() < recipe.getEnergyPerStand() / recipe.getTime()) hasPower = false;
}
if (hasPower) {
this.processTime++;
boolean done = this.processTime >= recipe.getTime();
for (TileEntityDisplayStand stand : stands) {
stand.storage.extractEnergyInternal(recipe.getEnergyPerStand() / recipe.getTime(), false);
if (done) {
stand.inv.getStackInSlot(0).shrink(1);
stand.markDirty();
}
}
if (this.processTime % 5 == 0 && this.world instanceof WorldServer) {
((WorldServer) this.world).spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, false, this.pos.getX() + 0.5, this.pos.getY() + 1.1, this.pos.getZ() + 0.5, 2, 0, 0, 0, 0.1D);
}
if (done) { if (done) {
stand.inv.getStackInSlot(0).shrink(1); ((WorldServer) this.world).spawnParticle(EnumParticleTypes.END_ROD, false, this.pos.getX() + 0.5, this.pos.getY() + 1.1, this.pos.getZ() + 0.5, 100, 0, 0, 0, 0.25D);
stand.markDirty();
this.inv.setStackInSlot(0, recipe.getOutput().copy());
this.markDirty();
this.processTime = 0;
this.recipeForRenderIndex = -1;
} }
} }
if (this.processTime % 5 == 0 && this.world instanceof WorldServer) {
((WorldServer) this.world).spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, false, this.pos.getX() + 0.5, this.pos.getY() + 1.1, this.pos.getZ() + 0.5, 2, 0, 0, 0, 0.1D);
}
if (done) {
((WorldServer) this.world).spawnParticle(EnumParticleTypes.END_ROD, false, this.pos.getX() + 0.5, this.pos.getY() + 1.1, this.pos.getZ() + 0.5, 100, 0, 0, 0, 0.25D);
this.inv.setStackInSlot(0, recipe.getOutput().copy());
this.markDirty();
this.processTime = 0;
this.recipeForRenderIndex = -1;
}
} else { } else {
this.processTime = 0; this.processTime = 0;
this.recipeForRenderIndex = -1; this.recipeForRenderIndex = -1;