From 64edc23f2e74fff1ad92603bc3e30cbc729b60e2 Mon Sep 17 00:00:00 2001 From: Sollace Date: Tue, 12 Feb 2019 16:41:27 +0200 Subject: [PATCH] Can't reference client code from the server 0__0 --- .../unicopia/render/DisguiseRenderer.java | 9 +---- .../unicopia/spell/SpellDisguise.java | 33 +++++++++---------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/render/DisguiseRenderer.java b/src/main/java/com/minelittlepony/unicopia/render/DisguiseRenderer.java index 8f1b102b..506d2c01 100644 --- a/src/main/java/com/minelittlepony/unicopia/render/DisguiseRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/render/DisguiseRenderer.java @@ -7,8 +7,6 @@ import com.minelittlepony.unicopia.spell.SpellDisguise; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityFallingBlock; -import net.minecraft.entity.monster.EntityShulker; public class DisguiseRenderer { @@ -25,7 +23,7 @@ public class DisguiseRenderer { if (entity.getEntityData().hasKey("disguise") && entity.getEntityData().getBoolean("disguise")) { - renderMan.setRenderShadow(!isAttachedEntity(entity)); + renderMan.setRenderShadow(!SpellDisguise.isAttachedEntity(entity)); renderDisguise(renderMan, entity); renderMan.setRenderShadow(false); @@ -80,9 +78,4 @@ public class DisguiseRenderer { return true; } - - public boolean isAttachedEntity(Entity entity) { - return entity instanceof EntityShulker - || entity instanceof EntityFallingBlock; - } } diff --git a/src/main/java/com/minelittlepony/unicopia/spell/SpellDisguise.java b/src/main/java/com/minelittlepony/unicopia/spell/SpellDisguise.java index bfbc4761..aad266b3 100644 --- a/src/main/java/com/minelittlepony/unicopia/spell/SpellDisguise.java +++ b/src/main/java/com/minelittlepony/unicopia/spell/SpellDisguise.java @@ -235,7 +235,7 @@ public class SpellDisguise extends AbstractSpell implements IFlyingPredicate, IP } } - if (DisguiseRenderer.instance().isAttachedEntity(entity)) { + if (isAttachedEntity(entity)) { entity.posX = Math.floor(owner.posX) + 0.5; entity.posY = Math.floor(owner.posY + 0.2); @@ -408,28 +408,22 @@ public class SpellDisguise extends AbstractSpell implements IFlyingPredicate, IP @Override public boolean checkCanFly(IPlayer player) { - if (!player.getPlayerSpecies().canFly()) { + if (entity == null || !player.getPlayerSpecies().canFly()) { return false; } - if (entity != null) { - if (entity instanceof EntityFlying - || entity instanceof net.minecraft.entity.passive.EntityFlying - || entity instanceof EntityDragon - || entity instanceof EntityAmbientCreature - || entity instanceof EntityShulkerBullet - || ProjectileUtil.isProjectile(entity)) { - return true; - } + if (entity instanceof IOwned) { + IPlayer iplayer = PlayerSpeciesList.instance().getPlayer(IOwned.cast(entity).getOwner()); - if (entity instanceof IOwned) { - IPlayer iplayer = PlayerSpeciesList.instance().getPlayer(IOwned.cast(entity).getOwner()); - - return iplayer != null && iplayer.getPlayerSpecies().canFly(); - } + return iplayer != null && iplayer.getPlayerSpecies().canFly(); } - return false; + return entity instanceof EntityFlying + || entity instanceof net.minecraft.entity.passive.EntityFlying + || entity instanceof EntityDragon + || entity instanceof EntityAmbientCreature + || entity instanceof EntityShulkerBullet + || ProjectileUtil.isProjectile(entity); } @Override @@ -453,4 +447,9 @@ public class SpellDisguise extends AbstractSpell implements IFlyingPredicate, IP } return -1; } + + public static boolean isAttachedEntity(Entity entity) { + return entity instanceof EntityShulker + || entity instanceof EntityFallingBlock; + } }