* Fix #12721 Track when knots are created and only fire the event then * Use mutable boolean + check if actually spawned
This commit is contained in:
@@ -27,3 +27,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +_,12 @@
|
||||
return this.level().getBlockState(this.pos).is(BlockTags.FENCES);
|
||||
}
|
||||
|
||||
+ // Paper start - Track if a knot was created
|
||||
public static LeashFenceKnotEntity getOrCreateKnot(Level level, BlockPos pos) {
|
||||
+ return getOrCreateKnot(level, pos, null);
|
||||
+ }
|
||||
+ public static LeashFenceKnotEntity getOrCreateKnot(Level level, BlockPos pos, @Nullable org.apache.commons.lang3.mutable.MutableBoolean created) {
|
||||
+ // Paper end - Track if a knot was created
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
@@ -134,7 +_,7 @@
|
||||
}
|
||||
|
||||
LeashFenceKnotEntity leashFenceKnotEntity1 = new LeashFenceKnotEntity(level, pos);
|
||||
- level.addFreshEntity(leashFenceKnotEntity1);
|
||||
+ if (level.addFreshEntity(leashFenceKnotEntity1) && created != null) { created.setTrue(); } // Paper - Track if a knot was created
|
||||
return leashFenceKnotEntity1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user