Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
7c640a1ae2
* 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#getWorldFoldere5e8eec2
SPIGOT-5241: setAttributeModifiers does not work on untouched stack803eaa31
SPIGOT-5231: ShotAtAngle API for Fireworks7881d2ae
SPIGOT-5237: Horses, pigs do not drop their inventory06efc9ec
Don't accept connections until all plugins have enabledda62a66a
SPIGOT-5225: World handle isn't closed if world is unloaded without saving104b3831
SPIGOT-5222: Cannot get Long values from Entity memoryf0b3fe43
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
187 Zeilen
7.1 KiB
Diff
187 Zeilen
7.1 KiB
Diff
From cc69a9a63cd4b9e2e5248acd36fa6f8117868852 Mon Sep 17 00:00:00 2001
|
|
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/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
|
|
index ffaf16cff8..6b94826536 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
|
|
@@ -7,7 +7,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;
|
|
@@ -101,22 +101,31 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
|
return nbttagcompound;
|
|
}
|
|
|
|
- @Override
|
|
public void tick() {
|
|
int i = this.position.getX();
|
|
int j = this.position.getY();
|
|
int k = this.position.getZ();
|
|
|
|
++this.j;
|
|
- this.viewingCount = a(this.world, this, this.j, i, j, k, this.viewingCount);
|
|
+ }
|
|
+
|
|
+ public void doOpenLogic() {
|
|
+ int i = this.position.getX();
|
|
+ int j = this.position.getY();
|
|
+ int k = this.position.getZ();
|
|
+
|
|
+ //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
|
|
this.b = this.a;
|
|
float f = 0.1F;
|
|
|
|
if (this.viewingCount > 0 && this.a == 0.0F) {
|
|
this.a(SoundEffects.BLOCK_CHEST_OPEN);
|
|
}
|
|
+ }
|
|
|
|
- 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;
|
|
|
|
if (this.viewingCount > 0) {
|
|
@@ -132,8 +141,11 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
|
float f2 = 0.5F;
|
|
|
|
if (this.a < 0.5F && f1 >= 0.5F) {
|
|
- this.a(SoundEffects.BLOCK_CHEST_CLOSE);
|
|
- }
|
|
+ */
|
|
+ MCUtil.scheduleTask(10, () -> {
|
|
+ this.a(SoundEffects.BLOCK_CHEST_CLOSE);
|
|
+ });
|
|
+ //} // Paper end
|
|
|
|
if (this.a < 0.0F) {
|
|
this.a = 0.0F;
|
|
@@ -172,6 +184,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
|
}
|
|
|
|
private void a(SoundEffect soundeffect) {
|
|
+ if (!this.getBlock().hasProperty(BlockChest.b)) { return; } // Paper - this can be delayed, double check exists - Fixes GH-2074
|
|
BlockPropertyChestType blockpropertychesttype = (BlockPropertyChestType) this.getBlock().get(BlockChest.b);
|
|
|
|
if (blockpropertychesttype != BlockPropertyChestType.LEFT) {
|
|
@@ -210,6 +223,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
|
|
|
++this.viewingCount;
|
|
if (this.world == null) return; // CraftBukkit
|
|
+ doOpenLogic(); // Paper
|
|
|
|
// CraftBukkit start - Call redstone event
|
|
if (this.getBlock().getBlock() == Blocks.TRAPPED_CHEST) {
|
|
@@ -232,6 +246,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
|
--this.viewingCount;
|
|
|
|
// CraftBukkit start - Call redstone event
|
|
+ doCloseLogic(); // Paper
|
|
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/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
|
|
index 0fae06d3a0..ae6784b6aa 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
|
|
@@ -1,6 +1,6 @@
|
|
package net.minecraft.server;
|
|
|
|
-public class TileEntityEnderChest extends TileEntity implements ITickable {
|
|
+public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickable
|
|
|
|
public float a;
|
|
public float b;
|
|
@@ -11,18 +11,28 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
|
|
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);
|
|
}
|
|
|
|
this.b = this.a;
|
|
+ /* // Paper
|
|
int i = this.position.getX();
|
|
int j = this.position.getY();
|
|
int k = this.position.getZ();
|
|
float f = 0.1F;
|
|
double d0;
|
|
+ // Paper start
|
|
+ */
|
|
+ }
|
|
+
|
|
+ private void doOpenLogic() {
|
|
+ int i = this.position.getX();
|
|
+ int j = this.position.getY();
|
|
+ int k = this.position.getZ();
|
|
+ double d0;
|
|
+ // Paper end
|
|
|
|
if (this.c > 0 && this.a == 0.0F) {
|
|
double d1 = (double) i + 0.5D;
|
|
@@ -30,8 +40,17 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
|
|
d0 = (double) k + 0.5D;
|
|
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
|
|
+ }
|
|
|
|
- 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
|
|
float f1 = this.a;
|
|
|
|
if (this.c > 0) {
|
|
@@ -47,11 +66,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, () -> {
|
|
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);
|
|
- }
|
|
+ });
|
|
|
|
if (this.a < 0.0F) {
|
|
this.a = 0.0F;
|
|
@@ -79,11 +101,13 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
|
|
public void d() {
|
|
++this.c;
|
|
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c);
|
|
+ doOpenLogic(); // Paper
|
|
}
|
|
|
|
public void f() {
|
|
--this.c;
|
|
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c);
|
|
+ doCloseLogic(); // Paper
|
|
}
|
|
|
|
public boolean a(EntityHuman entityhuman) {
|
|
--
|
|
2.22.0
|
|
|