geforkt von Mirrors/Paper
094bb03a37
- Lots of itemstack cloning removed. Only clone if the item is actually moved - Return true when a plugin cancels inventory move item event instead of false, as false causes pulls to cycle through all items. However, pushes do not exhibit the same behavior, so this is not something plugins could of been relying on. - Add option (Default on) to cooldown hoppers when they fail to move an item due to full inventory - Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
69 Zeilen
3.3 KiB
Diff
69 Zeilen
3.3 KiB
Diff
From 10d8c92db84bf780ee8477240e3698004cbce563 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
Date: Sun, 18 Jun 2017 18:17:05 -0500
|
|
Subject: [PATCH] Entity#fromMobSpawner()
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index f08f4ae56..1f3aabd01 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -170,6 +170,7 @@ public abstract class Entity implements ICommandListener {
|
|
public final boolean defaultActivationState;
|
|
public long activatedTick = Integer.MIN_VALUE;
|
|
public boolean fromMobSpawner;
|
|
+ public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
|
|
protected int numCollisions = 0; // Paper
|
|
public void inactiveTick() { }
|
|
// Spigot end
|
|
@@ -1590,6 +1591,10 @@ public abstract class Entity implements ICommandListener {
|
|
if (origin != null) {
|
|
nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ()));
|
|
}
|
|
+ // Save entity's from mob spawner status
|
|
+ if (spawnedViaMobSpawner) {
|
|
+ nbttagcompound.setBoolean("Paper.FromMobSpawner", true);
|
|
+ }
|
|
// Paper end
|
|
return nbttagcompound;
|
|
} catch (Throwable throwable) {
|
|
@@ -1740,6 +1745,8 @@ public abstract class Entity implements ICommandListener {
|
|
if (!originTag.isEmpty()) {
|
|
origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
|
|
}
|
|
+
|
|
+ spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
|
|
// Paper end
|
|
|
|
} catch (Throwable throwable) {
|
|
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
index a5261d70b..1ed0def1e 100644
|
|
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
@@ -107,6 +107,7 @@ public abstract class MobSpawnerAbstract {
|
|
if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) {
|
|
((EntityInsentient) entity).prepare(world.D(new BlockPosition(entity)), (GroupDataEntity) null);
|
|
}
|
|
+ entity.spawnedViaMobSpawner = true; // Paper
|
|
// Spigot Start
|
|
if ( entity.world.spigotConfig.nerfSpawnerMobs )
|
|
{
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
index 8628cd5a2..6f06584ff 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
@@ -793,5 +793,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|
Location origin = getHandle().origin;
|
|
return origin == null ? null : origin.clone();
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public boolean fromMobSpawner() {
|
|
+ return getHandle().spawnedViaMobSpawner;
|
|
+ }
|
|
// Paper end
|
|
}
|
|
--
|
|
2.16.1
|
|
|