mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-08 11:51:35 +01:00
Other small fixes.
This commit is contained in:
parent
2f1a8bde28
commit
493ea07880
@ -1,6 +1,6 @@
|
|||||||
name: HolographicDisplays
|
name: HolographicDisplays
|
||||||
main: com.gmail.filoghost.holograms.HolographicDisplays
|
main: com.gmail.filoghost.holograms.HolographicDisplays
|
||||||
version: 1.8.11
|
version: 1.8.12
|
||||||
|
|
||||||
softdepend: [Multiverse-Core, MultiWorld, My Worlds, My_Worlds, ProtocolLib]
|
softdepend: [Multiverse-Core, MultiWorld, My Worlds, My_Worlds, ProtocolLib]
|
||||||
|
|
||||||
|
@ -30,6 +30,9 @@ public class EntityCustomItem extends EntityItem implements CustomItem, BasicEnt
|
|||||||
public EntityCustomItem(World world) {
|
public EntityCustomItem(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
super.pickupDelay = Integer.MAX_VALUE;
|
super.pickupDelay = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
// To fix the bounding box
|
||||||
|
a(0.05f, 1.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -62,6 +65,11 @@ public class EntityCustomItem extends EntityItem implements CustomItem, BasicEnt
|
|||||||
@Override
|
@Override
|
||||||
public void d(EntityHuman human) {
|
public void d(EntityHuman human) {
|
||||||
|
|
||||||
|
if (human.locY < this.locY + 0.5) {
|
||||||
|
// Too low, it's a bit weird.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (parent instanceof FloatingItem && human instanceof EntityPlayer) {
|
if (parent instanceof FloatingItem && human instanceof EntityPlayer) {
|
||||||
|
|
||||||
FloatingItem floatingItemParent = (FloatingItem) parent;
|
FloatingItem floatingItemParent = (FloatingItem) parent;
|
||||||
@ -107,7 +115,7 @@ public class EntityCustomItem extends EntityItem implements CustomItem, BasicEnt
|
|||||||
* It's only used while saving NBTTags, but since the entity would be killed
|
* It's only used while saving NBTTags, but since the entity would be killed
|
||||||
* on chunk unload, we prefer to override isInvulnerable().
|
* on chunk unload, we prefer to override isInvulnerable().
|
||||||
*/
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -135,7 +143,7 @@ public class EntityCustomItem extends EntityItem implements CustomItem, BasicEnt
|
|||||||
public CraftEntity getBukkitEntity() {
|
public CraftEntity getBukkitEntity() {
|
||||||
if (super.bukkitEntity == null) {
|
if (super.bukkitEntity == null) {
|
||||||
this.bukkitEntity = new CraftCustomItem(this.world.getServer(), this);
|
this.bukkitEntity = new CraftCustomItem(this.world.getServer(), this);
|
||||||
}
|
}
|
||||||
return this.bukkitEntity;
|
return this.bukkitEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +176,7 @@ public class EntityCustomItem extends EntityItem implements CustomItem, BasicEnt
|
|||||||
NBTTagCompound display = newItem.getTag().getCompound("display");
|
NBTTagCompound display = newItem.getTag().getCompound("display");
|
||||||
|
|
||||||
if (!newItem.getTag().hasKey("display")) {
|
if (!newItem.getTag().hasKey("display")) {
|
||||||
newItem.getTag().set("display", display);
|
newItem.getTag().set("display", display);
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagList tagList = new NBTTagList();
|
NBTTagList tagList = new NBTTagList();
|
||||||
@ -179,7 +187,6 @@ public class EntityCustomItem extends EntityItem implements CustomItem, BasicEnt
|
|||||||
setItemStack(newItem);
|
setItemStack(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HologramBase getParentHologram() {
|
public HologramBase getParentHologram() {
|
||||||
return parent;
|
return parent;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.filoghost.holograms.nms.v1_8_R1;
|
package com.gmail.filoghost.holograms.nms.v1_8_R1;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R1.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_8_R1.DamageSource;
|
import net.minecraft.server.v1_8_R1.DamageSource;
|
||||||
import net.minecraft.server.v1_8_R1.Entity;
|
import net.minecraft.server.v1_8_R1.Entity;
|
||||||
import net.minecraft.server.v1_8_R1.EntityArmorStand;
|
import net.minecraft.server.v1_8_R1.EntityArmorStand;
|
||||||
@ -33,7 +34,7 @@ public class EntityHologramArmorStand extends EntityArmorStand implements Hologr
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// There's still the overridden method.
|
// There's still the overridden method.
|
||||||
}
|
}
|
||||||
a(0.0F, 0.0F);
|
forceSetBoundingBox(new NullBoundingBox());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -97,6 +98,14 @@ public class EntityHologramArmorStand extends EntityArmorStand implements Hologr
|
|||||||
// Prevent stand being equipped
|
// Prevent stand being equipped
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void a(AxisAlignedBB boundingBox) {
|
||||||
|
// Do not change it!
|
||||||
|
}
|
||||||
|
|
||||||
|
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||||
|
super.a(boundingBox);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void s_() {
|
public void s_() {
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
|
|||||||
import com.gmail.filoghost.holograms.nms.interfaces.TouchSlime;
|
import com.gmail.filoghost.holograms.nms.interfaces.TouchSlime;
|
||||||
import com.gmail.filoghost.holograms.object.HologramBase;
|
import com.gmail.filoghost.holograms.object.HologramBase;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R1.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_8_R1.DamageSource;
|
import net.minecraft.server.v1_8_R1.DamageSource;
|
||||||
import net.minecraft.server.v1_8_R1.EntitySlime;
|
import net.minecraft.server.v1_8_R1.EntitySlime;
|
||||||
import net.minecraft.server.v1_8_R1.NBTTagCompound;
|
import net.minecraft.server.v1_8_R1.NBTTagCompound;
|
||||||
@ -18,9 +19,18 @@ public class EntityTouchSlime extends EntitySlime implements TouchSlime {
|
|||||||
public EntityTouchSlime(World world) {
|
public EntityTouchSlime(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
super.persistent = true;
|
super.persistent = true;
|
||||||
a(0.0F, 0.0F);
|
|
||||||
setSize(1);
|
setSize(1);
|
||||||
setInvisible(true);
|
setInvisible(true);
|
||||||
|
forceSetBoundingBox(new NullBoundingBox());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void a(AxisAlignedBB boundingBox) {
|
||||||
|
// Do not change it!
|
||||||
|
}
|
||||||
|
|
||||||
|
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||||
|
super.a(boundingBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,7 +11,6 @@ import com.gmail.filoghost.holograms.exception.SpawnFailedException;
|
|||||||
import com.gmail.filoghost.holograms.object.pieces.FloatingItemDoubleEntity;
|
import com.gmail.filoghost.holograms.object.pieces.FloatingItemDoubleEntity;
|
||||||
import com.gmail.filoghost.holograms.object.pieces.FloatingTouchSlimeDoubleEntity;
|
import com.gmail.filoghost.holograms.object.pieces.FloatingTouchSlimeDoubleEntity;
|
||||||
import com.gmail.filoghost.holograms.utils.Validator;
|
import com.gmail.filoghost.holograms.utils.Validator;
|
||||||
import com.gmail.filoghost.holograms.utils.VisibilityManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is only used by the plugin itself. Other plugins should just use the API.
|
* This class is only used by the plugin itself. Other plugins should just use the API.
|
||||||
@ -20,7 +19,6 @@ import com.gmail.filoghost.holograms.utils.VisibilityManager;
|
|||||||
public class CraftFloatingItem extends HologramBase implements FloatingItem {
|
public class CraftFloatingItem extends HologramBase implements FloatingItem {
|
||||||
|
|
||||||
protected FloatingItemDoubleEntity floatingItemDoubleEntity;
|
protected FloatingItemDoubleEntity floatingItemDoubleEntity;
|
||||||
protected VisibilityManager visibilityManager;
|
|
||||||
|
|
||||||
protected long creationTimestamp;
|
protected long creationTimestamp;
|
||||||
|
|
||||||
@ -40,18 +38,6 @@ public class CraftFloatingItem extends HologramBase implements FloatingItem {
|
|||||||
return creationTimestamp;
|
return creationTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisibilityManager(VisibilityManager visibilityManager) {
|
|
||||||
this.visibilityManager = visibilityManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasVisibilityManager() {
|
|
||||||
return visibilityManager != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VisibilityManager getVisibilityManager() {
|
|
||||||
return visibilityManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTouchHandler(ItemTouchHandler touchHandler) {
|
public void setTouchHandler(ItemTouchHandler touchHandler) {
|
||||||
this.touchHandler = touchHandler;
|
this.touchHandler = touchHandler;
|
||||||
|
@ -9,18 +9,20 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import com.gmail.filoghost.holograms.Configuration;
|
import com.gmail.filoghost.holograms.Configuration;
|
||||||
|
import com.gmail.filoghost.holograms.utils.GenericUtils;
|
||||||
|
|
||||||
public class PlaceholdersList {
|
public class PlaceholdersList {
|
||||||
|
|
||||||
|
|
||||||
// Each 2 tenths of second
|
// Each 2 tenths of second
|
||||||
private static final Placeholder RAINBOW_TEXT = new AnimatedPlaceholder("&u", 2, new String[] {
|
private static final Placeholder RAINBOW_TEXT = new AnimatedPlaceholder("&u", 2, GenericUtils.arrayToStrings(
|
||||||
ChatColor.RED + "",
|
ChatColor.RED,
|
||||||
ChatColor.GOLD + "",
|
ChatColor.GOLD,
|
||||||
ChatColor.YELLOW + "",
|
ChatColor.YELLOW,
|
||||||
ChatColor.GREEN + "",
|
ChatColor.GREEN,
|
||||||
ChatColor.AQUA + "",
|
ChatColor.AQUA,
|
||||||
ChatColor.LIGHT_PURPLE + ""
|
ChatColor.LIGHT_PURPLE
|
||||||
});
|
));
|
||||||
|
|
||||||
// Each second
|
// Each second
|
||||||
private static final Placeholder ONLINE_PLAYERS = new Placeholder("{online}", "{o}", 10) {
|
private static final Placeholder ONLINE_PLAYERS = new Placeholder("{online}", "{o}", 10) {
|
||||||
|
@ -2,6 +2,15 @@ package com.gmail.filoghost.holograms.utils;
|
|||||||
|
|
||||||
public class GenericUtils {
|
public class GenericUtils {
|
||||||
|
|
||||||
|
public static <T> String[] arrayToStrings(T... array) {
|
||||||
|
String[] result = new String[array.length];
|
||||||
|
for (int i = 0; i < array.length; i++) {
|
||||||
|
result[i] = array[i] != null ? array[i].toString() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static double square(double d) {
|
public static double square(double d) {
|
||||||
return d * d;
|
return d * d;
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,17 @@ package com.gmail.filoghost.holograms.utils;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.server.v1_8_R1.EntityArmorStand;
|
|
||||||
|
|
||||||
public class ReflectionUtils {
|
public class ReflectionUtils {
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
public static void putInPrivateStaticMap(Class clazz, String fieldName, Object key, Object value) throws Exception {
|
public static void putInPrivateStaticMap(Class<?> clazz, String fieldName, Object key, Object value) throws Exception {
|
||||||
Field field = clazz.getDeclaredField(fieldName);
|
Field field = clazz.getDeclaredField(fieldName);
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
Map map = (Map) field.get(null);
|
Map map = (Map) field.get(null);
|
||||||
map.put(key, value);
|
map.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPrivateField(Class<EntityArmorStand> clazz, Object handle, String fieldName, Object value) throws Exception {
|
public static void setPrivateField(Class<?> clazz, Object handle, String fieldName, Object value) throws Exception {
|
||||||
Field field = clazz.getDeclaredField(fieldName);
|
Field field = clazz.getDeclaredField(fieldName);
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
field.set(handle, value);
|
field.set(handle, value);
|
||||||
|
Loading…
Reference in New Issue
Block a user