Rollback to the state of .152 build with some critical fixes and updates
This commit is contained in:
@ -24,7 +24,7 @@
|
||||
import net.minecraft.network.play.server.S23PacketBlockChange;
|
||||
import net.minecraft.network.play.server.S2FPacketSetSlot;
|
||||
import net.minecraft.network.play.server.S32PacketConfirmTransaction;
|
||||
@@ -81,19 +84,77 @@
|
||||
@@ -81,19 +84,75 @@
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.IntHashMap;
|
||||
import net.minecraft.util.ReportedException;
|
||||
@ -53,8 +53,6 @@
|
||||
+import net.minecraft.init.Blocks;
|
||||
+import net.minecraft.network.play.server.S05PacketSpawnPosition;
|
||||
+import net.minecraft.network.play.server.S09PacketHeldItemChange;
|
||||
+import net.minecraft.network.play.server.S0APacketUseBed;
|
||||
+import net.minecraft.network.play.server.S12PacketEntityVelocity;
|
||||
+import net.minecraft.network.play.server.S1BPacketEntityAttach;
|
||||
+import net.minecraft.network.play.server.S33PacketUpdateSign;
|
||||
+import net.minecraft.util.MathHelper;
|
||||
@ -104,7 +102,7 @@
|
||||
public class NetHandlerPlayServer implements INetHandlerPlayServer
|
||||
{
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
@@ -107,13 +168,12 @@
|
||||
@@ -107,13 +166,12 @@
|
||||
private long field_147379_i;
|
||||
private static Random field_147376_j = new Random();
|
||||
private long field_147377_k;
|
||||
@ -122,7 +120,7 @@
|
||||
private static final String __OBFID = "CL_00001452";
|
||||
|
||||
public NetHandlerPlayServer(MinecraftServer p_i1530_1_, NetworkManager p_i1530_2_, EntityPlayerMP p_i1530_3_)
|
||||
@@ -123,8 +183,41 @@
|
||||
@@ -123,8 +181,41 @@
|
||||
p_i1530_2_.setNetHandler(this);
|
||||
this.playerEntity = p_i1530_3_;
|
||||
p_i1530_3_.playerNetServerHandler = this;
|
||||
@ -164,7 +162,7 @@
|
||||
public void onNetworkTick()
|
||||
{
|
||||
this.field_147366_g = false;
|
||||
@@ -139,10 +232,16 @@
|
||||
@@ -139,10 +230,16 @@
|
||||
this.sendPacket(new S00PacketKeepAlive(this.field_147378_h));
|
||||
}
|
||||
|
||||
@ -181,7 +179,7 @@
|
||||
|
||||
if (this.field_147375_m > 0)
|
||||
{
|
||||
@@ -162,6 +261,24 @@
|
||||
@@ -162,6 +259,24 @@
|
||||
|
||||
public void kickPlayerFromServer(String p_147360_1_)
|
||||
{
|
||||
@ -206,7 +204,7 @@
|
||||
final ChatComponentText chatcomponenttext = new ChatComponentText(p_147360_1_);
|
||||
this.netManager.scheduleOutboundPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener[] {new GenericFutureListener()
|
||||
{
|
||||
@@ -170,8 +287,8 @@
|
||||
@@ -170,8 +285,8 @@
|
||||
{
|
||||
NetHandlerPlayServer.this.netManager.closeChannel(chatcomponenttext);
|
||||
}
|
||||
@ -217,7 +215,7 @@
|
||||
this.netManager.disableAutoRead();
|
||||
}
|
||||
|
||||
@@ -182,6 +299,15 @@
|
||||
@@ -182,6 +297,15 @@
|
||||
|
||||
public void processPlayer(C03PacketPlayer p_147347_1_)
|
||||
{
|
||||
@ -233,7 +231,7 @@
|
||||
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
|
||||
this.field_147366_g = true;
|
||||
|
||||
@@ -199,8 +325,79 @@
|
||||
@@ -199,8 +323,70 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,19 +240,10 @@
|
||||
+ Player player = this.getPlayerB();
|
||||
+ Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.
|
||||
+ Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
|
||||
+
|
||||
+ // KCauldron start
|
||||
+ if (this.playerEntity.isPlayerSleeping())
|
||||
{
|
||||
+ this.playerEntity.playerNetServerHandler.sendPacket(new S08PacketPlayerPosLook(playerEntity.posX, playerEntity.posY, playerEntity.posZ, playerEntity.rotationYaw, playerEntity.rotationPitch, false));
|
||||
+ this.playerEntity.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(player.getEntityId(), 0, 0, 0));
|
||||
+ return;
|
||||
+ }
|
||||
+ // KCauldron end
|
||||
+
|
||||
+ // If the packet contains movement information then we update the To location with the correct XYZ.
|
||||
+ if (p_147347_1_.field_149480_h && !(p_147347_1_.field_149480_h && p_147347_1_.field_149477_b == -999.0D && p_147347_1_.field_149475_d == -999.0D))
|
||||
+ {
|
||||
{
|
||||
+ to.setX(p_147347_1_.field_149479_a);
|
||||
+ to.setY(p_147347_1_.field_149477_b);
|
||||
+ to.setZ(p_147347_1_.field_149478_c);
|
||||
@ -314,23 +303,7 @@
|
||||
double d1;
|
||||
double d2;
|
||||
double d3;
|
||||
@@ -248,13 +445,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- if (this.playerEntity.isPlayerSleeping())
|
||||
+ /*if (this.playerEntity.isPlayerSleeping()) // KCauldron - moved up
|
||||
{
|
||||
this.playerEntity.onUpdateEntity();
|
||||
this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch);
|
||||
worldserver.updateEntity(this.playerEntity);
|
||||
return;
|
||||
- }
|
||||
+ }*/
|
||||
|
||||
d0 = this.playerEntity.posY;
|
||||
this.lastPosX = this.playerEntity.posX;
|
||||
@@ -280,13 +477,6 @@
|
||||
@@ -280,13 +466,6 @@
|
||||
d3 = p_147347_1_.func_149472_e();
|
||||
d4 = p_147347_1_.func_149471_f() - p_147347_1_.func_149467_d();
|
||||
|
||||
@ -344,7 +317,7 @@
|
||||
if (Math.abs(p_147347_1_.func_149464_c()) > 3.2E7D || Math.abs(p_147347_1_.func_149472_e()) > 3.2E7D)
|
||||
{
|
||||
this.kickPlayerFromServer("Illegal position");
|
||||
@@ -318,7 +508,7 @@
|
||||
@@ -318,7 +497,7 @@
|
||||
double d9 = Math.max(Math.abs(d6), Math.abs(this.playerEntity.motionZ));
|
||||
double d10 = d7 * d7 + d8 * d8 + d9 * d9;
|
||||
|
||||
@ -353,7 +326,7 @@
|
||||
{
|
||||
logger.warn(this.playerEntity.getCommandSenderName() + " moved too quickly! " + d4 + "," + d5 + "," + d6 + " (" + d7 + ", " + d8 + ", " + d9 + ")");
|
||||
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch);
|
||||
@@ -413,21 +603,85 @@
|
||||
@@ -413,21 +592,85 @@
|
||||
|
||||
public void setPlayerLocation(double p_147364_1_, double p_147364_3_, double p_147364_5_, float p_147364_7_, float p_147364_8_)
|
||||
{
|
||||
@ -444,7 +417,7 @@
|
||||
this.playerEntity.dropOneItem(false);
|
||||
}
|
||||
else if (p_147345_1_.func_149506_g() == 3)
|
||||
@@ -490,7 +744,17 @@
|
||||
@@ -490,7 +733,17 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -462,7 +435,7 @@
|
||||
}
|
||||
}
|
||||
else if (p_147345_1_.func_149506_g() == 2)
|
||||
@@ -517,6 +781,34 @@
|
||||
@@ -517,6 +770,34 @@
|
||||
public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement p_147346_1_)
|
||||
{
|
||||
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
|
||||
@ -497,7 +470,7 @@
|
||||
ItemStack itemstack = this.playerEntity.inventory.getCurrentItem();
|
||||
boolean flag = false;
|
||||
boolean placeResult = true;
|
||||
@@ -533,11 +825,21 @@
|
||||
@@ -533,11 +814,21 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@ -521,7 +494,7 @@
|
||||
}
|
||||
else if (p_147346_1_.func_149571_d() >= this.serverController.getBuildLimit() - 1 && (p_147346_1_.func_149568_f() == 1 || p_147346_1_.func_149571_d() >= this.serverController.getBuildLimit()))
|
||||
{
|
||||
@@ -548,17 +850,24 @@
|
||||
@@ -548,17 +839,24 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -554,7 +527,7 @@
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -615,7 +924,7 @@
|
||||
@@ -615,7 +913,7 @@
|
||||
this.playerEntity.openContainer.detectAndSendChanges();
|
||||
this.playerEntity.isChangingQuantityOnly = false;
|
||||
|
||||
@ -563,7 +536,7 @@
|
||||
{
|
||||
this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem()));
|
||||
}
|
||||
@@ -624,14 +933,34 @@
|
||||
@@ -624,14 +922,34 @@
|
||||
|
||||
public void onDisconnect(IChatComponent p_147231_1_)
|
||||
{
|
||||
@ -603,12 +576,12 @@
|
||||
if (this.serverController.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.serverController.getServerOwner()))
|
||||
{
|
||||
logger.info("Stopping singleplayer server as player logged out");
|
||||
@@ -657,6 +986,18 @@
|
||||
@@ -657,6 +975,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (p_147359_1_ == null || this.processedDisconnect) // KCauldron
|
||||
+ if (p_147359_1_ == null)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
@ -622,7 +595,7 @@
|
||||
try
|
||||
{
|
||||
this.netManager.scheduleOutboundPacket(p_147359_1_, new GenericFutureListener[0]);
|
||||
@@ -679,20 +1020,37 @@
|
||||
@@ -679,20 +1009,37 @@
|
||||
|
||||
public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_)
|
||||
{
|
||||
@ -661,7 +634,7 @@
|
||||
{
|
||||
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend", new Object[0]);
|
||||
chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
|
||||
@@ -708,51 +1066,385 @@
|
||||
@@ -708,51 +1055,385 @@
|
||||
{
|
||||
if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i)))
|
||||
{
|
||||
@ -1059,7 +1032,7 @@
|
||||
if (p_147357_1_.func_149513_d() == 1)
|
||||
{
|
||||
this.playerEntity.setSneaking(true);
|
||||
@@ -772,7 +1464,7 @@
|
||||
@@ -772,7 +1453,7 @@
|
||||
else if (p_147357_1_.func_149513_d() == 3)
|
||||
{
|
||||
this.playerEntity.wakeUpPlayer(false, true, true);
|
||||
@ -1068,7 +1041,7 @@
|
||||
}
|
||||
else if (p_147357_1_.func_149513_d() == 6)
|
||||
{
|
||||
@@ -789,8 +1481,20 @@
|
||||
@@ -789,8 +1470,20 @@
|
||||
|
||||
public void processUseEntity(C02PacketUseEntity p_147340_1_)
|
||||
{
|
||||
@ -1090,7 +1063,7 @@
|
||||
this.playerEntity.func_143004_u();
|
||||
|
||||
if (entity != null)
|
||||
@@ -805,9 +1509,53 @@
|
||||
@@ -805,9 +1498,53 @@
|
||||
|
||||
if (this.playerEntity.getDistanceSqToEntity(entity) < d0)
|
||||
{
|
||||
@ -1144,7 +1117,7 @@
|
||||
}
|
||||
else if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.ATTACK)
|
||||
{
|
||||
@@ -819,6 +1567,13 @@
|
||||
@@ -819,6 +1556,13 @@
|
||||
}
|
||||
|
||||
this.playerEntity.attackTargetEntityWithCurrentItem(entity);
|
||||
@ -1158,7 +1131,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -834,8 +1589,19 @@
|
||||
@@ -834,8 +1578,19 @@
|
||||
case 1:
|
||||
if (this.playerEntity.playerConqueredTheEnd)
|
||||
{
|
||||
@ -1179,7 +1152,7 @@
|
||||
else if (this.playerEntity.getServerForPlayer().getWorldInfo().isHardcoreModeEnabled())
|
||||
{
|
||||
if (this.serverController.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.serverController.getServerOwner()))
|
||||
@@ -871,17 +1637,461 @@
|
||||
@@ -871,17 +1626,461 @@
|
||||
|
||||
public void processCloseWindow(C0DPacketCloseWindow p_147356_1_)
|
||||
{
|
||||
@ -1642,7 +1615,7 @@
|
||||
if (ItemStack.areItemStacksEqual(p_147351_1_.func_149546_g(), itemstack))
|
||||
{
|
||||
this.playerEntity.playerNetServerHandler.sendPacket(new S32PacketConfirmTransaction(p_147351_1_.func_149548_c(), p_147351_1_.func_149547_f(), true));
|
||||
@@ -903,6 +2113,12 @@
|
||||
@@ -903,6 +2102,12 @@
|
||||
}
|
||||
|
||||
this.playerEntity.sendContainerAndContentsToPlayer(this.playerEntity.openContainer, arraylist);
|
||||
@ -1655,7 +1628,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -925,9 +2141,61 @@
|
||||
@@ -925,9 +2130,61 @@
|
||||
boolean flag = p_147344_1_.func_149627_c() < 0;
|
||||
ItemStack itemstack = p_147344_1_.func_149625_d();
|
||||
boolean flag1 = p_147344_1_.func_149627_c() >= 1 && p_147344_1_.func_149627_c() < 36 + InventoryPlayer.getHotbarSize();
|
||||
@ -1718,7 +1691,7 @@
|
||||
if (flag1 && flag2 && flag3)
|
||||
{
|
||||
if (itemstack == null)
|
||||
@@ -956,6 +2224,11 @@
|
||||
@@ -956,6 +2213,11 @@
|
||||
|
||||
public void processConfirmTransaction(C0FPacketConfirmTransaction p_147339_1_)
|
||||
{
|
||||
@ -1730,7 +1703,7 @@
|
||||
Short oshort = (Short)this.field_147372_n.lookup(this.playerEntity.openContainer.windowId);
|
||||
|
||||
if (oshort != null && p_147339_1_.func_149533_d() == oshort.shortValue() && this.playerEntity.openContainer.windowId == p_147339_1_.func_149532_c() && !this.playerEntity.openContainer.isPlayerNotUsingContainer(this.playerEntity))
|
||||
@@ -966,6 +2239,11 @@
|
||||
@@ -966,6 +2228,11 @@
|
||||
|
||||
public void processUpdateSign(C12PacketUpdateSign p_147343_1_)
|
||||
{
|
||||
@ -1742,7 +1715,7 @@
|
||||
this.playerEntity.func_143004_u();
|
||||
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
|
||||
|
||||
@@ -980,6 +2258,7 @@
|
||||
@@ -980,6 +2247,7 @@
|
||||
if (!tileentitysign.func_145914_a() || tileentitysign.func_145911_b() != this.playerEntity)
|
||||
{
|
||||
this.serverController.logWarning("Player " + this.playerEntity.getCommandSenderName() + " just tried to change non-editable sign");
|
||||
@ -1750,7 +1723,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -990,6 +2269,7 @@
|
||||
@@ -990,6 +2258,7 @@
|
||||
for (j = 0; j < 4; ++j)
|
||||
{
|
||||
boolean flag = true;
|
||||
@ -1758,7 +1731,7 @@
|
||||
|
||||
if (p_147343_1_.func_149589_f()[j].length() > 15)
|
||||
{
|
||||
@@ -1018,7 +2298,29 @@
|
||||
@@ -1018,7 +2287,29 @@
|
||||
int k = p_147343_1_.func_149586_d();
|
||||
i = p_147343_1_.func_149585_e();
|
||||
TileEntitySign tileentitysign1 = (TileEntitySign)tileentity;
|
||||
@ -1789,7 +1762,7 @@
|
||||
tileentitysign1.markDirty();
|
||||
worldserver.markBlockForUpdate(j, k, i);
|
||||
}
|
||||
@@ -1041,7 +2343,22 @@
|
||||
@@ -1041,7 +2332,22 @@
|
||||
|
||||
public void processPlayerAbilities(C13PacketPlayerAbilities p_147348_1_)
|
||||
{
|
||||
@ -1813,7 +1786,7 @@
|
||||
}
|
||||
|
||||
public void processTabComplete(C14PacketTabComplete p_147341_1_)
|
||||
@@ -1068,7 +2385,6 @@
|
||||
@@ -1068,7 +2374,6 @@
|
||||
PacketBuffer packetbuffer;
|
||||
ItemStack itemstack;
|
||||
ItemStack itemstack1;
|
||||
@ -1821,7 +1794,7 @@
|
||||
if ("MC|BEdit".equals(p_147349_1_.func_149559_c()))
|
||||
{
|
||||
packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(p_147349_1_.func_149558_e()));
|
||||
@@ -1093,16 +2409,18 @@
|
||||
@@ -1093,16 +2398,18 @@
|
||||
{
|
||||
if (itemstack.getItem() == Items.writable_book && itemstack.getItem() == itemstack1.getItem())
|
||||
{
|
||||
@ -1844,7 +1817,7 @@
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1135,19 +2453,18 @@
|
||||
@@ -1135,19 +2442,18 @@
|
||||
|
||||
if (itemstack.getItem() == Items.written_book && itemstack1.getItem() == Items.writable_book)
|
||||
{
|
||||
@ -1870,7 +1843,7 @@
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1174,9 +2491,12 @@
|
||||
@@ -1174,9 +2480,12 @@
|
||||
((ContainerMerchant)container).setCurrentRecipeIndex(i);
|
||||
}
|
||||
}
|
||||
@ -1884,7 +1857,7 @@
|
||||
}
|
||||
}
|
||||
else if ("MC|AdvCdm".equals(p_147349_1_.func_149559_c()))
|
||||
@@ -1222,9 +2542,12 @@
|
||||
@@ -1222,9 +2531,12 @@
|
||||
this.playerEntity.addChatMessage(new ChatComponentTranslation("advMode.setCommand.success", new Object[] {s1}));
|
||||
}
|
||||
}
|
||||
@ -1899,7 +1872,7 @@
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1257,9 +2580,12 @@
|
||||
@@ -1257,9 +2569,12 @@
|
||||
tileentitybeacon.markDirty();
|
||||
}
|
||||
}
|
||||
@ -1914,7 +1887,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1281,6 +2607,13 @@
|
||||
@@ -1281,6 +2596,13 @@
|
||||
containerrepair.updateItemName("");
|
||||
}
|
||||
}
|
||||
@ -1928,7 +1901,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1292,6 +2625,21 @@
|
||||
@@ -1292,6 +2614,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@
|
||||
packet.processPacket(this.netHandler);
|
||||
}
|
||||
|
||||
@@ -225,8 +257,11 @@
|
||||
@@ -225,6 +257,8 @@
|
||||
|
||||
public void closeChannel(IChatComponent p_150718_1_)
|
||||
{
|
||||
@ -85,11 +85,8 @@
|
||||
+
|
||||
if (this.channel.isOpen())
|
||||
{
|
||||
+ this.outboundPacketsQueue.clear(); // KCauldron
|
||||
this.channel.close();
|
||||
this.terminationReason = p_150718_1_;
|
||||
}
|
||||
@@ -254,7 +289,7 @@
|
||||
@@ -254,7 +288,7 @@
|
||||
{
|
||||
;
|
||||
}
|
||||
@ -98,7 +95,7 @@
|
||||
try
|
||||
{
|
||||
p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(false));
|
||||
@@ -322,6 +357,13 @@
|
||||
@@ -322,6 +356,13 @@
|
||||
return channel;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user