use of net.minecraft.world.level.block.ButtonBlock in project Create by Creators-of-Create.
the class Contraption method capture.
protected Pair<StructureBlockInfo, BlockEntity> capture(Level world, BlockPos pos) {
BlockState blockstate = world.getBlockState(pos);
if (AllBlocks.REDSTONE_CONTACT.has(blockstate))
blockstate = blockstate.setValue(RedstoneContactBlock.POWERED, true);
if (blockstate.getBlock() instanceof ButtonBlock) {
blockstate = blockstate.setValue(ButtonBlock.POWERED, false);
world.scheduleTick(pos, blockstate.getBlock(), -1);
}
if (blockstate.getBlock() instanceof PressurePlateBlock) {
blockstate = blockstate.setValue(PressurePlateBlock.POWERED, false);
world.scheduleTick(pos, blockstate.getBlock(), -1);
}
CompoundTag compoundnbt = getTileEntityNBT(world, pos);
BlockEntity tileentity = world.getBlockEntity(pos);
return Pair.of(new StructureBlockInfo(pos, blockstate, compoundnbt), tileentity);
}
Aggregations