Fix armor stands being equippable.

This commit is contained in:
filoghost 2014-11-30 01:39:09 +01:00
parent e40bc511eb
commit 22c51f04b3
2 changed files with 24 additions and 4 deletions

View File

@ -1,6 +1,6 @@
name: HolographicDisplays name: HolographicDisplays
main: com.gmail.filoghost.holograms.HolographicDisplays main: com.gmail.filoghost.holograms.HolographicDisplays
version: 1.8.9 version: 1.8.10
softdepend: [Multiverse-Core, MultiWorld, My Worlds, My_Worlds, ProtocolLib] softdepend: [Multiverse-Core, MultiWorld, My Worlds, My_Worlds, ProtocolLib]

View File

@ -3,7 +3,10 @@ package com.gmail.filoghost.holograms.nms.v1_8_R1;
import net.minecraft.server.v1_8_R1.DamageSource; import net.minecraft.server.v1_8_R1.DamageSource;
import net.minecraft.server.v1_8_R1.Entity; import net.minecraft.server.v1_8_R1.Entity;
import net.minecraft.server.v1_8_R1.EntityArmorStand; import net.minecraft.server.v1_8_R1.EntityArmorStand;
import net.minecraft.server.v1_8_R1.EntityHuman;
import net.minecraft.server.v1_8_R1.ItemStack;
import net.minecraft.server.v1_8_R1.NBTTagCompound; import net.minecraft.server.v1_8_R1.NBTTagCompound;
import net.minecraft.server.v1_8_R1.Vec3D;
import net.minecraft.server.v1_8_R1.World; import net.minecraft.server.v1_8_R1.World;
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
@ -26,10 +29,9 @@ public class EntityHologramArmorStand extends EntityArmorStand implements Hologr
setGravity(true); setGravity(true);
setBasePlate(true); setBasePlate(true);
try { try {
ReflectionUtils.setPrivateField(EntityArmorStand.class, this, "bg", 1); ReflectionUtils.setPrivateField(EntityArmorStand.class, this, "bg", Integer.MAX_VALUE);
} catch (Exception e) { } catch (Exception e) {
//TODO // There's still the overridden method.
e.printStackTrace();
} }
a(0.0F, 0.0F); a(0.0F, 0.0F);
} }
@ -78,6 +80,24 @@ public class EntityHologramArmorStand extends EntityArmorStand implements Hologr
// Locks the custom name. // Locks the custom name.
} }
@Override
public boolean a(EntityHuman human, Vec3D vec3d) {
// Prevent stand being equipped
return true;
}
@Override
public boolean d(int i, ItemStack item) {
// Prevent stand being equipped
return false;
}
@Override
public void setEquipment(int i, ItemStack item) {
// Prevent stand being equipped
}
@Override @Override
public void s_() { public void s_() {
if (!lockTick) { if (!lockTick) {