Add option to nerf pigmen from nether portals

This commit is contained in:
William Blake Galbreath
2020-02-07 14:36:56 -06:00
parent 0dd8044178
commit 196c153504
2 changed files with 100 additions and 93 deletions

View File

@@ -20,7 +20,7 @@
public class NetherPortalBlock extends Block implements Portal {
@@ -71,13 +78,14 @@
@@ -71,16 +78,21 @@
@Override
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
@@ -37,7 +37,14 @@
if (entity != null) {
entity.setPortalCooldown();
@@ -104,6 +112,10 @@
+ // Paper start - Add option to nerf pigmen from nether portals
+ entity.fromNetherPortal = true;
+ if (world.paperConfig().entities.behavior.nerfPigmenFromNetherPortals) ((net.minecraft.world.entity.Mob) entity).aware = false;
+ // Paper end - Add option to nerf pigmen from nether portals
Entity entity1 = entity.getVehicle();
if (entity1 != null) {
@@ -104,6 +116,10 @@
@Override
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
if (entity.canUsePortal(false)) {
@@ -48,7 +55,7 @@
entity.setAsInsidePortal(this, pos);
}
@@ -121,51 +133,72 @@
@@ -121,51 +137,72 @@
@Nullable
@Override
public TeleportTransition getPortalDestination(ServerLevel world, Entity entity, BlockPos pos) {
@@ -134,7 +141,7 @@
}
private static TeleportTransition getDimensionTransitionFromExit(Entity entity, BlockPos pos, BlockUtil.FoundRectangle exitPortalRectangle, ServerLevel world, TeleportTransition.PostTeleportTransition postDimensionTransition) {
@@ -203,7 +236,7 @@
@@ -203,7 +240,7 @@
Vec3 vec3d1 = new Vec3((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
Vec3 vec3d2 = PortalShape.findCollisionFreePosition(vec3d1, world, entity, entitysize);