Paper/Spigot-Server-Patches/0023-Optimize-TileEntity-Ti...

249 lines
12 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2018-07-22 23:39:56 +00:00
From: Aikar <aikar@aikar.co>
Date: Sun, 8 Mar 2015 22:55:25 -0600
Subject: [PATCH] Optimize TileEntity Ticking
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
index d4ebcf8f66197299256bd6b65710a1488c90ea41..c9164dfdb27ddf3709129c8aec54903a1df121ff 100644
--- a/src/main/java/co/aikar/timings/TimingsExport.java
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -109,7 +109,7 @@ public class TimingsExport extends Thread {
pair("end", System.currentTimeMillis() / 1000),
pair("online-mode", Bukkit.getServer().getOnlineMode()),
pair("sampletime", (System.currentTimeMillis() - TimingsManager.timingStart) / 1000),
- pair("datapacks", toArrayMapper(MinecraftServer.getServer().getResourcePackRepository().d(), pack -> {
+ pair("datapacks", toArrayMapper(MinecraftServer.getServer().getResourcePackRepository().e(), pack -> {
// Don't feel like obf helper'ing these, non fatal if its temp missed.
return ChatColor.stripColor(CraftChatMessage.fromComponent(pack.a(true)));
}))
@@ -148,8 +148,8 @@ public class TimingsExport extends Thread {
);
parent.put("worlds", toObjectMapper(MinecraftServer.getServer().getWorlds(), world -> {
- if (world.getWorldData().getName().equals("worldeditregentempworld")) return null;
- return pair(world.getWorldData().getName(), createObject(
+ if (world.getWorld().getName().equals("worldeditregentempworld")) return null;
+ return pair(world.getWorld().getName(), createObject(
pair("gamerules", toObjectMapper(world.getWorld().getGameRules(), rule -> {
return pair(rule, world.getWorld().getGameRuleValue(rule));
})),
diff --git a/src/main/java/net/minecraft/world/level/block/BlockChest.java b/src/main/java/net/minecraft/world/level/block/BlockChest.java
index 60e7dc1910ae9214d84d65b011cfec278b6b32ae..b229faad99120c67b089f7680d800fbe594fe7da 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockChest.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockChest.java
@@ -54,8 +54,8 @@ import net.minecraft.world.phys.shapes.VoxelShapeCollision;
public class BlockChest extends BlockChestAbstract<TileEntityChest> implements IBlockWaterlogged {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
- public static final BlockStateEnum<BlockPropertyChestType> c = BlockProperties.aF;
- public static final BlockStateBoolean d = BlockProperties.C;
+ public static final BlockStateEnum<BlockPropertyChestType> c = BlockProperties.aF; public static final BlockStateEnum<BlockPropertyChestType> CHEST_TYPE_PROPERTY = c; // Paper - OBFHELPER
+ public static final BlockStateBoolean d = BlockProperties.C; public static final BlockStateBoolean waterlogged() { return d; } // Paper OBFHELPER
protected static final VoxelShape e = Block.a(1.0D, 0.0D, 0.0D, 15.0D, 14.0D, 15.0D);
protected static final VoxelShape f = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 16.0D);
protected static final VoxelShape g = Block.a(0.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
2021-03-16 15:50:45 +00:00
index eed95b370d1d624ffc6b7a35357b7028ec58c584..51167d776c710decb0107bebcb35bdf43103772b 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
2021-03-16 15:50:45 +00:00
@@ -8,6 +8,7 @@ import net.minecraft.core.NonNullList;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.network.chat.IChatBaseComponent;
+import net.minecraft.server.MCUtil;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffect;
import net.minecraft.sounds.SoundEffects;
@@ -33,7 +34,7 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity;
// CraftBukkit end
-public class TileEntityChest extends TileEntityLootable implements ITickable {
+public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITickable
private NonNullList<ItemStack> items;
protected float a;
2021-03-16 15:50:45 +00:00
@@ -111,14 +112,20 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
2019-04-24 01:00:24 +00:00
return nbttagcompound;
}
- @Override
public void tick() {
int i = this.position.getX();
int j = this.position.getY();
int k = this.position.getZ();
2019-04-24 01:00:24 +00:00
++this.j;
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#2415) * fixup patch and rebuild * Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: bde198c9 SPIGOT-5246: PlayerQuitEvent.get/setQuitMessage() is incorrectly marked as NotNull 24ad5a79 SPIGOT-5240: Vector.angle not valid for angles very close to each other a143db9a SPIGOT-5231: ShotAtAngle API for Fireworks 10db5c3d SPIGOT-5226: Update Javadoc of PlayerDeathEvent CraftBukkit Changes: 1ec1b05e SPIGOT-5245: Unneeded cast to WorldNBTStorage in CraftWorld#getWorldFolder e5e8eec2 SPIGOT-5241: setAttributeModifiers does not work on untouched stack 803eaa31 SPIGOT-5231: ShotAtAngle API for Fireworks 7881d2ae SPIGOT-5237: Horses, pigs do not drop their inventory 06efc9ec Don't accept connections until all plugins have enabled da62a66a SPIGOT-5225: World handle isn't closed if world is unloaded without saving 104b3831 SPIGOT-5222: Cannot get Long values from Entity memory f0b3fe43 SPIGOT-5220: Server CPU usage reaches 100% when stdin is null Spigot Changes: e5b1b5db SPIGOT-5235: Destroy expired area effect clouds / fireworks that are inactive cbcc8e87 Make region files more reliable to write to 8887c5f4 Remove redundant late-bind option dac29063 Rebuild patches * Preserve old flush on save flag for reliable regionfiles Originally this patch was in paper * Fix some issues with the death event - Entities potentially entering a glitched state to the client where they appear to be falling over - Donkeys losing their chest if the event was cancelled (only an issue since the upstream merge) - Some wither death logic running for an entity killed by a wither
2019-08-05 16:35:40 +00:00
- this.viewingCount = a(this.world, this, this.j, i, j, k, this.viewingCount);
+ }
2019-04-24 01:00:24 +00:00
+
+ public void doOpenLogic() {
+ int i = this.position.getX();
+ int j = this.position.getY();
+ int k = this.position.getZ();
2019-04-24 01:00:24 +00:00
+
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#2415) * fixup patch and rebuild * Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: bde198c9 SPIGOT-5246: PlayerQuitEvent.get/setQuitMessage() is incorrectly marked as NotNull 24ad5a79 SPIGOT-5240: Vector.angle not valid for angles very close to each other a143db9a SPIGOT-5231: ShotAtAngle API for Fireworks 10db5c3d SPIGOT-5226: Update Javadoc of PlayerDeathEvent CraftBukkit Changes: 1ec1b05e SPIGOT-5245: Unneeded cast to WorldNBTStorage in CraftWorld#getWorldFolder e5e8eec2 SPIGOT-5241: setAttributeModifiers does not work on untouched stack 803eaa31 SPIGOT-5231: ShotAtAngle API for Fireworks 7881d2ae SPIGOT-5237: Horses, pigs do not drop their inventory 06efc9ec Don't accept connections until all plugins have enabled da62a66a SPIGOT-5225: World handle isn't closed if world is unloaded without saving 104b3831 SPIGOT-5222: Cannot get Long values from Entity memory f0b3fe43 SPIGOT-5220: Server CPU usage reaches 100% when stdin is null Spigot Changes: e5b1b5db SPIGOT-5235: Destroy expired area effect clouds / fireworks that are inactive cbcc8e87 Make region files more reliable to write to 8887c5f4 Remove redundant late-bind option dac29063 Rebuild patches * Preserve old flush on save flag for reliable regionfiles Originally this patch was in paper * Fix some issues with the death event - Entities potentially entering a glitched state to the client where they appear to be falling over - Donkeys losing their chest if the event was cancelled (only an issue since the upstream merge) - Some wither death logic running for an entity killed by a wither
2019-08-05 16:35:40 +00:00
+ //this.viewingCount = a(this.world, this, this.j, i, j, k, this.viewingCount); // Paper - check is faulty given our logic is called before active container set
2019-04-24 01:00:24 +00:00
this.b = this.a;
float f = 0.1F;
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#2415) * fixup patch and rebuild * Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: bde198c9 SPIGOT-5246: PlayerQuitEvent.get/setQuitMessage() is incorrectly marked as NotNull 24ad5a79 SPIGOT-5240: Vector.angle not valid for angles very close to each other a143db9a SPIGOT-5231: ShotAtAngle API for Fireworks 10db5c3d SPIGOT-5226: Update Javadoc of PlayerDeathEvent CraftBukkit Changes: 1ec1b05e SPIGOT-5245: Unneeded cast to WorldNBTStorage in CraftWorld#getWorldFolder e5e8eec2 SPIGOT-5241: setAttributeModifiers does not work on untouched stack 803eaa31 SPIGOT-5231: ShotAtAngle API for Fireworks 7881d2ae SPIGOT-5237: Horses, pigs do not drop their inventory 06efc9ec Don't accept connections until all plugins have enabled da62a66a SPIGOT-5225: World handle isn't closed if world is unloaded without saving 104b3831 SPIGOT-5222: Cannot get Long values from Entity memory f0b3fe43 SPIGOT-5220: Server CPU usage reaches 100% when stdin is null Spigot Changes: e5b1b5db SPIGOT-5235: Destroy expired area effect clouds / fireworks that are inactive cbcc8e87 Make region files more reliable to write to 8887c5f4 Remove redundant late-bind option dac29063 Rebuild patches * Preserve old flush on save flag for reliable regionfiles Originally this patch was in paper * Fix some issues with the death event - Entities potentially entering a glitched state to the client where they appear to be falling over - Donkeys losing their chest if the event was cancelled (only an issue since the upstream merge) - Some wither death logic running for an entity killed by a wither
2019-08-05 16:35:40 +00:00
2021-03-16 15:50:45 +00:00
@@ -132,8 +139,11 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
2019-04-24 01:00:24 +00:00
if (this.viewingCount > 0 && this.a == 0.0F) {
this.playOpenSound(SoundEffects.BLOCK_CHEST_OPEN);
}
+ }
2019-04-24 01:00:24 +00:00
- if (this.viewingCount == 0 && this.a > 0.0F || this.viewingCount > 0 && this.a < 1.0F) {
+ public void doCloseLogic() {
+ if (this.viewingCount == 0 /* && this.a > 0.0F || this.viewingCount > 0 && this.a < 1.0F */) { // Paper - disable all but player count check
+ /* // Paper - disable animation stuff
float f1 = this.a;
2018-07-22 23:39:56 +00:00
2019-04-24 01:00:24 +00:00
if (this.viewingCount > 0) {
2021-03-16 15:50:45 +00:00
@@ -149,8 +159,11 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
2018-07-22 23:39:56 +00:00
float f2 = 0.5F;
if (this.a < 0.5F && f1 >= 0.5F) {
+ */
2019-04-24 01:00:24 +00:00
+ MCUtil.scheduleTask(10, () -> {
this.playOpenSound(SoundEffects.BLOCK_CHEST_CLOSE);
- }
+ }, "Chest Sounds");
2019-04-24 01:00:24 +00:00
+ //} // Paper end
2018-07-22 23:39:56 +00:00
if (this.a < 0.0F) {
this.a = 0.0F;
2021-03-16 15:50:45 +00:00
@@ -189,6 +202,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
}
public void playOpenSound(SoundEffect soundeffect) {
+ if (!this.getBlock().contains(BlockChest.CHEST_TYPE_PROPERTY)) { return; } // Paper - this can be delayed, double check exists - Fixes GH-2074
2019-12-11 00:56:03 +00:00
BlockPropertyChestType blockpropertychesttype = (BlockPropertyChestType) this.getBlock().get(BlockChest.c);
if (blockpropertychesttype != BlockPropertyChestType.LEFT) {
2021-03-16 15:50:45 +00:00
@@ -227,6 +241,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
2019-04-24 01:00:24 +00:00
++this.viewingCount;
if (this.world == null) return; // CraftBukkit
+ doOpenLogic(); // Paper
// CraftBukkit start - Call redstone event
2019-04-24 01:00:24 +00:00
if (this.getBlock().getBlock() == Blocks.TRAPPED_CHEST) {
2021-03-16 15:50:45 +00:00
@@ -249,6 +264,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
2019-04-24 01:00:24 +00:00
--this.viewingCount;
// CraftBukkit start - Call redstone event
+ doCloseLogic(); // Paper
2019-04-24 01:00:24 +00:00
if (this.getBlock().getBlock() == Blocks.TRAPPED_CHEST) {
int newPower = Math.max(0, Math.min(15, this.viewingCount));
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java
2021-03-16 15:50:45 +00:00
index 930f1bd091d9754f7ca5d9e36cdf49b2be03eb23..2bc4213c70be47ca8bbc24898cc92e43f4228821 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java
2021-03-16 15:50:45 +00:00
@@ -1,11 +1,12 @@
package net.minecraft.world.level.block.entity;
+import net.minecraft.server.MCUtil;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.block.Blocks;
-public class TileEntityEnderChest extends TileEntity implements ITickable {
+public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickable
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 03:15:55 +00:00
public float a;
2019-04-24 01:00:24 +00:00
public float b;
2021-03-16 15:50:45 +00:00
@@ -16,18 +17,28 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
2019-04-24 01:00:24 +00:00
super(TileEntityTypes.ENDER_CHEST);
}
- @Override
public void tick() {
if (++this.g % 20 * 4 == 0) {
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c);
}
2019-04-24 01:00:24 +00:00
this.b = this.a;
+ /* // Paper
int i = this.position.getX();
int j = this.position.getY();
int k = this.position.getZ();
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 03:15:55 +00:00
float f = 0.1F;
double d0;
+ // Paper start
2019-04-24 01:00:24 +00:00
+ */
+ }
2019-04-24 01:00:24 +00:00
+
+ private void doOpenLogic() {
+ int i = this.position.getX();
+ int j = this.position.getY();
+ int k = this.position.getZ();
2019-04-24 01:00:24 +00:00
+ double d0;
+ // Paper end
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 03:15:55 +00:00
2019-04-24 01:00:24 +00:00
if (this.c > 0 && this.a == 0.0F) {
double d1 = (double) i + 0.5D;
2021-03-16 15:50:45 +00:00
@@ -35,8 +46,17 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
2019-04-24 01:00:24 +00:00
d0 = (double) k + 0.5D;
2019-07-20 04:01:24 +00:00
this.world.playSound((EntityHuman) null, d1, (double) j + 0.5D, d0, SoundEffects.BLOCK_ENDER_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
}
+ // Paper start
+ }
2019-04-24 01:00:24 +00:00
- if (this.c == 0 && this.a > 0.0F || this.c > 0 && this.a < 1.0F) {
+ private void doCloseLogic() {
+ int i = this.position.getX();
+ int j = this.position.getY();
+ int k = this.position.getZ();
+ double d0;
+
+ if (this.c == 0) { /* && this.a > 0.0F || this.c > 0 && this.a < 1.0F) {
+ // Paper end
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Warning: this commit contains more mapping changes from upstream, As always, ensure that you have working backups and test this build before deployment; Developers working on paper will, yet again, need to delete their work/Minecraft/1.13.2 folder Bukkit Changes: 7fca5fd4 SPIGOT-4558: Preserve user order in the face of copied defaults in configurations 15c9b1eb Ignore spurious slot IDs sent by client, e.g. in enchanting tables 5d2a10c5 SPIGOT-3747: Add API for force loaded chunks d6dd2bb3 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent 771db4aa SPIGOT-794: Call EntityPlaceEvent for Minecart placement 55462509 Add InventoryView#getSlotType 2f3ce5b6 Remove EntityTransformEvent and CustomItemTagContainer from draft API f04ad7b6 Make ProjectileLaunchEvent extend EntitySpawnEvent ccb85808 Define EntitySpawnEvent b8cc3ebe Add PlayerItemDamageEvent 184a495d Ease ClassLoader Deadlocks Where Possible 11ac4728 Expand Boolean Prompt Values in Conversation API aae62d51 Added getAllSessionData() to the Conversation API. 9290ff91 Add InventoryView#getInventory API 995e530f Add API to get / set base arrow damage CraftBukkit Changes: c4a67eed SPIGOT-4556: Fix plugins closing inventory during drop events 5be2ddcb Replace version constants with methods to prevent compiler inlining a5b9c7b3 Use API method to create offset command completions 2bc7d1df SPIGOT-3747: Add API for force loaded chunks a408f375 SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent b54b9409 SPIGOT-2864: Make Arrow / Item setTicksLived behave like FallingBlock 79ded7a8 SPIGOT-1811: Death message not shown on respawn screen b4a4f15d SPIGOT-943: InventoryCloseEvent called on death regardless of open inventory 0afed592 SPIGOT-794: Call EntityPlaceEvent for Minecart placement 2b2d084a Add InventoryView#getSlotType 01a9959a Do not use deprecated ItemSpawnEvent constructor 9642498d SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event 963f4a5f Add PlayerItemDamageEvent 63db0445 Add API to get / set base arrow damage 531c25d7 Add CraftMagicNumbers.MAPPINGS_VERSION for use by NMS plugins d05c8b14 Mappings Update bd36e200 SPIGOT-4551: Ignore invalid attribute modifier slots Spigot Changes: 518206a1 Remove redundant trove depend 1959ad21 MC-11211,SPIGOT-4552: Fix placing double slabs at y = 255 29ab5e43 SPIGOT-3661: Allow arguments in restart-script 7cc46316 SPIGOT-852: Growth modifiers for beetroots, potatoes, carrots 82e117e1 Squelch "fatal: Resolve operation not in progress" message 0a1a68e7 Mappings Update & Patch Rebuild
2019-01-01 03:15:55 +00:00
float f1 = this.a;
if (this.c > 0) {
2021-03-16 15:50:45 +00:00
@@ -52,11 +72,14 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
float f2 = 0.5F;
if (this.a < 0.5F && f1 >= 0.5F) {
+ // Paper start
+ */
d0 = (double) i + 0.5D;
double d2 = (double) k + 0.5D;
+ MCUtil.scheduleTask(10, () -> {
2019-07-20 04:01:24 +00:00
this.world.playSound((EntityHuman) null, d0, (double) j + 0.5D, d2, SoundEffects.BLOCK_ENDER_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
- }
+ }, "Chest Sounds");
if (this.a < 0.0F) {
this.a = 0.0F;
2021-03-16 15:50:45 +00:00
@@ -84,11 +107,13 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
2019-05-27 23:01:45 +00:00
public void d() {
2019-04-24 01:00:24 +00:00
++this.c;
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c);
+ doOpenLogic(); // Paper
}
2019-05-27 23:01:45 +00:00
public void f() {
2019-04-24 01:00:24 +00:00
--this.c;
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c);
+ doCloseLogic(); // Paper
}
public boolean a(EntityHuman entityhuman) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java
index e4b59a85ee9b435b2e86d4c7d78b7224773f6967..ba046cffdd8331c7e0427f19fa54d0c7a99077d9 100644
--- a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java
+++ b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java
@@ -84,6 +84,7 @@ public abstract class IBlockDataHolder<O, S> {
return Collections.unmodifiableCollection(this.b.keySet());
}
+ public <T extends Comparable<T>> boolean contains(IBlockState<T> iblockstate) { return this.b(iblockstate); } // Paper - OBFHELPER
public <T extends Comparable<T>> boolean b(IBlockState<T> iblockstate) {
return this.b.containsKey(iblockstate);
}