Pedestals and rituals state saving

This commit is contained in:
Aleksey 2020-11-10 13:51:25 +03:00
parent c7d8365765
commit 28427f54a3
3 changed files with 21 additions and 10 deletions

View file

@ -238,7 +238,6 @@ public class EndStoneSmelterBlockEntity extends LockableContainerBlockEntity imp
@Override
public void tick() {
boolean initialBurning = this.isBurning();
boolean smelting = false;
if (initialBurning) {
this.burnTime--;
}
@ -261,7 +260,6 @@ public class EndStoneSmelterBlockEntity extends LockableContainerBlockEntity imp
this.fuelTime = this.burnTime;
burning = this.isBurning();
if (burning) {
smelting = true;
if (!fuel.isEmpty()) {
Item item = fuel.getItem();
fuel.decrement(1);
@ -270,6 +268,7 @@ public class EndStoneSmelterBlockEntity extends LockableContainerBlockEntity imp
this.inventory.set(2, remainFuel == null ? ItemStack.EMPTY : new ItemStack(remainFuel));
}
}
this.markDirty();
}
}
@ -279,7 +278,7 @@ public class EndStoneSmelterBlockEntity extends LockableContainerBlockEntity imp
this.smeltTime = 0;
this.smeltTimeTotal = this.getSmeltTime();
this.craftRecipe(recipe);
smelting = true;
this.markDirty();
}
} else {
this.smeltTime = 0;
@ -287,14 +286,10 @@ public class EndStoneSmelterBlockEntity extends LockableContainerBlockEntity imp
}
if (initialBurning != burning) {
smelting = true;
this.world.setBlockState(pos, world.getBlockState(pos).with(EndStoneSmelter.LIT, burning), 3);
this.markDirty();
}
}
if (smelting) {
this.markDirty();
}
}
protected boolean canAcceptRecipeOutput(Recipe<?> recipe) {

View file

@ -38,6 +38,7 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
@Override
public void clear() {
this.activeItem = ItemStack.EMPTY;
this.markDirty();
}
@Override
@ -62,7 +63,10 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
@Override
public ItemStack removeStack(int slot) {
return this.activeItem = ItemStack.EMPTY;
ItemStack stored = this.activeItem;
this.activeItem = ItemStack.EMPTY;
this.markDirty();
return stored;
}
public void removeStack(World world, BlockState state) {
@ -73,6 +77,7 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
@Override
public void setStack(int slot, ItemStack stack) {
this.activeItem = stack;
this.markDirty();
}
public void setStack(World world, BlockState state, ItemStack stack) {