Redirect S19PacketEntityStatus to the Replay Player's entityID in ReplaySender
Removed unnecessary Event Listeners in RecordingHandler that injected S19PacketEntityStatus whenever the Player was damaged or died
This commit is contained in:
@@ -312,67 +312,6 @@ public class RecordingHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onHurt(LivingHurtEvent event) {
|
|
||||||
if(!ConnectionEventHandler.isRecording()) return;
|
|
||||||
try {
|
|
||||||
if(event.entity.getEntityId() != mc.thePlayer.getEntityId()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
S19PacketEntityStatus packet = new S19PacketEntityStatus();
|
|
||||||
|
|
||||||
ByteBuf buf = Unpooled.buffer();
|
|
||||||
PacketBuffer pbuf = new PacketBuffer(buf);
|
|
||||||
|
|
||||||
pbuf.writeInt(entityID);
|
|
||||||
pbuf.writeByte(2);
|
|
||||||
|
|
||||||
packet.readPacketData(pbuf);
|
|
||||||
|
|
||||||
ConnectionEventHandler.insertPacket(packet);
|
|
||||||
|
|
||||||
//Damage Animation
|
|
||||||
S0BPacketAnimation pac = new S0BPacketAnimation();
|
|
||||||
|
|
||||||
ByteBuf bb = Unpooled.buffer();
|
|
||||||
PacketBuffer pb = new PacketBuffer(bb);
|
|
||||||
|
|
||||||
pb.writeVarIntToBuffer(entityID);
|
|
||||||
pb.writeByte(1);
|
|
||||||
|
|
||||||
pac.readPacketData(pb);
|
|
||||||
|
|
||||||
ConnectionEventHandler.insertPacket(pac);
|
|
||||||
} catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onDeath(LivingDeathEvent event) {
|
|
||||||
if(!ConnectionEventHandler.isRecording()) return;
|
|
||||||
try {
|
|
||||||
if(event.entity.getEntityId() != mc.thePlayer.getEntityId()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
S19PacketEntityStatus packet = new S19PacketEntityStatus();
|
|
||||||
|
|
||||||
ByteBuf buf = Unpooled.buffer();
|
|
||||||
PacketBuffer pbuf = new PacketBuffer(buf);
|
|
||||||
|
|
||||||
pbuf.writeInt(entityID);
|
|
||||||
pbuf.writeByte(3);
|
|
||||||
|
|
||||||
packet.readPacketData(pbuf);
|
|
||||||
|
|
||||||
ConnectionEventHandler.insertPacket(packet);
|
|
||||||
} catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onStartEating(PlayerUseItemEvent.Start event) {
|
public void onStartEating(PlayerUseItemEvent.Start event) {
|
||||||
if(!ConnectionEventHandler.isRecording()) return;
|
if(!ConnectionEventHandler.isRecording()) return;
|
||||||
|
|||||||
@@ -325,6 +325,13 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(p instanceof S19PacketEntityStatus) {
|
||||||
|
S19PacketEntityStatus packet = (S19PacketEntityStatus)p;
|
||||||
|
if(packet.field_149164_a == actualID) {
|
||||||
|
packet.field_149164_a = RecordingHandler.entityID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(p instanceof S01PacketJoinGame) {
|
if(p instanceof S01PacketJoinGame) {
|
||||||
S01PacketJoinGame packet = (S01PacketJoinGame) p;
|
S01PacketJoinGame packet = (S01PacketJoinGame) p;
|
||||||
allowMovement = true;
|
allowMovement = true;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public net.minecraft.network.play.server.S1CPacketEntityMetadata field_149379_a
|
|||||||
public net.minecraft.network.play.server.S1CPacketEntityMetadata field_149378_b # list
|
public net.minecraft.network.play.server.S1CPacketEntityMetadata field_149378_b # list
|
||||||
public net.minecraft.network.play.server.S0BPacketAnimation field_148981_a # entityId
|
public net.minecraft.network.play.server.S0BPacketAnimation field_148981_a # entityId
|
||||||
public net.minecraft.network.play.server.S02PacketChat field_179842_b # position
|
public net.minecraft.network.play.server.S02PacketChat field_179842_b # position
|
||||||
|
public net.minecraft.network.play.server.S19PacketEntityStatus field_149164_a # entityId
|
||||||
|
|
||||||
# GuiTextField
|
# GuiTextField
|
||||||
public net.minecraft.client.gui.GuiTextField field_146216_j # text
|
public net.minecraft.client.gui.GuiTextField field_146216_j # text
|
||||||
|
|||||||
Reference in New Issue
Block a user