Skip to content

Commit

Permalink
fix: world is null when using baritone
Browse files Browse the repository at this point in the history
  • Loading branch information
RubixDev committed Apr 10, 2023
1 parent a911a88 commit c6dd733
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@

import de.rubixdev.rug.RugSettings;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(AbstractBlock.AbstractBlockState.class)
public class AbsractBlockStateMixin {
public abstract class AbsractBlockStateMixin {
@Shadow
public abstract Block getBlock();

@Inject(
method = "getHardness(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F",
at = @At("HEAD"),
cancellable = true)
private void onGetHardness(BlockView world, BlockPos pos, CallbackInfoReturnable<Float> cir) {
if (world.getBlockState(pos).isOf(Blocks.DRIED_KELP_BLOCK)) {
if (this.getBlock() == Blocks.DRIED_KELP_BLOCK) {
cir.setReturnValue((float) RugSettings.kelpBlockHardness);
}
}
Expand Down

0 comments on commit c6dd733

Please sign in to comment.