Can't reference client code from the server 0__0

This commit is contained in:
Sollace 2019-02-12 16:41:27 +02:00
parent 4585c11a6b
commit 64edc23f2e
2 changed files with 17 additions and 25 deletions

View file

@ -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;
}
}

View file

@ -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.<EntityPlayer>cast(entity).getOwner());
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;
}
}