mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-19 06:42:02 +01:00
Reduce the impact from EAR on hopper minecart based unloaders by making them immune to EAR while pulling objects. The EAR is still active outside misc activation range when the hopper minecart is idle, keeping lag low.
This commit is contained in:
parent
1e9ec27588
commit
53102645d2
@ -302,6 +302,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
super.customServerAiStep();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
|
||||
@@ -0,0 +0,0 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
|
||||
if (bl != this.isEnabled()) {
|
||||
this.setEnabled(bl);
|
||||
}
|
||||
+ this.immunize(); // Paper
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
|
||||
|
||||
public boolean suckInItems() {
|
||||
if (HopperBlockEntity.suckInItems(this.level, this)) {
|
||||
+ this.immunize(); // Paper
|
||||
return true;
|
||||
} else {
|
||||
List<ItemEntity> list = this.level.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25D, 0.0D, 0.25D), EntitySelector.ENTITY_STILL_ALIVE);
|
||||
if (!list.isEmpty()) {
|
||||
HopperBlockEntity.addItem(this, list.get(0));
|
||||
+ this.immunize(); // Paper
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -0,0 +0,0 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
|
||||
public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) {
|
||||
return new HopperMenu(syncId, playerInventory, this);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public void immunize() {
|
||||
+ this.activatedImmunityTick = Math.max(this.activatedImmunityTick, net.minecraft.server.MinecraftServer.currentTick + 20);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
|
Loading…
Reference in New Issue
Block a user