Fixed the stair/slab issue for real - missed the rename of W->X, readded this change

This commit is contained in:
fullwall 2012-11-01 22:05:25 +08:00
parent 9024c3a8d2
commit 6f1eb32445
2 changed files with 3 additions and 34 deletions

View File

@ -109,6 +109,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
}
getNavigation().e(true);
X = 0.5F; // stepHeight - must not stay as the default 0 (breaks steps).
// Check the EntityPlayer constructor for the new name.
try {
socket.close();
@ -150,8 +152,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
motY += 0.04;
} else //(handled elsewhere)*/
if (onGround && bW == 0) {
// bf(); // jump commented to provide block-specific handling
NMS.blockSpecificJump(this);
bf();
bW = 10;
}
} else

View File

@ -8,7 +8,6 @@ import java.util.Set;
import java.util.WeakHashMap;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.minecraft.server.ControllerLook;
import net.minecraft.server.DamageSource;
import net.minecraft.server.EnchantmentManager;
@ -25,7 +24,6 @@ import net.minecraft.server.World;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.entity.EntityType;
@ -35,7 +33,6 @@ import org.bukkit.material.Step;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.primitives.Ints;
@SuppressWarnings("unchecked")
public class NMS {
@ -109,28 +106,6 @@ public class NMS {
target.setOnFire(fireAspectLevel * 4);
}
public static void blockSpecificJump(EntityHumanNPC entity) {
int x = MathHelper.floor(entity.locX), y = MathHelper.floor(entity.boundingBox.b - 1), z = MathHelper
.floor(entity.locZ);
int below = entity.world.getTypeId(x, y, z);
BlockFace dir = Util.getFacingDirection(entity.yaw);
int[] typeIds = { below };
if (dir != BlockFace.SELF) {
int modX = x + dir.getModX(), modY = y + dir.getModY(), modZ = y + dir.getModZ();
typeIds = Ints.concat(
typeIds,
new int[] { entity.world.getTypeId(modX, modY, modZ),
entity.world.getTypeId(modX, modY + 1, modZ),
entity.world.getTypeId(modX, modY + 2, modZ) });
}
if (containsAny(STAIR_MATERIALS, typeIds)) {
entity.motY = 0.47F;
} else if (containsAny(SLAB_MATERIALS, typeIds)) {
entity.motY = 0.52F;
} else
entity.motY = 0.5F;
}
public static void clearGoals(PathfinderGoalSelector... goalSelectors) {
if (GOAL_FIELD == null || goalSelectors == null)
return;
@ -144,13 +119,6 @@ public class NMS {
}
}
private static boolean containsAny(Set<Integer> set, int[] tests) {
for (int test : tests)
if (set.contains(test))
return true;
return false;
}
private static Constructor<? extends Entity> getCustomEntityConstructor(Class<? extends Entity> clazz,
EntityType type) throws SecurityException, NoSuchMethodException {
Constructor<? extends Entity> constructor = ENTITY_CONSTRUCTOR_CACHE.get(clazz);