From 8e3928e945e5ca0799eddc864011ab64554b1d8c Mon Sep 17 00:00:00 2001 From: sashafiesta <46864270+sashafiesta@users.noreply.github.com> Date: Tue, 14 May 2024 19:19:39 +0700 Subject: [PATCH] Removed a bug, added a bug --- .../mixin/ItemUseOverridesMixin.java | 39 ------------------- .../resources/create_connected.mixins.json | 3 +- 2 files changed, 1 insertion(+), 41 deletions(-) delete mode 100644 src/main/java/com/hlysine/create_connected/mixin/ItemUseOverridesMixin.java diff --git a/src/main/java/com/hlysine/create_connected/mixin/ItemUseOverridesMixin.java b/src/main/java/com/hlysine/create_connected/mixin/ItemUseOverridesMixin.java deleted file mode 100644 index 8e991b1..0000000 --- a/src/main/java/com/hlysine/create_connected/mixin/ItemUseOverridesMixin.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.hlysine.create_connected.mixin; - -import com.hlysine.create_connected.PreciseItemUseOverrides; -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.llamalad7.mixinextras.sugar.Local; -import com.simibubi.create.foundation.block.ItemUseOverrides; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -@Mixin(ItemUseOverrides.class) -public class ItemUseOverridesMixin { - @WrapOperation( - method = "onBlockActivated(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/phys/BlockHitResult;)Lnet/minecraft/world/InteractionResult;", - at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;use(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/phys/BlockHitResult;)Lnet/minecraft/world/InteractionResult;") - ) - private static InteractionResult preciseHitLocation(BlockState instance, - Level level, - Player player, - InteractionHand interactionHand, - BlockHitResult blockHitResult, - Operation original, - @Local ResourceLocation id) { - if (PreciseItemUseOverrides.OVERRIDES.contains(id) && blockHitResult.getType() == HitResult.Type.BLOCK) { - HitResult hitResult = player.pick((player.position().distanceTo(blockHitResult.getBlockPos().getCenter())+1.0F)*2.0F, 1.0F, false); - if (hitResult instanceof BlockHitResult blockHit) { - return original.call(instance, level, player, interactionHand, blockHit); - } - } - return original.call(instance, level, player, interactionHand, blockHitResult); - } -} diff --git a/src/main/resources/create_connected.mixins.json b/src/main/resources/create_connected.mixins.json index beb59fc..add8c6e 100644 --- a/src/main/resources/create_connected.mixins.json +++ b/src/main/resources/create_connected.mixins.json @@ -7,8 +7,7 @@ "linkedtransmitter.AnalogLeverBlockEntityAccessor", "linkedtransmitter.AnalogLeverBlockMixin", "linkedtransmitter.ButtonBlockAccessor", - "chaincogwheel.RotationPropagatorMixin", - "ItemUseOverridesMixin" + "chaincogwheel.RotationPropagatorMixin" ], "client": [ ],