This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |