diff --git a/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java b/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java index 8f9a73795..796dc20ca 100644 --- a/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java @@ -305,6 +305,11 @@ public class ClientProxy extends CommonProxy { return entity == Minecraft.getMinecraft().thePlayer; } + @Override + public EntityPlayer getClientPlayer() { + return Minecraft.getMinecraft().thePlayer; + } + @Override public boolean isClientPlayerWearingMonocle() { return ItemMonocle.hasMonocle(Minecraft.getMinecraft().thePlayer); diff --git a/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java b/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java index f514a6b0a..bf43f34f5 100644 --- a/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/src/main/java/vazkii/botania/common/core/proxy/CommonProxy.java @@ -18,6 +18,7 @@ import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.item.EntityEnderCrystal; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemStack; @@ -241,6 +242,10 @@ public class CommonProxy { return false; } + public EntityPlayer getClientPlayer() { + return null; + } + public boolean isClientPlayerWearingMonocle() { return false; } diff --git a/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java b/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java index 4e6adf921..944c17ff3 100644 --- a/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java +++ b/src/main/java/vazkii/botania/common/entity/EntityDoppleganger.java @@ -15,7 +15,6 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; @@ -36,7 +35,6 @@ import net.minecraft.init.Items; import net.minecraft.init.MobEffects; import net.minecraft.init.SoundEvents; import net.minecraft.inventory.EntityEquipmentSlot; -import net.minecraft.item.Item; import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -59,9 +57,6 @@ import net.minecraft.world.BossInfo; import net.minecraft.world.BossInfoServer; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraft.world.storage.loot.LootContext; -import net.minecraft.world.storage.loot.LootTable; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -82,22 +77,23 @@ import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.core.handler.ConfigHandler; import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.item.ModItems; -import vazkii.botania.common.item.relic.ItemRelic; import vazkii.botania.common.lib.LibMisc; +import vazkii.botania.common.network.PacketBotaniaEffect; +import vazkii.botania.common.network.PacketHandler; import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Iterator; import java.util.List; -import java.util.Random; import java.util.UUID; import java.util.regex.Pattern; public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWithShader { + public static final float ARENA_RANGE = 12F; private static final int SPAWN_TICKS = 160; - private static final float RANGE = 12F; private static final float MAX_HP = 800F; private static final int MOB_SPAWN_START_TICKS = 20; @@ -173,50 +169,35 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi return mb.makeSet(); } - public static boolean spawn(EntityPlayer player, ItemStack par1ItemStack, World par3World, BlockPos pos, boolean hard) { - if(par3World.getTileEntity(pos) instanceof TileEntityBeacon && isTruePlayer(player)) { - if(par3World.getDifficulty() == EnumDifficulty.PEACEFUL) { - if(!par3World.isRemote) - player.addChatMessage(new TextComponentTranslation("botaniamisc.peacefulNoob").setStyle(new Style().setColor(TextFormatting.RED))); + public static boolean spawn(EntityPlayer player, ItemStack stack, World world, BlockPos pos, boolean hard) { + if(world.getTileEntity(pos) instanceof TileEntityBeacon && isTruePlayer(player)) { + if(world.getDifficulty() == EnumDifficulty.PEACEFUL) { + player.addChatMessage(new TextComponentTranslation("botaniamisc.peacefulNoob").setStyle(new Style().setColor(TextFormatting.RED))); return false; } for(BlockPos coords : PYLON_LOCATIONS) { BlockPos pos_ = pos.add(coords); - IBlockState state = par3World.getBlockState(pos_); + IBlockState state = world.getBlockState(pos_); Block blockat = state.getBlock(); if(blockat != ModBlocks.pylon || state.getValue(BotaniaStateProps.PYLON_VARIANT) != PylonVariant.GAIA) { - if(!par3World.isRemote) - player.addChatMessage(new TextComponentTranslation("botaniamisc.needsCatalysts").setStyle(new Style().setColor(TextFormatting.RED))); + player.addChatMessage(new TextComponentTranslation("botaniamisc.needsCatalysts").setStyle(new Style().setColor(TextFormatting.RED))); return false; } } - if(!hasProperArena(par3World, pos)) { - for(int i = 0; i < 360; i += 8) { - float r = 1F; - float g = 0F; - float b = 1F; - float rad = i * (float) Math.PI / 180F; - double x = pos.getX() + 0.5 - Math.cos(rad) * RANGE; - double y = pos.getY() + 0.5; - double z = pos.getZ() + 0.5 - Math.sin(rad) * RANGE; + if(!hasProperArena(world, pos)) { + PacketHandler.sendTo((EntityPlayerMP) player, + new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ARENA_INDICATOR, pos.getX(), pos.getY(), pos.getZ())); - Botania.proxy.sparkleFX(par3World, x, y, z, r, g, b, 5F, 120); - } - - if(!par3World.isRemote) - player.addChatMessage(new TextComponentTranslation("botaniamisc.badArena").setStyle(new Style().setColor(TextFormatting.RED))); + player.addChatMessage(new TextComponentTranslation("botaniamisc.badArena").setStyle(new Style().setColor(TextFormatting.RED))); return false; } - par1ItemStack.stackSize--; + stack.stackSize--; - if(par3World.isRemote) - return true; - - EntityDoppleganger e = new EntityDoppleganger(par3World); + EntityDoppleganger e = new EntityDoppleganger(world); e.setPosition(pos.getX() + 0.5, pos.getY() + 3, pos.getZ() + 0.5); e.setInvulTime(SPAWN_TICKS); e.setHealth(1F); @@ -234,7 +215,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi e.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(MAX_HP * playerCount); e.playSound(SoundEvents.entity_enderdragon_growl, 10F, 0.1F); - par3World.spawnEntityInWorld(e); + world.spawnEntityInWorld(e); return true; } @@ -244,10 +225,10 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi private static boolean hasProperArena(World world, BlockPos startPos) { int heightCheck = 3; int heightMin = 2; - int range = (int) Math.ceil(RANGE); + int range = (int) Math.ceil(ARENA_RANGE); for(int i = -range; i < range + 1; i++) for(int j = -range; j < range + 1; j++) { - if(Math.abs(i) == 4 && Math.abs(j) == 4 || vazkii.botania.common.core.helper.MathHelper.pointDistancePlane(i, j, 0, 0) > RANGE) + if(Math.abs(i) == 4 && Math.abs(j) == 4 || vazkii.botania.common.core.helper.MathHelper.pointDistancePlane(i, j, 0, 0) > ARENA_RANGE) continue; // Ignore pylons and out of circle int air = 0; @@ -513,70 +494,97 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi public void onLivingUpdate() { super.onLivingUpdate(); - if (!worldObj.isRemote) { - dataManager.set(BOSSINFO_ID, Optional.of(bossInfo.getUniqueId())); - bossInfo.setPercent(getHealth() / getMaxHealth()); + BlockPos source = getSource(); + float range = ARENA_RANGE; + int invul = getInvulTime(); + + if (worldObj.isRemote) { + for(int i = 0; i < 360; i += 8) { + float r = 0.6F; + float g = 0F; + float b = 0.2F; + float m = 0.15F; + float mv = 0.35F; + + float rad = i * (float) Math.PI / 180F; + double x = source.getX() + 0.5 - Math.cos(rad) * range; + double y = source.getY() + 0.5; + double z = source.getZ() + 0.5 - Math.sin(rad) * range; + + Botania.proxy.wispFX(worldObj, x, y, z, r, g, b, 0.5F, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * mv, (float) (Math.random() - 0.5F) * m); + } + + if(worldObj.isRemote && !isPlayingMusic && !isDead && !getPlayersAround().isEmpty()) { + Botania.proxy.playRecordClientSided(worldObj, source, (ItemRecord) (isHardMode() ? ModItems.recordGaia2 : ModItems.recordGaia1)); + isPlayingMusic = true; + } + + EntityPlayer player = Botania.proxy.getClientPlayer(); + + player.capabilities.isFlying = player.capabilities.isFlying && player.capabilities.isCreativeMode; + + if(invul > 10) { + Vector3 pos = Vector3.fromEntityCenter(this).subtract(new Vector3(0, 0.2, 0)); + for (BlockPos arr : PYLON_LOCATIONS) { + Vector3 pylonPos = new Vector3(source.getX() + arr.getX(), source.getY() + arr.getY(), source.getZ() + arr.getZ()); + double worldTime = ticksExisted; + worldTime /= 5; + + float rad = 0.75F + (float) Math.random() * 0.05F; + double xp = pylonPos.x + 0.5 + Math.cos(worldTime) * rad; + double zp = pylonPos.z + 0.5 + Math.sin(worldTime) * rad; + + Vector3 partPos = new Vector3(xp, pylonPos.y, zp); + Vector3 mot = pos.copy().sub(partPos).multiply(0.04); + + float r = 0.7F + (float) Math.random() * 0.3F; + float g = (float) Math.random() * 0.3F; + float b = 0.7F + (float) Math.random() * 0.3F; + + Botania.proxy.wispFX(worldObj, partPos.x, partPos.y, partPos.z, r, g, b, 0.25F + (float) Math.random() * 0.1F, -0.075F - (float) Math.random() * 0.015F); + Botania.proxy.wispFX(worldObj, partPos.x, partPos.y, partPos.z, r, g, b, 0.4F, (float) mot.x, (float) mot.y, (float) mot.z); + } + } + + return; } + dataManager.set(BOSSINFO_ID, Optional.of(bossInfo.getUniqueId())); + bossInfo.setPercent(getHealth() / getMaxHealth()); + if(!getPassengers().isEmpty()) this.dismountRidingEntity(); - boolean peaceful = worldObj.getDifficulty() == EnumDifficulty.PEACEFUL; - if(!worldObj.isRemote && peaceful) + if(worldObj.getDifficulty() == EnumDifficulty.PEACEFUL) setDead(); - if(!worldObj.isRemote) { - int radius = 1; - int posXInt = MathHelper.floor_double(posX); - int posYInt = MathHelper.floor_double(posY); - int posZInt = MathHelper.floor_double(posZ); - for(int i = -radius; i < radius + 1; i++) - for(int j = -radius; j < radius + 1; j++) - for(int k = -radius; k < radius + 1; k++) { - int xp = posXInt + i; - int yp = posYInt + j; - int zp = posZInt + k; - BlockPos posp = new BlockPos(xp, yp, zp); - if(isCheatyBlock(worldObj, posp)) { - Block block = worldObj.getBlockState(posp).getBlock(); - List items = block.getDrops(worldObj, posp, worldObj.getBlockState(posp), 0); - for(ItemStack stack : items) { - if(ConfigHandler.blockBreakParticles) - worldObj.playAuxSFX(2001, posp, Block.getStateId(worldObj.getBlockState(posp))); - worldObj.spawnEntityInWorld(new EntityItem(worldObj, xp + 0.5, yp + 0.5, zp + 0.5, stack)); - } - worldObj.setBlockToAir(posp); + int radius = 1; + int posXInt = MathHelper.floor_double(posX); + int posYInt = MathHelper.floor_double(posY); + int posZInt = MathHelper.floor_double(posZ); + for(int i = -radius; i < radius + 1; i++) + for(int j = -radius; j < radius + 1; j++) + for(int k = -radius; k < radius + 1; k++) { + int xp = posXInt + i; + int yp = posYInt + j; + int zp = posZInt + k; + BlockPos posp = new BlockPos(xp, yp, zp); + if(isCheatyBlock(worldObj, posp)) { + Block block = worldObj.getBlockState(posp).getBlock(); + List items = block.getDrops(worldObj, posp, worldObj.getBlockState(posp), 0); + for(ItemStack stack : items) { + if(ConfigHandler.blockBreakParticles) + worldObj.playAuxSFX(2001, posp, Block.getStateId(worldObj.getBlockState(posp))); + worldObj.spawnEntityInWorld(new EntityItem(worldObj, xp + 0.5, yp + 0.5, zp + 0.5, stack)); } + worldObj.setBlockToAir(posp); } - } + } - BlockPos source = getSource(); boolean hard = isHardMode(); - float range; List players = getPlayersAround(); int playerCount = getPlayerCount(); - if(worldObj.isRemote && !isPlayingMusic && !isDead && !players.isEmpty()) { - Botania.proxy.playRecordClientSided(worldObj, source, (ItemRecord) (hard ? ModItems.recordGaia2 : ModItems.recordGaia1)); - isPlayingMusic = true; - } - - range = RANGE; - for(int i = 0; i < 360; i += 8) { - float r = 0.6F; - float g = 0F; - float b = 0.2F; - float m = 0.15F; - float mv = 0.35F; - - float rad = i * (float) Math.PI / 180F; - double x = source.getX() + 0.5 - Math.cos(rad) * range; - double y = source.getY() + 0.5; - double z = source.getZ() + 0.5 - Math.sin(rad) * range; - - Botania.proxy.wispFX(worldObj, x, y, z, r, g, b, 0.5F, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * mv, (float) (Math.random() - 0.5F) * m); - } - if(players.isEmpty() && !worldObj.playerEntities.isEmpty()) setDead(); else { @@ -584,16 +592,16 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi if(player.inventory.armorInventory[0] != null || player.inventory.armorInventory[1] != null || player.inventory.armorInventory[2] != null || player.inventory.armorInventory[3] != null) anyWithArmor = true; - List remove = new ArrayList<>(); Collection active = player.getActivePotionEffects(); - for(PotionEffect effect : active) - if(effect.getDuration() < 200 && effect.getIsAmbient() && !effect.getPotion().isBadEffect()) - remove.add(effect); + Iterator iter = active.iterator(); - active.removeAll(remove); + while (iter.hasNext()) { + PotionEffect effect = iter.next(); + if(effect.getDuration() < 200 && effect.getIsAmbient() && !effect.getPotion().isBadEffect()) + iter.remove(); + } player.capabilities.isFlying = player.capabilities.isFlying && player.capabilities.isCreativeMode; - if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5) >= range) { Vector3 sourceVector = new Vector3(source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5); Vector3 playerVector = Vector3.fromEntityCenter(player); @@ -602,6 +610,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi player.motionX = motion.x; player.motionY = 0.2; player.motionZ = motion.z; + player.velocityChanged = true; } } } @@ -609,35 +618,9 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi if(isDead) return; - int invul = getInvulTime(); int mobTicks = getMobSpawnTicks(); boolean spawnMissiles = hard && ticksExisted % 15 < 4; - if(invul > 10) { - Vector3 pos = Vector3.fromEntityCenter(this).subtract(new Vector3(0, 0.2, 0)); - for(int i = 0; i < PYLON_LOCATIONS.length; i++) { - BlockPos arr = PYLON_LOCATIONS[i]; - - Vector3 pylonPos = new Vector3(source.getX() + arr.getX(), source.getY() + arr.getY(), source.getZ() + arr.getZ()); - double worldTime = ticksExisted; - worldTime /= 5; - - float rad = 0.75F + (float) Math.random() * 0.05F; - double xp = pylonPos.x + 0.5 + Math.cos(worldTime) * rad; - double zp = pylonPos.z + 0.5 + Math.sin(worldTime) * rad; - - Vector3 partPos = new Vector3(xp, pylonPos.y, zp); - Vector3 mot = pos.copy().sub(partPos).multiply(0.04); - - float r = 0.7F + (float) Math.random() * 0.3F; - float g = (float) Math.random() * 0.3F; - float b = 0.7F + (float) Math.random() * 0.3F; - - Botania.proxy.wispFX(worldObj, partPos.x, partPos.y, partPos.z, r, g, b, 0.25F + (float) Math.random() * 0.1F, -0.075F - (float) Math.random() * 0.015F); - Botania.proxy.wispFX(worldObj, partPos.x, partPos.y, partPos.z, r, g, b, 0.4F, (float) mot.x, (float) mot.y, (float) mot.z); - } - } - if(invul > 0 && mobTicks == MOB_SPAWN_TICKS) { if(invul < SPAWN_TICKS) { if(invul > SPAWN_TICKS / 2 && worldObj.rand.nextInt(SPAWN_TICKS - invul + 1) == 0) @@ -645,10 +628,9 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi spawnExplosionParticle(); } - if(!worldObj.isRemote) { - setHealth(getHealth() + (getMaxHealth() - 1F) / SPAWN_TICKS); - setInvulTime(invul - 1); - } + setHealth(getHealth() + (getMaxHealth() - 1F) / SPAWN_TICKS); + setInvulTime(invul - 1); + motionY = 0; } else { if(isAggroed()) { @@ -664,7 +646,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi setInvulTime(invul + 1); } - if(reverseTicks > MOB_SPAWN_START_TICKS * 2 && mobTicks > MOB_SPAWN_END_TICKS && mobTicks % MOB_SPAWN_WAVE_TIME == 0 && !worldObj.isRemote) { + if(reverseTicks > MOB_SPAWN_START_TICKS * 2 && mobTicks > MOB_SPAWN_END_TICKS && mobTicks % MOB_SPAWN_WAVE_TIME == 0) { for(int pl = 0; pl < playerCount; pl++) for(int i = 0; i < 3 + worldObj.rand.nextInt(2); i++) { EntityLiving entity = null; @@ -697,6 +679,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi } if(entity != null) { + if(!entity.isImmuneToFire()) + entity.addPotionEffect(new PotionEffect(MobEffects.fireResistance, 30, 0)); range = 6F; entity.setPosition(posX + 0.5 + Math.random() * range - range / 2, posY - 1, posZ + 0.5 + Math.random() * range - range / 2); worldObj.spawnEntityInWorld(entity); @@ -712,7 +696,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi setMobSpawnTicks(mobTicks - 1); setTPDelay(10); - } else if(getTPDelay() > 0 && !worldObj.isRemote) { + } else if(getTPDelay() > 0) { if(invul > 0) setInvulTime(invul - 1); @@ -786,13 +770,11 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi } private void spawnMissile() { - if(!worldObj.isRemote) { - EntityMagicMissile missile = new EntityMagicMissile(this, true); - missile.setPosition(posX + (Math.random() - 0.5 * 0.1), posY + 2.4 + (Math.random() - 0.5 * 0.1), posZ + (Math.random() - 0.5 * 0.1)); - if(missile.getTarget()) { - this.playSound(BotaniaSoundEvents.missile, 0.6F, 0.8F + (float) Math.random() * 0.2F); - worldObj.spawnEntityInWorld(missile); - } + EntityMagicMissile missile = new EntityMagicMissile(this, true); + missile.setPosition(posX + (Math.random() - 0.5 * 0.1), posY + 2.4 + (Math.random() - 0.5 * 0.1), posZ + (Math.random() - 0.5 * 0.1)); + if(missile.getTarget()) { + this.playSound(BotaniaSoundEvents.missile, 0.6F, 0.8F + (float) Math.random() * 0.2F); + worldObj.spawnEntityInWorld(missile); } } diff --git a/src/main/java/vazkii/botania/common/item/ItemGrassSeeds.java b/src/main/java/vazkii/botania/common/item/ItemGrassSeeds.java index a22f8c693..d62d851a2 100644 --- a/src/main/java/vazkii/botania/common/item/ItemGrassSeeds.java +++ b/src/main/java/vazkii/botania/common/item/ItemGrassSeeds.java @@ -270,7 +270,7 @@ public class ItemGrassSeeds extends ItemMod implements IFloatingFlowerVariant { public boolean tick() { ++ticksExisted; - // Go through all blocks in the specified RANGE, and then + // Go through all blocks in the specified ARENA_RANGE, and then // try and spread around that block if it is our target block already for(int i = -RANGE; i <= RANGE; i++) { for(int j = -RANGE; j <= RANGE; j++) { diff --git a/src/main/java/vazkii/botania/common/item/material/ItemManaResource.java b/src/main/java/vazkii/botania/common/item/material/ItemManaResource.java index a6f22093f..2912e2b89 100644 --- a/src/main/java/vazkii/botania/common/item/material/ItemManaResource.java +++ b/src/main/java/vazkii/botania/common/item/material/ItemManaResource.java @@ -87,7 +87,7 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve @Override public EnumActionResult onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10) { if(par1ItemStack.getItemDamage() == 4 || par1ItemStack.getItemDamage() == 14) - return EntityDoppleganger.spawn(par2EntityPlayer, par1ItemStack, par3World, pos, par1ItemStack.getItemDamage() == 14) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; + return par3World.isRemote || EntityDoppleganger.spawn(par2EntityPlayer, par1ItemStack, par3World, pos, par1ItemStack.getItemDamage() == 14) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; else if(par1ItemStack.getItemDamage() == 20 && net.minecraft.item.ItemDye.applyBonemeal(par1ItemStack, par3World, pos, par2EntityPlayer)) { if(!par3World.isRemote) par3World.playAuxSFX(2005, pos, 0); diff --git a/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java b/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java index 9def12676..72e58fca7 100644 --- a/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java +++ b/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java @@ -3,7 +3,6 @@ package vazkii.botania.common.network; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.item.EnumDyeColor; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.network.ByteBufUtils; @@ -14,6 +13,7 @@ import vazkii.botania.client.core.handler.LightningHandler; import vazkii.botania.common.Botania; import vazkii.botania.common.core.handler.ConfigHandler; import vazkii.botania.common.core.helper.Vector3; +import vazkii.botania.common.entity.EntityDoppleganger; public class PacketBotaniaEffect implements IMessage { @@ -99,6 +99,19 @@ public class PacketBotaniaEffect implements IMessage { } break; } + case ARENA_INDICATOR: { + for(int i = 0; i < 360; i += 8) { + float r = 1F; + float g = 0F; + float b = 1F; + float rad = i * (float) Math.PI / 180F; + double x = message.x + 0.5 - Math.cos(rad) * EntityDoppleganger.ARENA_RANGE; + double y = message.y + 0.5; + double z = message.z + 0.5 - Math.sin(rad) * EntityDoppleganger.ARENA_RANGE; + + Botania.proxy.sparkleFX(Minecraft.getMinecraft().theWorld, x, y, z, r, g, b, 5F, 120); + } + } } }); @@ -110,7 +123,8 @@ public class PacketBotaniaEffect implements IMessage { public enum EffectType { POOL_CRAFT(0), POOL_CHARGE(1), // Arg: 1 if outputting, 0 if inputting - PAINT_LENS(1); // Arg: colour + PAINT_LENS(1), // Arg: colour + ARENA_INDICATOR(0); private final int argCount; diff --git a/src/main/java/vazkii/botania/common/network/PacketHandler.java b/src/main/java/vazkii/botania/common/network/PacketHandler.java index 706771969..0035991b5 100644 --- a/src/main/java/vazkii/botania/common/network/PacketHandler.java +++ b/src/main/java/vazkii/botania/common/network/PacketHandler.java @@ -43,6 +43,10 @@ public final class PacketHandler { } } + public static void sendTo(EntityPlayerMP playerMP, IMessage toSend) { + HANDLER.sendTo(toSend, playerMP); + } + private PacketHandler() {} }