Skip to content

Commit 1d03e98

Browse files
authored
Fix methods injection (#766)
1 parent eeb5759 commit 1d03e98

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

fabric/src/main/java/fr/rakambda/fallingtree/fabric/mixin/AbstractBlockMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
@Mixin(BlockBehaviour.class)
1717
public abstract class AbstractBlockMixin{
1818
@Inject(method = "getDestroyProgress", at = @At(value = "TAIL"), cancellable = true)
19-
public void calcBlockBreakingDelta(BlockState state, Player player, BlockGetter level, BlockPos pos, CallbackInfoReturnable<Float> callbackInfoReturnable){
19+
public void calcBlockBreakingDelta(BlockState blockState, Player player, BlockGetter blockGetter, BlockPos blockPos, CallbackInfoReturnable<Float> callbackInfoReturnable){
2020
var wrappedPlayer = new PlayerWrapper(player);
21-
var wrappedPos = new BlockPosWrapper(pos);
21+
var wrappedPos = new BlockPosWrapper(blockPos);
2222

2323
var result = FallingTree.getMod().getTreeHandler().getBreakSpeed(wrappedPlayer, wrappedPos, callbackInfoReturnable.getReturnValue());
2424
if(result.isEmpty()){

fabric/src/main/java/fr/rakambda/fallingtree/fabric/mixin/LevelMixin.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import net.minecraft.core.Direction;
1010
import net.minecraft.server.level.ServerLevel;
1111
import net.minecraft.world.level.block.Block;
12+
import net.minecraft.world.level.redstone.Orientation;
13+
import org.jetbrains.annotations.Nullable;
1214
import org.spongepowered.asm.mixin.Mixin;
1315
import org.spongepowered.asm.mixin.injection.At;
1416
import org.spongepowered.asm.mixin.injection.Inject;
@@ -30,16 +32,16 @@ public void updateNeighborsAlways(BlockPos pos, Block block, CallbackInfo callba
3032
}
3133

3234
@Inject(method = "updateNeighborsAtExceptFromFacing", at = @At(value = "TAIL"))
33-
public void updateNeighborsExcept(BlockPos pos, Block sourceBlock, Direction direction, CallbackInfo callbackInfo){
35+
public void updateNeighborsExcept(BlockPos blockPos, Block block, Direction direction, @Nullable Orientation orientation, CallbackInfo callbackInfo){
3436
//noinspection ConstantConditions
3537
var serverLevel = (ServerLevel) (Object) this;
3638
var directions = EnumSet.allOf(Direction.class);
3739
directions.remove(direction);
3840

3941
FallingTree.getMod().getLeafBreakingHandler().onBlockUpdate(
4042
new ServerLevelWrapper(serverLevel),
41-
new BlockPosWrapper(pos),
42-
new BlockStateWrapper(serverLevel.getBlockState(pos)),
43+
new BlockPosWrapper(blockPos),
44+
new BlockStateWrapper(serverLevel.getBlockState(blockPos)),
4345
directions.stream().map(FallingTree.getMod()::asDirectionCompat).collect(Collectors.toSet()));
4446
}
4547
}

0 commit comments

Comments
 (0)