From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: kashike Date: Wed, 21 Dec 2016 11:47:25 -0600 Subject: [PATCH] Add API methods to control if armour stands can move diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java index 09d39b73e8a3987e58a502bd914a6451b807421b..46f0ebfc99352ec8b64bdff2c6bb8d17ecfeb619 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1,6 +1,5 @@ package net.minecraft.world.entity; -import PathfinderGoalFloat; import com.google.common.collect.Maps; import java.util.Arrays; import java.util.Iterator; @@ -39,6 +38,7 @@ import net.minecraft.world.entity.ai.control.BodyRotationControl; import net.minecraft.world.entity.ai.control.JumpControl; import net.minecraft.world.entity.ai.control.LookControl; import net.minecraft.world.entity.ai.control.MoveControl; +import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.GoalSelector; import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; @@ -47,6 +47,8 @@ import net.minecraft.world.entity.ai.sensing.Sensing; import net.minecraft.world.entity.decoration.HangingEntity; import net.minecraft.world.entity.decoration.LeashFenceKnotEntity; import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.monster.Blaze; +import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.entity.monster.Enemy; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.Boat; @@ -97,7 +99,7 @@ public abstract class Mob extends LivingEntity { private final BodyRotationControl bodyRotationControl; protected PathNavigation navigation; public GoalSelector goalSelector; - @Nullable public PathfinderGoalFloat goalFloat; // Paper + @Nullable public FloatGoal goalFloat; // Paper public GoalSelector targetSelector; private LivingEntity target; private final Sensing sensing; @@ -789,7 +791,7 @@ public abstract class Mob extends LivingEntity { if (goalFloat.validConditions()) goalFloat.update(); this.getJumpControl().jumpIfSet(); } - if ((this instanceof EntityBlaze || this instanceof EntityEnderman) && isInWaterOrRainOrBubble()) { + if ((this instanceof Blaze || this instanceof EnderMan) && isInWaterOrRainOrBubble()) { hurt(DamageSource.DROWN, 1.0F); } return; diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java index 438dd75e3adffc395960b34b8bb26cbc07a4291e..8b6ec9ddf0d47bf4369b247e764f75893ab15781 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java @@ -26,6 +26,7 @@ import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.vehicle.AbstractMinecart; @@ -75,6 +76,7 @@ public class ArmorStand extends LivingEntity { public Rotations rightArmPose; public Rotations leftLegPose; public Rotations rightLegPose; + public boolean canMove = true; // Paper public ArmorStand(EntityType type, Level world) { super(type, world); @@ -858,4 +860,13 @@ public class ArmorStand extends LivingEntity { private EntityDimensions getDimensionsMarker(boolean flag) { return flag ? ArmorStand.MARKER_DIMENSIONS : (this.isBaby() ? ArmorStand.BABY_DIMENSIONS : this.getType().getDimensions()); } + + // Paper start + @Override + public void move(MoverType type, Vec3 movement) { + if (this.canMove) { + super.move(type, movement); + } + } + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java index 6b292162fb8c6416b1637b7b83e5113f6a35dbac..16f996d505b96da8a40c7709214ebbd2a0d0d9f3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java @@ -228,4 +228,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { public boolean hasEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) { return (getHandle().disabledSlots & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getFilterFlag() + lockType.ordinal() * 8)) != 0; } + // Paper start + @Override + public boolean canMove() { + return getHandle().canMove; + } + + @Override + public void setCanMove(boolean move) { + getHandle().canMove = move; + } + // Paper end }