Fixed hopper & dropper pedestal iteraction, added comparator ouytput for pedestals
This commit is contained in:
parent
d9aa50fe1c
commit
0180fcf11e
3 changed files with 33 additions and 9 deletions
|
@ -109,7 +109,7 @@ public class BlockPedestal extends BlockBaseNotFull implements BlockEntityProvid
|
|||
if (pedestal.isEmpty()) {
|
||||
ItemStack itemStack = player.getStackInHand(hand);
|
||||
if (itemStack.isEmpty()) return ActionResult.CONSUME;
|
||||
pedestal.setStack(world, state, itemStack.split(1));
|
||||
pedestal.setStack(0, itemStack.split(1));
|
||||
return ActionResult.SUCCESS;
|
||||
} else {
|
||||
ItemStack itemStack = pedestal.getStack(0);
|
||||
|
@ -305,6 +305,17 @@ public class BlockPedestal extends BlockBaseNotFull implements BlockEntityProvid
|
|||
return new PedestalBlockEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorOutput(BlockState state) {
|
||||
return state.getBlock() instanceof BlockPedestal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorOutput(BlockState state, World world, BlockPos pos) {
|
||||
System.out.println(state.get(HAS_ITEM));
|
||||
return state.get(HAS_ITEM) ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String texture = Registry.BLOCK.getId(this).getPath();
|
||||
|
|
|
@ -61,6 +61,11 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
|
|||
public ItemStack removeStack(int slot, int amount) {
|
||||
return this.removeStack(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(int slot, ItemStack stack) {
|
||||
return this.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeStack(int slot) {
|
||||
|
@ -82,15 +87,23 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
|
|||
this.markDirty();
|
||||
}
|
||||
|
||||
public void setStack(World world, BlockState state, ItemStack stack) {
|
||||
state = state.with(BlockPedestal.HAS_ITEM, true);
|
||||
if (stack.getItem() == EndItems.ETERNAL_CRYSTAL) {
|
||||
state = state.with(BlockPedestal.HAS_LIGHT, true);
|
||||
@Override
|
||||
public void markDirty() {
|
||||
if (world != null && !world.isClient) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() instanceof BlockPedestal) {
|
||||
state = state.with(BlockPedestal.HAS_ITEM, !isEmpty());
|
||||
if (activeItem.getItem() == EndItems.ETERNAL_CRYSTAL) {
|
||||
state = state.with(BlockPedestal.HAS_LIGHT, true);
|
||||
} else {
|
||||
state = state.with(BlockPedestal.HAS_LIGHT, false);
|
||||
}
|
||||
world.setBlockState(pos, state);
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos, state);
|
||||
this.setStack(0, stack);
|
||||
super.markDirty();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canPlayerUse(PlayerEntity player) {
|
||||
return true;
|
||||
|
|
|
@ -107,7 +107,7 @@ public class InfusionRitual implements Inventory {
|
|||
if (progress == time) {
|
||||
BlockState inputState = world.getBlockState(input.getPos());
|
||||
this.input.removeStack(world, inputState);
|
||||
this.input.setStack(world, inputState, activeRecipe.craft(this));
|
||||
this.input.setStack(0, activeRecipe.craft(this));
|
||||
for (PedestalBlockEntity catalyst : catalysts) {
|
||||
catalyst.removeStack(world, world.getBlockState(catalyst.getPos()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue