Skip to content

Commit

Permalink
Remove no longer needed injections
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Dec 3, 2024
1 parent 6efe7f1 commit 72ab236
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,13 @@
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.v1_11_1to1_12.Protocol1_11_1To1_12;
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ServerboundPackets1_9_3;
import de.florianmichael.viafabricplus.fixes.data.ItemRegistryDiff;
import de.florianmichael.viafabricplus.injection.access.IMouseKeyboard;
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
import de.florianmichael.viafabricplus.settings.impl.DebugSettings;
import net.minecraft.client.Keyboard;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.Mouse;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.client.render.item.HeldItemRenderer;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -71,23 +66,6 @@ public abstract class MixinMinecraftClient {
@Final
public Keyboard keyboard;

@Redirect(method = "doItemPick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerInventory;addPickBlock(Lnet/minecraft/item/ItemStack;)V"))
private void filterItem(PlayerInventory instance, ItemStack stack) {
if (ItemRegistryDiff.keepItem(stack.getItem())) {
instance.addPickBlock(stack);
}
}

/**
* Never happens in Vanilla, this is only for {@link ItemRegistryDiff} to work
*/
@Redirect(method = "doItemPick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;clickCreativeStack(Lnet/minecraft/item/ItemStack;I)V"))
private void dontSendEmptyItem(ClientPlayerInteractionManager instance, ItemStack stack, int slotId) {
if (!stack.isEmpty()) {
instance.clickCreativeStack(stack, slotId);
}
}

@WrapWithCondition(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
private boolean disableSwing(ClientPlayerEntity instance, Hand hand) {
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_15);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ protected MixinSkeletonHorseEntity(EntityType<? extends AbstractHorseEntity> ent
super(entityType, world);
}

@Inject(method = "getBaseMovementSpeedMultiplier", at = @At("HEAD"), cancellable = true)
private void modifyBaseMovementSpeedMultiplier(CallbackInfoReturnable<Float> cir) {
@Inject(method = "getBaseWaterMovementSpeedMultiplier", at = @At("HEAD"), cancellable = true)
private void modifyBaseWaterMovementSpeedMultiplier(CallbackInfoReturnable<Float> cir) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
cir.setReturnValue(super.getBaseMovementSpeedMultiplier());
cir.setReturnValue(super.getBaseWaterMovementSpeedMultiplier());
}
}

Expand Down

0 comments on commit 72ab236

Please sign in to comment.