ForgePatch/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.p...

111 lines
7.4 KiB
Diff

--- a/net/minecraft/client/network/play/ClientPlayNetHandler.java
+++ b/net/minecraft/client/network/play/ClientPlayNetHandler.java
@@ -361,6 +361,7 @@
this.field_147299_f.field_184132_p.func_217737_a();
this.field_147299_f.field_71439_g.func_70065_x();
+ net.minecraftforge.fml.client.ClientHooks.firePlayerLogin(this.field_147299_f.field_71442_b, this.field_147299_f.field_71439_g, this.field_147299_f.func_147114_u().func_147298_b());
int i = p_147282_1_.func_149197_c();
this.field_147300_g.func_217408_a(i, this.field_147299_f.field_71439_g);
this.field_147299_f.field_71439_g.field_71158_b = new MovementInputFromOptions(this.field_147299_f.field_71474_y);
@@ -372,6 +373,7 @@
this.field_147299_f.field_71439_g.func_175150_k(p_147282_1_.func_179744_h());
this.field_147299_f.field_71439_g.func_228355_a_(p_147282_1_.func_229743_k_());
this.field_147299_f.field_71442_b.func_78746_a(p_147282_1_.func_149198_e());
+ net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(field_147302_e, "PLAY_TO_SERVER");
this.field_147299_f.field_71474_y.func_82879_c();
this.field_147302_e.func_179290_a(new CCustomPayloadPacket(CCustomPayloadPacket.field_210344_a, (new PacketBuffer(Unpooled.buffer())).func_180714_a(ClientBrandRetriever.getClientModName())));
this.field_147299_f.func_213229_ar().func_216814_a();
@@ -727,7 +729,7 @@
BlockPos blockpos = new BlockPos(compoundnbt.func_74762_e("x"), compoundnbt.func_74762_e("y"), compoundnbt.func_74762_e("z"));
TileEntity tileentity = this.field_147300_g.func_175625_s(blockpos);
if (tileentity != null) {
- tileentity.func_145839_a(compoundnbt);
+ tileentity.handleUpdateTag(compoundnbt);
}
}
@@ -803,7 +805,9 @@
public void func_147251_a(SChatPacket p_147251_1_) {
PacketThreadUtil.func_218797_a(p_147251_1_, this, this.field_147299_f);
- this.field_147299_f.field_71456_v.func_191742_a(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c());
+ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c());
+ if (message == null) return;
+ this.field_147299_f.field_71456_v.func_191742_a(p_147251_1_.func_192590_c(), message);
}
public void func_147279_a(SAnimateHandPacket p_147279_1_) {
@@ -983,8 +987,10 @@
this.field_147299_f.field_175622_Z = clientplayerentity1;
clientplayerentity1.func_184212_Q().func_187218_a(clientplayerentity.func_184212_Q().func_187231_c());
clientplayerentity1.func_110140_aT().func_226303_a_(clientplayerentity.func_110140_aT());
+ clientplayerentity1.updateSyncFields(clientplayerentity); // Forge: fix MC-10657
clientplayerentity1.func_70065_x();
clientplayerentity1.func_175158_f(s);
+ net.minecraftforge.fml.client.ClientHooks.firePlayerRespawn(this.field_147299_f.field_71442_b, clientplayerentity, clientplayerentity1, clientplayerentity1.field_71174_a.func_147298_b());
this.field_147300_g.func_217408_a(i, clientplayerentity1);
clientplayerentity1.field_70177_z = -180.0F;
clientplayerentity1.field_71158_b = new MovementInputFromOptions(this.field_147299_f.field_71474_y);
@@ -1105,6 +1111,12 @@
boolean flag = i == 2 && tileentity instanceof CommandBlockTileEntity;
if (i == 1 && tileentity instanceof MobSpawnerTileEntity || flag || i == 3 && tileentity instanceof BeaconTileEntity || i == 4 && tileentity instanceof SkullTileEntity || i == 6 && tileentity instanceof BannerTileEntity || i == 7 && tileentity instanceof StructureBlockTileEntity || i == 8 && tileentity instanceof EndGatewayTileEntity || i == 9 && tileentity instanceof SignTileEntity || i == 11 && tileentity instanceof BedTileEntity || i == 5 && tileentity instanceof ConduitTileEntity || i == 12 && tileentity instanceof JigsawTileEntity || i == 13 && tileentity instanceof CampfireTileEntity || i == 14 && tileentity instanceof BeehiveTileEntity) {
tileentity.func_145839_a(p_147273_1_.func_148857_g());
+ } else {
+ if(tileentity == null) {
+ field_147301_d.error("Received invalid update packet for null tile entity at {} with data: {}", p_147273_1_.func_179823_a(), p_147273_1_.func_148857_g());
+ return;
+ }
+ tileentity.onDataPacket(field_147302_e, p_147273_1_);
}
if (flag && this.field_147299_f.field_71462_r instanceof CommandBlockScreen) {
@@ -1276,6 +1288,7 @@
clientrecipebook.func_199644_c();
clientrecipebook.func_199642_d().forEach(imutablesearchtree::func_217872_a);
imutablesearchtree.func_194040_a();
+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.field_199528_o);
}
public void func_200232_a(SPlayerLookPacket p_200232_1_) {
@@ -1356,7 +1369,7 @@
PacketThreadUtil.func_218797_a(p_147260_1_, this, this.field_147299_f);
Entity entity = this.field_147300_g.func_73045_a(p_147260_1_.func_149426_d());
if (entity instanceof LivingEntity) {
- Effect effect = Effect.func_188412_a(p_147260_1_.func_149427_e());
+ Effect effect = Effect.func_188412_a(p_147260_1_.func_149427_e() & 0xFF);
if (effect != null) {
EffectInstance effectinstance = new EffectInstance(effect, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h());
effectinstance.func_100012_b(p_147260_1_.func_149429_c());
@@ -1376,6 +1389,7 @@
}
this.field_147299_f.func_213253_a(SearchTreeManager.field_215360_b).func_194040_a();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.field_199725_m));
}
public void func_175098_a(SCombatPacket p_175098_1_) {
@@ -1851,10 +1865,12 @@
int l5 = packetbuffer.readInt();
this.field_147299_f.field_184132_p.field_229018_q_.func_229022_a_(blockpos7, l3, s10, l5);
} else {
- field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation);
+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147240_1_, this.field_147302_e))
+ field_147301_d.warn("Unknown custom packet identifier: {}", (Object)resourcelocation);
}
} finally {
if (packetbuffer != null) {
+ if (false) // Forge: let packet handle releasing buffer
packetbuffer.release();
}
@@ -1994,7 +2010,7 @@
for(SEntityPropertiesPacket.Snapshot sentitypropertiespacket$snapshot : p_147290_1_.func_149441_d()) {
IAttributeInstance iattributeinstance = abstractattributemap.func_111152_a(sentitypropertiespacket$snapshot.func_151409_a());
if (iattributeinstance == null) {
- iattributeinstance = abstractattributemap.func_111150_b(new RangedAttribute((IAttribute)null, sentitypropertiespacket$snapshot.func_151409_a(), 0.0D, Double.MIN_NORMAL, Double.MAX_VALUE));
+ iattributeinstance = abstractattributemap.func_111150_b(new RangedAttribute((IAttribute)null, sentitypropertiespacket$snapshot.func_151409_a(), 0.0D, -Double.MAX_VALUE, Double.MAX_VALUE)); // FORGE: fix invalid value range (MC-150405)
}
iattributeinstance.func_111128_a(sentitypropertiespacket$snapshot.func_151410_b());