diff --git a/patches/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/net/minecraft/entity/player/EntityPlayer.java.patch index 279978c..74bc616 100644 --- a/patches/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/net/minecraft/entity/player/EntityPlayer.java.patch @@ -62,6 +62,24 @@ public int experienceLevel; public int experienceTotal; public float experience; +@@ -254,7 +281,7 @@ + --this.xpCooldown; + } + +- if (this.isPlayerSleeping()) ++ /*if (this.isPlayerSleeping()) KCauldron - moved into EntityPlayerMP + { + ++this.sleepTimer; + +@@ -283,7 +310,7 @@ + { + this.sleepTimer = 0; + } +- } ++ }*/ + + super.onUpdate(); + @@ -416,6 +443,42 @@ { this.updateItemUse(this.itemInUse, 16); @@ -485,6 +503,15 @@ if (p_70999_1_) { this.sleepTimer = 0; +@@ -1491,7 +1712,7 @@ + } + } + +- private boolean isInBed() ++ protected boolean isInBed() // KCauldron - private -> protected + { + return this.worldObj.getBlock(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ).isBed(worldObj, playerLocation.posX, playerLocation.posY, playerLocation.posZ, this); + } @@ -1606,11 +1827,13 @@ { this.spawnChunk = new ChunkCoordinates(p_71063_1_); diff --git a/patches/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/net/minecraft/entity/player/EntityPlayerMP.java.patch index 2f72840..505b884 100644 --- a/patches/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -190,7 +190,46 @@ iterator1.remove(); } } -@@ -309,9 +407,10 @@ +@@ -286,6 +384,38 @@ + } + } + } ++ // KCauldron start ++ if (this.isPlayerSleeping()) ++ { ++ ++this.sleepTimer; ++ ++ if (this.sleepTimer > 100) ++ { ++ this.sleepTimer = 100; ++ } ++ ++ if (!this.worldObj.isRemote) ++ { ++ if (!this.isInBed()) ++ { ++ this.wakeUpPlayer(true, true, false); ++ } ++ else if (this.worldObj.isDaytime()) ++ { ++ this.wakeUpPlayer(false, true, true); ++ } ++ } ++ } ++ else if (this.sleepTimer > 0) ++ { ++ ++this.sleepTimer; ++ ++ if (this.sleepTimer >= 110) ++ { ++ this.sleepTimer = 0; ++ } ++ } ++ // KCauldron end + } + + public void onUpdateEntity() +@@ -309,9 +439,10 @@ } } @@ -202,7 +241,7 @@ this.lastHealth = this.getHealth(); this.lastFoodLevel = this.foodStats.getFoodLevel(); this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F; -@@ -320,16 +419,18 @@ +@@ -320,16 +451,18 @@ if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO) { this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount(); @@ -228,7 +267,7 @@ if (this.experienceTotal != this.lastExperience) { this.lastExperience = this.experienceTotal; -@@ -340,6 +441,20 @@ +@@ -340,6 +473,20 @@ { this.func_147098_j(); } @@ -249,7 +288,7 @@ } catch (Throwable throwable) { -@@ -402,34 +517,74 @@ +@@ -402,34 +549,74 @@ public void onDeath(DamageSource p_70645_1_) { @@ -333,7 +372,7 @@ score.func_96648_a(); } -@@ -495,7 +650,8 @@ +@@ -495,7 +682,8 @@ public boolean canAttackPlayer(EntityPlayer p_96122_1_) { @@ -343,7 +382,7 @@ } public void travelToDimension(int p_71027_1_) -@@ -526,7 +682,10 @@ +@@ -526,7 +714,10 @@ this.triggerAchievement(AchievementList.portal); } @@ -355,7 +394,7 @@ this.lastExperience = -1; this.lastHealth = -1.0F; this.lastFoodLevel = -1; -@@ -569,6 +728,11 @@ +@@ -569,6 +760,11 @@ public void wakeUpPlayer(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { @@ -367,7 +406,7 @@ if (this.isPlayerSleeping()) { this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 2)); -@@ -584,11 +748,27 @@ +@@ -584,11 +780,27 @@ public void mountEntity(Entity p_70078_1_) { @@ -398,7 +437,7 @@ protected void updateFallState(double p_70064_1_, boolean p_70064_3_) {} public void handleFalling(double p_71122_1_, boolean p_71122_3_) -@@ -610,29 +790,64 @@ +@@ -610,29 +822,64 @@ this.currentWindowId = this.currentWindowId % 100 + 1; } @@ -466,7 +505,7 @@ this.openContainer.windowId = this.currentWindowId; this.openContainer.addCraftingToCrafters(this); } -@@ -644,71 +859,150 @@ +@@ -644,71 +891,150 @@ this.closeScreen(); } @@ -625,7 +664,7 @@ this.openContainer.windowId = this.currentWindowId; this.openContainer.addCraftingToCrafters(this); InventoryMerchant inventorymerchant = ((ContainerMerchant)this.openContainer).getMerchantInventory(); -@@ -725,7 +1019,7 @@ +@@ -725,7 +1051,7 @@ merchantrecipelist.func_151391_a(packetbuffer); this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer)); } @@ -634,7 +673,7 @@ { logger.error("Couldn\'t send trade list", ioexception); } -@@ -738,6 +1032,17 @@ +@@ -738,6 +1064,17 @@ public void displayGUIHorse(EntityHorse p_110298_1_, IInventory p_110298_2_) { @@ -652,7 +691,7 @@ if (this.openContainer != this.inventoryContainer) { this.closeScreen(); -@@ -745,7 +1050,7 @@ +@@ -745,7 +1082,7 @@ this.getNextWindowId(); this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 11, p_110298_2_.getInventoryName(), p_110298_2_.getSizeInventory(), p_110298_2_.hasCustomInventoryName(), p_110298_1_.getEntityId())); @@ -661,7 +700,7 @@ this.openContainer.windowId = this.currentWindowId; this.openContainer.addCraftingToCrafters(this); } -@@ -770,6 +1075,15 @@ +@@ -770,6 +1107,15 @@ { this.playerNetServerHandler.sendPacket(new S30PacketWindowItems(p_71110_1_.windowId, p_71110_2_)); this.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(-1, -1, this.inventory.getItemStack())); @@ -677,7 +716,7 @@ } public void sendProgressBarUpdate(Container p_71112_1_, int p_71112_2_, int p_71112_3_) -@@ -779,6 +1093,7 @@ +@@ -779,6 +1125,7 @@ public void closeScreen() { @@ -685,7 +724,7 @@ this.playerNetServerHandler.sendPacket(new S2EPacketCloseWindow(this.openContainer.windowId)); this.closeContainer(); } -@@ -853,8 +1168,19 @@ +@@ -853,8 +1200,19 @@ public void setPlayerHealthUpdated() { this.lastHealth = -1.0E8F; @@ -705,7 +744,7 @@ public void addChatComponentMessage(IChatComponent p_146105_1_) { this.playerNetServerHandler.sendPacket(new S02PacketChat(p_146105_1_)); -@@ -1037,6 +1363,114 @@ +@@ -1037,6 +1395,114 @@ return this.field_143005_bX; } diff --git a/patches/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/net/minecraft/network/NetHandlerPlayServer.java.patch index d5b5bdf..2e44db9 100644 --- a/patches/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -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,75 @@ +@@ -81,19 +84,77 @@ import net.minecraft.util.IChatComponent; import net.minecraft.util.IntHashMap; import net.minecraft.util.ReportedException; @@ -53,6 +53,8 @@ +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; @@ -102,7 +104,7 @@ public class NetHandlerPlayServer implements INetHandlerPlayServer { private static final Logger logger = LogManager.getLogger(); -@@ -107,13 +166,12 @@ +@@ -107,13 +168,12 @@ private long field_147379_i; private static Random field_147376_j = new Random(); private long field_147377_k; @@ -120,7 +122,7 @@ private static final String __OBFID = "CL_00001452"; public NetHandlerPlayServer(MinecraftServer p_i1530_1_, NetworkManager p_i1530_2_, EntityPlayerMP p_i1530_3_) -@@ -123,8 +181,41 @@ +@@ -123,8 +183,41 @@ p_i1530_2_.setNetHandler(this); this.playerEntity = p_i1530_3_; p_i1530_3_.playerNetServerHandler = this; @@ -162,7 +164,7 @@ public void onNetworkTick() { this.field_147366_g = false; -@@ -139,10 +230,16 @@ +@@ -139,10 +232,16 @@ this.sendPacket(new S00PacketKeepAlive(this.field_147378_h)); } @@ -179,7 +181,7 @@ if (this.field_147375_m > 0) { -@@ -162,6 +259,24 @@ +@@ -162,6 +261,24 @@ public void kickPlayerFromServer(String p_147360_1_) { @@ -204,7 +206,7 @@ final ChatComponentText chatcomponenttext = new ChatComponentText(p_147360_1_); this.netManager.scheduleOutboundPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener[] {new GenericFutureListener() { -@@ -170,8 +285,8 @@ +@@ -170,8 +287,8 @@ { NetHandlerPlayServer.this.netManager.closeChannel(chatcomponenttext); } @@ -215,7 +217,7 @@ this.netManager.disableAutoRead(); } -@@ -182,6 +297,15 @@ +@@ -182,6 +299,15 @@ public void processPlayer(C03PacketPlayer p_147347_1_) { @@ -231,7 +233,7 @@ WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); this.field_147366_g = true; -@@ -199,8 +323,70 @@ +@@ -199,8 +325,79 @@ } } @@ -240,10 +242,19 @@ + 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); @@ -303,7 +314,24 @@ double d1; double d2; double d3; -@@ -280,13 +466,6 @@ +@@ -248,13 +445,13 @@ + return; + } + +- if (this.playerEntity.isPlayerSleeping()) ++ /*if (this.playerEntity.isPlayerSleeping()) // KCauldron - moved up + { +- this.playerEntity.onUpdateEntity(); ++ 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 @@ d3 = p_147347_1_.func_149472_e(); d4 = p_147347_1_.func_149471_f() - p_147347_1_.func_149467_d(); @@ -317,7 +345,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 +497,7 @@ +@@ -318,7 +508,7 @@ double d9 = Math.max(Math.abs(d6), Math.abs(this.playerEntity.motionZ)); double d10 = d7 * d7 + d8 * d8 + d9 * d9; @@ -326,7 +354,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 +592,85 @@ +@@ -413,21 +603,85 @@ public void setPlayerLocation(double p_147364_1_, double p_147364_3_, double p_147364_5_, float p_147364_7_, float p_147364_8_) { @@ -417,7 +445,7 @@ this.playerEntity.dropOneItem(false); } else if (p_147345_1_.func_149506_g() == 3) -@@ -490,7 +733,17 @@ +@@ -490,7 +744,17 @@ } else { @@ -435,7 +463,7 @@ } } else if (p_147345_1_.func_149506_g() == 2) -@@ -517,6 +770,34 @@ +@@ -517,6 +781,34 @@ public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement p_147346_1_) { WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); @@ -470,7 +498,7 @@ ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); boolean flag = false; boolean placeResult = true; -@@ -533,11 +814,21 @@ +@@ -533,11 +825,21 @@ return; } @@ -494,7 +522,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 +839,24 @@ +@@ -548,17 +850,24 @@ } else { @@ -527,7 +555,7 @@ flag = true; } -@@ -615,7 +913,7 @@ +@@ -615,7 +924,7 @@ this.playerEntity.openContainer.detectAndSendChanges(); this.playerEntity.isChangingQuantityOnly = false; @@ -536,7 +564,7 @@ { this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); } -@@ -624,14 +922,34 @@ +@@ -624,14 +933,34 @@ public void onDisconnect(IChatComponent p_147231_1_) { @@ -576,7 +604,7 @@ if (this.serverController.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.serverController.getServerOwner())) { logger.info("Stopping singleplayer server as player logged out"); -@@ -657,6 +975,18 @@ +@@ -657,6 +986,18 @@ } } @@ -595,7 +623,7 @@ try { this.netManager.scheduleOutboundPacket(p_147359_1_, new GenericFutureListener[0]); -@@ -679,20 +1009,37 @@ +@@ -679,20 +1020,37 @@ public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_) { @@ -634,7 +662,7 @@ { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend", new Object[0]); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); -@@ -708,51 +1055,385 @@ +@@ -708,51 +1066,385 @@ { if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i))) { @@ -1032,7 +1060,7 @@ if (p_147357_1_.func_149513_d() == 1) { this.playerEntity.setSneaking(true); -@@ -772,7 +1453,7 @@ +@@ -772,7 +1464,7 @@ else if (p_147357_1_.func_149513_d() == 3) { this.playerEntity.wakeUpPlayer(false, true, true); @@ -1041,7 +1069,7 @@ } else if (p_147357_1_.func_149513_d() == 6) { -@@ -789,8 +1470,20 @@ +@@ -789,8 +1481,20 @@ public void processUseEntity(C02PacketUseEntity p_147340_1_) { @@ -1063,7 +1091,7 @@ this.playerEntity.func_143004_u(); if (entity != null) -@@ -805,9 +1498,53 @@ +@@ -805,9 +1509,53 @@ if (this.playerEntity.getDistanceSqToEntity(entity) < d0) { @@ -1117,7 +1145,7 @@ } else if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.ATTACK) { -@@ -819,6 +1556,13 @@ +@@ -819,6 +1567,13 @@ } this.playerEntity.attackTargetEntityWithCurrentItem(entity); @@ -1131,7 +1159,7 @@ } } } -@@ -834,8 +1578,19 @@ +@@ -834,8 +1589,19 @@ case 1: if (this.playerEntity.playerConqueredTheEnd) { @@ -1152,7 +1180,7 @@ else if (this.playerEntity.getServerForPlayer().getWorldInfo().isHardcoreModeEnabled()) { if (this.serverController.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.serverController.getServerOwner())) -@@ -871,17 +1626,461 @@ +@@ -871,17 +1637,461 @@ public void processCloseWindow(C0DPacketCloseWindow p_147356_1_) { @@ -1615,7 +1643,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 +2102,12 @@ +@@ -903,6 +2113,12 @@ } this.playerEntity.sendContainerAndContentsToPlayer(this.playerEntity.openContainer, arraylist); @@ -1628,7 +1656,7 @@ } } } -@@ -925,9 +2130,61 @@ +@@ -925,9 +2141,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(); @@ -1691,7 +1719,7 @@ if (flag1 && flag2 && flag3) { if (itemstack == null) -@@ -956,6 +2213,11 @@ +@@ -956,6 +2224,11 @@ public void processConfirmTransaction(C0FPacketConfirmTransaction p_147339_1_) { @@ -1703,7 +1731,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 +2228,11 @@ +@@ -966,6 +2239,11 @@ public void processUpdateSign(C12PacketUpdateSign p_147343_1_) { @@ -1715,7 +1743,7 @@ this.playerEntity.func_143004_u(); WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); -@@ -980,6 +2247,7 @@ +@@ -980,6 +2258,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"); @@ -1723,7 +1751,7 @@ return; } } -@@ -990,6 +2258,7 @@ +@@ -990,6 +2269,7 @@ for (j = 0; j < 4; ++j) { boolean flag = true; @@ -1731,7 +1759,7 @@ if (p_147343_1_.func_149589_f()[j].length() > 15) { -@@ -1018,7 +2287,29 @@ +@@ -1018,7 +2298,29 @@ int k = p_147343_1_.func_149586_d(); i = p_147343_1_.func_149585_e(); TileEntitySign tileentitysign1 = (TileEntitySign)tileentity; @@ -1762,7 +1790,7 @@ tileentitysign1.markDirty(); worldserver.markBlockForUpdate(j, k, i); } -@@ -1041,7 +2332,22 @@ +@@ -1041,7 +2343,22 @@ public void processPlayerAbilities(C13PacketPlayerAbilities p_147348_1_) { @@ -1786,7 +1814,7 @@ } public void processTabComplete(C14PacketTabComplete p_147341_1_) -@@ -1068,7 +2374,6 @@ +@@ -1068,7 +2385,6 @@ PacketBuffer packetbuffer; ItemStack itemstack; ItemStack itemstack1; @@ -1794,7 +1822,7 @@ if ("MC|BEdit".equals(p_147349_1_.func_149559_c())) { packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(p_147349_1_.func_149558_e())); -@@ -1093,16 +2398,18 @@ +@@ -1093,16 +2409,18 @@ if (itemstack.getItem() == Items.writable_book && itemstack.getItem() == itemstack1.getItem()) { @@ -1817,7 +1845,7 @@ } finally { -@@ -1135,19 +2442,18 @@ +@@ -1135,19 +2453,18 @@ { if (itemstack.getItem() == Items.written_book && itemstack1.getItem() == Items.writable_book) { @@ -1843,7 +1871,7 @@ } finally { -@@ -1174,9 +2480,12 @@ +@@ -1174,9 +2491,12 @@ ((ContainerMerchant)container).setCurrentRecipeIndex(i); } } @@ -1857,7 +1885,7 @@ } } else if ("MC|AdvCdm".equals(p_147349_1_.func_149559_c())) -@@ -1222,9 +2531,12 @@ +@@ -1222,9 +2542,12 @@ this.playerEntity.addChatMessage(new ChatComponentTranslation("advMode.setCommand.success", new Object[] {s1})); } } @@ -1872,7 +1900,7 @@ } finally { -@@ -1257,9 +2569,12 @@ +@@ -1257,9 +2580,12 @@ tileentitybeacon.markDirty(); } } @@ -1887,7 +1915,7 @@ } } } -@@ -1281,6 +2596,13 @@ +@@ -1281,6 +2607,13 @@ containerrepair.updateItemName(""); } } @@ -1901,7 +1929,7 @@ } } -@@ -1292,6 +2614,21 @@ +@@ -1292,6 +2625,21 @@ } } diff --git a/patches/net/minecraft/server/MinecraftServer.java.patch b/patches/net/minecraft/server/MinecraftServer.java.patch index aea23c9..7bd29f2 100644 --- a/patches/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/net/minecraft/server/MinecraftServer.java.patch @@ -663,7 +663,7 @@ int i; Integer[] ids = DimensionManager.getIDs(this.tickCounter % 200 == 0); -@@ -602,19 +905,21 @@ +@@ -602,19 +905,22 @@ int id = ids[x]; long j = System.nanoTime(); @@ -673,6 +673,7 @@ + //if (id == 0 || this.getAllowNether()) + //{ WorldServer worldserver = DimensionManager.getWorld(id); ++ worldserver.timings.fullTick.startTiming(); // KCauldron this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); this.theProfiler.startSection("pools"); this.theProfiler.endSection(); @@ -688,7 +689,7 @@ this.theProfiler.startSection("tick"); FMLCommonHandler.instance().onPreWorldTick(worldserver); -@@ -622,22 +927,46 @@ +@@ -622,22 +928,46 @@ try { @@ -737,7 +738,7 @@ worldserver.addWorldInfoToCrashReport(crashreport); throw new ReportedException(crashreport); } -@@ -645,10 +974,12 @@ +@@ -645,10 +975,13 @@ FMLCommonHandler.instance().onPostWorldTick(worldserver); this.theProfiler.endSection(); this.theProfiler.startSection("tracker"); @@ -747,11 +748,12 @@ this.theProfiler.endSection(); this.theProfiler.endSection(); - } ++ worldserver.timings.fullTick.stopTiming(); // KCauldron + // } // CraftBukkit worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - j; } -@@ -656,15 +987,21 @@ +@@ -656,15 +989,21 @@ this.theProfiler.endStartSection("dim_unloading"); DimensionManager.unloadWorlds(worldTickTimes); this.theProfiler.endStartSection("connection"); @@ -773,7 +775,7 @@ this.theProfiler.endSection(); } -@@ -699,6 +1036,13 @@ +@@ -699,6 +1038,13 @@ public WorldServer worldServerForDimension(int p_71218_1_) { @@ -787,7 +789,7 @@ WorldServer ret = DimensionManager.getWorld(p_71218_1_); if (ret == null) { -@@ -784,13 +1128,14 @@ +@@ -784,13 +1130,14 @@ public List getPossibleCompletions(ICommandSender p_71248_1_, String p_71248_2_) { @@ -806,7 +808,7 @@ if (list != null) { -@@ -798,40 +1143,25 @@ +@@ -798,40 +1145,25 @@ while (iterator.hasNext()) { @@ -855,7 +857,7 @@ } public static MinecraftServer getServer() -@@ -1034,7 +1364,7 @@ +@@ -1034,7 +1366,7 @@ public boolean isServerInOnlineMode() { @@ -864,7 +866,7 @@ } public void setOnlineMode(boolean p_71229_1_) -@@ -1124,7 +1454,7 @@ +@@ -1124,7 +1456,7 @@ public NetworkSystem func_147137_ag() { @@ -873,7 +875,7 @@ } @SideOnly(Side.CLIENT) -@@ -1259,8 +1589,11 @@ +@@ -1259,8 +1591,11 @@ { Bootstrap.func_151354_b(); @@ -885,7 +887,7 @@ boolean flag = true; String s = null; String s1 = "."; -@@ -1356,16 +1689,34 @@ +@@ -1356,16 +1691,34 @@ { dedicatedserver.setGuiEnabled(); } @@ -926,7 +928,7 @@ } catch (Exception exception) { -@@ -1400,15 +1751,70 @@ +@@ -1400,15 +1753,70 @@ @SideOnly(Side.SERVER) public String getPlugins() { @@ -1002,7 +1004,7 @@ } @SideOnly(Side.SERVER) -@@ -1455,9 +1861,213 @@ +@@ -1455,9 +1863,213 @@ return this.serverStopped; } diff --git a/patches/net/minecraft/world/World.java.patch b/patches/net/minecraft/world/World.java.patch index 3c54ae6..8b858d4 100644 --- a/patches/net/minecraft/world/World.java.patch +++ b/patches/net/minecraft/world/World.java.patch @@ -1166,7 +1166,17 @@ } public boolean func_147469_q(int p_147469_1_, int p_147469_2_, int p_147469_3_) -@@ -2718,7 +3258,15 @@ +@@ -2666,7 +3206,9 @@ + + public void tick() + { ++ timings.weatherUpdate.startTiming(); // KCauldron + this.updateWeather(); ++ timings.weatherUpdate.stopTiming(); // KCauldron + } + + private void calculateInitialWeather() +@@ -2718,7 +3260,15 @@ if (i <= 0) { @@ -1183,7 +1193,7 @@ } } -@@ -2754,7 +3302,15 @@ +@@ -2754,7 +3304,15 @@ if (j <= 0) { @@ -1200,7 +1210,7 @@ } } -@@ -2777,8 +3333,41 @@ +@@ -2777,8 +3335,41 @@ protected void setActivePlayerChunksAndCheckLight() { this.activeChunkSet.clear(); @@ -1243,7 +1253,7 @@ int i; EntityPlayer entityplayer; int j; -@@ -2788,17 +3377,28 @@ +@@ -2788,17 +3379,28 @@ for (i = 0; i < this.playerEntities.size(); ++i) { entityplayer = (EntityPlayer)this.playerEntities.get(i); @@ -1278,7 +1288,7 @@ } this.theProfiler.endSection(); -@@ -2810,7 +3410,7 @@ +@@ -2810,7 +3412,7 @@ this.theProfiler.startSection("playerCheckLight"); @@ -1287,7 +1297,7 @@ { i = this.rand.nextInt(this.playerEntities.size()); entityplayer = (EntityPlayer)this.playerEntities.get(i); -@@ -3280,12 +3880,23 @@ +@@ -3280,12 +3882,23 @@ { int i = 0; @@ -1314,7 +1324,7 @@ ++i; } } -@@ -3298,9 +3909,10 @@ +@@ -3298,9 +3911,10 @@ for (int i = 0; i < p_72868_1_.size(); ++i) { Entity entity = (Entity)p_72868_1_.get(i); @@ -1326,7 +1336,7 @@ this.onEntityAdded(entity); } } -@@ -3308,14 +3920,25 @@ +@@ -3308,14 +3922,25 @@ public void unloadEntities(List p_72828_1_) { @@ -1354,7 +1364,7 @@ } public PathEntity getPathEntityToEntity(Entity p_72865_1_, Entity p_72865_2_, float p_72865_3_, boolean p_72865_4_, boolean p_72865_5_, boolean p_72865_6_, boolean p_72865_7_) -@@ -3464,6 +4087,12 @@ +@@ -3464,6 +4089,12 @@ for (int i = 0; i < this.playerEntities.size(); ++i) { EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i); @@ -1367,7 +1377,7 @@ double d5 = entityplayer1.getDistanceSq(p_72977_1_, p_72977_3_, p_72977_5_); if ((p_72977_7_ < 0.0D || d5 < p_72977_7_ * p_72977_7_) && (d4 == -1.0D || d5 < d4)) -@@ -3489,7 +4118,12 @@ +@@ -3489,7 +4120,12 @@ for (int i = 0; i < this.playerEntities.size(); ++i) { EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i); @@ -1381,7 +1391,7 @@ if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive()) { double d5 = entityplayer1.getDistanceSq(p_72846_1_, p_72846_3_, p_72846_5_); -@@ -3612,11 +4246,11 @@ +@@ -3612,11 +4248,11 @@ } } @@ -1395,7 +1405,7 @@ } } } -@@ -3660,6 +4294,18 @@ +@@ -3660,6 +4296,18 @@ public void updateAllPlayersSleepingFlag() {} @@ -1414,7 +1424,7 @@ public float getWeightedThunderStrength(float p_72819_1_) { return (this.prevThunderingStrength + (this.thunderingStrength - this.prevThunderingStrength) * p_72819_1_) * this.getRainStrength(p_72819_1_); -@@ -3932,8 +4578,8 @@ +@@ -3932,8 +4580,8 @@ */ public void addTileEntity(TileEntity entity) { @@ -1425,7 +1435,7 @@ { dest.add(entity); } -@@ -4020,13 +4666,82 @@ +@@ -4020,13 +4668,82 @@ public int countEntities(EnumCreatureType type, boolean forSpawnCount) { int count = 0; diff --git a/patches/net/minecraft/world/WorldServer.java.patch b/patches/net/minecraft/world/WorldServer.java.patch index eee985e..03e1d75 100644 --- a/patches/net/minecraft/world/WorldServer.java.patch +++ b/patches/net/minecraft/world/WorldServer.java.patch @@ -150,7 +150,17 @@ public void tick() { super.tick(); -@@ -155,12 +245,19 @@ +@@ -141,7 +231,9 @@ + this.difficultySetting = EnumDifficulty.HARD; + } + ++ timings.cleanupCache.startTiming(); // KCauldron + this.provider.worldChunkMgr.cleanupCache(); ++ timings.cleanupCache.stopTiming(); // KCauldron + + if (this.areAllPlayersAsleep()) + { +@@ -155,12 +247,19 @@ } this.theProfiler.startSection("mobSpawner"); @@ -173,7 +183,7 @@ this.theProfiler.endStartSection("chunkSource"); this.chunkProvider.unloadQueuedChunks(); int j = this.calculateSkylightSubtracted(1.0F); -@@ -170,30 +267,47 @@ +@@ -170,30 +269,47 @@ this.skylightSubtracted = j; } @@ -189,7 +199,7 @@ this.theProfiler.endStartSection("tickPending"); + timings.doTickPending.startTiming(); // Spigot this.tickUpdates(false); -+ timings.doChunkUnload.stopTiming(); // Spigot ++ timings.doTickPending.stopTiming(); // Spigot this.theProfiler.endStartSection("tickBlocks"); + timings.doTickTiles.startTiming(); // Spigot this.func_147456_g(); @@ -222,7 +232,7 @@ } public BiomeGenBase.SpawnListEntry spawnRandomCreature(EnumCreatureType p_73057_1_, int p_73057_2_, int p_73057_3_, int p_73057_4_) -@@ -212,7 +326,7 @@ +@@ -212,7 +328,7 @@ { EntityPlayer entityplayer = (EntityPlayer)iterator.next(); @@ -231,7 +241,7 @@ { this.allPlayersSleeping = false; break; -@@ -240,7 +354,25 @@ +@@ -240,7 +356,25 @@ private void resetRainAndThunder() { @@ -258,7 +268,7 @@ } public boolean areAllPlayersAsleep() -@@ -248,19 +380,26 @@ +@@ -248,19 +382,26 @@ if (this.allPlayersSleeping && !this.isRemote) { Iterator iterator = this.playerEntities.iterator(); @@ -288,7 +298,7 @@ return false; } else -@@ -302,15 +441,29 @@ +@@ -302,15 +443,29 @@ super.func_147456_g(); int i = 0; int j = 0; @@ -324,7 +334,7 @@ this.func_147467_a(k, l, chunk); this.theProfiler.endStartSection("tickChunk"); chunk.func_150804_b(false); -@@ -346,12 +499,32 @@ +@@ -346,12 +501,32 @@ if (this.isBlockFreezableNaturally(j1 + k, l1 - 1, k1 + l)) { @@ -359,7 +369,7 @@ } if (this.isRaining()) -@@ -388,6 +561,7 @@ +@@ -388,6 +563,7 @@ if (block.getTickRandomly()) { ++i; @@ -367,7 +377,7 @@ block.updateTick(this, j2 + k, l2 + extendedblockstorage.getYLocation(), k2 + l, this.rand); } } -@@ -396,6 +570,13 @@ +@@ -396,6 +572,13 @@ this.theProfiler.endSection(); } @@ -381,7 +391,7 @@ } public boolean isBlockTickScheduledThisTick(int p_147477_1_, int p_147477_2_, int p_147477_3_, Block p_147477_4_) -@@ -474,7 +655,7 @@ +@@ -474,7 +657,7 @@ public void updateEntities() { @@ -390,7 +400,7 @@ { if (this.updateEntityTick++ >= 1200) { -@@ -506,7 +687,16 @@ +@@ -506,7 +689,16 @@ { if (i > 1000) { @@ -408,7 +418,7 @@ } this.theProfiler.startSection("cleaning"); -@@ -651,7 +841,37 @@ +@@ -651,7 +843,37 @@ protected IChunkProvider createChunkProvider() { IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider); @@ -447,7 +457,7 @@ return this.theChunkProviderServer; } -@@ -659,29 +879,31 @@ +@@ -659,29 +881,31 @@ { ArrayList arraylist = new ArrayList(); @@ -494,7 +504,7 @@ return arraylist; } -@@ -733,7 +955,28 @@ +@@ -733,7 +957,28 @@ int i = 0; int j = this.provider.getAverageGroundLevel(); int k = 0; @@ -523,7 +533,7 @@ if (chunkposition != null) { i = chunkposition.chunkPosX; -@@ -876,6 +1119,20 @@ +@@ -876,6 +1121,20 @@ public boolean addWeatherEffect(Entity p_72942_1_) { @@ -544,7 +554,7 @@ if (super.addWeatherEffect(p_72942_1_)) { this.mcServer.getConfigurationManager().sendToAllNear(p_72942_1_.posX, p_72942_1_.posY, p_72942_1_.posZ, 512.0D, this.provider.dimensionId, new S2CPacketSpawnGlobalEntity(p_72942_1_)); -@@ -894,13 +1151,23 @@ +@@ -894,13 +1153,23 @@ public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { @@ -569,7 +579,7 @@ if (!p_72885_10_) { explosion.affectedBlockPositions.clear(); -@@ -977,7 +1244,7 @@ +@@ -977,7 +1246,7 @@ { boolean flag = this.isRaining(); super.updateWeather(); @@ -578,7 +588,7 @@ if (this.prevRainingStrength != this.rainingStrength) { this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); -@@ -988,10 +1255,6 @@ +@@ -988,10 +1257,6 @@ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); } @@ -589,7 +599,7 @@ if (flag != this.isRaining()) { if (flag) -@@ -1006,6 +1269,33 @@ +@@ -1006,6 +1271,33 @@ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); } @@ -623,7 +633,7 @@ } protected int func_152379_p() -@@ -1069,4 +1359,51 @@ +@@ -1069,4 +1361,51 @@ this(); } } diff --git a/src/main/java/kcauldron/KCauldronCommand.java b/src/main/java/kcauldron/KCauldronCommand.java index 698360c..0c5fd6a 100644 --- a/src/main/java/kcauldron/KCauldronCommand.java +++ b/src/main/java/kcauldron/KCauldronCommand.java @@ -12,6 +12,7 @@ import kcauldron.updater.KCauldronUpdater; import kcauldron.updater.KVersionRetriever; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; +import net.minecraft.world.WorldServer; import net.minecraftforge.server.command.ForgeCommand; public class KCauldronCommand extends Command { @@ -92,8 +93,8 @@ public class KCauldronCommand extends Command { double worldTPS = Math.min(1000.0 / worldTickTime, 20); sender.sendMessage(String.format("%s[%d] %s%s %s- %s%.2fms / %.2ftps", ChatColor.GOLD, dimensionId, - current ? ChatColor.GREEN : ChatColor.YELLOW, displayName, ChatColor.RESET, ChatColor.DARK_RED, worldTickTime, - worldTPS)); + current ? ChatColor.GREEN : ChatColor.YELLOW, displayName, ChatColor.RESET, ChatColor.DARK_RED, worldTickTime, + worldTPS)); } } double meanTickTime = mean(server.tickTimeArray) * 1.0E-6D; diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java index dd32404..2c978ed 100644 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java +++ b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java @@ -136,6 +136,9 @@ public class SpigotTimings { public final CustomTimingsHandler tracker; public final CustomTimingsHandler doTick; public final CustomTimingsHandler tickEntities; + public final CustomTimingsHandler weatherUpdate; + public final CustomTimingsHandler cleanupCache; + public final CustomTimingsHandler fullTick; public final CustomTimingsHandler syncChunkLoadTimer; public final CustomTimingsHandler syncChunkLoadDataTimer; @@ -173,6 +176,9 @@ public class SpigotTimings { tracker = new CustomTimingsHandler(name + "tracker"); doTick = new CustomTimingsHandler(name + "doTick"); tickEntities = new CustomTimingsHandler(name + "tickEntities"); + weatherUpdate = new CustomTimingsHandler(name + "weatherUpdate"); + cleanupCache = new CustomTimingsHandler(name + "cleanupCache"); + fullTick = new CustomTimingsHandler(name + "fullTick"); } } } \ No newline at end of file