mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 09:11:32 +01:00
(vanilla fix) resolve NPE in NetHandlerPlayClient#handleSpawnPlayer
This commit is contained in:
parent
54e4e25401
commit
882d89d0e6
@ -4,7 +4,9 @@ import net.minecraft.client.entity.EntityPlayerSP;
|
|||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
import net.minecraft.client.multiplayer.WorldClient;
|
||||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||||
|
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||||
import net.minecraft.network.play.server.S01PacketJoinGame;
|
import net.minecraft.network.play.server.S01PacketJoinGame;
|
||||||
|
import net.minecraft.network.play.server.S0CPacketSpawnPlayer;
|
||||||
import net.minecraft.network.play.server.S19PacketEntityStatus;
|
import net.minecraft.network.play.server.S19PacketEntityStatus;
|
||||||
import net.minecraft.network.play.server.S48PacketResourcePackSend;
|
import net.minecraft.network.play.server.S48PacketResourcePackSend;
|
||||||
import net.minecraft.util.IChatComponent;
|
import net.minecraft.util.IChatComponent;
|
||||||
@ -16,9 +18,28 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||||||
import org.spongepowered.asm.mixin.injection.*;
|
import org.spongepowered.asm.mixin.injection.*;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@Mixin(NetHandlerPlayClient.class)
|
@Mixin(NetHandlerPlayClient.class)
|
||||||
public class NetHandlerPlayClientMixin {
|
public abstract class NetHandlerPlayClientMixin {
|
||||||
@Shadow private WorldClient clientWorldController;
|
@Shadow private WorldClient clientWorldController;
|
||||||
|
@Shadow
|
||||||
|
public abstract NetworkPlayerInfo getPlayerInfo(UUID p_175102_1_);
|
||||||
|
|
||||||
|
@Inject(
|
||||||
|
method = "handleSpawnPlayer",
|
||||||
|
cancellable = true,
|
||||||
|
at =
|
||||||
|
@At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/network/PacketThreadUtil;checkThreadAndEnqueue(Lnet/minecraft/network/Packet;Lnet/minecraft/network/INetHandler;Lnet/minecraft/util/IThreadListener;)V",
|
||||||
|
shift = At.Shift.AFTER
|
||||||
|
))
|
||||||
|
private void patcher$fixHandleSpawnPlayerNPE(S0CPacketSpawnPlayer packetIn, CallbackInfo ci) {
|
||||||
|
if (this.getPlayerInfo(packetIn.getPlayer()) == null) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "handleEntityStatus", at = @At("RETURN"))
|
@Inject(method = "handleEntityStatus", at = @At("RETURN"))
|
||||||
public void callEntityDamageEvent(S19PacketEntityStatus packetIn, CallbackInfo ci) {
|
public void callEntityDamageEvent(S19PacketEntityStatus packetIn, CallbackInfo ci) {
|
||||||
|
Loading…
Reference in New Issue
Block a user