Work on things

This commit is contained in:
Nedelosk committed 2016-10-27 16:05:15 +02:00
1 parent 5bb4b5d9a5
commit 3bf37f8838
31 files changed
+519 -762

No files matched your search

@@ -11,6 +11,7 @@ import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList;
import java.util.List;
@@ -46,16 +47,16 @@ public class GeneArrayItem implements INbtReadable, INbtWritable, IGeneItem {
@Override
public void getInfo(final List list) {
final List<Object> totalList = new ArrayList<>();
for (final IGene gene : this.genes) {
for (IGene gene : this.genes) {
final String chromosomeName = this.getBreedingSystem().getChromosomeName(gene.getChromosome());
totalList.add("§6" + chromosomeName + "§7: " + gene.getName());
totalList.add(TextFormatting.GOLD + chromosomeName + TextFormatting.GRAY + ": " + gene.getName());
}
if (totalList.size() < 4 || BinnieCore.proxy.isShiftDown()) {
list.addAll(totalList);
} else {
list.add(totalList.get(0));
list.add(totalList.get(1));
list.add(totalList.size() - 2 + " more genes. Hold shift to display.");
list.add(totalList.size() - 2 + " " + Binnie.Language.localise("genetic.item.gene.more.genes"));
}
}
@@ -9,6 +9,7 @@ import forestry.api.core.INbtWritable;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.text.TextFormatting;
import java.util.List;
@@ -51,7 +52,7 @@ public class GeneItem implements INbtReadable, INbtWritable, IGeneItem {
@Override
public void getInfo(final List list) {
final String chromosomeName = this.getBreedingSystem().getChromosomeName(this.gene.getChromosome());
list.add("§6" + chromosomeName + "§7: " + this.gene.getName());
list.add(TextFormatting.GOLD +chromosomeName + TextFormatting.GRAY + ": " + this.gene.getName());
}
public BreedingSystem getBreedingSystem() {
@@ -1,5 +1,7 @@
package binnie.genetics.item;
import binnie.Binnie;
import binnie.core.BinnieCore;
import binnie.core.item.ItemCore;
import binnie.genetics.CreativeTabGenetics;
import binnie.genetics.genetics.IGeneItem;
@@ -14,15 +16,6 @@ import java.util.List;
public abstract class ItemGene extends ItemCore {
// IIcon[] icons;
//
// @Override
// @SideOnly(Side.CLIENT)
// public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
// return this.icons[pass];
// }
@Override
public boolean getShareTag() {
return true;
@@ -33,34 +26,13 @@ public abstract class ItemGene extends ItemCore {
return false;
}
// @Override
// @SideOnly(Side.CLIENT)
// public void registerIcons(final IIconRegister register) {
// this.icons[0] = Genetics.proxy.getIcon(register, "machines/serum.glass");
// this.icons[1] = Genetics.proxy.getIcon(register, "machines/serum.cap");
// this.icons[2] = Genetics.proxy.getIcon(register, "machines/serum.edges");
// this.icons[3] = Genetics.proxy.getIcon(register, "machines/serum.dna");
// }
//
// @Override
// public int getRenderPasses(final int metadata) {
// return 4;
// }
public ItemGene(final String unlocName) {
super(unlocName);
// this.icons = new IIcon[4];
this.setMaxStackSize(1);
this.setMaxDamage(16);
this.setUnlocalizedName(unlocName);
this.setCreativeTab(CreativeTabGenetics.instance);
}
//
// @Override
// public int getColorFromItemStack(final ItemStack itemstack, final int j) {
// final IGeneItem gene = this.getGeneItem(itemstack);
// return gene.getColour(j);
// }
public int getCharges(final ItemStack stack) {
return (stack == null) ? 0 : (stack.getItem().getMaxDamage() - stack.getItemDamage());
@@ -72,11 +44,11 @@ public abstract class ItemGene extends ItemCore {
super.addInformation(itemstack, entityPlayer, list, advanced);
final int damage = this.getMaxDamage() - itemstack.getItemDamage();
if (damage == 0) {
list.add("Empty");
list.add(Binnie.Language.localise("genetic.item.gene.empty"));
} else if (damage == 1) {
list.add("1 Charge");
list.add("1 " + Binnie.Language.localise("genetic.item.gene.charge"));
} else {
list.add(damage + " Charges");
list.add(damage + " " + Binnie.Language.localise("genetic.item.gene.charges"));
}
final IGeneItem gene = this.getGeneItem(itemstack);
gene.getInfo(list);
@@ -89,10 +61,5 @@ public abstract class ItemGene extends ItemCore {
public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
}
// @Override
// public boolean requiresMultipleRenderPasses() {
// return true;
// }
public abstract IGeneItem getGeneItem(final ItemStack p0);
}
@@ -82,8 +82,8 @@ public class ItemSerum extends ItemGene implements IItemSerum {
public String getItemStackDisplayName(final ItemStack itemstack) {
final GeneItem gene = this.getGeneItem(itemstack);
if (!gene.isCorrupted())
return Binnie.Genetics.getSystem(gene.getSpeciesRoot()).getDescriptor() + " Serum";
return "Corrupted Serum";
return Binnie.Genetics.getSystem(gene.getSpeciesRoot()).getDescriptor() + " " + Binnie.Language.localise("genetic.item.gene.serum");
return Binnie.Language.localise("genetic.item.gene.corrupted.serum");
}
@Override
@@ -25,6 +25,7 @@ import binnie.genetics.item.GeneticsItems;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.entity.item.EntityItem;
@@ -32,6 +33,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -195,7 +197,7 @@ public class Analyser {
}
}
public static class ComponentAnalyserFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync {
public static class ComponentAnalyserFX extends MachineComponent implements IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync {
private final EntityItem dummyEntityItem;
public ComponentAnalyserFX(final IMachine machine) {
@@ -205,48 +207,43 @@ public class Analyser {
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
public void onDisplayTick(World world, BlockPos pos, Random rand) {
if (rand.nextFloat() < 1.0f && this.getUtil().getProcess().isInProgress()) {
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 1.3 + rand.nextDouble() * 0.2, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = this.rand.nextDouble() * 2.0 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.05 * (this.rand.nextDouble() - 0.5);
this.motionZ = 0.05 * (this.rand.nextDouble() - 0.5);
this.motionY = 0.0;
this.particleMaxAge = 25;
this.particleGravity = 0.05f;
this.field_190017_n = true;
this.setRBGColorF(0.6f, 0.0f, 1.0f);
}
@Override
public void onUpdate() {
super.onUpdate();
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
});
}
}
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
// if (rand.nextFloat() < 1.0f && this.getUtil().getProcess().isInProgress()) {
// BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1.3 + rand.nextDouble() * 0.2, z + 0.5, 0.0, 0.0, 0.0) {
// double axisX = this.posX;
// double axisZ = this.posZ;
// double angle = this.rand.nextDouble() * 2.0 * 3.1415;
//
// {
// this.axisX = 0.0;
// this.axisZ = 0.0;
// this.angle = 0.0;
// this.motionX = 0.05 * (this.rand.nextDouble() - 0.5);
// this.motionZ = 0.05 * (this.rand.nextDouble() - 0.5);
// this.motionY = 0.0;
// this.particleMaxAge = 25;
// this.particleGravity = 0.05f;
// this.noClip = true;
// this.setRBGColorF(0.6f, 0.0f, 1.0f);
// }
//
// @Override
// public void onUpdate() {
// super.onUpdate();
// this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
// }
//
// @Override
// public int getFXLayer() {
// return 0;
// }
// });
// }
}
@SideOnly(Side.CLIENT)
@Override
public void renderInWorld(final RenderItem customRenderItem, final double x, final double y, final double z) {
public void renderInWorld(final double x, final double y, final double z) {
if (!this.getUtil().getProcess().isInProgress()) {
return;
}
@@ -266,7 +263,7 @@ public class Analyser {
GL11.glPushMatrix();
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
GL11.glTranslatef(0.0f, -0.2f, 0.0f);
customRenderItem.renderItem(dummyEntityItem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);//doRender(this.dummyEntityItem.getEntityItem(), 0.0, 0.0, 0.0, 0.0f, 0.0f);
BinnieCore.proxy.getMinecraftInstance().getRenderItem().renderItem(dummyEntityItem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);//doRender(this.dummyEntityItem.getEntityItem(), 0.0, 0.0, 0.0, 0.0f, 0.0f);
GL11.glPopMatrix();
}
@@ -1,6 +1,7 @@
package binnie.genetics.machine;
import binnie.Binnie;
import binnie.core.BinnieCore;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
@@ -25,8 +26,10 @@ import binnie.genetics.item.GeneticLiquid;
import binnie.genetics.item.GeneticsItems;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.client.particle.Particle;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
@@ -167,50 +170,45 @@ public class Genepool {
}
}
public static class ComponentGenepoolFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
public static class ComponentGenepoolFX extends MachineComponent implements IRender.DisplayTick {
public ComponentGenepoolFX(final IMachine machine) {
super(machine);
}
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
}
public void onDisplayTick(World world, BlockPos pos, Random rand) {
if (rand.nextFloat() < 1.0f && this.getUtil().getProcess().isInProgress()) {
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.3 + rand.nextDouble() * 0.4, pos.getY() + 1, pos.getZ() + 0.3 + rand.nextDouble() * 0.4, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = this.rand.nextDouble() * 2.0 * 3.1415;
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
// if (rand.nextFloat() < 1.0f && this.getUtil().getProcess().isInProgress()) {
// BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.3 + rand.nextDouble() * 0.4, y + 1, z + 0.3 + rand.nextDouble() * 0.4, 0.0, 0.0, 0.0) {
// double axisX = this.posX;
// double axisZ = this.posZ;
// double angle = this.rand.nextDouble() * 2.0 * 3.1415;
//
// {
// this.axisX = 0.0;
// this.axisZ = 0.0;
// this.angle = 0.0;
// this.motionX = 0.0;
// this.motionZ = 0.0;
// this.motionY = this.rand.nextFloat() * 0.01;
// this.particleMaxAge = 25;
// this.particleGravity = 0.0f;
// this.noClip = true;
// this.setRBGColorF(0.4f + 0.6f * this.rand.nextFloat(), 0.6f * this.rand.nextFloat(), 0.6f + 0.4f * this.rand.nextFloat());
// }
//
// @Override
// public void onUpdate() {
// super.onUpdate();
// this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
// }
//
// @Override
// public int getFXLayer() {
// return 0;
// }
// });
// }
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = this.rand.nextFloat() * 0.01;
this.particleMaxAge = 25;
this.particleGravity = 0.0f;
this.field_190017_n = true;
this.setRBGColorF(0.4f + 0.6f * this.rand.nextFloat(), 0.6f * this.rand.nextFloat(), 0.6f + 0.4f * this.rand.nextFloat());
}
@Override
public void onUpdate() {
super.onUpdate();
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
});
}
}
}
}
@@ -56,8 +56,8 @@ public enum GeneticMachine implements IMachineType {
}
@Override
public void renderMachine(final Machine machine, final double x, final double y, final double z, final float var8) {
MachineRendererGenetics.instance.renderMachine(machine, this.colour, this.renderTexture, x, y, z, var8);
public void renderMachine(Machine machine, double x, double y, double z, float partialTicks, int destroyStage) {
MachineRendererGenetics.instance.renderMachine(machine, x, y, z, partialTicks, destroyStage);
}
}
}
@@ -31,6 +31,7 @@ import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.entity.item.EntityItem;
@@ -39,6 +40,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
@@ -275,7 +277,7 @@ public class Inoculator {
}
}
public static class ComponentInoculatorFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync {
public static class ComponentInoculatorFX extends MachineComponent implements IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync {
private final EntityItem dummyEntityItem;
public ComponentInoculatorFX(final IMachine machine) {
@@ -285,59 +287,54 @@ public class Inoculator {
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
public void onDisplayTick(World world, BlockPos pos, Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 3L);
if (tick == 0 && this.getUtil().getProcess().isInProgress()) {
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 0.92, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = (int) (this.worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.007 + this.rand.nextDouble() * 0.002;
this.particleMaxAge = 240;
this.particleGravity = 0.0f;
this.field_190017_n = true;
this.setRBGColorF(0.8f, 0.0f, 1.0f);
}
@Override
public void onUpdate() {
super.onUpdate();
double speed = 5.0E-4;
if (this.particleAge > 60) {
speed += (this.particleAge - 60) / 4000.0f;
}
this.angle += speed;
final double dist = 0.27;
this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
if (this.particleAge > 40) {
this.setRBGColorF(this.particleRed + (1.0f - this.particleRed) / 10.0f, this.particleGreen + (0.0f - this.particleGreen) / 10.0f, this.particleBlue + (0.0f - this.particleBlue) / 10.0f);
}
}
@Override
public int getFXLayer() {
return 0;
}
});
}
}
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
// final int tick = (int) (world.getTotalWorldTime() % 3L);
// if (tick == 0 && this.getUtil().getProcess().isInProgress()) {
// BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 0.92, z + 0.5, 0.0, 0.0, 0.0) {
// double axisX = this.posX;
// double axisZ = this.posZ;
// double angle = (int) (this.worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
//
// {
// this.axisX = 0.0;
// this.axisZ = 0.0;
// this.angle = 0.0;
// this.motionX = 0.0;
// this.motionZ = 0.0;
// this.motionY = 0.007 + this.rand.nextDouble() * 0.002;
// this.particleMaxAge = 240;
// this.particleGravity = 0.0f;
// this.noClip = true;
// this.setRBGColorF(0.8f, 0.0f, 1.0f);
// }
//
// @Override
// public void onUpdate() {
// super.onUpdate();
// double speed = 5.0E-4;
// if (this.particleAge > 60) {
// speed += (this.particleAge - 60) / 4000.0f;
// }
// this.angle += speed;
// final double dist = 0.27;
// this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
// this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
// if (this.particleAge > 40) {
// this.setRBGColorF(this.particleRed + (1.0f - this.particleRed) / 10.0f, this.particleGreen + (0.0f - this.particleGreen) / 10.0f, this.particleBlue + (0.0f - this.particleBlue) / 10.0f);
// }
// }
//
// @Override
// public int getFXLayer() {
// return 0;
// }
// });
// }
}
@SideOnly(Side.CLIENT)
@Override
public void renderInWorld(final RenderItem customRenderItem, final double x, final double y, final double z) {
public void renderInWorld(final double x, final double y, final double z) {
if (!this.getUtil().getProcess().isInProgress()) {
return;
}
@@ -357,7 +354,7 @@ public class Inoculator {
GL11.glPushMatrix();
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
GL11.glTranslatef(0.0f, -0.25f, 0.0f);
customRenderItem.renderItem(this.dummyEntityItem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED); //, 0.0, 0.0, 0.0, 0.0f, 0.0f);
BinnieCore.proxy.getMinecraftInstance().getRenderItem().renderItem(this.dummyEntityItem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED); //, 0.0, 0.0, 0.0, 0.0f, 0.0f);
GL11.glPopMatrix();
}
@@ -1,5 +1,6 @@
package binnie.genetics.machine;
import binnie.core.BinnieCore;
import binnie.core.genetics.Gene;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
@@ -28,8 +29,10 @@ import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.client.particle.Particle;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
@@ -194,76 +197,76 @@ public class Isolator {
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
// if (!this.getUtil().getProcess().isInProgress()) {
// return;
// }
// BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.4 + 0.2 * rand.nextDouble(), y + 1.6, z + 0.4 + rand.nextDouble() * 0.2, 0.0, 0.0, 0.0) {
// double axisX = 0.0;
// double axisZ = 0.0;
// double angle = 0.0;
//
// {
// this.motionX = 0.0;
// this.motionZ = 0.0;
// this.motionY = -0.012;
// this.particleMaxAge = 100;
// this.particleGravity = 0.0f;
// this.noClip = true;
// this.setRBGColorF(0.8f, 0.4f, 0.0f);
// }
//
// @Override
// public void onUpdate() {
// super.onUpdate();
// this.angle += 0.06;
// this.setAlphaF((float) Math.sin(3.14 * this.particleAge / this.particleMaxAge));
// }
//
// @Override
// public int getFXLayer() {
// return 0;
// }
// });
public void onRandomDisplayTick(World world, BlockPos pos, Random rand) {
if (!this.getUtil().getProcess().isInProgress()) {
return;
}
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.4 + 0.2 * rand.nextDouble(), pos.getY() + 1.6, pos.getZ() + 0.4 + rand.nextDouble() * 0.2, 0.0, 0.0, 0.0) {
double axisX = 0.0;
double axisZ = 0.0;
double angle = 0.0;
{
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = -0.012;
this.particleMaxAge = 100;
this.particleGravity = 0.0f;
this.field_190017_n = true;
this.setRBGColorF(0.8f, 0.4f, 0.0f);
}
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.06;
this.setAlphaF((float) Math.sin(3.14 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
});
}
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
// final int tick = (int) (world.getTotalWorldTime() % 6L);
// if ((tick == 0 || tick == 5) && this.getUtil().getProcess().isInProgress()) {
// BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0) {
// double axisX = this.posX;
// double axisZ = this.posZ;
// double angle = 0.7 + (int) (this.worldObj.getTotalWorldTime() % 2L) * 3.1415;
//
// {
// this.axisX = 0.0;
// this.axisZ = 0.0;
// this.angle = 0.0;
// this.motionX = 0.0;
// this.motionZ = 0.0;
// this.motionY = 0.012;
// this.particleMaxAge = 100;
// this.particleGravity = 0.0f;
// this.noClip = true;
// this.setRBGColorF(0.8f, 0.0f, 1.0f);
// }
//
// @Override
// public void onUpdate() {
// super.onUpdate();
// this.angle += 0.06;
// this.setPosition(this.axisX + 0.26 * Math.sin(this.angle), this.posY, this.axisZ + 0.26 * Math.cos(this.angle));
// this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
// }
//
// @Override
// public int getFXLayer() {
// return 0;
// }
// });
// }
public void onDisplayTick(World world, BlockPos pos, Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 6L);
if ((tick == 0 || tick == 5) && this.getUtil().getProcess().isInProgress()) {
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = 0.7 + (int) (this.worldObj.getTotalWorldTime() % 2L) * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.012;
this.particleMaxAge = 100;
this.particleGravity = 0.0f;
this.field_190017_n = true;
this.setRBGColorF(0.8f, 0.0f, 1.0f);
}
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.06;
this.setPosition(this.axisX + 0.26 * Math.sin(this.angle), this.posY, this.axisZ + 0.26 * Math.cos(this.angle));
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
});
}
}
}
}
@@ -6,6 +6,7 @@ import binnie.core.machines.component.IRender;
import binnie.core.resource.BinnieResource;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
@@ -13,49 +14,25 @@ import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class MachineRendererGenetics {
public static MachineRendererGenetics instance = new MachineRendererGenetics();
public final RenderItem customRenderItem;
private ModelMachine model;
public MachineRendererGenetics() {
this.model = new ModelMachine();
this.customRenderItem = Minecraft.getMinecraft().getRenderItem(); //new RenderItem(Minecraft.getMinecraft().getTextureManager(),) {
// @Override
// public boolean shouldBob() {
// return false;
// }
//
// @Override
// public boolean shouldSpreadItems() {
// return false;
// }
//});//.setRenderManager(RenderManager.instance);
}
public void renderMachine(final Machine machine, final int colour, final BinnieResource texture, final double x, final double y, final double z, final float var8) {
public void renderMachine(Machine machine, double x, double y, double z, float partialTicks, int destroyStage) {
GL11.glPushMatrix();
int i1 = 0;
final int ix = machine.getTileEntity().getPos().getX();
final int iy = machine.getTileEntity().getPos().getY();
final int iz = machine.getTileEntity().getPos().getZ();
BlockPos pos = machine.getTileEntity().getPos();
final int ix = pos.getX();
final int iy = pos.getY();
final int iz = pos.getZ();
if (machine.getTileEntity() != null) {
i1 = ix * iy * iz + ix * iy - ix * iz + iy * iz - ix + iy - iz;
}
final float phase = (float) Math.max(0.0, Math.sin((System.currentTimeMillis() + i1) * 0.003));
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
BinnieCore.proxy.bindTexture(texture);
GL11.glPushMatrix();
//TODO remove
//this.model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
GL11.glPopMatrix();
GL11.glPushMatrix();
BinnieCore.proxy.getMinecraftInstance();
if (Minecraft.isFancyGraphicsEnabled()) {
for (final IRender.Render render : machine.getInterfaces(IRender.Render.class)) {
render.renderInWorld(this.customRenderItem, x, y, z);
for (IRender.Render render : machine.getInterfaces(IRender.Render.class)) {
render.renderInWorld(x, y, z);
}
}
GL11.glPopMatrix();
@@ -1,9 +1,18 @@
package binnie.genetics.machine;
import org.lwjgl.opengl.GL11;
import binnie.Binnie;
import binnie.core.BinnieCore;
import binnie.core.machines.Machine;
import binnie.core.resource.BinnieResource;
import binnie.genetics.Genetics;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -13,97 +22,77 @@ public class MachineRendererLab {
public static MachineRendererLab instance = new MachineRendererLab();
private final EntityItem dummyEntityItem;
private final EntityItem[] itemSides;
// private final RenderItem customRenderItem;
private long lastTick;
private ModelMachine model;
public MachineRendererLab() {
World world = Minecraft.getMinecraft().theWorld;
this.dummyEntityItem = new EntityItem(world);
this.itemSides = new EntityItem[]{new EntityItem(world), new EntityItem(world), new EntityItem(world), new EntityItem(world)};
this.model = new ModelMachine();
// (this.customRenderItem = new RenderItem() {
// @Override
// public boolean shouldBob() {
// return false;
// }
//
// @Override
// public boolean shouldSpreadItems() {
// return false;
// }
// }).setRenderManager(RenderManager.instance);
}
public void renderMachine(final Machine machine, final int colour, final BinnieResource texture, final double x, final double y, final double z, final float var8) {
// GL11.glPushMatrix();
// int i1 = 0;
// final int ix = machine.getTileEntity().xCoord;
// final int iy = machine.getTileEntity().yCoord;
// final int iz = machine.getTileEntity().zCoord;
// if (machine.getTileEntity() != null) {
// i1 = ix * iy * iz + ix * iy - ix * iz + iy * iz - ix + iy - iz;
// }
// final float phase = (float) Math.max(0.0, Math.sin((System.currentTimeMillis() + i1) * 0.003));
// GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
// GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
// BinnieCore.proxy.bindTexture(texture);
// GL11.glPushMatrix();
// this.model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
// GL11.glPopMatrix();
// final World world = machine.getWorld();
// final LaboratoryMachine.ComponentGUIHolder holder = Machine.getInterface(LaboratoryMachine.ComponentGUIHolder.class, machine);
// Label_0591: {
// if (world != null && holder != null && holder.getStack() != null) {
// BinnieCore.proxy.getMinecraftInstance();
// if (Minecraft.isFancyGraphicsEnabled()) {
// final ItemStack stack = holder.getStack();
// this.dummyEntityItem.worldObj = world;
// this.dummyEntityItem.setEntityItemStack(stack);
// if (world.getTotalWorldTime() != this.lastTick) {
// this.lastTick = world.getTotalWorldTime();
// this.dummyEntityItem.onUpdate();
// }
// this.dummyEntityItem.age = 0;
// this.dummyEntityItem.hoverStart = 0.0f;
// GL11.glPushMatrix();
// final EntityPlayer player = BinnieCore.proxy.getPlayer();
// final double dx = ix + 0.5 - player.lastTickPosX;
// final double dz = iz + 0.5 - player.lastTickPosZ;
// final double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
// GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
// GL11.glTranslatef(0.0f, 0.0f, -0.55f);
// GL11.glRotatef(90.0f + (float) (-t), 0.0f, 0.0f, 1.0f);
// GL11.glTranslatef(0.0f, -0.125f, 0.0f);
// GL11.glScalef(1.2f, 1.2f, 1.2f);
// GL11.glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
// GL11.glTranslatef(0.0f, 0.1f, 0.1f);
// this.customRenderItem.doRender(this.dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
// GL11.glPopMatrix();
// int rot = 0;
// for (final EntityItem item : this.itemSides) {
// GL11.glPushMatrix();
// item.worldObj = world;
// item.setEntityItemStack(stack);
// item.age = 0;
// item.hoverStart = 0.0f;
// GL11.glRotatef(rot, 0.0f, 1.0f, 0.0f);
// GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
// GL11.glTranslated(0.0, -1.13, 0.4);
// GL11.glScalef(0.8f, 0.8f, 0.8f);
// this.customRenderItem.doRender(item, 0.0, 0.0, 0.0, 0.0f, 0.0f);
// rot += 90;
// GL11.glPopMatrix();
// }
// break Label_0591;
// }
// }
// this.dummyEntityItem.setEntityItemStack((ItemStack) null);
// for (final EntityItem item2 : this.itemSides) {
// item2.setEntityItemStack((ItemStack) null);
// }
// }
// GL11.glPopMatrix();
public void renderMachine(Machine machine, double x, double y, double z, float partialTicks, int destroyStage) {
GL11.glPushMatrix();
int i1 = 0;
BlockPos pos = machine.getTileEntity().getPos();
int ix = pos.getX();
int iy = pos.getY();
int iz = pos.getZ();
if (machine.getTileEntity() != null) {
i1 = ix * iy * iz + ix * iy - ix * iz + iy * iz - ix + iy - iz;
}
float phase = (float) Math.max(0.0, Math.sin((System.currentTimeMillis() + i1) * 0.003));
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
World world = machine.getWorld();
LaboratoryMachine.ComponentGUIHolder holder = Machine.getInterface(LaboratoryMachine.ComponentGUIHolder.class, machine);
Label_0591: {
if (world != null && holder != null && holder.getStack() != null) {
BinnieCore.proxy.getMinecraftInstance();
if (Minecraft.isFancyGraphicsEnabled()) {
final ItemStack stack = holder.getStack();
this.dummyEntityItem.worldObj = world;
this.dummyEntityItem.setEntityItemStack(stack);
if (world.getTotalWorldTime() != this.lastTick) {
this.lastTick = world.getTotalWorldTime();
this.dummyEntityItem.onUpdate();
}
GL11.glPushMatrix();
final EntityPlayer player = BinnieCore.proxy.getPlayer();
final double dx = ix + 0.5 - player.lastTickPosX;
final double dz = iz + 0.5 - player.lastTickPosZ;
final double t = Math.atan2(dz, dx) * 180.0 / 3.1415;
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
GL11.glTranslatef(0.0f, 0.0f, -0.55f);
GL11.glRotatef(90.0f + (float) (-t), 0.0f, 0.0f, 1.0f);
GL11.glTranslatef(0.0f, -0.125f, 0.0f);
GL11.glScalef(1.2f, 1.2f, 1.2f);
GL11.glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
GL11.glTranslatef(0.0f, 0.1f, 0.1f);
RenderManager renderManager = BinnieCore.proxy.getMinecraftInstance().getRenderManager();
renderManager.doRenderEntity(this.dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f, false);
GL11.glPopMatrix();
int rot = 0;
for (EntityItem item : this.itemSides) {
GL11.glPushMatrix();
item.worldObj = world;
item.setEntityItemStack(stack);
GL11.glRotatef(rot, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
GL11.glTranslated(0.0, -1.13, 0.4);
GL11.glScalef(0.8f, 0.8f, 0.8f);
renderManager.doRenderEntity(item, 0.0, 0.0, 0.0, 0.0f, 0.0f, false);
rot += 90;
GL11.glPopMatrix();
}
break Label_0591;
}
}
this.dummyEntityItem.setEntityItemStack((ItemStack) null);
for (final EntityItem item2 : this.itemSides) {
item2.setEntityItemStack((ItemStack) null);
}
}
GL11.glPopMatrix();
}
}
@@ -1,76 +0,0 @@
package binnie.genetics.machine;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelMachine extends ModelBase {
ModelRenderer Base;
ModelRenderer Body;
ModelRenderer Arm1;
ModelRenderer Arm2;
ModelRenderer Arm3;
ModelRenderer Arm4;
ModelRenderer Top;
public ModelMachine() {
this.textureWidth = 64;
this.textureHeight = 64;
(this.Base = new ModelRenderer(this, 0, 18)).addBox(0.0f, 0.0f, 0.0f, 16, 4, 16);
this.Base.setRotationPoint(-8.0f, 20.0f, -8.0f);
this.Base.setTextureSize(64, 64);
this.Base.mirror = true;
this.setRotation(this.Base, 0.0f, 0.0f, 0.0f);
(this.Body = new ModelRenderer(this, 0, 26)).addBox(0.0f, 0.0f, 0.0f, 12, 7, 12);
this.Body.setRotationPoint(-6.0f, 13.0f, -6.0f);
this.Body.setTextureSize(64, 64);
this.Body.mirror = true;
this.setRotation(this.Body, 0.0f, 0.0f, 0.0f);
(this.Arm1 = new ModelRenderer(this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
this.Arm1.setRotationPoint(5.0f, 8.0f, 5.0f);
this.Arm1.setTextureSize(64, 64);
this.Arm1.mirror = true;
this.setRotation(this.Arm1, 0.0f, 0.0f, 0.0f);
(this.Arm2 = new ModelRenderer(this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
this.Arm2.setRotationPoint(-5.0f, 8.0f, 5.0f);
this.Arm2.setTextureSize(64, 64);
this.Arm2.mirror = true;
this.setRotation(this.Arm2, 0.0f, -1.57075f, 0.0f);
(this.Arm3 = new ModelRenderer(this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
this.Arm3.setRotationPoint(-5.0f, 8.0f, -5.0f);
this.Arm3.setTextureSize(64, 64);
this.Arm3.mirror = true;
this.setRotation(this.Arm3, 0.0f, -3.1415f, 0.0f);
(this.Arm4 = new ModelRenderer(this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 3, 6, 3);
this.Arm4.setRotationPoint(5.0f, 8.0f, -5.0f);
this.Arm4.setTextureSize(64, 64);
this.Arm4.mirror = true;
this.setRotation(this.Arm4, 0.0f, -4.7122498f, 0.0f);
(this.Top = new ModelRenderer(this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 14, 4, 14);
this.Top.setRotationPoint(-7.0f, 9.0f, -7.0f);
this.Top.setTextureSize(64, 64);
this.Top.mirror = true;
this.setRotation(this.Top, 0.0f, 0.0f, 0.0f);
}
// public void render(final float f, final float f1, final float f2, final float f3, final float f4, final float f5) {
// super.render((Entity) null, f, f1, f2, f3, f4, f5);
// this.setRotationAngles(f, f1, f2, f3, f4, f5);
// this.Base.render(f5);
// this.Body.render(f5);
// this.Arm1.render(f5);
// this.Arm2.render(f5);
// this.Arm3.render(f5);
// this.Arm4.render(f5);
// this.Top.render(f5);
// }
private void setRotation(final ModelRenderer model, final float x, final float y, final float z) {
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(final float f, final float f1, final float f2, final float f3, final float f4, final float f5) {
super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
}
}
@@ -1,5 +1,6 @@
package binnie.genetics.machine;
import binnie.core.BinnieCore;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
@@ -22,9 +23,11 @@ import binnie.genetics.core.GeneticsGUI;
import binnie.genetics.core.GeneticsTexture;
import binnie.genetics.genetics.Engineering;
import binnie.genetics.item.GeneticLiquid;
import net.minecraft.client.particle.Particle;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
@@ -216,68 +219,63 @@ public class Polymeriser {
}
}
public static class ComponentPolymeriserFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick {
public static class ComponentPolymeriserFX extends MachineComponent implements IRender.DisplayTick {
public ComponentPolymeriserFX(final IMachine machine) {
super(machine);
}
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
}
public void onDisplayTick(World world, BlockPos pos, Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 8L);
if ((tick == 0 || tick == 3) && this.getUtil().getProcess().isInProgress()) {
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 1.8, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = 0.7 + (int) (this.worldObj.getTotalWorldTime() % 2L) * 3.1415;
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
// final int tick = (int) (world.getTotalWorldTime() % 8L);
// if ((tick == 0 || tick == 3) && this.getUtil().getProcess().isInProgress()) {
// BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1.8, z + 0.5, 0.0, 0.0, 0.0) {
// double axisX = this.posX;
// double axisZ = this.posZ;
// double angle = 0.7 + (int) (this.worldObj.getTotalWorldTime() % 2L) * 3.1415;
//
// {
// this.axisX = 0.0;
// this.axisZ = 0.0;
// this.angle = 0.0;
// this.motionX = 0.0;
// this.motionZ = 0.0;
// this.motionY = -0.006;
// this.particleMaxAge = 140;
// this.particleGravity = 0.0f;
// this.noClip = true;
// this.setRBGColorF(0.8f, 0.0f, 1.0f);
// }
//
// @Override
// public void onUpdate() {
// super.onUpdate();
// this.angle += 0.1;
// this.motionY = -0.006;
// double dist = 0.2;
// if (this.particleAge > 60) {
// if (this.particleAge > 120) {
// dist = 0.1;
// }
// else {
// dist = 0.2 - 0.1 * ((this.particleAge - 60.0f) / 60.0f);
// }
// }
// this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
// if (this.particleAge <= 40) {
// this.setAlphaF(this.particleAge / 40.0f);
// }
// if (this.particleAge > 80) {
// this.setRBGColorF(this.particleRed + (0.0f - this.particleRed) / 10.0f, this.particleGreen + (1.0f - this.particleGreen) / 10.0f, this.particleBlue + (1.0f - this.particleBlue) / 10.0f);
// }
// }
//
// @Override
// public int getFXLayer() {
// return 0;
// }
// });
// }
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = -0.006;
this.particleMaxAge = 140;
this.particleGravity = 0.0f;
this.field_190017_n = true;
this.setRBGColorF(0.8f, 0.0f, 1.0f);
}
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.1;
this.motionY = -0.006;
double dist = 0.2;
if (this.particleAge > 60) {
if (this.particleAge > 120) {
dist = 0.1;
}
else {
dist = 0.2 - 0.1 * ((this.particleAge - 60.0f) / 60.0f);
}
}
this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
if (this.particleAge <= 40) {
this.setAlphaF(this.particleAge / 40.0f);
}
if (this.particleAge > 80) {
this.setRBGColorF(this.particleRed + (0.0f - this.particleRed) / 10.0f, this.particleGreen + (1.0f - this.particleGreen) / 10.0f, this.particleBlue + (1.0f - this.particleBlue) / 10.0f);
}
}
@Override
public int getFXLayer() {
return 0;
}
});
}
}
}
}
@@ -1,6 +1,7 @@
package binnie.genetics.machine;
import binnie.Binnie;
import binnie.core.BinnieCore;
import binnie.core.machines.IMachine;
import binnie.core.machines.Machine;
import binnie.core.machines.MachineComponent;
@@ -23,8 +24,10 @@ import binnie.genetics.core.GeneticsTexture;
import binnie.genetics.genetics.GeneTracker;
import binnie.genetics.genetics.SequencerItem;
import binnie.genetics.item.GeneticsItems;
import net.minecraft.client.particle.Particle;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -182,80 +185,81 @@ public class Sequencer {
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
// if (!this.getUtil().getProcess().isInProgress()) {
// return;
// }
// BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1.2 + rand.nextDouble() * 0.2, z + 0.5, 0.0, 0.0, 0.0) {
// double axisX = this.posX;
// double axisZ = this.posZ;
// double angle = this.rand.nextDouble() * 2.0 * 3.1415;
//
// {
// this.axisX = 0.0;
// this.axisZ = 0.0;
// this.angle = 0.0;
// this.motionX = 0.0;
// this.motionZ = 0.0;
// this.motionY = 0.0;
// this.particleMaxAge = 200;
// this.particleGravity = 0.0f;
// this.noClip = true;
// this.setRBGColorF(0.6f + this.rand.nextFloat() * 0.2f, 1.0f, 0.8f * this.rand.nextFloat() * 0.2f);
// }
//
// @Override
// public void onUpdate() {
// super.onUpdate();
// this.angle += 0.03;
// this.setPosition(this.axisX + 0.4 * Math.sin(this.angle), this.posY, this.axisZ + 0.4 * Math.cos(this.angle));
// this.motionY = 0.0;
// this.setAlphaF((float) Math.sin(3.14 * this.particleAge / this.particleMaxAge));
// }
//
// @Override
// public int getFXLayer() {
// return 0;
// }
// });
public void onRandomDisplayTick(World world, BlockPos pos, Random rand) {
if (!this.getUtil().getProcess().isInProgress()) {
return;
}
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 1.2 + rand.nextDouble() * 0.2, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = this.rand.nextDouble() * 2.0 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.0;
this.particleMaxAge = 200;
this.particleGravity = 0.0f;
this.field_190017_n = true;
this.setRBGColorF(0.6f + this.rand.nextFloat() * 0.2f, 1.0f, 0.8f * this.rand.nextFloat() * 0.2f);
}
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.03;
this.setPosition(this.axisX + 0.4 * Math.sin(this.angle), this.posY, this.axisZ + 0.4 * Math.cos(this.angle));
this.motionY = 0.0;
this.setAlphaF((float) Math.sin(3.14 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
});
}
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
// final int ticks = (int) (world.getTotalWorldTime() % 16L);
// if (ticks == 0 && this.getUtil().getProcess().isInProgress()) {
// BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1, z + 0.5, 0.0, 0.0, 0.0) {
// double axisX = 0.0;
// double axisZ = 0.0;
// double angle = 0.0;
//
// {
// this.motionX = 0.0;
// this.motionZ = 0.0;
// this.motionY = 0.012;
// this.particleMaxAge = 50;
// this.particleGravity = 0.0f;
// this.noClip = true;
// this.particleScale = 2.0f;
// this.setParticleIcon((new BinnieIcon[] { Sequencer.fxSeqA, Sequencer.fxSeqG, Sequencer.fxSeqC, Sequencer.fxSeqT })[this.rand.nextInt(4)].getIcon());
// }
//
// @Override
// public void onUpdate() {
// super.onUpdate();
// this.motionY = 0.012;
// if (this.particleAge > 40) {
// this.setAlphaF((50 - this.particleAge) / 10.0f);
// }
// }
//
// @Override
// public int getFXLayer() {
// return 1;
// }
// });
// }
public void onDisplayTick(World world, BlockPos pos, Random rand) {
final int ticks = (int) (world.getTotalWorldTime() % 16L);
if (ticks == 0 && this.getUtil().getProcess().isInProgress()) {
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = 0.0;
double axisZ = 0.0;
double angle = 0.0;
{
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.012;
this.particleMaxAge = 50;
this.particleGravity = 0.0f;
this.field_190017_n = true;
this.particleScale = 2.0f;
//TODO: Add sprites
//this.setParticleIcon((new BinnieIcon[] { Sequencer.fxSeqA, Sequencer.fxSeqG, Sequencer.fxSeqC, Sequencer.fxSeqT })[this.rand.nextInt(4)].getIcon());
}
@Override
public void onUpdate() {
super.onUpdate();
this.motionY = 0.012;
if (this.particleAge > 40) {
this.setAlphaF((50 - this.particleAge) / 10.0f);
}
}
@Override
public int getFXLayer() {
return 1;
}
});
}
}
}
@@ -28,6 +28,7 @@ import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.entity.item.EntityItem;
@@ -36,6 +37,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -295,7 +297,7 @@ public class Splicer {
}
}
public static class ComponentSplicerFX extends MachineComponent implements IRender.RandomDisplayTick, IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync {
public static class ComponentSplicerFX extends MachineComponent implements IRender.DisplayTick, IRender.Render, INetwork.TilePacketSync {
private final EntityItem dummyEntityItem;
public ComponentSplicerFX(final IMachine machine) {
@@ -305,53 +307,48 @@ public class Splicer {
@SideOnly(Side.CLIENT)
@Override
public void onRandomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
public void onDisplayTick(World world, BlockPos pos, Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 3L);
if (tick == 0 && this.getUtil().getProcess().isInProgress()) {
BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = (int) (this.worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = (this.rand.nextDouble() - 0.5) * 0.02;
this.particleMaxAge = 240;
this.particleGravity = 0.0f;
this.field_190017_n = true;
this.setRBGColorF(0.3f + this.rand.nextFloat() * 0.5f, 0.3f + this.rand.nextFloat() * 0.5f, 0.0f);
}
@Override
public void onUpdate() {
super.onUpdate();
final double speed = 0.04;
this.angle -= speed;
final double dist = 0.25 + 0.2 * Math.sin(this.particleAge / 50.0f);
this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
});
}
}
@SideOnly(Side.CLIENT)
@Override
public void onDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
// final int tick = (int) (world.getTotalWorldTime() % 3L);
// if (tick == 0 && this.getUtil().getProcess().isInProgress()) {
// BinnieCore.proxy.getMinecraftInstance().effectRenderer.addEffect(new EntityFX(world, x + 0.5, y + 1.5, z + 0.5, 0.0, 0.0, 0.0) {
// double axisX = this.posX;
// double axisZ = this.posZ;
// double angle = (int) (this.worldObj.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
//
// {
// this.axisX = 0.0;
// this.axisZ = 0.0;
// this.angle = 0.0;
// this.motionX = 0.0;
// this.motionZ = 0.0;
// this.motionY = (this.rand.nextDouble() - 0.5) * 0.02;
// this.particleMaxAge = 240;
// this.particleGravity = 0.0f;
// this.noClip = true;
// this.setRBGColorF(0.3f + this.rand.nextFloat() * 0.5f, 0.3f + this.rand.nextFloat() * 0.5f, 0.0f);
// }
//
// @Override
// public void onUpdate() {
// super.onUpdate();
// final double speed = 0.04;
// this.angle -= speed;
// final double dist = 0.25 + 0.2 * Math.sin(this.particleAge / 50.0f);
// this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
// this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
// }
//
// @Override
// public int getFXLayer() {
// return 0;
// }
// });
// }
}
@SideOnly(Side.CLIENT)
@Override
public void renderInWorld(final RenderItem customRenderItem, final double x, final double y, final double z) {
public void renderInWorld(double x, final double y, final double z) {
if (!this.getUtil().getProcess().isInProgress()) {
return;
}
@@ -371,7 +368,7 @@ public class Splicer {
GL11.glPushMatrix();
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
GL11.glTranslatef(0.0f, -0.25f, 0.0f);
customRenderItem.renderItem(dummyEntityItem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);//doRender(this.dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
BinnieCore.proxy.getMinecraftInstance().getRenderItem().renderItem(dummyEntityItem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);//doRender(this.dummyEntityItem, 0.0, 0.0, 0.0, 0.0f, 0.0f);
GL11.glPopMatrix();
}