mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-23 02:45:22 +01:00
Improve comments
This commit is contained in:
parent
949018c60f
commit
523b866f8e
@ -11,7 +11,8 @@ public interface ChatComponentCustomNameEditor<T> extends CustomNameEditor {
|
||||
|
||||
@Override
|
||||
default T replaceCustomName(Object customNameObject, String target, String replacement) {
|
||||
// Custom name is expected to be a ChatComponentText with empty text and child components (called "siblings") that do not contain more components.
|
||||
// Custom name is expected to be a ChatComponentText with empty text
|
||||
// and child components (called "siblings") that do not contain more components.
|
||||
@SuppressWarnings("unchecked")
|
||||
T rootComponent = (T) customNameObject;
|
||||
|
||||
@ -31,7 +32,7 @@ public interface ChatComponentCustomNameEditor<T> extends CustomNameEditor {
|
||||
}
|
||||
|
||||
if (getText(childComponent).contains(target)) {
|
||||
// Lazy initialization for performance, since this method can be called frequently.
|
||||
// Lazy initialization for performance, since this method can be called frequently
|
||||
if (childrenContainingTarget == null) {
|
||||
childrenContainingTarget = new boolean[childrenSize];
|
||||
}
|
||||
@ -40,11 +41,11 @@ public interface ChatComponentCustomNameEditor<T> extends CustomNameEditor {
|
||||
}
|
||||
|
||||
if (childrenContainingTarget == null) {
|
||||
// No match found, return original unmodified object.
|
||||
// No match found, return original unmodified object
|
||||
return rootComponent;
|
||||
}
|
||||
|
||||
// Clone all the objects and apply replacements where needed.
|
||||
// Clone all the objects and apply replacements where needed
|
||||
T clonedRoot = cloneComponent(rootComponent);
|
||||
for (int i = 0; i < childrenSize; i++) {
|
||||
T childComponent = children.get(i);
|
||||
|
@ -15,7 +15,11 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface NMSManager {
|
||||
|
||||
// A method to register all the custom entities of the plugin, it may fail.
|
||||
/**
|
||||
* Register all the custom entities of the plugin.
|
||||
*
|
||||
* @throws Exception if anything during the process fails
|
||||
*/
|
||||
void setup() throws Exception;
|
||||
|
||||
NMSArmorStand spawnNMSArmorStand(org.bukkit.World world, double x, double y, double z, StandardHologramLine parentHologramLine) throws SpawnFailedException;
|
||||
|
@ -7,13 +7,18 @@ package me.filoghost.holographicdisplays.core.nms.entity;
|
||||
|
||||
public interface NMSArmorStand extends NMSVehicle {
|
||||
|
||||
// Sets a custom name as a String.
|
||||
void setCustomNameNMS(String customName);
|
||||
|
||||
// Returns the last custom name set.
|
||||
/**
|
||||
* Returns the last custom name set.
|
||||
*/
|
||||
String getCustomNameStringNMS();
|
||||
|
||||
// Returns the custom name as version-dependent NMS object (String for MC 1.12 and below, ChatComponent for MC 1.13+ a ChatComponent).
|
||||
/**
|
||||
* Returns the custom name NMS object, whose type is version-dependent (String for MC 1.12 and below, ChatComponent
|
||||
* for MC 1.13+). The returned value may differ from {@link #getCustomNameStringNMS()} even if it's a string, for
|
||||
* example if the custom name has been truncated before being applied.
|
||||
*/
|
||||
Object getCustomNameObjectNMS();
|
||||
|
||||
}
|
||||
|
@ -9,26 +9,20 @@ import me.filoghost.holographicdisplays.core.hologram.StandardHologramLine;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* An interface to represent a custom NMS entity being part of a hologram.
|
||||
* A custom entity that is part of a hologram.
|
||||
*/
|
||||
public interface NMSEntity {
|
||||
|
||||
// Returns the linked line, all the entities are part of a line. Should never be null.
|
||||
StandardHologramLine getHologramLine();
|
||||
|
||||
// Sets the location through NMS.
|
||||
|
||||
void setLocationNMS(double x, double y, double z);
|
||||
|
||||
// Returns if the entity is dead through NMS.
|
||||
boolean isDeadNMS();
|
||||
|
||||
// Kills the entity through NMS.
|
||||
void killEntityNMS();
|
||||
|
||||
// The entity ID.
|
||||
int getIdNMS();
|
||||
|
||||
// Returns the bukkit entity.
|
||||
org.bukkit.entity.Entity getBukkitEntityNMS();
|
||||
|
||||
boolean isTrackedBy(Player bukkitPlayer);
|
||||
|
@ -9,10 +9,11 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface NMSItem extends NMSEntity {
|
||||
|
||||
// Sets the bukkit ItemStack for this item.
|
||||
void setItemStackNMS(ItemStack stack);
|
||||
|
||||
// The raw NMS ItemStack object.
|
||||
/**
|
||||
* Returns the item stack NMS object.
|
||||
*/
|
||||
Object getRawItemStack();
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class RelativePlaceholder implements RelativePlaceholderReplacer {
|
||||
|
||||
private static final Collection<RelativePlaceholder> registry = new HashSet<>();
|
||||
|
||||
// The placeholder itself, something like {player}.
|
||||
// The placeholder itself, something like {player}
|
||||
private final String textPlaceholder;
|
||||
|
||||
private final RelativePlaceholderReplacer replacer;
|
||||
|
@ -43,23 +43,23 @@ public class PowerUps extends JavaPlugin implements Listener {
|
||||
@EventHandler
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
if (event.getEntityType() == EntityType.ZOMBIE) {
|
||||
// Remove normal drops and exp.
|
||||
// Remove normal drops and exp
|
||||
event.getDrops().clear();
|
||||
event.setDroppedExp(0);
|
||||
|
||||
// Spawn the floating item with a label.
|
||||
// Spawn the floating item with a label
|
||||
Hologram hologram = holographicDisplaysAPI.createHologram(event.getEntity().getLocation().add(0.0, 0.9, 0.0));
|
||||
hologram.appendTextLine(ChatColor.AQUA + "" + ChatColor.BOLD + "Speed PowerUp");
|
||||
ItemLine icon = hologram.appendItemLine(new ItemStack(Material.SUGAR));
|
||||
|
||||
icon.setPickupHandler((Player player) -> {
|
||||
// Play an effect.
|
||||
// Play an effect
|
||||
player.playEffect(hologram.getLocation(), Effect.MOBSPAWNER_FLAMES, null);
|
||||
|
||||
// 30 seconds of speed II.
|
||||
// 30 seconds of speed II
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30 * 20, 1), true);
|
||||
|
||||
// Delete the hologram.
|
||||
// Delete the hologram
|
||||
hologram.delete();
|
||||
});
|
||||
}
|
||||
|
@ -24,14 +24,14 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Armor stand class
|
||||
// Methods from ArmorStand class
|
||||
@Override public void setArms(boolean arms) {}
|
||||
@Override public void setBasePlate(boolean basePlate) {}
|
||||
@Override public void setBodyPose(EulerAngle pose) {}
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Entity
|
||||
|
@ -22,11 +22,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from LivingEntity class
|
||||
|
@ -54,15 +54,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -70,9 +70,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -80,35 +80,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,34 +128,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, ItemStack itemstack, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -164,7 +164,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -189,7 +189,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,9 +42,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
|
||||
if (resendMountPacketTicks++ > 20) {
|
||||
@ -60,57 +60,57 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void d(EntityHuman human) {
|
||||
if (human.locY < super.locY - 1.5 || human.locY > super.locY + 1.0) {
|
||||
// Too low or too high, it's a bit weird.
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -130,13 +130,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,9 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
|
||||
if (resendMountPacketTicks++ > 20) {
|
||||
@ -62,15 +62,15 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -79,35 +79,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,22 +138,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,14 +24,14 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Armor stand class
|
||||
// Methods from ArmorStand class
|
||||
@Override public void setArms(boolean arms) {}
|
||||
@Override public void setBasePlate(boolean basePlate) {}
|
||||
@Override public void setBodyPose(EulerAngle pose) {}
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Entity
|
||||
|
@ -22,11 +22,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from LivingEntity class
|
||||
|
@ -54,15 +54,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void A_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -70,9 +70,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -80,35 +80,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,34 +128,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -164,7 +164,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -189,7 +189,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,65 +38,65 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void A_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void d(EntityHuman human) {
|
||||
if (human.locY < super.locY - 1.5 || human.locY > super.locY + 1.0) {
|
||||
// Too low or too high, it's a bit weird.
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,13 +116,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -151,9 +150,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void setItemStackNMS(org.bukkit.inventory.ItemStack stack) {
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack); // ItemStack.a is returned if the stack is not valid
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
if (newItem == null || newItem == ItemStack.a) {
|
||||
if (newItem == null || newItem == ItemStack.a) { // ItemStack.a is returned if the stack is not valid
|
||||
newItem = new ItemStack(Blocks.BEDROCK);
|
||||
}
|
||||
|
||||
|
@ -40,23 +40,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void A_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -65,35 +65,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,22 +124,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,17 +50,17 @@ public class VersionNMSManager implements NMSManager {
|
||||
}
|
||||
|
||||
public void registerCustomEntity(Class<? extends Entity> entityClass, int id) throws Exception {
|
||||
// Use reflection to get the RegistryID of entities.
|
||||
// Use reflection to get the RegistryID of entities
|
||||
RegistryID<Class<? extends Entity>> registryID = REGISTRY_ID_FIELD.get(EntityTypes.b);
|
||||
Object[] idToClassMap = ID_TO_CLASS_MAP_FIELD.get(registryID);
|
||||
|
||||
// Save the the ID -> entity class mapping before the registration.
|
||||
// Save the the ID -> entity class mapping before the registration
|
||||
Object oldValue = idToClassMap[id];
|
||||
|
||||
// Register the entity class.
|
||||
// Register the entity class
|
||||
registryID.a(entityClass, id);
|
||||
|
||||
// Restore the ID -> entity class mapping.
|
||||
// Restore the ID -> entity class mapping
|
||||
idToClassMap[id] = oldValue;
|
||||
}
|
||||
|
||||
|
@ -24,14 +24,14 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Armor stand class
|
||||
// Methods from ArmorStand class
|
||||
|
||||
@Override public void setArms(boolean arms) {}
|
||||
@Override public void setBasePlate(boolean basePlate) {}
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Entity
|
||||
|
@ -22,11 +22,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from LivingEntity class
|
||||
|
@ -54,15 +54,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void B_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -70,9 +70,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -80,35 +80,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,34 +128,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -164,7 +164,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -189,7 +189,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,65 +38,65 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void B_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void d(EntityHuman human) {
|
||||
if (human.locY < super.locY - 1.5 || human.locY > super.locY + 1.0) {
|
||||
// Too low or too high, it's a bit weird.
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,13 +116,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -151,9 +150,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void setItemStackNMS(org.bukkit.inventory.ItemStack stack) {
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack); // ItemStack.a is returned if the stack is not valid
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
if (newItem == null || newItem == ItemStack.a) {
|
||||
if (newItem == null || newItem == ItemStack.a) { // ItemStack.a is returned if the stack is not valid
|
||||
newItem = new ItemStack(Blocks.BEDROCK);
|
||||
}
|
||||
|
||||
|
@ -40,23 +40,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void B_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -65,35 +65,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,22 +124,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,17 +50,17 @@ public class VersionNMSManager implements NMSManager {
|
||||
}
|
||||
|
||||
public void registerCustomEntity(Class<? extends Entity> entityClass, int id) throws Exception {
|
||||
// Use reflection to get the RegistryID of entities.
|
||||
// Use reflection to get the RegistryID of entities
|
||||
RegistryID<Class<? extends Entity>> registryID = REGISTRY_ID_FIELD.get(EntityTypes.b);
|
||||
Object[] idToClassMap = ID_TO_CLASS_MAP_FIELD.get(registryID);
|
||||
|
||||
// Save the the ID -> entity class mapping before the registration.
|
||||
// Save the the ID -> entity class mapping before the registration
|
||||
Object oldValue = idToClassMap[id];
|
||||
|
||||
// Register the entity class.
|
||||
// Register the entity class
|
||||
registryID.a(entityClass, id);
|
||||
|
||||
// Restore the ID -> entity class mapping.
|
||||
// Restore the ID -> entity class mapping
|
||||
idToClassMap[id] = oldValue;
|
||||
}
|
||||
|
||||
|
@ -24,14 +24,14 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Armor stand class
|
||||
// Methods from ArmorStand class
|
||||
|
||||
@Override public void setArms(boolean arms) {}
|
||||
@Override public void setBasePlate(boolean basePlate) {}
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Entity
|
||||
|
@ -23,11 +23,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from LivingEntity class
|
||||
|
@ -56,15 +56,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -72,9 +72,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -82,35 +82,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -130,34 +130,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -166,7 +166,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -191,7 +191,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,65 +38,65 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void d(EntityHuman human) {
|
||||
if (human.locY < super.locY - 1.5 || human.locY > super.locY + 1.0) {
|
||||
// Too low or too high, it's a bit weird.
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,13 +116,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -151,9 +150,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void setItemStackNMS(org.bukkit.inventory.ItemStack stack) {
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack); // ItemStack.a is returned if the stack is not valid
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
if (newItem == null || newItem == ItemStack.a) {
|
||||
if (newItem == null || newItem == ItemStack.a) { // ItemStack.a is returned if the stack is not valid
|
||||
newItem = new ItemStack(Blocks.BEDROCK);
|
||||
}
|
||||
|
||||
|
@ -41,23 +41,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -66,35 +66,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,22 +125,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,17 +56,17 @@ public class VersionNMSManager implements NMSManager {
|
||||
}
|
||||
|
||||
public void registerCustomEntity(Class<? extends Entity> entityClass, int id) throws Exception {
|
||||
// Use reflection to get the RegistryID of entities.
|
||||
// Use reflection to get the RegistryID of entities
|
||||
RegistryID<EntityTypes<?>> registryID = REGISTRY_ID_FIELD.get(EntityTypes.REGISTRY);
|
||||
Object[] idToClassMap = ID_TO_CLASS_MAP_FIELD.get(registryID);
|
||||
|
||||
// Save the the ID -> EntityTypes mapping before the registration.
|
||||
// Save the the ID -> EntityTypes mapping before the registration
|
||||
Object oldValue = idToClassMap[id];
|
||||
|
||||
// Register the EntityTypes object.
|
||||
// Register the EntityTypes object
|
||||
registryID.a(new EntityTypes<>(entityClass, world -> null, true, true, null), id);
|
||||
|
||||
// Restore the ID -> EntityTypes mapping.
|
||||
// Restore the ID -> EntityTypes mapping
|
||||
idToClassMap[id] = oldValue;
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ public class VersionNMSManager implements NMSManager {
|
||||
nmsWorld.getChunkAt(chunkX, chunkZ).a(nmsEntity);
|
||||
if (NMSCommons.IS_PAPER_SERVER) {
|
||||
try {
|
||||
// Workaround because nmsWorld.entityList is a different class in Paper, if used without reflection it throws NoSuchFieldError.
|
||||
// Workaround because nmsWorld.entityList is a different class in Paper, if used without reflection it throws NoSuchFieldError
|
||||
ENTITY_LIST_FIELD.get(nmsWorld).add(nmsEntity);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -24,14 +24,14 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Armor stand class
|
||||
// Methods from ArmorStand class
|
||||
|
||||
@Override public void setArms(boolean arms) {}
|
||||
@Override public void setBasePlate(boolean basePlate) {}
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Entity
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from LivingEntity class
|
||||
|
@ -56,15 +56,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -72,9 +72,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -82,35 +82,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -130,34 +130,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -166,7 +166,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -191,7 +191,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,65 +38,65 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void d(EntityHuman human) {
|
||||
if (human.locY < super.locY - 1.5 || human.locY > super.locY + 1.0) {
|
||||
// Too low or too high, it's a bit weird.
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,13 +116,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -151,9 +150,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void setItemStackNMS(org.bukkit.inventory.ItemStack stack) {
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack); // ItemStack.a is returned if the stack is not valid
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
if (newItem == null || newItem == ItemStack.a) {
|
||||
if (newItem == null || newItem == ItemStack.a) { // ItemStack.a is returned if the stack is not valid
|
||||
newItem = new ItemStack(Blocks.BEDROCK);
|
||||
}
|
||||
|
||||
|
@ -41,23 +41,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -66,35 +66,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,22 +125,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,17 +57,17 @@ public class VersionNMSManager implements NMSManager {
|
||||
}
|
||||
|
||||
public void registerCustomEntity(Class<? extends Entity> entityClass, int id) throws Exception {
|
||||
// Use reflection to get the RegistryID of entities.
|
||||
// Use reflection to get the RegistryID of entities
|
||||
RegistryID<EntityTypes<?>> registryID = REGISTRY_ID_FIELD.get(IRegistry.ENTITY_TYPE);
|
||||
Object[] idToClassMap = ID_TO_CLASS_MAP_FIELD.get(registryID);
|
||||
|
||||
// Save the the ID -> EntityTypes mapping before the registration.
|
||||
// Save the the ID -> EntityTypes mapping before the registration
|
||||
Object oldValue = idToClassMap[id];
|
||||
|
||||
// Register the EntityTypes object.
|
||||
// Register the EntityTypes object
|
||||
registryID.a(new EntityTypes<>(entityClass, world -> null, true, true, null), id);
|
||||
|
||||
// Restore the ID -> EntityTypes mapping.
|
||||
// Restore the ID -> EntityTypes mapping
|
||||
idToClassMap[id] = oldValue;
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public class VersionNMSManager implements NMSManager {
|
||||
nmsWorld.getChunkAt(chunkX, chunkZ).a(nmsEntity);
|
||||
if (NMSCommons.IS_PAPER_SERVER) {
|
||||
try {
|
||||
// Workaround because nmsWorld.entityList is a different class in Paper, if used without reflection it throws NoSuchFieldError.
|
||||
// Workaround because nmsWorld.entityList is a different class in Paper, if used without reflection it throws NoSuchFieldError
|
||||
ENTITY_LIST_FIELD.get(nmsWorld).add(nmsEntity);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from ArmorStand class
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Item class
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Slime class
|
||||
|
@ -58,15 +58,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -74,9 +74,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -84,35 +84,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,34 +132,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -168,7 +168,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -193,7 +193,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,65 +40,65 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void pickup(EntityHuman human) {
|
||||
if (human.locY < super.locY - 1.5 || human.locY > super.locY + 1.0) {
|
||||
// Too low or too high, it's a bit weird.
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,13 +118,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -153,9 +152,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void setItemStackNMS(org.bukkit.inventory.ItemStack stack) {
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack); // ItemStack.a is returned if the stack is not valid
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
if (newItem == null || newItem == ItemStack.a) {
|
||||
if (newItem == null || newItem == ItemStack.a) { // ItemStack.a is returned if the stack is not valid
|
||||
newItem = new ItemStack(Blocks.BEDROCK);
|
||||
}
|
||||
|
||||
|
@ -43,23 +43,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -68,35 +68,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -127,22 +127,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,17 +56,17 @@ public class VersionNMSManager implements NMSManager {
|
||||
}
|
||||
|
||||
public void registerCustomEntity(Class<? extends Entity> entityClass, int id, float sizeWidth, float sizeHeight) throws Exception {
|
||||
// Use reflection to get the RegistryID of entities.
|
||||
// Use reflection to get the RegistryID of entities
|
||||
RegistryID<EntityTypes<?>> registryID = REGISTRY_ID_FIELD.get(IRegistry.ENTITY_TYPE);
|
||||
Object[] idToClassMap = ID_TO_CLASS_MAP_FIELD.get(registryID);
|
||||
|
||||
// Save the the ID -> EntityTypes mapping before the registration.
|
||||
// Save the the ID -> EntityTypes mapping before the registration
|
||||
Object oldValue = idToClassMap[id];
|
||||
|
||||
// Register the EntityTypes object.
|
||||
// Register the EntityTypes object
|
||||
registryID.a(EntityTypes.a.a(EnumCreatureType.MONSTER).a(sizeWidth, sizeHeight).b().a((String) null), id);
|
||||
|
||||
// Restore the ID -> EntityTypes mapping.
|
||||
// Restore the ID -> EntityTypes mapping
|
||||
idToClassMap[id] = oldValue;
|
||||
}
|
||||
|
||||
@ -170,12 +170,12 @@ public class VersionNMSManager implements NMSManager {
|
||||
try {
|
||||
return chatComponent.getSiblings();
|
||||
} catch (NoSuchMethodError e) {
|
||||
// The method was named differently in older 1.14 versions, use workaround.
|
||||
// The method was named differently in older 1.14 versions, use workaround
|
||||
useNewGetSiblingsMethod = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Access siblings field directly in older 1.14 versions.
|
||||
// Access siblings field directly in older 1.14 versions
|
||||
try {
|
||||
return OLD_SIBLINGS_FIELD.get(chatComponent);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from ArmorStand class
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Item class
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Slime class
|
||||
|
@ -58,15 +58,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -74,9 +74,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -84,35 +84,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,34 +132,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -168,7 +168,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -193,7 +193,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,65 +40,65 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void pickup(EntityHuman human) {
|
||||
if (human.locY() < super.locY() - 1.5 || human.locY() > super.locY() + 1.0) {
|
||||
// Too low or too high, it's a bit weird./
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,13 +118,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -153,9 +152,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void setItemStackNMS(org.bukkit.inventory.ItemStack stack) {
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack); // ItemStack.a is returned if the stack is not valid
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
if (newItem == null || newItem == ItemStack.a) {
|
||||
if (newItem == null || newItem == ItemStack.a) { // ItemStack.a is returned if the stack is not valid
|
||||
newItem = new ItemStack(Blocks.BEDROCK);
|
||||
}
|
||||
|
||||
|
@ -43,23 +43,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -68,35 +68,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -127,22 +127,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,17 +55,17 @@ public class VersionNMSManager implements NMSManager {
|
||||
}
|
||||
|
||||
public void registerCustomEntity(Class<? extends Entity> entityClass, int id, float sizeWidth, float sizeHeight) throws Exception {
|
||||
// Use reflection to get the RegistryID of entities.
|
||||
// Use reflection to get the RegistryID of entities
|
||||
RegistryID<EntityTypes<?>> registryID = REGISTRY_ID_FIELD.get(IRegistry.ENTITY_TYPE);
|
||||
Object[] idToClassMap = ID_TO_CLASS_MAP_FIELD.get(registryID);
|
||||
|
||||
// Save the the ID -> EntityTypes mapping before the registration.
|
||||
// Save the the ID -> EntityTypes mapping before the registration
|
||||
Object oldValue = idToClassMap[id];
|
||||
|
||||
// Register the EntityTypes object.
|
||||
// Register the EntityTypes object
|
||||
registryID.a(EntityTypes.a.a(EnumCreatureType.MONSTER).a(sizeWidth, sizeHeight).b().a((String) null), id);
|
||||
|
||||
// Restore the ID -> EntityTypes mapping.
|
||||
// Restore the ID -> EntityTypes mapping
|
||||
idToClassMap[id] = oldValue;
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from ArmorStand class
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Item class
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Slime class
|
||||
|
@ -58,15 +58,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -74,9 +74,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -84,35 +84,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,34 +132,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -168,7 +168,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void playSound(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -193,7 +193,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,65 +40,65 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void pickup(EntityHuman human) {
|
||||
if (human.locY() < super.locY() - 1.5 || human.locY() > super.locY() + 1.0) {
|
||||
// Too low or too high, it's a bit weird./
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,13 +118,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -153,9 +152,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void setItemStackNMS(org.bukkit.inventory.ItemStack stack) {
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack); // ItemStack.b is returned if the stack is not valid
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
if (newItem == null || newItem == ItemStack.b) {
|
||||
if (newItem == null || newItem == ItemStack.b) { // ItemStack.b is returned if the stack is not valid
|
||||
newItem = new ItemStack(Blocks.BEDROCK);
|
||||
}
|
||||
|
||||
|
@ -43,23 +43,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -68,35 +68,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -127,22 +127,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,17 +55,17 @@ public class VersionNMSManager implements NMSManager {
|
||||
}
|
||||
|
||||
public void registerCustomEntity(Class<? extends Entity> entityClass, int id, float sizeWidth, float sizeHeight) throws Exception {
|
||||
// Use reflection to get the RegistryID of entities.
|
||||
// Use reflection to get the RegistryID of entities
|
||||
RegistryID<EntityTypes<?>> registryID = REGISTRY_ID_FIELD.get(IRegistry.ENTITY_TYPE);
|
||||
Object[] idToClassMap = ID_TO_CLASS_MAP_FIELD.get(registryID);
|
||||
|
||||
// Save the the ID -> EntityTypes mapping before the registration.
|
||||
// Save the the ID -> EntityTypes mapping before the registration
|
||||
Object oldValue = idToClassMap[id];
|
||||
|
||||
// Register the EntityTypes object.
|
||||
// Register the EntityTypes object
|
||||
registryID.a(EntityTypes.Builder.a(EnumCreatureType.MONSTER).a(sizeWidth, sizeHeight).b().a((String) null), id);
|
||||
|
||||
// Restore the ID -> EntityTypes mapping.
|
||||
// Restore the ID -> EntityTypes mapping
|
||||
idToClassMap[id] = oldValue;
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from ArmorStand class
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Item class
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Slime class
|
||||
|
@ -58,15 +58,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -74,9 +74,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -84,35 +84,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,34 +132,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -168,7 +168,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void playSound(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -193,7 +193,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,65 +40,65 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void pickup(EntityHuman human) {
|
||||
if (human.locY() < super.locY() - 1.5 || human.locY() > super.locY() + 1.0) {
|
||||
// Too low or too high, it's a bit weird./
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,13 +118,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -153,9 +152,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void setItemStackNMS(org.bukkit.inventory.ItemStack stack) {
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack); // ItemStack.b is returned if the stack is not valid
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
if (newItem == null || newItem == ItemStack.b) {
|
||||
if (newItem == null || newItem == ItemStack.b) { // ItemStack.b is returned if the stack is not valid
|
||||
newItem = new ItemStack(Blocks.BEDROCK);
|
||||
}
|
||||
|
||||
|
@ -43,23 +43,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -68,35 +68,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -127,22 +127,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from ArmorStand class
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Item class
|
||||
|
@ -24,11 +24,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Slime class
|
||||
|
@ -58,15 +58,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -74,9 +74,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -84,35 +84,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,34 +132,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -168,7 +168,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void playSound(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -193,7 +193,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,65 +40,65 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void pickup(EntityHuman human) {
|
||||
if (human.locY() < super.locY() - 1.5 || human.locY() > super.locY() + 1.0) {
|
||||
// Too low or too high, it's a bit weird./
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,13 +118,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -153,9 +152,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void setItemStackNMS(org.bukkit.inventory.ItemStack stack) {
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack); // ItemStack.b is returned if the stack is not valid
|
||||
ItemStack newItem = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
if (newItem == null || newItem == ItemStack.b) {
|
||||
if (newItem == null || newItem == ItemStack.b) { // ItemStack.b is returned if the stack is not valid
|
||||
newItem = new ItemStack(Blocks.BEDROCK);
|
||||
}
|
||||
|
||||
|
@ -43,23 +43,23 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -68,35 +68,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void saveData(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -127,22 +127,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(IChatBaseComponent ichatbasecomponent) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,14 +24,14 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Armor stand class
|
||||
// Methods from ArmorStand class
|
||||
@Override public void setArms(boolean arms) {}
|
||||
@Override public void setBasePlate(boolean basePlate) {}
|
||||
@Override public void setBodyPose(EulerAngle pose) {}
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Entity
|
||||
|
@ -22,11 +22,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from LivingEntity class
|
||||
|
@ -55,18 +55,18 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
SET_MARKER_METHOD.invoke(this, true);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
DebugLogger.cannotSetArmorStandAsMarker(e);
|
||||
// It will still work, but the offset will be wrong.
|
||||
// It will still work, but the offset will be wrong
|
||||
}
|
||||
super.noclip = true;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void t_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -74,9 +74,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -84,24 +84,24 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
|
||||
@ -117,34 +117,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(EntityHuman human, Vec3D vec3d) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEquipment(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -153,7 +153,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void makeSound(String sound, float f1, float f2) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -178,7 +178,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,54 +38,54 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void t_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void d(EntityHuman human) {
|
||||
if (human.locY < this.locY - 1.5 || human.locY > this.locY + 1.0) {
|
||||
// Too low or too high, it's a bit weird.
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,13 +100,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,12 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void t_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
|
||||
// The slime dies without a vehicle.
|
||||
// The slime dies without a vehicle
|
||||
if (super.vehicle == null) {
|
||||
killEntityNMS();
|
||||
}
|
||||
@ -52,15 +52,15 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -69,24 +69,24 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -112,22 +112,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeSound(String sound, float volume, float pitch) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,14 +24,14 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Armor stand class
|
||||
// Methods from ArmorStand class
|
||||
@Override public void setArms(boolean arms) {}
|
||||
@Override public void setBasePlate(boolean basePlate) {}
|
||||
@Override public void setBodyPose(EulerAngle pose) {}
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Entity
|
||||
|
@ -22,11 +22,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from LivingEntity class
|
||||
|
@ -55,18 +55,18 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
SET_MARKER_METHOD.invoke(this, true);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
DebugLogger.cannotSetArmorStandAsMarker(e);
|
||||
// It will still work, but the offset will be wrong.
|
||||
// It will still work, but the offset will be wrong
|
||||
}
|
||||
super.noclip = true;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void t_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -74,9 +74,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -84,24 +84,24 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
|
||||
@ -117,34 +117,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(EntityHuman human, Vec3D vec3d) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEquipment(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -153,7 +153,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void makeSound(String sound, float f1, float f2) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -178,7 +178,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,54 +38,54 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void t_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void d(EntityHuman human) {
|
||||
if (human.locY < this.locY - 1.5 || human.locY > this.locY + 1.0) {
|
||||
// Too low or too high, it's a bit weird.
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,13 +100,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,12 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void t_() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
|
||||
// The slime dies without a vehicle.
|
||||
// The slime dies without a vehicle
|
||||
if (super.vehicle == null) {
|
||||
killEntityNMS();
|
||||
}
|
||||
@ -52,15 +52,15 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -69,24 +69,24 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -112,22 +112,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeSound(String sound, float volume, float pitch) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,14 +24,14 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Armor stand class
|
||||
// Methods from ArmorStand class
|
||||
@Override public void setArms(boolean arms) {}
|
||||
@Override public void setBasePlate(boolean basePlate) {}
|
||||
@Override public void setBodyPose(EulerAngle pose) {}
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Entity
|
||||
|
@ -22,11 +22,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from LivingEntity class
|
||||
|
@ -55,15 +55,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -71,9 +71,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -81,34 +81,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
|
||||
@ -129,34 +129,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, ItemStack itemstack, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -165,7 +165,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -190,7 +190,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,9 +42,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
|
||||
if (resendMountPacketTicks++ > 20) {
|
||||
@ -60,56 +60,56 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void d(EntityHuman human) {
|
||||
if (human.locY < super.locY - 1.5 || human.locY > super.locY + 1.0) {
|
||||
// Too low or too high, it's a bit weird.
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,13 +129,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,9 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
|
||||
if (resendMountPacketTicks++ > 20) {
|
||||
@ -62,15 +62,15 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -79,34 +79,34 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -137,22 +137,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,14 +24,14 @@ public class CraftNMSArmorStand extends CraftArmorStand {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Armor stand class
|
||||
// Methods from ArmorStand class
|
||||
@Override public void setArms(boolean arms) {}
|
||||
@Override public void setBasePlate(boolean basePlate) {}
|
||||
@Override public void setBodyPose(EulerAngle pose) {}
|
||||
|
@ -20,11 +20,11 @@ public class CraftNMSItem extends CraftItem {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from Entity
|
||||
|
@ -22,11 +22,11 @@ public class CraftNMSSlime extends CraftSlime {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
// Disallow all the bukkit methods.
|
||||
// Disallow all the bukkit methods
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// Cannot be removed, this is the most important to override.
|
||||
// Cannot be removed, this is the most important to override
|
||||
}
|
||||
|
||||
// Methods from LivingEntity class
|
||||
|
@ -54,15 +54,15 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
super.setBasePlate(true);
|
||||
super.setMarker(true);
|
||||
super.collides = false;
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet.
|
||||
super.onGround = true; // Workaround to force EntityTrackerEntry to send a teleport packet
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -70,9 +70,9 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity.
|
||||
// Workaround to force EntityTrackerEntry to send a teleport packet immediately after spawning this entity
|
||||
if (super.onGround) {
|
||||
super.onGround = false;
|
||||
}
|
||||
@ -80,35 +80,35 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
|
||||
@ -129,34 +129,34 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman human, Vec3D vec3d, ItemStack itemstack, EnumHand enumhand) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(int i, ItemStack item) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
// Prevent stand being equipped
|
||||
// Prevent armor stand from being equipped
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -165,7 +165,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -190,7 +190,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,9 +42,9 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
|
||||
if (resendMountPacketTicks++ > 20) {
|
||||
@ -60,57 +60,57 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
// Method called when a player is near.
|
||||
// Method called when a player is near
|
||||
@Override
|
||||
public void d(EntityHuman human) {
|
||||
if (human.locY < super.locY - 1.5 || human.locY > super.locY + 1.0) {
|
||||
// Too low or too high, it's a bit weird.
|
||||
// Too low or too high, it's a bit weird
|
||||
return;
|
||||
}
|
||||
|
||||
if (human instanceof EntityPlayer) {
|
||||
parentHologramLine.onPickup(((EntityPlayer) human).getBukkitEntity());
|
||||
// It is never added to the inventory.
|
||||
// It is never added to the inventory
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -130,13 +130,12 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
// This override prevents items from being picked up by hoppers.
|
||||
// Should have no side effects.
|
||||
// This override prevents items from being picked up by hoppers (should have no side effects)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,9 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
|
||||
if (resendMountPacketTicks++ > 20) {
|
||||
@ -62,15 +62,15 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
// Disable normal ticking for this entity.
|
||||
// Disable normal ticking for this entity
|
||||
|
||||
// So it won't get removed.
|
||||
// So it won't get removed
|
||||
ticksLived = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Prevent bounding box from being changed
|
||||
// Prevent changes to bounding box
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
@ -79,35 +79,35 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound e(NBTTagCompound nbttagcompound) {
|
||||
// Do not save NBT.
|
||||
// Do not save NBT
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void f(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
// Do not load NBT.
|
||||
// Do not load NBT
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,22 +138,22 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
||||
|
||||
@Override
|
||||
public void setCustomName(String customName) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean visible) {
|
||||
// Locks the custom name.
|
||||
// Prevents changes to custom name visibility
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
// Remove sounds.
|
||||
// Remove sounds
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
// Prevent being killed.
|
||||
// Prevent entity from dying
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,7 +55,7 @@ public class HolographicDisplays extends FCommonsPlugin implements ProtocolPacke
|
||||
|
||||
@Override
|
||||
public void onCheckedEnable() throws PluginEnableException {
|
||||
// Warn about plugin reloaders and the /reload command.
|
||||
// Warn about plugin reloaders and the /reload command
|
||||
if (instance != null || System.getProperty("HolographicDisplaysLoaded") != null) {
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
ChatColor.RED + "[HolographicDisplays] Please do not use /reload or plugin reloaders."
|
||||
@ -66,7 +66,7 @@ public class HolographicDisplays extends FCommonsPlugin implements ProtocolPacke
|
||||
System.setProperty("HolographicDisplaysLoaded", "true");
|
||||
instance = this;
|
||||
|
||||
// The bungee chat API is required.
|
||||
// The bungee chat API is required
|
||||
if (!FeatureSupport.CHAT_COMPONENTS) {
|
||||
throw new PluginEnableException(
|
||||
"Holographic Displays requires the new chat API.",
|
||||
@ -102,7 +102,7 @@ public class HolographicDisplays extends FCommonsPlugin implements ProtocolPacke
|
||||
|
||||
PrintableErrorCollector errorCollector = new PrintableErrorCollector();
|
||||
|
||||
// Run only once at startup, before anything else.
|
||||
// Run only once at startup, before anything else
|
||||
try {
|
||||
LegacySymbolsUpgrader.run(configManager, errorCollector);
|
||||
} catch (ConfigException e) {
|
||||
@ -113,7 +113,6 @@ public class HolographicDisplays extends FCommonsPlugin implements ProtocolPacke
|
||||
|
||||
ProtocolLibHook.setup(this, nmsManager, this, errorCollector);
|
||||
|
||||
// Start repeating tasks.
|
||||
placeholderManager.startUpdaterTask(this);
|
||||
|
||||
HologramCommandManager commandManager = new HologramCommandManager(configManager, internalHologramManager, nmsManager);
|
||||
|
@ -73,12 +73,12 @@ class PacketListener extends PacketAdapter {
|
||||
|
||||
NMSEntity nmsEntity = nmsManager.getNMSEntityBaseFromID(event.getPlayer().getWorld(), entityID);
|
||||
if (nmsEntity == null) {
|
||||
return; // Entity not existing or not related to holograms.
|
||||
return; // Entity not existing or not related to holograms
|
||||
}
|
||||
|
||||
if (packetType == PacketType.Play.Server.REL_ENTITY_MOVE || packetType == PacketType.Play.Server.REL_ENTITY_MOVE_LOOK) {
|
||||
if (nmsEntity instanceof NMSArmorStand && packetSettings.sendAccurateLocationPackets()) {
|
||||
event.setCancelled(true); // Don't send relative movement packets for armor stands, only keep precise teleport packets.
|
||||
event.setCancelled(true); // Don't send relative movement packets for armor stands, only keep precise teleport packets
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -153,7 +153,7 @@ class PacketListener extends PacketAdapter {
|
||||
}
|
||||
|
||||
if (replacedCustomNameNMSObject == originalCustomNameNMSObject) {
|
||||
// It means nothing has been replaced, since original custom name has been returned.
|
||||
// It means nothing has been replaced, since original custom name has been returned
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user