mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-03 09:29:34 +01:00
Other small fixes.
This commit is contained in:
parent
2f1a8bde28
commit
493ea07880
@ -1,6 +1,6 @@
|
||||
name: HolographicDisplays
|
||||
main: com.gmail.filoghost.holograms.HolographicDisplays
|
||||
version: 1.8.11
|
||||
version: 1.8.12
|
||||
|
||||
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) {
|
||||
super(world);
|
||||
super.pickupDelay = Integer.MAX_VALUE;
|
||||
|
||||
// To fix the bounding box
|
||||
a(0.05f, 1.2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,6 +65,11 @@ public class EntityCustomItem extends EntityItem implements CustomItem, BasicEnt
|
||||
@Override
|
||||
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) {
|
||||
|
||||
FloatingItem floatingItemParent = (FloatingItem) parent;
|
||||
@ -179,7 +187,6 @@ public class EntityCustomItem extends EntityItem implements CustomItem, BasicEnt
|
||||
setItemStack(newItem);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HologramBase getParentHologram() {
|
||||
return parent;
|
||||
|
@ -1,5 +1,6 @@
|
||||
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.Entity;
|
||||
import net.minecraft.server.v1_8_R1.EntityArmorStand;
|
||||
@ -33,7 +34,7 @@ public class EntityHologramArmorStand extends EntityArmorStand implements Hologr
|
||||
} catch (Exception e) {
|
||||
// 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
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Do not change it!
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
super.a(boundingBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
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.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.EntitySlime;
|
||||
import net.minecraft.server.v1_8_R1.NBTTagCompound;
|
||||
@ -18,9 +19,18 @@ public class EntityTouchSlime extends EntitySlime implements TouchSlime {
|
||||
public EntityTouchSlime(World world) {
|
||||
super(world);
|
||||
super.persistent = true;
|
||||
a(0.0F, 0.0F);
|
||||
setSize(1);
|
||||
setInvisible(true);
|
||||
forceSetBoundingBox(new NullBoundingBox());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(AxisAlignedBB boundingBox) {
|
||||
// Do not change it!
|
||||
}
|
||||
|
||||
public void forceSetBoundingBox(AxisAlignedBB boundingBox) {
|
||||
super.a(boundingBox);
|
||||
}
|
||||
|
||||
@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.FloatingTouchSlimeDoubleEntity;
|
||||
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.
|
||||
@ -20,7 +19,6 @@ import com.gmail.filoghost.holograms.utils.VisibilityManager;
|
||||
public class CraftFloatingItem extends HologramBase implements FloatingItem {
|
||||
|
||||
protected FloatingItemDoubleEntity floatingItemDoubleEntity;
|
||||
protected VisibilityManager visibilityManager;
|
||||
|
||||
protected long creationTimestamp;
|
||||
|
||||
@ -40,18 +38,6 @@ public class CraftFloatingItem extends HologramBase implements FloatingItem {
|
||||
return creationTimestamp;
|
||||
}
|
||||
|
||||
public void setVisibilityManager(VisibilityManager visibilityManager) {
|
||||
this.visibilityManager = visibilityManager;
|
||||
}
|
||||
|
||||
public boolean hasVisibilityManager() {
|
||||
return visibilityManager != null;
|
||||
}
|
||||
|
||||
public VisibilityManager getVisibilityManager() {
|
||||
return visibilityManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTouchHandler(ItemTouchHandler touchHandler) {
|
||||
this.touchHandler = touchHandler;
|
||||
|
@ -9,18 +9,20 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.gmail.filoghost.holograms.Configuration;
|
||||
import com.gmail.filoghost.holograms.utils.GenericUtils;
|
||||
|
||||
public class PlaceholdersList {
|
||||
|
||||
|
||||
// Each 2 tenths of second
|
||||
private static final Placeholder RAINBOW_TEXT = new AnimatedPlaceholder("&u", 2, new String[] {
|
||||
ChatColor.RED + "",
|
||||
ChatColor.GOLD + "",
|
||||
ChatColor.YELLOW + "",
|
||||
ChatColor.GREEN + "",
|
||||
ChatColor.AQUA + "",
|
||||
ChatColor.LIGHT_PURPLE + ""
|
||||
});
|
||||
private static final Placeholder RAINBOW_TEXT = new AnimatedPlaceholder("&u", 2, GenericUtils.arrayToStrings(
|
||||
ChatColor.RED,
|
||||
ChatColor.GOLD,
|
||||
ChatColor.YELLOW,
|
||||
ChatColor.GREEN,
|
||||
ChatColor.AQUA,
|
||||
ChatColor.LIGHT_PURPLE
|
||||
));
|
||||
|
||||
// Each second
|
||||
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 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) {
|
||||
return d * d;
|
||||
}
|
||||
|
@ -3,19 +3,17 @@ package com.gmail.filoghost.holograms.utils;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.server.v1_8_R1.EntityArmorStand;
|
||||
|
||||
public class ReflectionUtils {
|
||||
|
||||
@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.setAccessible(true);
|
||||
Map map = (Map) field.get(null);
|
||||
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.setAccessible(true);
|
||||
field.set(handle, value);
|
||||
|
Loading…
Reference in New Issue
Block a user