forked from BluSunrize/ImmersiveEngineering
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
e9198a2
commit 821ee44
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/main/java/blusunrize/immersiveengineering/mixin/coremods/WaterwheelBoundsMixin.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,54 @@ | ||
/* | ||
* BluSunrize | ||
* Copyright (c) 2024 | ||
* | ||
* This code is licensed under "Blu's License of Common Sense" | ||
* Details can be found in the license file in the root folder of this project | ||
*/ | ||
|
||
package blusunrize.immersiveengineering.mixin.coremods; | ||
|
||
import blusunrize.immersiveengineering.api.IEProperties; | ||
import blusunrize.immersiveengineering.common.register.IEBlocks.WoodenDevices; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.core.Direction.Axis; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.material.FlowingFluid; | ||
import net.minecraft.world.level.material.Fluid; | ||
import net.minecraft.world.level.material.FluidState; | ||
|
||
@Mixin(FlowingFluid.class) | ||
public class WaterwheelBoundsMixin { | ||
@Inject( | ||
method = "canPassThrough(" + | ||
"Lnet/minecraft/world/level/BlockGetter;" + | ||
"Lnet/minecraft/world/level/material/Fluid;" + | ||
"Lnet/minecraft/core/BlockPos;" + | ||
"Lnet/minecraft/world/level/block/state/BlockState;" + | ||
"Lnet/minecraft/core/Direction;Lnet/minecraft/core/BlockPos;" + | ||
"Lnet/minecraft/world/level/block/state/BlockState;" + | ||
"Lnet/minecraft/world/level/material/FluidState;)Z", | ||
at = @At("HEAD"), | ||
cancellable = true) | ||
protected void canPassThrough(BlockGetter pLevel, Fluid pFluid, BlockPos pFromPos, BlockState p_75967_, | ||
Direction pDirection, BlockPos p_75969_, BlockState p_75970_, FluidState p_75971_, | ||
CallbackInfoReturnable<Boolean> info) { | ||
|
||
if (pDirection.getAxis() == Axis.Y) | ||
return; | ||
|
||
BlockPos pos = pFromPos.below(); | ||
BlockState state = pLevel.getBlockState(pos); | ||
|
||
if (state.getBlock().equals(WoodenDevices.WATERMILL.get())) { | ||
if (state.getValue(IEProperties.FACING_HORIZONTAL).getAxis().equals(pDirection.getAxis())) | ||
info.setReturnValue(false); | ||
} | ||
} | ||
} |
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