diff --git a/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityBridge.java b/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityBridge.java new file mode 100644 index 000000000..edee52111 --- /dev/null +++ b/common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityBridge.java @@ -0,0 +1,28 @@ +package muramasa.gregtech.blockentity.single; + +import muramasa.antimatter.blockentity.BlockEntityMachine; +import muramasa.antimatter.blockentity.IExtendingBlockEntity; +import muramasa.antimatter.machine.types.Machine; +import muramasa.antimatter.util.Utils; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; + +public class BlockEntityBridge extends BlockEntityMachine implements IExtendingBlockEntity { + public BlockEntityBridge(Machine type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + @Override + public BlockEntity getExtendedBlockEntity(Direction side) { + return getCachedBlockEntity(side); + } + @Override + public void onBlockUpdate(BlockPos neighbor) { + super.onBlockUpdate(neighbor); + Direction facing = Utils.getOffsetFacing(this.getBlockPos(), neighbor); + BlockPos offset = getBlockPos().relative(facing.getOpposite()); + getLevel().neighborChanged(offset, getLevel().getBlockState(offset).getBlock(), getBlockPos()); + } +}