Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
added BlockEntityBridge
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Aug 27, 2024
1 parent 624e8ec commit 8e66b8d
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<BlockEntityBridge> 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());
}
}

0 comments on commit 8e66b8d

Please sign in to comment.