1
0
forked from xjboss/KCauldronX

Pass net handler during reverse cloning due to some mods could transmit some packets in cloning

This commit is contained in:
Sergey Shatunov 2016-02-06 23:20:23 +07:00
parent d09dc71f62
commit db3a8c3045

View File

@ -1,7 +1,6 @@
package kcauldron; package kcauldron;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ContainerPlayer; import net.minecraft.inventory.ContainerPlayer;
import net.minecraft.server.management.ItemInWorldManager; import net.minecraft.server.management.ItemInWorldManager;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
@ -10,9 +9,11 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
public enum ReverseClonner { public enum ReverseClonner {
; ;
public static EntityPlayerMP clone(EntityPlayerMP player, boolean wasDeath) { public static EntityPlayerMP clone(EntityPlayerMP player, boolean wasDeath) {
EntityPlayerMP shadowCopy = new EntityPlayerMP(player.mcServer, (WorldServer) player.worldObj, EntityPlayerMP shadowCopy = new EntityPlayerMP(player.mcServer, (WorldServer) player.worldObj,
player.getGameProfile(), new ItemInWorldManager(player.worldObj)); player.getGameProfile(), new ItemInWorldManager(player.worldObj));
shadowCopy.playerNetServerHandler = player.playerNetServerHandler;
shadowCopy.clonePlayer(player, true); shadowCopy.clonePlayer(player, true);
if (wasDeath && !player.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { if (wasDeath && !player.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) {
player.inventory.clearInventory(null, -1); player.inventory.clearInventory(null, -1);