mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-12 04:57:31 +00:00
crash fix
This commit is contained in:
1 file changed
+12
-7
+12
-7
@@ -1,17 +1,20 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IS1DPacketEntityEffectMixin;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import lombok.val;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.network.play.server.S1DPacketEntityEffect;
|
||||
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@@ -64,11 +67,13 @@ public abstract class NetHandlerPlayClientMixin {
|
||||
theID.set(((IS1DPacketEntityEffectMixin)packetIn).getIDExtended());
|
||||
}
|
||||
|
||||
@Redirect(method = "handleEntityEffect",
|
||||
at = @At(value = "NEW",
|
||||
target = "Lnet/minecraft/potion/PotionEffect;<init>(III)V"),
|
||||
require = 1)
|
||||
private PotionEffect customNewPotionEffect(int id, int duration, int amplifier) {
|
||||
return new PotionEffect(theID.get(), duration, amplifier);
|
||||
@WrapOperation(method = "handleEntityEffect",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/entity/EntityLivingBase;addPotionEffect(Lnet/minecraft/potion/PotionEffect;)V"),
|
||||
require = 1)
|
||||
private void addPotionEffect(EntityLivingBase entity, PotionEffect effect, Operation<Void> op) {
|
||||
val newPotion = new PotionEffect(theID.get(), effect.getDuration(), effect.getAmplifier());
|
||||
newPotion.setPotionDurationMax(effect.getIsPotionDurationMax());
|
||||
op.call(entity, newPotion);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user