-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Should fix #1
- Loading branch information
Showing
7 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
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
10 changes: 10 additions & 0 deletions
10
fabric/src/main/java/ca/fxco/RailOptimization/fabric/mixin/PoweredRailBlockInvoker.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,10 @@ | ||
package ca.fxco.RailOptimization.fabric.mixin; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
public interface PoweredRailBlockInvoker { | ||
|
||
boolean invokeFindPoweredRailSignal(Level level, BlockPos pos, BlockState state, boolean bl, int distance); | ||
} |
35 changes: 35 additions & 0 deletions
35
fabric/src/main/java/ca/fxco/RailOptimization/fabric/mixin/PoweredRailBlockMixin.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,35 @@ | ||
package ca.fxco.RailOptimization.fabric.mixin; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.PoweredRailBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import static ca.fxco.RailOptimization.RailLogic.customUpdateState; | ||
|
||
@Mixin(value = PoweredRailBlock.class, priority = 990) | ||
public abstract class PoweredRailBlockMixin implements PoweredRailBlockInvoker { | ||
|
||
@Shadow | ||
protected boolean findPoweredRailSignal(Level Level, BlockPos pos, BlockState state, boolean bl, int distance) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
/** | ||
* @author FX | ||
* @reason Required to implement faster alternative | ||
*/ | ||
@Overwrite | ||
protected void updateState(BlockState state, Level level, BlockPos pos, Block block) { | ||
customUpdateState((PoweredRailBlock)(Object)this, state, level, pos); | ||
} | ||
|
||
@Override | ||
public boolean invokeFindPoweredRailSignal(Level level, BlockPos pos, BlockState state, boolean bl, int distance) { | ||
return this.findPoweredRailSignal(level, pos, state, bl, distance); | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...zation/mixin/PoweredRailBlockInvoker.java → .../forge/mixin/PoweredRailBlockInvoker.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
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
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