Add more varied bee particles

This commit is contained in:
mezz committed 2016-06-03 04:30:12 -07:00
1 parent 2f66d0ea82
commit c09cdcdb64
9 files changed
+358 -48

No files matched your search

@@ -11,6 +11,8 @@ public interface IHiveTile {
*/
void calmBees();
boolean isAngry();
/**
* Called when the hive is attacked.
*/
@@ -14,7 +14,6 @@ import com.google.common.collect.ImmutableMap;
import java.io.File;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -23,7 +22,6 @@ import java.util.Random;
import java.util.Set;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockRedFlower;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.passive.EntityVillager;
@@ -71,7 +69,6 @@ import forestry.apiculture.blocks.BlockRegistryApiculture;
import forestry.apiculture.commands.CommandBee;
import forestry.apiculture.entities.EntityMinecartApiary;
import forestry.apiculture.entities.EntityMinecartBeehouse;
import forestry.apiculture.entities.ParticleBee;
import forestry.apiculture.flowers.FlowerRegistry;
import forestry.apiculture.genetics.BeeBranchDefinition;
import forestry.apiculture.genetics.BeeDefinition;
@@ -130,6 +127,7 @@ public class PluginApiculture extends BlankForestryPlugin {
public static ProxyApiculture proxy;
private static final String CONFIG_CATEGORY = "apiculture";
public static String beekeepingMode = "NORMAL";
public static TextureAtlasSprite beeSprite;
private static float secondPrincessChance = 0;
public static final int ticksPerBeeWorkCycle = 550;
public static boolean fancyRenderedBees = false;
@@ -850,7 +848,7 @@ public class PluginApiculture extends BlankForestryPlugin {
for (int i = 0; i < ParticleSnow.sprites.length; i++) {
ParticleSnow.sprites[i] = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/snow." + (i + 1)));
}
ParticleBee.beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
}
private static class EndFlowerAcceptableRule implements IFlowerAcceptableRule {
@@ -0,0 +1,135 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.apiculture.entities;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import forestry.apiculture.PluginApiculture;
public class ParticleBeeExplore extends Particle {
private final Vec3d origin;
private final int brightness;
public ParticleBeeExplore(World world, Vec3d origin, BlockPos destination, int color) {
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
setParticleTexture(PluginApiculture.beeSprite);
this.origin = origin;
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.015;
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.015;
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.015;
particleRed = (color >> 16 & 255) / 255.0F;
particleGreen = (color >> 8 & 255) / 255.0F;
particleBlue = (color & 255) / 255.0F;
this.setSize(0.1F, 0.1F);
this.particleScale *= 0.2F;
this.particleMaxAge = (int) (80.0D / (Math.random() * 0.8D + 0.2D));
this.motionX *= 0.9D;
this.motionY *= 0.015D;
this.motionZ *= 0.9D;
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
this.brightness = this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getCombinedLight(blockpos, 0) : 0;
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.particleAge == this.particleMaxAge / 2) {
this.motionX = (origin.xCoord - this.posX) * 0.03;
this.motionY = (origin.yCoord - this.posY) * 0.03;
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
}
if (this.particleAge < this.particleMaxAge * 0.25) {
// venture out
this.motionX *= 0.92 + 0.3D * rand.nextFloat();
this.motionY = (this.motionY + 0.3 * (-0.5 + rand.nextFloat())) / 2;
this.motionZ *= 0.92 + 0.3D * rand.nextFloat();
} else if (this.particleAge < this.particleMaxAge * 0.5) {
// slow down
this.motionX *= 0.75 + 0.3D * rand.nextFloat();
this.motionY = (this.motionY + 0.3 * (-0.5 + rand.nextFloat())) / 2;
this.motionZ *= 0.75 + 0.3D * rand.nextFloat();
} else if (this.particleAge < this.particleMaxAge * 0.75) {
// venture back
this.motionX *= 0.95;
this.motionY = (origin.yCoord - this.posY) * 0.03;
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
this.motionZ *= 0.95;
} else {
// get to origin
this.motionX = (origin.xCoord - this.posX) * 0.03;
this.motionY = (origin.yCoord - this.posY) * 0.03;
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
}
if (this.particleAge++ >= this.particleMaxAge) {
this.setExpired();
}
}
@Override
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
float minU = 0;
float maxU = 1;
float minV = 0;
float maxV = 1;
if (this.particleTexture != null) {
minU = particleTexture.getMinU();
maxU = particleTexture.getMaxU();
minV = particleTexture.getMinV();
maxV = particleTexture.getMaxV();
}
float f10 = 0.1F * particleScale;
float f11 = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
float f12 = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
float f13 = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
int i = this.getBrightnessForRender(partialTicks);
int j = i >> 16 & 65535;
int k = i & 65535;
worldRendererIn.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
}
// avoid calculating lighting for bees, it is too much processing
@Override
public int getBrightnessForRender(float p_189214_1_) {
return this.brightness;
}
@Override
public int getFXLayer() {
return 1;
}
}
@@ -12,31 +12,27 @@ package forestry.apiculture.entities;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
public class ParticleBee extends Particle {
private final double originX;
private final double originY;
private final double originZ;
import forestry.apiculture.PluginApiculture;
public class ParticleBeeRoundTrip extends Particle {
private final Vec3d origin;
private final BlockPos destination;
private final int brightness;
public static TextureAtlasSprite beeSprite;
public ParticleBee(World world, double x, double y, double z, int color, BlockPos destination) {
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
setParticleTexture(beeSprite);
this.originX = x;
this.originY = y;
this.originZ = z;
public ParticleBeeRoundTrip(World world, Vec3d origin, BlockPos destination, int color) {
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
setParticleTexture(PluginApiculture.beeSprite);
this.origin = origin;
this.destination = destination;
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.015;
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.015;
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.015;
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.02 + 0.1 * rand.nextFloat();
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.015 + 0.1 * rand.nextFloat();
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.02 + 0.1 * rand.nextFloat();
particleRed = (color >> 16 & 255) / 255.0F;
particleGreen = (color >> 8 & 255) / 255.0F;
@@ -65,34 +61,34 @@ public class ParticleBee extends Particle {
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.particleAge == this.particleMaxAge / 2) {
this.motionX = (this.originX - this.posX) * 0.03;
this.motionY = (this.originY - this.posY) * 0.03;
this.motionZ = (this.originZ - this.posZ) * 0.03;
this.motionX = (origin.xCoord - this.posX) * 0.03 + 0.1 * rand.nextFloat();
this.motionY = (origin.yCoord - this.posY) * 0.03 + 0.1 * rand.nextFloat();
this.motionZ = (origin.zCoord - this.posZ) * 0.03 + 0.1 * rand.nextFloat();
}
if (this.particleAge < this.particleMaxAge * 0.25) {
// venture out
this.motionX *= 0.92 + 0.2D * rand.nextFloat();
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
this.motionY = (this.motionY + 0.3 * (-0.5 + rand.nextFloat())) / 2;
this.motionZ *= 0.92 + 0.2D * rand.nextFloat();
} else if (this.particleAge < this.particleMaxAge * 0.5) {
// get to flower destination
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.03;
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.03;
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.1;
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.03;
} else if (this.particleAge < this.particleMaxAge * 0.75) {
// venture back
this.motionX *= 0.95;
this.motionY = (this.originY - this.posY) * 0.03;
this.motionY = (origin.yCoord - this.posY) * 0.03;
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
this.motionZ *= 0.95;
} else {
// get to origin
this.motionX = (this.originX - this.posX) * 0.03;
this.motionY = (this.originY - this.posY) * 0.03;
this.motionX = (origin.xCoord - this.posX) * 0.03;
this.motionY = (origin.yCoord - this.posY) * 0.03;
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
this.motionZ = (this.originZ - this.posZ) * 0.03;
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
}
if (this.particleAge++ >= this.particleMaxAge) {
@@ -134,13 +130,6 @@ public class ParticleBee extends Particle {
return this.brightness;
}
// avoid calculating collisions for bees, it is too much processing
@Override
public void moveEntity(double x, double y, double z) {
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z));
this.resetPositionToBB();
}
@Override
public int getFXLayer() {
return 1;
@@ -0,0 +1,143 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.apiculture.entities;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import forestry.apiculture.PluginApiculture;
public class ParticleBeeTargetEntity extends Particle {
private final Vec3d origin;
private final Entity entity;
private final int brightness;
public ParticleBeeTargetEntity(World world, Vec3d origin, Entity entity, int color) {
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
setParticleTexture(PluginApiculture.beeSprite);
this.origin = origin;
this.entity = entity;
this.motionX = (entity.posX - this.posX) * 0.015;
this.motionY = (entity.posY + 1.62F - this.posY) * 0.015;
this.motionZ = (entity.posZ - this.posZ) * 0.015;
particleRed = (color >> 16 & 255) / 255.0F;
particleGreen = (color >> 8 & 255) / 255.0F;
particleBlue = (color & 255) / 255.0F;
this.setSize(0.1F, 0.1F);
this.particleScale *= 0.2F;
this.particleMaxAge = (int) (80.0D / (Math.random() * 0.8D + 0.2D));
this.motionX *= 0.9D;
this.motionY *= 0.9D;
this.motionZ *= 0.9D;
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
this.brightness = this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getCombinedLight(blockpos, 0) : 0;
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.particleAge == this.particleMaxAge / 2) {
this.motionX = (origin.xCoord - this.posX) * 0.03;
this.motionY = (origin.yCoord - this.posY) * 0.03;
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
}
if (this.particleAge < this.particleMaxAge * 0.5) {
// fly near the entity
this.motionX = (entity.posX - this.posX) * 0.09;
this.motionX = (this.motionX + 0.2 * (-0.5 + rand.nextFloat())) / 2;
this.motionY = (entity.posY + 1.62F - this.posY) * 0.03;
this.motionY = (this.motionY + 0.4 * (-0.5 + rand.nextFloat())) / 4;
this.motionZ = (entity.posZ - this.posZ) * 0.09;
this.motionZ = (this.motionZ + 0.2 * (-0.5 + rand.nextFloat())) / 2;
} else if (this.particleAge < this.particleMaxAge * 0.75) {
// venture back
this.motionX *= 0.95;
this.motionY = (origin.yCoord - this.posY) * 0.03;
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
this.motionZ *= 0.95;
} else {
// get to origin
this.motionX = (origin.xCoord - this.posX) * 0.03;
this.motionY = (origin.yCoord - this.posY) * 0.03;
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
}
if (this.particleAge++ >= this.particleMaxAge) {
this.setExpired();
}
}
@Override
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
float minU = 0;
float maxU = 1;
float minV = 0;
float maxV = 1;
if (this.particleTexture != null) {
minU = particleTexture.getMinU();
maxU = particleTexture.getMaxU();
minV = particleTexture.getMinV();
maxV = particleTexture.getMaxV();
}
float f10 = 0.1F * particleScale;
float f11 = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
float f12 = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
float f13 = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
int i = this.getBrightnessForRender(partialTicks);
int j = i >> 16 & 65535;
int k = i & 65535;
worldRendererIn.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
}
// avoid calculating lighting for bees, it is too much processing
@Override
public int getBrightnessForRender(float p_189214_1_) {
return this.brightness;
}
// avoid calculating collisions
@Override
public void moveEntity(double x, double y, double z) {
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z));
this.resetPositionToBB();
}
@Override
public int getFXLayer() {
return 1;
}
}
@@ -17,7 +17,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.init.MobEffects;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import forestry.api.apiculture.BeeManager;
@@ -105,16 +104,14 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB
@Override
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
Vec3d origin = housing.getBeeFXCoordinates();
IBeekeepingLogic beekeepingLogic = housing.getBeekeepingLogic();
List<BlockPos> flowerPositions = beekeepingLogic.getFlowerPositions();
int beeColor = genome.getPrimary().getSpriteColour(0);
Proxies.render.addBeeHiveFX(housing.getWorldObj(), origin.xCoord, origin.yCoord, origin.zCoord, beeColor, flowerPositions);
Proxies.render.addBeeHiveFX(housing, genome, flowerPositions);
return storedData;
}
protected Vec3i getModifiedArea(IBeeGenome genome, IBeeHousing housing) {
public static Vec3i getModifiedArea(IBeeGenome genome, IBeeHousing housing) {
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1f);
@@ -203,6 +203,11 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
setActive(false);
}
@Override
public boolean isAngry() {
return angry;
}
@Override
public void onAttack(World world, BlockPos pos, EntityPlayer player) {
if (calmTime == 0) {
@@ -23,11 +23,14 @@ import net.minecraft.client.resources.IResourceManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import net.minecraftforge.common.animation.ITimeValue;
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.core.fluids.Fluids;
import forestry.core.models.BlockModelIndex;
import forestry.core.models.ModelIndex;
@@ -115,7 +118,7 @@ public class ProxyRender {
/* FX */
public void addBeeHiveFX(@Nonnull World world, double x, double y, double z, int color, @Nonnull List<BlockPos> flowerPositions) {
public void addBeeHiveFX(@Nonnull IBeeHousing housing, @Nonnull IBeeGenome genome, @Nonnull List<BlockPos> flowerPositions) {
}
public void addEntityHoneyDustFX(World world, double x, double y, double z) {
@@ -28,11 +28,14 @@ import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
@@ -40,7 +43,13 @@ import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.animation.ITimeValue;
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
import forestry.apiculture.entities.ParticleBee;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IHiveTile;
import forestry.apiculture.entities.ParticleBeeExplore;
import forestry.apiculture.entities.ParticleBeeRoundTrip;
import forestry.apiculture.entities.ParticleBeeTargetEntity;
import forestry.apiculture.genetics.alleles.AlleleEffect;
import forestry.apiculture.render.TextureHabitatLocator;
import forestry.core.config.Config;
import forestry.core.config.Constants;
@@ -62,6 +71,7 @@ import forestry.core.tiles.TileBase;
import forestry.core.tiles.TileEscritoire;
import forestry.core.tiles.TileMill;
import forestry.core.tiles.TileNaturalistChest;
import forestry.core.utils.VectUtil;
public class ProxyRenderClient extends ProxyRender {
@@ -188,16 +198,44 @@ public class ProxyRenderClient extends ProxyRender {
}
@Override
public void addBeeHiveFX(@Nonnull World world, double x, double y, double z, int color, @Nonnull List<BlockPos> flowerPositions) {
public void addBeeHiveFX(@Nonnull IBeeHousing housing, @Nonnull IBeeGenome genome, @Nonnull List<BlockPos> flowerPositions) {
World world = housing.getWorldObj();
if (!shouldSpawnParticle(world)) {
return;
}
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
Vec3d particleStart = housing.getBeeFXCoordinates();
int color = genome.getPrimary().getSpriteColour(0);
if (!flowerPositions.isEmpty()) {
BlockPos destination = flowerPositions.get(world.rand.nextInt(flowerPositions.size()));
Particle particle = new ParticleBee(world, x, y, z, color, destination);
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(particle);
int randomInt = world.rand.nextInt(100);
if (housing instanceof IHiveTile) {
if (((IHiveTile) housing).isAngry() || randomInt >= 85) {
List<EntityLivingBase> entitiesInRange = AlleleEffect.getEntitiesInRange(genome, housing, EntityLivingBase.class);
if (!entitiesInRange.isEmpty()) {
EntityLivingBase entity = entitiesInRange.get(world.rand.nextInt(entitiesInRange.size()));
Particle particle = new ParticleBeeTargetEntity(world, particleStart, entity, color);
effectRenderer.addEffect(particle);
return;
}
}
}
if (randomInt < 50) {
BlockPos destination = flowerPositions.get(world.rand.nextInt(flowerPositions.size()));
Particle particle = new ParticleBeeRoundTrip(world, particleStart, destination, color);
effectRenderer.addEffect(particle);
} else {
Vec3i area = AlleleEffect.getModifiedArea(genome, housing);
Vec3i offset = housing.getCoordinates().add(-area.getX() / 2, -area.getY() / 4, -area.getZ() / 2);
BlockPos destination = VectUtil.getRandomPositionInArea(world.rand, area).add(offset);
Particle particle = new ParticleBeeExplore(world, particleStart, destination, color);
effectRenderer.addEffect(particle);
}
}
}