Fix flugel eye use animation and particles, and make binding interaction less intrusive

This commit is contained in:
Vincent Lee committed 2017-07-22 21:42:49 -05:00
1 parent 03ece97fdf
commit 6fc22e19da
2 files changed
+25 -13

No files matched your search

@@ -31,6 +31,8 @@ import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.network.PacketBotaniaEffect;
import vazkii.botania.common.network.PacketHandler;
import javax.annotation.Nonnull;
@@ -65,15 +67,17 @@ public class ItemFlugelEye extends ItemRelic implements ICoordBoundItem, IManaUs
ItemNBTHelper.setInt(stack, TAG_DIMENSION, world.provider.getDimension());
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1F, 5F);
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.SUCCESS;
return EnumActionResult.PASS;
}
@Override
public void onUsingTick(ItemStack stack, EntityLivingBase living, int count) {
float x = (float) (living.posX - Math.random() * living.width);
float y = (float) (living.posY - 1.6 + Math.random());
float y = (float) (living.posY + Math.random());
float z = (float) (living.posZ - Math.random() * living.width);
Botania.proxy.wispFX(x, y, z, (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random() * 0.7F, -0.05F - (float) Math.random() * 0.05F);
}
@@ -101,7 +105,7 @@ public class ItemFlugelEye extends ItemRelic implements ICoordBoundItem, IManaUs
if(y > -1 && dim == world.provider.getDimension() && ManaItemHandler.requestManaExact(stack, player, cost, true)) {
moveParticlesAndSound(player);
if(player instanceof EntityPlayerMP && !world.isRemote)
if(player instanceof EntityPlayerMP)
((EntityPlayerMP) player).connection.setPlayerLocation(x + 0.5, y + 1.6, z + 0.5, player.rotationYaw, player.rotationPitch);
moveParticlesAndSound(player);
}
@@ -110,14 +114,8 @@ public class ItemFlugelEye extends ItemRelic implements ICoordBoundItem, IManaUs
}
private static void moveParticlesAndSound(Entity entity) {
for(int i = 0; i < 15; i++) {
float x = (float) (entity.posX + Math.random());
float y = (float) (entity.posY - 1.6 + Math.random());
float z = (float) (entity.posZ + Math.random());
Botania.proxy.wispFX(x, y, z, (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), -0.3F + (float) Math.random() * 0.2F);
}
if(!entity.world.isRemote)
entity.world.playSound(null, entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1F, 1F);
PacketHandler.sendToNearby(entity.world, entity, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.FLUGEL_EFFECT, entity.posX, entity.posY, entity.posZ, entity.getEntityId()));
entity.world.playSound(null, entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1F, 1F);
}
@Override
@@ -128,7 +126,7 @@ public class ItemFlugelEye extends ItemRelic implements ICoordBoundItem, IManaUs
@Nonnull
@Override
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
return EnumAction.BLOCK;
return EnumAction.BOW;
}
@Override
@@ -297,6 +297,19 @@ public class PacketBotaniaEffect implements IMessage {
float blue = (float) Math.random();
Botania.proxy.sparkleFX(message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 1, message.z + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
}
break;
}
case FLUGEL_EFFECT: {
Entity entity = world.getEntityByID(message.args[0]);
if(entity != null) {
for(int i = 0; i < 15; i++) {
float x = (float) (entity.posX + Math.random());
float y = (float) (entity.posY + Math.random());
float z = (float) (entity.posZ + Math.random());
Botania.proxy.wispFX(x, y, z, (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), -0.3F + (float) Math.random() * 0.2F);
}
}
break;
}
}
}
@@ -321,7 +334,8 @@ public class PacketBotaniaEffect implements IMessage {
BREWERY_FINISH(1), // Arg: RGB
TERRA_PLATE(0),
APOTHECARY_CRAFT(0),
RUNE_CRAFT(0);
RUNE_CRAFT(0),
FLUGEL_EFFECT(1); // Arg: Entity ID
private final int argCount;