Some fixes and utils

This commit is contained in:
Aleksey 2020-11-22 00:42:12 +03:00
parent 3b31532fea
commit 70d5a6d209
5 changed files with 216 additions and 6 deletions

View file

@ -35,7 +35,10 @@ public class InfusionPedestal extends BlockPedestal {
if (blockEntity instanceof InfusionPedestalEntity) {
pedestal = (InfusionPedestalEntity) blockEntity;
if (!pedestal.isEmpty() && pedestal.hasRitual()) {
if (pedestal.getRitual().checkRecipe()) {
if (pedestal.getRitual().hasRecipe()) {
pedestal.getRitual().stop();
return ActionResult.SUCCESS;
} else if (pedestal.getRitual().checkRecipe()) {
return ActionResult.SUCCESS;
}
}

View file

@ -72,7 +72,7 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
public void removeStack(World world, BlockState state) {
world.setBlockState(pos, state.with(BlockPedestal.HAS_ITEM, false)
.with(BlockPedestal.HAS_LIGHT, false));
.with(BlockPedestal.HAS_LIGHT, false));
this.removeStack(0);
}
@ -83,12 +83,11 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
}
public void setStack(World world, BlockState state, ItemStack stack) {
world.setBlockState(pos, state.with(BlockPedestal.HAS_ITEM, true));
state = state.with(BlockPedestal.HAS_ITEM, true);
if (stack.getItem() == EndItems.ETERNAL_CRYSTAL) {
world.setBlockState(pos, state.with(BlockPedestal.HAS_LIGHT, true));
} else {
world.setBlockState(pos, state.with(BlockPedestal.HAS_LIGHT, false));
state = state.with(BlockPedestal.HAS_LIGHT, true);
}
world.setBlockState(pos, state);
this.setStack(0, stack);
}