Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
SPIGOT-2926: Check spawn-npcs setting for NPCs.
Probably should refactor this code to be more similar to Vanilla in future.
Dieser Commit ist enthalten in:
Ursprung
532457e41d
Commit
7f313269d7
@ -272,7 +272,7 @@
|
|||||||
int i = MathHelper.floor(entity.locX / 16.0D);
|
int i = MathHelper.floor(entity.locX / 16.0D);
|
||||||
int j = MathHelper.floor(entity.locZ / 16.0D);
|
int j = MathHelper.floor(entity.locZ / 16.0D);
|
||||||
boolean flag = entity.attachedToPlayer;
|
boolean flag = entity.attachedToPlayer;
|
||||||
@@ -793,6 +977,34 @@
|
@@ -793,6 +977,35 @@
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,9 +281,10 @@
|
|||||||
+ if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) {
|
+ if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) {
|
||||||
+ boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal || entity instanceof EntityGolem;
|
+ boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal || entity instanceof EntityGolem;
|
||||||
+ boolean isMonster = entity instanceof EntityMonster || entity instanceof EntityGhast || entity instanceof EntitySlime;
|
+ boolean isMonster = entity instanceof EntityMonster || entity instanceof EntityGhast || entity instanceof EntitySlime;
|
||||||
|
+ boolean isNpc = entity instanceof NPC;
|
||||||
+
|
+
|
||||||
+ if (spawnReason != SpawnReason.CUSTOM) {
|
+ if (spawnReason != SpawnReason.CUSTOM) {
|
||||||
+ if (isAnimal && !allowAnimals || isMonster && !allowMonsters) {
|
+ if (isAnimal && !allowAnimals || isMonster && !allowMonsters || isNpc && !getServer().getServer().getSpawnNPCs()) {
|
||||||
+ entity.dead = true;
|
+ entity.dead = true;
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
@ -307,7 +308,7 @@
|
|||||||
if (!flag && !this.isChunkLoaded(i, j, false)) {
|
if (!flag && !this.isChunkLoaded(i, j, false)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -815,6 +1027,7 @@
|
@@ -815,6 +1028,7 @@
|
||||||
((IWorldAccess) this.u.get(i)).a(entity);
|
((IWorldAccess) this.u.get(i)).a(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +316,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void c(Entity entity) {
|
protected void c(Entity entity) {
|
||||||
@@ -822,6 +1035,7 @@
|
@@ -822,6 +1036,7 @@
|
||||||
((IWorldAccess) this.u.get(i)).b(entity);
|
((IWorldAccess) this.u.get(i)).b(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +324,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void kill(Entity entity) {
|
public void kill(Entity entity) {
|
||||||
@@ -857,7 +1071,15 @@
|
@@ -857,7 +1072,15 @@
|
||||||
this.getChunkAt(i, j).b(entity);
|
this.getChunkAt(i, j).b(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +341,7 @@
|
|||||||
this.c(entity);
|
this.c(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1068,6 +1290,11 @@
|
@@ -1068,6 +1291,11 @@
|
||||||
|
|
||||||
for (i = 0; i < this.j.size(); ++i) {
|
for (i = 0; i < this.j.size(); ++i) {
|
||||||
entity = (Entity) this.j.get(i);
|
entity = (Entity) this.j.get(i);
|
||||||
@ -352,7 +353,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
++entity.ticksLived;
|
++entity.ticksLived;
|
||||||
@@ -1116,8 +1343,10 @@
|
@@ -1116,8 +1344,10 @@
|
||||||
CrashReportSystemDetails crashreportsystemdetails1;
|
CrashReportSystemDetails crashreportsystemdetails1;
|
||||||
CrashReport crashreport1;
|
CrashReport crashreport1;
|
||||||
|
|
||||||
@ -365,7 +366,7 @@
|
|||||||
Entity entity1 = entity.bB();
|
Entity entity1 = entity.bB();
|
||||||
|
|
||||||
if (entity1 != null) {
|
if (entity1 != null) {
|
||||||
@@ -1150,7 +1379,7 @@
|
@@ -1150,7 +1380,7 @@
|
||||||
this.getChunkAt(j, l).b(entity);
|
this.getChunkAt(j, l).b(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +375,7 @@
|
|||||||
this.c(entity);
|
this.c(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1159,6 +1388,13 @@
|
@@ -1159,6 +1389,13 @@
|
||||||
|
|
||||||
this.methodProfiler.c("blockEntities");
|
this.methodProfiler.c("blockEntities");
|
||||||
this.M = true;
|
this.M = true;
|
||||||
@ -388,7 +389,7 @@
|
|||||||
Iterator iterator = this.tileEntityListTick.iterator();
|
Iterator iterator = this.tileEntityListTick.iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -1169,7 +1405,7 @@
|
@@ -1169,7 +1406,7 @@
|
||||||
|
|
||||||
if (this.isLoaded(blockposition) && this.N.a(blockposition)) {
|
if (this.isLoaded(blockposition) && this.N.a(blockposition)) {
|
||||||
try {
|
try {
|
||||||
@ -397,7 +398,7 @@
|
|||||||
((ITickable) tileentity).F_();
|
((ITickable) tileentity).F_();
|
||||||
this.methodProfiler.b();
|
this.methodProfiler.b();
|
||||||
} catch (Throwable throwable2) {
|
} catch (Throwable throwable2) {
|
||||||
@@ -1191,11 +1427,13 @@
|
@@ -1191,11 +1428,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.M = false;
|
this.M = false;
|
||||||
@ -411,7 +412,7 @@
|
|||||||
|
|
||||||
this.methodProfiler.c("pendingBlockEntities");
|
this.methodProfiler.c("pendingBlockEntities");
|
||||||
if (!this.b.isEmpty()) {
|
if (!this.b.isEmpty()) {
|
||||||
@@ -1203,9 +1441,11 @@
|
@@ -1203,9 +1442,11 @@
|
||||||
TileEntity tileentity1 = (TileEntity) this.b.get(i1);
|
TileEntity tileentity1 = (TileEntity) this.b.get(i1);
|
||||||
|
|
||||||
if (!tileentity1.y()) {
|
if (!tileentity1.y()) {
|
||||||
@ -423,7 +424,7 @@
|
|||||||
|
|
||||||
if (this.isLoaded(tileentity1.getPosition())) {
|
if (this.isLoaded(tileentity1.getPosition())) {
|
||||||
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
|
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
|
||||||
@@ -1213,6 +1453,12 @@
|
@@ -1213,6 +1454,12 @@
|
||||||
|
|
||||||
chunk.a(tileentity1.getPosition(), tileentity1);
|
chunk.a(tileentity1.getPosition(), tileentity1);
|
||||||
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
|
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
|
||||||
@ -436,7 +437,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1267,7 +1513,10 @@
|
@@ -1267,7 +1514,10 @@
|
||||||
int j = MathHelper.floor(entity.locZ);
|
int j = MathHelper.floor(entity.locZ);
|
||||||
boolean flag1 = true;
|
boolean flag1 = true;
|
||||||
|
|
||||||
@ -448,7 +449,7 @@
|
|||||||
entity.M = entity.locX;
|
entity.M = entity.locX;
|
||||||
entity.N = entity.locY;
|
entity.N = entity.locY;
|
||||||
entity.O = entity.locZ;
|
entity.O = entity.locZ;
|
||||||
@@ -1571,11 +1820,18 @@
|
@@ -1571,11 +1821,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,7 +468,7 @@
|
|||||||
TileEntity tileentity = null;
|
TileEntity tileentity = null;
|
||||||
|
|
||||||
if (this.M) {
|
if (this.M) {
|
||||||
@@ -1610,6 +1866,14 @@
|
@@ -1610,6 +1867,14 @@
|
||||||
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
|
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
|
||||||
if (!this.E(blockposition)) {
|
if (!this.E(blockposition)) {
|
||||||
if (tileentity != null && !tileentity.y()) {
|
if (tileentity != null && !tileentity.y()) {
|
||||||
@ -482,7 +483,7 @@
|
|||||||
if (this.M) {
|
if (this.M) {
|
||||||
tileentity.setPosition(blockposition);
|
tileentity.setPosition(blockposition);
|
||||||
Iterator iterator = this.b.iterator();
|
Iterator iterator = this.b.iterator();
|
||||||
@@ -1769,6 +2033,14 @@
|
@@ -1769,6 +2034,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.o = MathHelper.a(this.o, 0.0F, 1.0F);
|
this.o = MathHelper.a(this.o, 0.0F, 1.0F);
|
||||||
@ -497,7 +498,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1900,7 +2172,10 @@
|
@@ -1900,7 +2173,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
|
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
|
||||||
@ -509,7 +510,7 @@
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -2067,7 +2342,7 @@
|
@@ -2067,7 +2343,7 @@
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entity entity = (Entity) iterator.next();
|
Entity entity = (Entity) iterator.next();
|
||||||
|
|
||||||
@ -518,7 +519,7 @@
|
|||||||
arraylist.add(entity);
|
arraylist.add(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2082,7 +2357,7 @@
|
@@ -2082,7 +2358,7 @@
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entity entity = (Entity) iterator.next();
|
Entity entity = (Entity) iterator.next();
|
||||||
|
|
||||||
@ -527,7 +528,7 @@
|
|||||||
arraylist.add(entity);
|
arraylist.add(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2131,7 +2406,7 @@
|
@@ -2131,7 +2407,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,7 +537,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -2152,8 +2427,17 @@
|
@@ -2152,8 +2428,17 @@
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entity entity = (Entity) iterator.next();
|
Entity entity = (Entity) iterator.next();
|
||||||
@ -556,7 +557,7 @@
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2162,12 +2446,18 @@
|
@@ -2162,12 +2447,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Collection<Entity> collection) {
|
public void a(Collection<Entity> collection) {
|
||||||
@ -576,7 +577,7 @@
|
|||||||
this.b(entity);
|
this.b(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2181,7 +2471,13 @@
|
@@ -2181,7 +2472,13 @@
|
||||||
IBlockData iblockdata = this.getType(blockposition);
|
IBlockData iblockdata = this.getType(blockposition);
|
||||||
AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().c(this, blockposition);
|
AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().c(this, blockposition);
|
||||||
|
|
||||||
@ -591,7 +592,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int K() {
|
public int K() {
|
||||||
@@ -2291,6 +2587,11 @@
|
@@ -2291,6 +2588,11 @@
|
||||||
|
|
||||||
for (int i = 0; i < this.players.size(); ++i) {
|
for (int i = 0; i < this.players.size(); ++i) {
|
||||||
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
|
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
|
||||||
@ -603,7 +604,7 @@
|
|||||||
|
|
||||||
if (predicate.apply(entityhuman1)) {
|
if (predicate.apply(entityhuman1)) {
|
||||||
double d5 = entityhuman1.d(d0, d1, d2);
|
double d5 = entityhuman1.d(d0, d1, d2);
|
||||||
@@ -2459,6 +2760,16 @@
|
@@ -2459,6 +2761,16 @@
|
||||||
|
|
||||||
public void everyoneSleeping() {}
|
public void everyoneSleeping() {}
|
||||||
|
|
||||||
@ -620,7 +621,7 @@
|
|||||||
public float h(float f) {
|
public float h(float f) {
|
||||||
return (this.p + (this.q - this.p) * f) * this.j(f);
|
return (this.p + (this.q - this.p) * f) * this.j(f);
|
||||||
}
|
}
|
||||||
@@ -2676,7 +2987,7 @@
|
@@ -2676,7 +2988,7 @@
|
||||||
int l = j * 16 + 8 - blockposition.getZ();
|
int l = j * 16 + 8 - blockposition.getZ();
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren