Fix skin layers not showing up

This commit is contained in:
fullwall 2016-11-22 14:58:51 +08:00
parent 3cd6da8ff5
commit 58c5fc748e
3 changed files with 21 additions and 3 deletions

View File

@ -43,6 +43,7 @@ import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_11_R1.AttributeInstance;
import net.minecraft.server.v1_11_R1.BlockPosition;
import net.minecraft.server.v1_11_R1.ChatComponentText;
import net.minecraft.server.v1_11_R1.DamageSource;
import net.minecraft.server.v1_11_R1.Entity;
import net.minecraft.server.v1_11_R1.EntityHuman;
@ -52,6 +53,7 @@ import net.minecraft.server.v1_11_R1.EnumItemSlot;
import net.minecraft.server.v1_11_R1.EnumProtocolDirection;
import net.minecraft.server.v1_11_R1.GenericAttributes;
import net.minecraft.server.v1_11_R1.IBlockData;
import net.minecraft.server.v1_11_R1.IChatBaseComponent;
import net.minecraft.server.v1_11_R1.MathHelper;
import net.minecraft.server.v1_11_R1.MinecraftServer;
import net.minecraft.server.v1_11_R1.NavigationAbstract;
@ -258,6 +260,14 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
return npc;
}
@Override
public IChatBaseComponent getPlayerListName() {
if (Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean()) {
return new ChatComponentText("");
}
return super.getPlayerListName();
}
@Override
public String getSkinName() {
MetadataStore meta = npc.data();
@ -350,7 +360,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
@Override
public void setSkinFlags(byte flags) {
// set skin flag byte
getDataWatcher().set(EntityHuman.br, flags);
getDataWatcher().set(EntityHuman.bq, flags);
}
@Override
@ -379,6 +389,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
private void updatePackets(boolean navigating) {
if (updateCounter++ <= Setting.PACKET_UPDATE_DELAY.asInt())
return;
updateCounter = 0;
Location current = getBukkitEntity().getLocation(packetLocationCache);
Packet<?>[] packets = new Packet[navigating ? EnumItemSlot.values().length : EnumItemSlot.values().length + 1];

View File

@ -1,5 +1,7 @@
package net.citizensnpcs.nms.v1_11_R1.entity;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_11_R1.CraftServer;
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity;
@ -20,6 +22,7 @@ import net.minecraft.server.v1_11_R1.EntityHuman;
import net.minecraft.server.v1_11_R1.EntityVillager;
import net.minecraft.server.v1_11_R1.EnumHand;
import net.minecraft.server.v1_11_R1.IBlockData;
import net.minecraft.server.v1_11_R1.MerchantRecipe;
import net.minecraft.server.v1_11_R1.NBTTagCompound;
import net.minecraft.server.v1_11_R1.SoundEffect;
import net.minecraft.server.v1_11_R1.World;
@ -73,6 +76,10 @@ public class VillagerController extends MobEntityController {
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
if (npc != null && blockTrades) {
blockingATrade = true;
List<MerchantRecipe> list = getOffers(entityhuman);
if (list != null) {
list.clear();
}
}
return super.a(entityhuman, enumhand);
}

View File

@ -658,10 +658,10 @@ public class NMSImpl implements NMSBridge {
Class<?> search = clazz;
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
MinecraftKey key = ENTITY_REGISTRY.b((Class<? extends Entity>) search);
MinecraftKey key = ENTITY_REGISTRY.b(search);
if (key == null)
continue;
int code = ENTITY_REGISTRY.a((Class<? extends Entity>) search);
int code = ENTITY_REGISTRY.a(search);
ENTITY_REGISTRY.put(code, key, (Class<? extends Entity>) clazz);
return;
}