@@ -0,0 +1,93 @@
package cc.client.gui.element;

import cc.utils.MathUtils;
import cc.api.ITEHasChroma;
import cc.common.item.ItemChromaCrystal;
import net.minecraft.client.Minecraft;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

/**
* Created by jakihappycity on 08.11.15.
*/
public class GuiChromaCrystalState extends GuiTextField {

public TileEntity tile;
public int slotNum;

public GuiChromaCrystalState(int i, int j, TileEntity t, int slot)
{
super(i,j);
tile = t;
slotNum = slot;
}

@Override
public ResourceLocation getElementTexture() {
// TODO Auto-generated method stub
return super.getElementTexture();
}

@Override
public void draw(int posX, int posY) {
super.draw(posX, posY);
}

@Override
public int getX() {
// TODO Auto-generated method stub
return super.getX();
}

@Override
public int getY() {
// TODO Auto-generated method stub
return super.getY();
}

@Override
public void drawText(int posX, int posY) {
IInventory inventory = (IInventory) tile;
if(inventory.getStackInSlot(slotNum) == null || !(inventory.getStackInSlot(slotNum).getItem() instanceof ItemChromaCrystal))
{
Minecraft.getMinecraft().fontRenderer.drawString("No Chroma Crystal!", posX+6, posY+5, 0xff0000, true);
}else
{
if(inventory.getStackInSlot(slotNum).getTagCompound() == null)
{
Minecraft.getMinecraft().fontRenderer.drawString("Chroma Crystal Not Bound!", posX+4, posY+5, 0xff0000, true);
}else
{
int o[] = ItemChromaCrystal.getCoords(inventory.getStackInSlot(slotNum));
if(this.tile.getWorldObj().getTileEntity(o[0], o[1], o[2]) == null)
{
Minecraft.getMinecraft().fontRenderer.drawString("No Tile At Pos!", posX+5, posY+5, 0xff0000, true);
}else
{
if(!(this.tile.getWorldObj().getTileEntity(o[0], o[1], o[2]) instanceof ITEHasChroma))
{
Minecraft.getMinecraft().fontRenderer.drawString("Not Magical!", posX+12, posY+5, 0xff0000, true);
}else
{
if(!(MathUtils.getDifference(tile.xCoord, o[0]) <= 16 && MathUtils.getDifference(tile.yCoord, o[1]) <= 16 && MathUtils.getDifference(tile.zCoord, o[2]) <= 16))
{
Minecraft.getMinecraft().fontRenderer.drawString("Not In Range!", posX+8, posY+5, 0xff0000, true);
}else
{
if(((ITEHasChroma)(tile.getWorldObj().getTileEntity(o[0], o[1], o[2]))).getChroma() <= 0)
{
Minecraft.getMinecraft().fontRenderer.drawString("No Chroma In Tile!", posX+6, posY+5, 0xff0000, true);
}else
{
Minecraft.getMinecraft().fontRenderer.drawString("Working", posX+22, posY+5, 0x00ff00, true);
}
}
}
}
}
}
}


}
@@ -0,0 +1,105 @@
package cc.client.gui.element;

import org.lwjgl.opengl.GL11;

import cc.utils.MathUtils;
import cc.utils.MiscUtils;
import cc.api.IHotBlock;
import cc.common.tile.TileHeatGenerator;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

/**
* Created by jakihappycity on 06.11.15.
*/
public class GuiChromaGenerated extends GuiTextField {

public TileEntity tile;
public String tileValue;

public GuiChromaGenerated(int i, int j, TileEntity t, String tileType)
{
super(i,j);
tile = t;
tileValue = tileType;
}

@Override
public ResourceLocation getElementTexture() {
// TODO Auto-generated method stub
return super.getElementTexture();
}

@Override
public void draw(int posX, int posY) {
super.draw(posX, posY);
}

@Override
public int getX() {
// TODO Auto-generated method stub
return super.getX();
}

@Override
public int getY() {
// TODO Auto-generated method stub
return super.getY();
}

@Override
public void drawText(int posX, int posY) {
if(tileValue.equals("heatGenerator"))
{
if(tile instanceof TileHeatGenerator)
{
TileHeatGenerator furnace = (TileHeatGenerator) tile;
MiscUtils.bindTexture("minecraft", "textures/gui/container/furnace.png");
this.drawTexturedModalRect(posX+100, posY+2, 55, 36, 15, 15);
if(furnace.currentBurnTime > 0)
{
int scaledSize = MathUtils.pixelatedTextureSize(furnace.currentBurnTime, furnace.currentMaxBurnTime, 14)+1;
this.drawTexturedModalRect(posX+101, posY+2+15-scaledSize, 176, 15-scaledSize, 15, scaledSize);
}
float chromaGenerated = TileHeatGenerator.chromaGenerated;
float chromaFactor = 1.0F;
Block[] b = new Block[4];
b[0] = furnace.getWorldObj().getBlock(furnace.xCoord+2, furnace.yCoord, furnace.zCoord);
b[1] = furnace.getWorldObj().getBlock(furnace.xCoord-2, furnace.yCoord, furnace.zCoord);
b[2] = furnace.getWorldObj().getBlock(furnace.xCoord, furnace.yCoord, furnace.zCoord+2);
b[3] = furnace.getWorldObj().getBlock(furnace.xCoord, furnace.yCoord, furnace.zCoord-2);
int[] ox = new int[]{2,-2,0,0};
int[] oz = new int[]{0,0,2,-2};
for(int i = 0; i < 4; ++i)
{
if(b[i] == Blocks.air)
{
chromaFactor*=0;
}else if(b[i] == Blocks.netherrack)
{
chromaFactor*=0.75F;
}else if(b[i] == Blocks.lava)
{
chromaFactor*=0.95F;
}else if(b[i] == Blocks.fire)
{
chromaFactor*=0.7F;
}else if(b[i] instanceof IHotBlock)
{
chromaFactor*=(((IHotBlock)b[i]).getHeatModifier(tile.getWorldObj(), tile.xCoord+ox[i], tile.yCoord, tile.zCoord+oz[i]));
}else
{
chromaFactor*=0.5F;
}

}
chromaGenerated*=chromaFactor;
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow((int)chromaGenerated+" Chroma/t", posX+2, posY+5, 0xffffff);
}
}
}

}
@@ -0,0 +1,59 @@
package cc.client.gui.element;

import cc.api.ITEHasChroma;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;

/**
* Created by jakihappycity on 08.11.15.
*/
public class GuiChromaState extends GuiTextField {

public ITEHasChroma tile;
public int chroma;

public GuiChromaState(int i, int j, ITEHasChroma t, int chromaToSearch)
{
super(i,j);
tile = t;
}

@Override
public ResourceLocation getElementTexture() {
// TODO Auto-generated method stub
return super.getElementTexture();
}

@Override
public void draw(int posX, int posY) {
this.drawTexturedModalRect(posX, posY, 0, 0, 17, 18);
this.drawTexturedModalRect(posX+17, posY, 1, 0, 16, 18);
this.drawTexturedModalRect(posX+17+16, posY, 1, 0, 16, 18);
this.drawTexturedModalRect(posX+17+32, posY, 1, 0, 16, 18);
this.drawTexturedModalRect(posX+17+48, posY, 1, 0, 16, 18);
this.drawTexturedModalRect(posX+17+64, posY, 1, 0, 16, 18);
this.drawTexturedModalRect(posX+17+80, posY, 1, 0, 16, 18);
this.drawTexturedModalRect(posX+17+96, posY, 1, 0, 16, 18);
this.drawTexturedModalRect(posX+17+111, posY, 1, 0, 17, 18);
drawText(posX,posY);
}

@Override
public int getX() {
// TODO Auto-generated method stub
return super.getX();
}

@Override
public int getY() {
// TODO Auto-generated method stub
return super.getY();
}

@Override
public void drawText(int posX, int posY) {
Minecraft.getMinecraft().fontRenderer.drawString(""+this.tile.getChroma()+"/"+this.tile.getMaxChroma()+" Chroma", posX+2, posY+5, 0xffffff, true);
}


}
@@ -0,0 +1,51 @@
package cc.client.gui.element;

import cc.client.gui.GuiElement;
import net.minecraft.util.ResourceLocation;

/**
* Created by jakihappycity on 06.11.15.
*/
public abstract class GuiTextField extends GuiElement {
private ResourceLocation rec = new ResourceLocation("cc","textures/gui/slot_common.png");

public int x;
public int y;

public GuiTextField(int i, int j)
{
x = i;
y = j;
}

@Override
public ResourceLocation getElementTexture() {
// TODO Auto-generated method stub
return rec;
}

@Override
public void draw(int posX, int posY) {
this.drawTexturedModalRect(posX, posY, 0, 0, 17, 18);
this.drawTexturedModalRect(posX+17, posY, 1, 0, 16, 18);
this.drawTexturedModalRect(posX+17+16, posY, 1, 0, 16, 18);
this.drawTexturedModalRect(posX+17+32, posY, 1, 0, 16, 18);
this.drawTexturedModalRect(posX+17+48, posY, 1, 0, 17, 18);
drawText(posX,posY);
}

public abstract void drawText(int posX, int posY);

@Override
public int getX() {
// TODO Auto-generated method stub
return x;
}

@Override
public int getY() {
// TODO Auto-generated method stub
return y;
}

}
@@ -0,0 +1,62 @@
package cc.client.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.tileentity.TileEntity;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

/**
* Created by jakihappycity on 07.11.15.
*/
@SideOnly(Side.CLIENT)
public class ModelFloatingCube extends ModelBase
{
/** The cube model for the Ender Crystal. */
private ModelRenderer cube;
/** The glass model for the Ender Crystal. */
private ModelRenderer glass = new ModelRenderer(this, "glass");
/** The base model for the Ender Crystal. */
private ModelRenderer base;

public ModelFloatingCube(float p_i1170_1_, boolean p_i1170_2_)
{
this.glass.setTextureOffset(0, 0).addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8);
this.cube = new ModelRenderer(this, "cube");
this.cube.setTextureOffset(32, 0).addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8);

if (p_i1170_2_)
{
this.base = new ModelRenderer(this, "base");
this.base.setTextureOffset(0, 16).addBox(-6.0F, 0.0F, -6.0F, 12, 4, 12);
}
}

/**
* Sets the models various rotation angles then renders the model.
*/


public void render(TileEntity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_)
{
GL11.glPushMatrix();
GL11.glScalef(2.0F, 2.0F, 2.0F);
GL11.glTranslatef(0.0F, -0.5F, 0.0F);
GL11.glRotatef(p_78088_3_, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.8F + p_78088_4_, 0.0F);
GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
this.glass.render(p_78088_7_);
float f6 = 0.875F;
GL11.glScalef(f6, f6, f6);
GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
GL11.glRotatef(p_78088_3_, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f6, f6, f6);
GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
GL11.glRotatef(p_78088_3_, 0.0F, 1.0F, 0.0F);
this.cube.render(p_78088_7_);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,130 @@
package cc.client.regular;

import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;

/**
* Created by jakihappycity on 08.11.15.
*/
public class EntityChromaFX extends EntityFX {

private double chromaPosX;
private double chromaPosY;
private double chromaPosZ;
public float tickPos;
private static final ResourceLocation particleTextures = new ResourceLocation("textures/particle/particles.png");
private static final ResourceLocation ccparticleTextures = new ResourceLocation("cc","textures/special/particles.png");
public EntityChromaFX(World w, double x, double y, double z, double i, double j, double k)
{
super(w, x, y, z, i, j,k);
this.motionX = i;
this.motionY = j;
this.motionZ = k;
this.chromaPosX = this.posX = x;
this.chromaPosY = this.posY = y;
this.chromaPosZ = this.posZ = z;
this.rand.nextFloat();
this.particleScale = 0.5F;
this.particleRed = 0;
this.particleGreen = 0F;
this.particleRed = 0.8F;
this.particleMaxAge = (int)(Math.random() * 10.0D) + 40;
this.noClip = true;
this.setParticleTextureIndex((int)(Math.random() * 8.0D));
}

public EntityChromaFX(World w, double x, double y,double z, double i, double j,double k, double cR, double cG, double cB)
{
this(w,x,y,z,i,j,k);
this.particleRed = (float) cR;
this.particleGreen = (float) cG;
this.particleBlue = (float) cB;
}

public void renderParticle(Tessellator var3, float par2, float par3, float par4, float par5, float par6, float par7)
{

var3.draw();
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_ALPHA_TEST);
boolean enabled = GL11.glIsEnabled(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_BLEND);

Minecraft.getMinecraft().renderEngine.bindTexture(ccparticleTextures);
var3.startDrawingQuads();

float sc = this.particleScale;
float cR = this.particleRed;
float cG = this.particleGreen;
float cB = this.particleBlue;
float cA = this.particleAlpha;
this.particleScale *= 1.5F;
this.particleRed = 1;
this.particleGreen = 0F;
this.particleBlue = 1F;
this.particleAlpha = 1F;
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
var3.setBrightness(512);
super.renderParticle(var3, par2, par3, par4, par5, par6, par7);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.particleScale = sc;
this.particleRed = cR;
this.particleGreen = cG;
this.particleBlue = cB;
this.particleAlpha = cA;
super.renderParticle(var3, par2, par3, par4, par5, par6, par7);
var3.draw();
Minecraft.getMinecraft().renderEngine.bindTexture(particleTextures);

if(!enabled)
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glPopMatrix();
var3.startDrawingQuads();
}

public int getBrightnessForRender(float p_70070_1_)
{
return 255;
}

/**
* Gets how bright this entity is.
*/
public float getBrightness(float p_70013_1_)
{
float f1 = super.getBrightness(p_70013_1_);
float f2 = (float)this.particleAge / (float)this.particleMaxAge;
f2 = f2 * f2 * f2 * f2;
return f1 * (1.0F - f2) + f2;
}

/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
tickPos += 15+this.worldObj.rand.nextFloat()*15;
if(this.particleAge < this.particleMaxAge/2)
this.setParticleTextureIndex(7 - this.particleAge * 8 / (this.particleMaxAge/2));
else
this.setParticleTextureIndex((this.particleAge-this.particleMaxAge/2) * 8 / (this.particleMaxAge/2));
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
float f = (float)this.particleAge / (float)this.particleMaxAge;
this.posX = (this.chromaPosX + this.motionX * (double)f) + Math.sin(Math.toRadians(tickPos + this.worldObj.getWorldTime()*10))/10;
this.posY = (this.chromaPosY + this.motionY * (double)f) + Math.cos(Math.toRadians(tickPos + this.worldObj.getWorldTime()*10))/10;
this.posZ = (this.chromaPosZ + this.motionZ * (double)f) - Math.sin(Math.toRadians(tickPos + this.worldObj.getWorldTime()*10))/10;

if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
}

}
@@ -0,0 +1,137 @@
package cc.client.regular;

import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;


/**
* Created by jakihappycity on 06.11.15.
*/
public class EntityColoredFlameFX extends EntityFX{

private float flameScale;

private static final ResourceLocation particleTextures = new ResourceLocation("textures/particle/particles.png");
private static final ResourceLocation ccparticleTextures = new ResourceLocation("cc","textures/special/particles.png");

public EntityColoredFlameFX(World w, double x,double y, double z, double mX,double mY, double mZ)
{
super(w, x, y, z, mX, mY,mZ);
this.motionX = this.motionX * 0.009999999776482582D + mX;
this.motionY = this.motionY * 0.009999999776482582D + mY;
this.motionZ = this.motionZ * 0.009999999776482582D + mZ;
this.flameScale = this.particleScale;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4;
this.noClip = true;
this.setParticleTextureIndex(48);
}

public EntityColoredFlameFX(World w, double x,double y, double z, double mX,double mY, double mZ, double r, double g, double b, double scale)
{
super(w, x, y, z, mX, mY,mZ);
this.motionX = this.motionX * 0.009999999776482582D + mX;
this.motionY = this.motionY * 0.009999999776482582D + mY;
this.motionZ = this.motionZ * 0.009999999776482582D + mZ;
this.flameScale = (float) scale;
this.particleRed = (float) r;
this.particleGreen = (float) g;
this.particleBlue = (float) b;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4;
this.noClip = true;
this.setParticleTextureIndex(48);
}

public void renderParticle(Tessellator var3, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_)
{
var3.draw();
Minecraft.getMinecraft().renderEngine.bindTexture(ccparticleTextures);

float f6 = ((float)this.particleAge + p_70539_2_) / (float)this.particleMaxAge;
this.particleScale = this.flameScale * (1.0F - f6 * f6 * 0.5F);
var3.startDrawingQuads();
super.renderParticle(var3, p_70539_2_, p_70539_3_, p_70539_4_, p_70539_5_, p_70539_6_, p_70539_7_);
var3.draw();

Minecraft.getMinecraft().renderEngine.bindTexture(particleTextures);
var3.startDrawingQuads();
}

public int getBrightnessForRender(float p_70070_1_)
{
float f1 = ((float)this.particleAge + p_70070_1_) / (float)this.particleMaxAge;

if (f1 < 0.0F)
{
f1 = 0.0F;
}

if (f1 > 1.0F)
{
f1 = 1.0F;
}

int i = super.getBrightnessForRender(p_70070_1_);
int j = i & 255;
int k = i >> 16 & 255;
j += (int)(f1 * 15.0F * 16.0F);

if (j > 240)
{
j = 240;
}

return j | k << 16;
}

/**
* Gets how bright this entity is.
*/
public float getBrightness(float p_70013_1_)
{
float f1 = ((float)this.particleAge + p_70013_1_) / (float)this.particleMaxAge;

if (f1 < 0.0F)
{
f1 = 0.0F;
}

if (f1 > 1.0F)
{
f1 = 1.0F;
}

float f2 = super.getBrightness(p_70013_1_);
return f2 * f1 + (1.0F - f1);
}

/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;

if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}

this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;

if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}

}
@@ -0,0 +1,50 @@
package cc.client.regular;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntitySmokeFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

/**
* Created by jakihappycity on 06.11.15.
*/
public class SmokeFX extends EntitySmokeFX{
private static final ResourceLocation particleTextures = new ResourceLocation("textures/particle/particles.png");
private static final ResourceLocation ccparticleTextures = new ResourceLocation("cc","textures/special/particles.png");

public SmokeFX(World w, double x, double y, double z, double mX, double mY, double mZ, float scale)
{
super(w, x, y, z, mX, mY,mZ, scale);
}

public SmokeFX(World w, double x, double y, double z, double mX, double mY, double mZ, float scale, double r, double g, double b)
{
super(w, x, y, z, mX, mY,mZ, scale);
this.particleRed = (float) r;
this.particleGreen = (float) g;
this.particleBlue = (float) b;
}

public void renderParticle(Tessellator var3, float par2, float par3, float par4, float par5, float par6, float par7)
{
var3.draw();
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_ALPHA_TEST);
boolean enabled = GL11.glIsEnabled(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_BLEND);
Minecraft.getMinecraft().renderEngine.bindTexture(ccparticleTextures);
var3.startDrawingQuads();
super.renderParticle(var3, par2, par3, par4, par5, par6, par7);
var3.draw();
Minecraft.getMinecraft().renderEngine.bindTexture(particleTextures);
if(!enabled)
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glPopMatrix();
var3.startDrawingQuads();
}

}
@@ -0,0 +1,46 @@
package cc.client.render.tile;

import cc.common.block.BlockHeatGenerator;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;

/**
* Created by jakihappycity on 08.11.15.
*/
public class RenderBlocksCC implements ISimpleBlockRenderingHandler {

@Override
public void renderInventoryBlock(Block block, int metadata, int modelId,
RenderBlocks renderer) {
if(block instanceof BlockHeatGenerator)
{
GL11.glPushMatrix();
GL11.glTranslatef(0F,-0.5F,0F);
Minecraft.getMinecraft().renderEngine.bindTexture(RenderHeatGenerator.textures);
RenderHeatGenerator.model.renderAll();
GL11.glPopMatrix();
}
}

@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return true;
}

@Override
public boolean shouldRender3DInInventory(int modelId) {
// TODO Auto-generated method stub
return true;
}

@Override
public int getRenderId() {
// TODO Auto-generated method stub
return 2634;
}

}
@@ -0,0 +1,76 @@
package cc.client.render.tile;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;

import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;

import cc.client.model.ModelFloatingCube;
import cc.common.tile.TileChromaTower;

/**
* Created by jakihappycity on 07.11.15.
*/
@SideOnly(Side.CLIENT)
public class RenderChromaTower extends TileEntitySpecialRenderer {

private static final ResourceLocation enderCrystalTextures = new ResourceLocation("cc:textures/entities/chromaCrystal.png");
private ModelFloatingCube model;

public RenderChromaTower()
{
this.model = new ModelFloatingCube(0.0F, true);
}

/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(TileChromaTower p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
RenderHelper.disableStandardItemLighting();
float f2 = p_76986_1_.innerRotation + p_76986_9_;
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_+0.5F, (float)p_76986_4_+1.6F, (float)p_76986_6_+0.5F);
this.bindTexture(enderCrystalTextures);
float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
f3 += f3 * f3;
GL11.glScalef(0.4F, 0.4F, 0.4F);
this.model.render(p_76986_1_, 0.0F, f2 * 3.0F, 0.35F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
RenderHelper.enableStandardItemLighting();
}

/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(TileChromaTower p_110775_1_)
{
return enderCrystalTextures;
}

/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(TileEntity p_110775_1_)
{
return this.getEntityTexture((TileChromaTower)p_110775_1_);
}

@Override
public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_,
double p_147500_4_, double p_147500_6_, float p_147500_8_) {
if(p_147500_1_.getWorldObj().getBlockMetadata(p_147500_1_.xCoord, p_147500_1_.yCoord, p_147500_1_.zCoord) == 0)
this.doRender((TileChromaTower) p_147500_1_, p_147500_2_, p_147500_4_, p_147500_6_, p_147500_8_, 0);
}

}
@@ -0,0 +1,58 @@
package cc.client.render.tile;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;

import org.lwjgl.opengl.GL11;

/**
* Created by jakihappycity on 07.11.15.
*/
@SideOnly(Side.CLIENT)
public class RenderHeatGenerator extends TileEntitySpecialRenderer
{
public static final ResourceLocation textures = new ResourceLocation("cc:textures/special/models/heatGenerator.png");
public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("cc:textures/special/models/HeatGenerator.obj"));

public RenderHeatGenerator()
{
}

/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(TileEntity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
RenderHelper.disableStandardItemLighting();
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_+0.5F, (float)p_76986_4_, (float)p_76986_6_+0.5F);
this.bindTexture(textures);
model.renderAll();
GL11.glPopMatrix();
RenderHelper.enableStandardItemLighting();
}

/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(TileEntity p_110775_1_)
{
return textures;
}

@Override
public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_,
double p_147500_4_, double p_147500_6_, float p_147500_8_) {
if(p_147500_1_.getWorldObj().getBlockMetadata(p_147500_1_.xCoord, p_147500_1_.yCoord, p_147500_1_.zCoord) == 0)
this.doRender((TileEntity) p_147500_1_, p_147500_2_, p_147500_4_, p_147500_6_, p_147500_8_, 0);
}
}
@@ -70,21 +70,21 @@ public int getRenderBlockPass()
}

@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
if (par1World.isRemote)
if (world.isRemote)
{
return true;
}else
{
if(!par5EntityPlayer.isSneaking())
if(!player.isSneaking())
{
if(par1World.getBlockMetadata(par2, par3, par4) == 0)
if(world.getBlockMetadata(x, y, z) == 0)
{
par5EntityPlayer.openGui(CCCore.instance, Config.guiID[0], par1World, par2, par3, par4);
player.openGui(CCCore.instance, Config.guiID[0], world, x, y, z);
}else
{
par5EntityPlayer.openGui(CCCore.instance, Config.guiID[0], par1World, par2, par3-1, par4);
player.openGui(CCCore.instance, Config.guiID[0], world, x, y-1, z);
}
return true;
}else
@@ -0,0 +1,77 @@
package cc.common.block;

import cc.common.mod.CCCore;
import cc.common.tile.TileHeatGenerator;
import cc.utils.MiscUtils;
import cc.utils.cfg.Config;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

/**
* Created by jakihappycity on 06.11.15.
*/
public class BlockHeatGenerator extends BlockContainer {

public BlockHeatGenerator(Material p_i45394_1_) {
super(p_i45394_1_);
}

public boolean isOpaqueCube()
{
return false;
}

@Override
public int getRenderBlockPass()
{
return 0;
}

public boolean renderAsNormalBlock()
{
return false;
}

public int getRenderType()
{
return 2634;
}

@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
// TODO Auto-generated method stub
return new TileHeatGenerator();
}

@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par1World.isRemote)
{
return true;
}else
{
if(!par5EntityPlayer.isSneaking())
{
par5EntityPlayer.openGui(CCCore.instance, Config.guiID[0], par1World, par2, par3, par4);
return true;
}
else
{
return false;
}
}
}

@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6)
{
MiscUtils.dropItemsOnBlockBreak(par1World, par2, par3, par4, par5, par6);
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}

}
@@ -0,0 +1,81 @@
package cc.common.block;

import cc.common.mod.CCCore;
import cc.common.tile.TileMagicalPulverizer;
import cc.utils.MiscUtils;
import cc.utils.cfg.Config;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

/**
* Created by jakihappycity on 08.11.15.
*/
public class BlockMagicalPulverizer extends BlockContainer {

public BlockMagicalPulverizer() {
super(Material.rock);
}

public BlockMagicalPulverizer(Material p_i45394_1_) {
super(p_i45394_1_);
}

@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6)
{
MiscUtils.dropItemsOnBlockBreak(par1World, par2, par3, par4, par5, par6);
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}

public boolean isOpaqueCube()
{
return false;
}

@Override
public int getRenderBlockPass()
{
return 0;
}

public boolean renderAsNormalBlock()
{
return false;
}

public int getRenderType()
{
return 2634;
}

@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
// TODO Auto-generated method stub
return new TileMagicalPulverizer();
}

@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par1World.isRemote)
{
return true;
}else
{
if(!par5EntityPlayer.isSneaking())
{
par5EntityPlayer.openGui(CCCore.instance, Config.guiID[0], par1World, par2, par3, par4);
return true;
}
else
{
return false;
}
}
}

}
@@ -0,0 +1,46 @@
package cc.common.block;

import cc.common.mod.CCCore;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;

import java.util.Hashtable;

/**
* Created by jakihappycity on 09.11.15.
*/
public class BlocksRegistry {

/**
* Used to check the creative tab block belongs to
*/
public static Hashtable<Block,String> blocksList = new Hashtable<Block, String>();

/**
* Use this to register new simple blocks.
* @param b - the block to be registered.
* @param name - in-game name of the block. Will be written to the corresponding .lang file
* @param modClass - class file of your mod. If registered from the mod itself, use getClass(), else just put in this field something like YourModClassName.class
* @param blockClass - used, if you want to register a block, that has an ItemBlock. Can be null.
*/
public static void registerBlock(Block b, String name, Class<?> modClass, Class<? extends ItemBlock> blockClass)
{
if(blockClass == null)
{
GameRegistry.registerBlock(b, name);
}else
{
GameRegistry.registerBlock(b, blockClass, name);
}
Side s = FMLCommonHandler.instance().getEffectiveSide();
if(s == Side.CLIENT)
{
b.setCreativeTab(CCCore.tabCC);
blocksList.put(b, CCCore.tabCC.getTabLabel());
}
}

}
@@ -1,24 +1,20 @@
package cc.common.init;

import cc.common.block.BlockChromaTower;
import cc.common.block.ModBlock;
import cc.common.block.BlocksRegistry;
import cc.common.mod.CCCore;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemBlock;

/**
* Created by jakihappycity on 05.11.15.
*/
public class CoreBlocks {

public static Block oreChroma = new ModBlock(Material.rock).setBlockName("oreChroma").setBlockTextureName("cc:ore_chroma").setCreativeTab(CCCore.tabCC);
public static Block chromaTower = new BlockChromaTower(Material.iron).setBlockName("chromaTower").setBlockTextureName("cc:tower_chroma").setCreativeTab(CCCore.tabCC);

public static void Init()
{
GameRegistry.registerBlock(oreChroma, "oreChroma");
GameRegistry.registerBlock(chromaTower, "chromaTower");
BlocksRegistry.registerBlock(chromaTower, "chromaTower", core, ItemBlock.class);
}

}
public static Block chromaTower = new BlockChromaTower(Material.glass).setBlockName("chromaTower").setBlockTextureName("cc:chroma_tower").setCreativeTab(CCCore.tabCC);
public static final Class<CCCore> core = CCCore.class;
}
@@ -1,7 +1,6 @@
package cc.common.init;

import cc.common.item.ItemChromaCrystal;
import cc.common.item.ItemChromaticum;
import cc.common.item.*;
import cc.common.mod.CCCore;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.item.Item;
@@ -12,12 +11,18 @@
public class CoreItems {

public static Item chromaticum = new ItemChromaticum().setUnlocalizedName("chromaticum").setCreativeTab(CCCore.tabCC).setTextureName("cc:chromaticum");
public static Item crystalChroma = new ItemChromaCrystal().setUnlocalizedName("crystalChroma").setCreativeTab(CCCore.tabCC);
public static Item crystalChroma = new ItemChromaCrystal().setUnlocalizedName("crystalChroma").setCreativeTab(CCCore.tabCC).setTextureName("chroma_crystal");
public static Item lavaCrystal = new ItemLavaCrystal().setUnlocalizedName("lavaCrystal").setCreativeTab(CCCore.tabCC).setTextureName("cc:lava_crystal");
public static Item chromaAmulet = new ItemChromaAmulet().setUnlocalizedName("chromaAmulet").setCreativeTab(CCCore.tabCC).setTextureName("cc:chroma_amulet");
public static Item magicalDust = new ItemMagicalDust().setUnlocalizedName("magicalDust").setCreativeTab(CCCore.tabCC).setTextureName("cc:magical_dust");

public static void Init()
{
GameRegistry.registerItem(chromaticum, "chromaticum");
GameRegistry.registerItem(crystalChroma, "crystalChroma");
GameRegistry.registerItem(lavaCrystal, "lavaCrystal");
GameRegistry.registerItem(chromaAmulet, "chromaAmulet");
GameRegistry.registerItem(magicalDust, "magicalDust");
}

}
@@ -1,5 +1,7 @@
package cc.common.init;

import cpw.mods.fml.common.registry.GameRegistry;

/**
* Created by jakihappycity on 05.11.15.
*/
@@ -1,6 +1,8 @@
package cc.common.init;

import cc.common.tile.TileChromaTower;
import cc.common.tile.TileHeatGenerator;
import cc.common.tile.TileMagicalPulverizer;
import cc.utils.cfg.Config;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.tileentity.TileEntity;
@@ -19,6 +21,8 @@ public class CoreTile {
public static void Init()
{
addTileToMapping(TileChromaTower.class);
addTileToMapping(TileHeatGenerator.class);
addTileToMapping(TileMagicalPulverizer.class);
}

public static void addTileToMapping(Class<? extends TileEntity> tile)
@@ -0,0 +1,38 @@
/*package cc.common.init;
import cc.common.potion.PotionChromed;
import cc.utils.MiscUtils;
import net.minecraft.potion.Potion;
/**
* Created by jakihappycity on 08.11.15.
*//*
public class PotionRegistry {
public static void registerPotions()
{
int pStart = 20;
pStart = getNextPotionId(pStart);
if(pStart >= 0)
{
potionChromed = new PotionChromed(pStart, true, 0xff00ff);
}
}
static int getNextPotionId(int start)
{
if(Potion.potionTypes != null && start > 0 && start < Potion.potionTypes.length && Potion.potionTypes[start] == null)
return start;
if(++start < Potion.potionTypes.length)
start = getNextPotionId(start);
else
start = -1;
if(start == -1)
start = MiscUtils.extendPotionArray(1);
return start;
}
public static PotionChromed potionChromed;
}
*/
@@ -18,7 +18,7 @@ public class ContainerChromaTower extends Container {
public ContainerChromaTower(InventoryPlayer par1InventoryPlayer, TileEntity par2)
{
this.chromaTower = par2;
this.addSlotToContainer(new SlotChromaCrystal((IInventory) chromaTower, 0, 29, 32));
this.addSlotToContainer(new SlotChromaCrystal((IInventory) chromaTower, 0, 26, 8));
int i;

for (i = 0; i < 3; ++i)
@@ -0,0 +1,125 @@
package cc.common.invertory;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnace;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;

/**
* Created by jakihappycity on 06.11.15.
*/
public class ContainerHeatGenerator extends Container{

private IInventory inv;
public ContainerHeatGenerator(InventoryPlayer par1InventoryPlayer, TileEntity par2)
{
this.inv = (IInventory) par2;
this.addSlotToContainer(new Slot(inv, 0, 108, 41));
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, inv, 1, 144, 41));
int i;

for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, j + i * 9 + 9, 8 + j * 18,84+ i * 18));
}
}

for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, i, 8 + i * 18, 142));
}
}

@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
// TODO Auto-generated method stub
return inv.isUseableByPlayer(p_75145_1_);
}

public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_)
{
ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(p_82846_2_);

if (slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();

if (p_82846_2_ < inv.getSizeInventory())
{
if (!this.mergeItemStack(itemstack1, inv.getSizeInventory(), 36+inv.getSizeInventory(), true))
{
if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
slot.onSlotChange(itemstack1, itemstack);
return null;
}


}
else if (p_82846_2_ > inv.getSizeInventory())
{
for(int i = 0; i < inv.getSizeInventory(); ++i)
{
if (this.mergeItemStack(itemstack1, i, i+1, false))
{
if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
return null;
}
}
}
if (p_82846_2_ > inv.getSizeInventory() && p_82846_2_ < 27+inv.getSizeInventory())
{
if (!this.mergeItemStack(itemstack1, 27+inv.getSizeInventory(), 36+inv.getSizeInventory(), false))
{
if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
return null;
}
}
else if (p_82846_2_ > 27+inv.getSizeInventory() && p_82846_2_ < 36+inv.getSizeInventory() && !this.mergeItemStack(itemstack1, inv.getSizeInventory(), 27+inv.getSizeInventory(), false))
{
if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
return null;
}
if (itemstack.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
else
{
slot.onSlotChanged();
}

if (itemstack1.stackSize == itemstack.stackSize)
{
return null;
}

slot.onPickupFromSlot(p_82846_1_, itemstack1);
}

return itemstack;
}
}
@@ -0,0 +1,68 @@
package cc.common.item;

import baubles.api.BaubleType;
import baubles.api.IBauble;
import cc.api.IItemRequiresChroma;
import cc.api.ItemStoresChromaInNBT;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;

/**
* Created by jakihappycity on 08.11.15.
*/
public class ItemChromaAmulet extends ItemStoresChromaInNBT implements IBauble {

public ItemChromaAmulet()
{
super();
this.setMaxChroma(50000);
this.maxStackSize = 1;
this.bFull3D = true;
}

@Override
public BaubleType getBaubleType(ItemStack itemStack) {
return BaubleType.AMULET;
}

@Override
public void onWornTick(ItemStack itemStack, EntityLivingBase entityLivingBase) {

}

@Override
public void onEquipped(ItemStack itemStack, EntityLivingBase entityLivingBase) {

}

@Override
public void onUnequipped(ItemStack itemStack, EntityLivingBase entityLivingBase) {

}

@Override
public boolean canEquip(ItemStack itemStack, EntityLivingBase entityLivingBase) {
return true;
}

@Override
public boolean canUnequip(ItemStack itemStack, EntityLivingBase entityLivingBase) {
return true;
}

@Override
public boolean setChroma(ItemStack stack, int amount) {
return true;
}

@Override
public int getChroma(ItemStack stack) {
return 10000;
}

@Override
public int getMaxChroma(ItemStack stack) {
return 1000000;
}
}
@@ -0,0 +1,16 @@
package cc.common.item;

import cpw.mods.fml.common.IFuelHandler;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

/**
* Created by jakihappycity on 06.11.15.
*/
public class ItemLavaCrystal extends Item implements IFuelHandler {

@Override
public int getBurnTime(ItemStack fuel) {
return 600;
}
}
@@ -0,0 +1,80 @@
package cc.common.item;

import java.util.ArrayList;
import java.util.List;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cc.utils.EnumOreColoring;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraftforge.oredict.OreDictionary;

/**
* Created by jakihappycity on 08.11.15.
*/
public class ItemMagicalDust extends Item {

public static IIcon[] layerIcon = new IIcon[2];

public ItemMagicalDust()
{
this.setMaxDamage(0);
this.setHasSubtypes(true);
}

public void registerIcons(IIconRegister p_94581_1_)
{
super.registerIcons(p_94581_1_);
layerIcon[0] = p_94581_1_.registerIcon("cc:modular/dust_layer_0");
layerIcon[1] = p_94581_1_.registerIcon("cc:modular/dust_layer_1");
}

@SuppressWarnings({ "unchecked", "rawtypes" })
@SideOnly(Side.CLIENT)
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_)
{
for(int i = 0; i < EnumOreColoring.values().length; ++i)
{
p_150895_3_.add(new ItemStack(p_150895_1_,1,i));
}
}

@SuppressWarnings({ "unchecked", "rawtypes" })
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_)
{
EnumOreColoring ore = EnumOreColoring.values()[p_77624_1_.getItemDamage()];
ArrayList<ItemStack> oreLst = OreDictionary.getOres(ore.oreName);
if(oreLst != null && !oreLst.isEmpty())
p_77624_3_.add(oreLst.get(0).getDisplayName());
else
p_77624_3_.add(StatCollector.translateToLocal("tile."+EnumOreColoring.values()[p_77624_1_.getItemDamage()].oreName+".name"));
}

@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses()
{
return true;
}

@SideOnly(Side.CLIENT)
public IIcon getIconFromDamageForRenderPass(int i, int j)
{
return layerIcon[j];
}

@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack p_82790_1_, int p_82790_2_)
{
if(p_82790_2_ == 0)
return 16777215;
return EnumOreColoring.values()[p_82790_1_.getItemDamage()].color;
}

}
@@ -2,15 +2,18 @@

import cc.common.init.*;
import cc.common.world.CCWorldGen;
import cc.network.PacketNBT;
import cc.network.proxy.CommonProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.common.registry.GameRegistry;
import io.netty.channel.ChannelHandler;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import org.apache.logging.log4j.LogManager;
@@ -70,13 +73,6 @@ public void preInit(FMLPreInitializationEvent event)
{
log.debug("Loading " + name);
instance = this;
if(proxy != null)
{
proxy.registerRenderInformation();
}else
{

}
ModInfo(event.getModMetadata());
this.modDir = event.getModConfigurationDirectory();
try {
@@ -87,12 +83,22 @@ public void preInit(FMLPreInitializationEvent event)
if(Config.config != null) {
Config.save();
}
}
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);
if(proxy != null)
{
proxy.registerRenderInformation();
//proxy.registerTileEntitySpecialRenderer();
}else
{

}
CoreBlocks.Init();
CoreItems.Init();
CoreRecipes.Init();
CoreResearch.Init();
CoreTile.Init();
//PotionRegistry.registerPotions();
}

@Mod.EventHandler
@@ -104,8 +110,8 @@ public void init(FMLInitializationEvent event)
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
log.debug(name + " has loaded");
GameRegistry.registerWorldGenerator(new CCWorldGen(), 16);
log.debug(name + " has loaded");
}

public static void ModInfo(ModMetadata m)
@@ -31,7 +31,6 @@ public TileChromaGeneric()
int Chroma;
int maxChroma = 100;
UUID uuid = UUID.randomUUID();
float balance;
public int innerRotation;
private ItemStack[] items = new ItemStack[1];
private TileStatTracker tracker;
@@ -70,7 +69,7 @@ public void updateEntity()
else
if(!this.worldObj.isRemote && this.tracker.tileNeedsSyncing())
{
MiscUtils.sendPacketToAllAround(worldObj, getDescriptionPacket(), xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId, 32);
//MiscUtils.sendPacketToAllAround(worldObj, getDescriptionPacket(), xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId, 32);
}
syncTick = 60;
}else
@@ -79,7 +78,7 @@ public void updateEntity()
if(requestSync && this.worldObj.isRemote)
{
requestSync = false;
CCUtils.requestScheduledTileSync(this, CCCore.proxy.getClientPlayer());
//CCUtils.requestScheduledTileSync(this, CCCore.proxy.getClientPlayer());
}
}

@@ -0,0 +1,191 @@
package cc.common.tile;

import cc.api.ApiCore;
import cc.api.IHotBlock;
import cc.common.init.CoreItems;
import cc.common.mod.CCCore;
import cc.utils.DataStorage;
import cc.utils.DummyData;
import cc.utils.MathUtils;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.util.ForgeDirection;

/**
* Created by jakihappycity on 06.11.15.
*/
public class TileHeatGenerator extends TileChromaGeneric {

public int currentBurnTime, currentMaxBurnTime;
public static float cfgMaxChroma = ApiCore.GENERATOR_MAX_Chroma_GENERIC;
public static float chromaGenerated = 20;

public TileHeatGenerator()
{
super();
this.maxChroma = (int)cfgMaxChroma;
this.setSlotsNum(2);
}

public boolean canGenerateChroma()
{
return false;
}

@Override
public void updateEntity()
{
float chromaGen = chromaGenerated;
super.updateEntity();
if(!this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
{
if (this.currentBurnTime > 0)
{
--this.currentBurnTime;
if(!this.worldObj.isRemote)
{
float chromaFactor = 1.0F;
Block[] b = new Block[4];
b[0] = this.worldObj.getBlock(xCoord+2, yCoord, zCoord);
b[1] = this.worldObj.getBlock(xCoord-2, yCoord, zCoord);
b[2] = this.worldObj.getBlock(xCoord, yCoord, zCoord+2);
b[3] = this.worldObj.getBlock(xCoord, yCoord, zCoord-2);
int[] ox = new int[]{2,-2,0,0};
int[] oz = new int[]{0,0,2,-2};
for(int i = 0; i < 4; ++i)
{
if(b[i] == Blocks.air)
{
chromaFactor*=0;
}else if(b[i] == Blocks.netherrack)
{
chromaFactor*=0.75F;
}else if(b[i] == Blocks.lava)
{
chromaFactor*=0.95F;
}else if(b[i] == Blocks.fire)
{
chromaFactor*=0.7F;
}else if(b[i] instanceof IHotBlock)
{
chromaFactor*=(((IHotBlock)b[i]).getHeatModifier(getWorldObj(), xCoord+ox[i], yCoord, zCoord+oz[i]));
}else
{
chromaFactor*=0.5F;
}

}

chromaGen*=chromaFactor;
if(chromaGen >= 1)
{
this.setChroma((int) (this.getChroma()+chromaGen));
if(this.getChroma() > this.getMaxChroma())
this.setChroma(this.getMaxChroma());
}
}
}

if (!this.worldObj.isRemote)
{
if (this.getStackInSlot(0) != null)
{
if (this.currentBurnTime == 0 && this.getChroma() < this.getMaxChroma())
{
this.currentMaxBurnTime = this.currentBurnTime = TileEntityFurnace.getItemBurnTime(this.getStackInSlot(0));

if (this.currentBurnTime > 0)
{
if (this.getStackInSlot(0) != null)
{

if(this.getStackInSlot(1) == null || this.getStackInSlot(1).stackSize < this.getInventoryStackLimit())
{
if(this.getStackInSlot(1) != null && this.getStackInSlot(1).getItem() == CoreItems.lavaCrystal)
{
ItemStack stk = this.getStackInSlot(1);
++stk.stackSize;
this.setInventorySlotContents(1, stk);
}
if(this.getStackInSlot(1) == null)
{
ItemStack stk = new ItemStack(CoreItems.lavaCrystal,1,0);
this.setInventorySlotContents(1, stk);
}
}
if(this.getStackInSlot(0).stackSize == 0)
{
this.setInventorySlotContents(0, this.getStackInSlot(0).getItem().getContainerItem(this.getStackInSlot(0)));
}
this.decrStackSize(0, 1);
}
}
}
}
}
}
for(int i = 2; i < 6; ++i)
{
ForgeDirection rotation = ForgeDirection.VALID_DIRECTIONS[i];
float rotXAdv = rotation.offsetX-0.5F;
float rotZAdv = rotation.offsetZ-0.5F;
CCCore.proxy.FlameFX(xCoord+0.725F+rotXAdv/2.2F, yCoord+0.4F, zCoord+0.725F+rotZAdv/2.2F, 0, 0F, 0, 0.8D, 0.5D, 0.5F, 0.5F);
CCCore.proxy.FlameFX(xCoord+0.5F+ MathUtils.randomFloat(this.worldObj.rand)*0.2F, yCoord+0.65F, zCoord+0.5F+MathUtils.randomFloat(this.worldObj.rand)*0.2F, 0, 0.01F, 0, 0.8D, 0.5D, 0.5F, 1F);

}
CCCore.proxy.SmokeFX(xCoord+0.5F+MathUtils.randomFloat(this.worldObj.rand)*0.05F, yCoord+0.8F, zCoord+0.5F+MathUtils.randomFloat(this.worldObj.rand)*0.05F, 0, 0, 0, 1);
}

@Override
public void readFromNBT(NBTTagCompound i)
{
currentBurnTime = i.getInteger("burn");
currentMaxBurnTime = i.getInteger("burnMax");
super.readFromNBT(i);
}

@Override
public void writeToNBT(NBTTagCompound i)
{
i.setInteger("burn", currentBurnTime);
i.setInteger("burnMax", currentMaxBurnTime);
super.writeToNBT(i);
}

public static void setupConfig(Configuration cfg)
{
try
{
cfg.load();
String[] cfgArrayString = cfg.getStringList("HeatGeneratorSettings", "tileentities", new String[]{
"Max Chroma:"+ApiCore.GENERATOR_MAX_Chroma_GENERIC,
"Max Chroma generated per tick:20"
},"");
String dataString="";

for(int i = 0; i < cfgArrayString.length; ++i)
dataString+="||"+cfgArrayString[i];

DummyData[] data = DataStorage.parseData(dataString);

cfgMaxChroma = Float.parseFloat(data[0].fieldValue);
chromaGenerated = Float.parseFloat(data[2].fieldValue);

cfg.save();
}catch(Exception e)
{
return;
}
}

@Override
public int[] getOutputSlots() {
return new int[]{1};
}


}

Large diffs are not rendered by default.

@@ -32,12 +32,12 @@ public PacketNBT setID(int i)
@Override
public void fromBytes(ByteBuf buf) {
theTag = ByteBufUtils.readTag(buf);
packetID = theTag.getInteger("ec3packetData.id");
packetID = theTag.getInteger("ссpacketData.id");
}

@Override
public void toBytes(ByteBuf buf) {
theTag.setInteger("ec3packetData.id", packetID);
theTag.setInteger("ссpacketData.id", packetID);
ByteBufUtils.writeTag(buf, theTag);
}

@@ -2,9 +2,18 @@

import cc.client.gui.GuiChromaTower;
import cc.client.gui.GuiChromaticum;
import cc.client.gui.GuiHeatGenerator;
import cc.client.regular.EntityChromaFX;
import cc.client.regular.EntityColoredFlameFX;
import cc.client.render.tile.RenderChromaTower;
import cc.client.render.tile.RenderHeatGenerator;
import cc.common.invertory.ContainerChromaTower;
import cc.common.invertory.ContainerHeatGenerator;
import cc.common.tile.TileChromaTower;
import cc.common.tile.TileHeatGenerator;
import cc.utils.cfg.Config;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
@@ -26,15 +35,19 @@ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int
{
return new GuiChromaTower(new ContainerChromaTower(player.inventory, tile), tile);
}
if(tile instanceof TileHeatGenerator)
{
return new GuiHeatGenerator(new ContainerHeatGenerator(player.inventory, tile),tile);
}
}
return null;

}

@Override
public void registerRenderInformation()
{

ClientRegistry.bindTileEntitySpecialRenderer(TileHeatGenerator.class, new RenderHeatGenerator());
ClientRegistry.bindTileEntitySpecialRenderer(TileChromaTower.class, new RenderChromaTower());
}

@Override
@@ -63,4 +76,44 @@ public Object getClientIcon(String str)
return null;
}

@Override
public void FlameFX(double... ds)
{
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityColoredFlameFX(
Minecraft.getMinecraft().theWorld, ds[0], ds[1], ds[2], ds[3], ds[4], ds[5], ds[6], ds[7], ds[8], ds[9]
));
}

public void SmokeFX(double... ds)
{
if(ds.length == 7)
{
Minecraft.getMinecraft().effectRenderer.addEffect(new cc.client.regular.SmokeFX(
Minecraft.getMinecraft().theWorld, ds[0], ds[1], ds[2], ds[3], ds[4], ds[5], (float) ds[6]
));
}
if(ds.length == 10)
{
Minecraft.getMinecraft().effectRenderer.addEffect(new cc.client.regular.SmokeFX(
Minecraft.getMinecraft().theWorld, ds[0], ds[1], ds[2], ds[3], ds[4], ds[5], (float) ds[6], ds[7], ds[8], ds[9]
));
}
}

@Override
public World getClientWorld()
{
return FMLClientHandler.instance().getClient().theWorld;
}

@Override
public void CHROMAFX(double... ds)
{
if(ds.length <= 6)
{
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityChromaFX(getClientWorld(), ds[0], ds[1], ds[2], ds[3], ds[4], ds[5]));
}else
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityChromaFX(getClientWorld(), ds[0], ds[1], ds[2], ds[3], ds[4], ds[5], ds[6], ds[7], ds[8]));
}

}
@@ -1,8 +1,12 @@
package cc.network.proxy;

import cc.common.invertory.ContainerChromaTower;
import cc.common.invertory.ContainerHeatGenerator;
import cc.common.tile.TileChromaTower;
import cc.common.tile.TileHeatGenerator;
import cc.utils.cfg.Config;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
@@ -14,10 +18,12 @@
*/
public class CommonProxy implements IGuiHandler {

@SuppressWarnings("unchecked")
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

/**
* FMLLog.info(String.format("Gui %d: [world: %s, x:%d, y:%d, z:%d] at side %s", ID, world.toString(), x, y, z, FMLCommonHandler.instance().getEffectiveSide().toString()));
* This is debug log.
*/
TileEntity tile = world.getTileEntity(x, y, z);

if(ID == Config.guiID[0])
@@ -26,9 +32,12 @@ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int
{
return new ContainerChromaTower(player.inventory, tile);
}
if(tile instanceof TileHeatGenerator)
{
return new ContainerHeatGenerator(player.inventory, tile);
}
}
return null;

}

@Override
@@ -55,4 +64,25 @@ public EntityPlayer getClientPlayer()
{
return null;
}

public void FlameFX(double... ds)
{

}

public void SmokeFX(double... ds)
{

}

public World getClientWorld()
{
return null;
}

public void CHROMAFX(double... ds)
{

}

}
@@ -1,13 +1,20 @@
package cc.utils;

import cc.api.ITEHasChroma;
import cc.common.item.ItemChromaCrystal;
import cc.common.mod.CCCore;
import cc.common.tile.TileChromaTower;
import cc.network.PacketNBT;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

@@ -18,6 +25,29 @@ public class CCUtils {

private static final List<ScheduledServerAction> actions = new ArrayList<ScheduledServerAction>();

protected static void actionsTick()
{
if(!actions.isEmpty())
for(int i = 0; i < actions.size(); ++i)
{
ScheduledServerAction ssa = actions.get(i);
--ssa.actionTime;
if(ssa.actionTime <= 0)
{
ssa.execute();
actions.remove(i);
}
}
}

public static void addScheduledAction(ScheduledServerAction ssa)
{
if(FMLCommonHandler.instance().getEffectiveSide() != Side.SERVER)
Notifier.notifyCustomMod("ChromaCraft", "[WARNING][SEVERE]Trying to add a scheduled server action not on server side, aborting!");

actions.add(ssa);
}

public static void requestScheduledTileSync(TileEntity tile, EntityPlayer requester)
{
Side s = FMLCommonHandler.instance().getEffectiveSide();
@@ -40,12 +70,122 @@ public static void requestScheduledTileSync(TileEntity tile, EntityPlayer reques
}
}

public static void addScheduledAction(ScheduledServerAction ssa)
public static void initChromaTag(ItemStack stack, int maxChroma)
{
if(FMLCommonHandler.instance().getEffectiveSide() != Side.SERVER)
Notifier.notifyCustomMod("EssentialCraft", "[WARNING][SEVERE]Trying to add a scheduled server action not on server side, aborting!");
if(maxChroma == 0)
{
try
{
Class<? extends Item> itemClz = stack.getItem().getClass();
Field f = itemClz.getField("maxChroma");
f.setInt(stack.getItem(), 5000);
maxChroma = 5000;
}catch(Exception e)
{
//Silent error tracking
}
}
getStackTag(stack).setInteger("maxChroma", maxChroma);
if(!getStackTag(stack).hasKey("chroma"))
getStackTag(stack).setInteger("chroma", 0);
}

actions.add(ssa);
public static NBTTagCompound getStackTag(ItemStack stack)
{
createNBTTag(stack);
return stack.getTagCompound();
}

public static void createNBTTag(ItemStack stack)
{

if(stack.hasTagCompound())
{
return;
}
NBTTagCompound itemTag = new NBTTagCompound();
stack.setTagCompound(itemTag);
}

public static void chromaIn(TileEntity tile, int slotNum)
{
if(tile instanceof IInventory && tile instanceof ITEHasChroma)
{
IInventory inv = (IInventory) tile;
ITEHasChroma chromat = (ITEHasChroma) tile;

if(inv.getStackInSlot(slotNum) != null && inv.getStackInSlot(slotNum).getItem() instanceof ItemChromaCrystal && inv.getStackInSlot(slotNum).getTagCompound() != null)
{
ItemStack s = inv.getStackInSlot(slotNum);
int[] o = ItemChromaCrystal.getCoords(s);
if(MathUtils.getDifference(tile.xCoord, o[0]) <= 16 && MathUtils.getDifference(tile.yCoord, o[1]) <= 16 && MathUtils.getDifference(tile.zCoord, o[2]) <= 16)
{
if(tile.getWorldObj().getTileEntity(o[0], o[1], o[2]) != null && tile.getWorldObj().getTileEntity(o[0], o[1], o[2]) instanceof ITEHasChroma)
{
ITEHasChroma t = (ITEHasChroma) tile.getWorldObj().getTileEntity(o[0], o[1], o[2]);
if(t != tile && t != null && !tile.getWorldObj().isRemote)
{
if(chromat.getChroma() < chromat.getMaxChroma())
{
int chroma = t.getChroma();
if(chroma > chromat.getMaxChroma() - chromat.getChroma())
{
t.setChroma(chroma-(chromat.getMaxChroma() - chromat.getChroma()));
chromat.setChroma(chromat.getMaxChroma());
}else
{
t.setChroma(0);
chromat.setChroma(chromat.getChroma()+chroma);
}
}
}
}
}
}
if(chromat.getChroma() < 0)
chromat.setChroma(0);
}
}

public static void spawnChromaParticles(TileEntity tile, int slotNum)
{
IInventory inv = (IInventory) tile;
if(tile.getWorldObj().isRemote)
{
if(inv.getStackInSlot(slotNum) != null && inv.getStackInSlot(slotNum).getItem() instanceof ItemChromaCrystal && inv.getStackInSlot(slotNum).getTagCompound() != null)
{
ItemStack s = inv.getStackInSlot(slotNum);
int[] o = ItemChromaCrystal.getCoords(s);
if(MathUtils.getDifference(tile.xCoord, o[0]) <= 16 && MathUtils.getDifference(tile.yCoord, o[1]) <= 16 && MathUtils.getDifference(tile.zCoord, o[2]) <= 16)
{
if(tile.getWorldObj().getTileEntity(o[0], o[1], o[2]) != null && tile.getWorldObj().getTileEntity(o[0], o[1], o[2]) instanceof ITEHasChroma)
{
float colorRRender = 0.0F;
float colorGRender = 1.0F;
float colorBRender = 1.0F;
if(tile instanceof TileChromaTower)
{
if(tile.getWorldObj().getTileEntity(o[0], o[1], o[2]) instanceof TileChromaTower)
CCCore.proxy.CHROMAFX((float) (o[0]+0.5D), (float) (o[1]+1.85D), (float) (o[2]+0.5D), tile.xCoord-o[0], tile.yCoord-o[1]+0.25D, tile.zCoord-o[2],colorRRender,colorGRender,colorBRender);
else
CCCore.proxy.CHROMAFX((float) (o[0]+0.5D), (float) (o[1]+0.5D), (float) (o[2]+0.5D), tile.xCoord-o[0], tile.yCoord-o[1]+1.5D, tile.zCoord-o[2],colorRRender,colorGRender,colorBRender);
}else
{
if(tile.getWorldObj().getTileEntity(o[0], o[1], o[2]) instanceof TileChromaTower)
CCCore.proxy.CHROMAFX((float) (o[0]+0.5D), (float) (o[1]+1.85D), (float) (o[2]+0.5D), tile.xCoord-o[0], tile.yCoord-o[1]-1.5D, tile.zCoord-o[2],colorRRender,colorGRender,colorBRender);
else
CCCore.proxy.CHROMAFX((float) (o[0]+0.5D), (float) (o[1]+0.5D), (float) (o[2]+0.5D), tile.xCoord-o[0], tile.yCoord-o[1], tile.zCoord-o[2],colorRRender,colorGRender,colorBRender);
}
}
}
}
}
}

public static void manage(TileEntity tile, int slotNum)
{
chromaIn(tile, 0);
spawnChromaParticles(tile, 0);
}

}
@@ -0,0 +1,71 @@
package cc.utils;

/**
* Created by jakihappycity on 08.11.15.
*/
public enum EnumOreColoring {

COAL("oreCoal","gemCoal",0x343434),
IRON("oreIron",0xe2c0aa),
GOLD("oreGold",0xf8af2b),
DIAMOND("oreDiamond","gemDiamond",0x5decf5),
EMERALD("oreEmerald","gemEmerald",0x17dd62),
QUARTZ("oreQuartz","gemQuartz",0xd1beb1),
REDSTONE("oreRedstone","dustRedstone",0x8f0303,8),
LAPIS("oreLapis","gemLapis",0x1c40a9,16),
COPPER("oreCopper",0xbc4800),
TIN("oreTin",0xc3e9ff),
LEAD("oreLead",0x7c8cc7),
SILVER("oreSilver",0xf0fdfe),
COBALT("oreCobalt",0x002568),
ARDITE("oreArdite",0xc9a537),
NICKEL("oreFerrous",0xe5e4bd),
ALUMINUM("oreAluminum",0xc5c5c5),
URANIUM("oreUranium",0x41b200),
IRIDIUM("oreIridium",0xebffff),
ALCHEMITE("oreAlchemite","gemAlchemite",0xff0e27,5),
FIRE("oreInfusedFire","shardFire",0xff0000,3),
WATER("oreInfusedWater","shardWater",0x0000ff,3),
EARTH("oreInfusedEarth","shardEarth",0x00ff00,3),
AIR("oreInfusedAir","shardAir",0xffff00,3),
ORDER("oreInfusedOrder","shardOrder",0xcccccc,3),
ENTROPY("oreInfusedEntropy","shardEntropy",0x333333,3),
;

EnumOreColoring(String i, int j)
{
oreName = i;
color = j;
dropAmount = 1;
outputName = "";
}

EnumOreColoring(String i, int j, int k)
{
oreName = i;
color = j;
dropAmount = k;
outputName = "";
}

EnumOreColoring(String i,String s, int j, int k)
{
oreName = i;
color = j;
dropAmount = k;
outputName = s;
}

EnumOreColoring(String i,String s, int j)
{
oreName = i;
color = j;
dropAmount = 1;
outputName = s;
}

public int color, dropAmount;
public String oreName;
public String outputName;

}
@@ -1,6 +1,8 @@
package cc.utils;

import cc.common.mod.CCCore;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@@ -13,11 +15,14 @@
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.potion.Potion;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.List;

/**
@@ -233,10 +238,54 @@ public static void dropItemsOnBlockBreak(World par1World, int par2, int par3, in
}
}catch(Exception ex)
{
Notifier.notifyCustomMod("DummyCore", "[ERROR]Trying to drop items upon block breaking, but caught an exception:");
Notifier.notifyCustomMod("ChromaCraft", "[ERROR]Trying to drop items upon block breaking, but caught an exception:");
ex.printStackTrace();
return;
}
}

/**
* Extends the default mc potionArray(which is declared as public static final Potion[] potionTypes = new Potion[32]) by the given amount
* @param byAmount - how much to extends for
* @return the first free index in the new potionArray.
*/
public static int extendPotionArray(int byAmount)
{
int potionOffset = Potion.potionTypes.length;
Potion[] potionTypes = new Potion[potionOffset + byAmount];
System.arraycopy(Potion.potionTypes, 0, potionTypes, 0, potionOffset);
setPrivateFinalValue(Potion.class,null,potionTypes, ObfuscationReflectionHelper.remapFieldNames(Potion.class.getName(), new String[] {"potionTypes","field_76425_a","a"}));
for(int i = 0; i < Potion.potionTypes.length; ++i)
if(Potion.potionTypes[i] == null)
return i;

return -1;
}

/**
* Allows changes of variables declared like private final || private static final. Advanced. Do not use if you do not know what you are doing!
* Sometimes considered as a dirty hacking of the java code. I agree. There is nothing more dirty, than just removing the FINAL modifier of the variable. It's like Java can't even do anything, no matter the protection given.
* This should not be done. However, in vanilla MC it is pretty much the only way to do so, so I can't help it.
* The only thing, that would be worse is using ASM to remotely change the compiled final variable. That is the most disgusting thing you can do with Java, I believe.
* @param classToAccess - the class in wich you are changing the variable
* @param instance - if you want to modify non-static field you should put the instance of the class here. Leave null for static
* @param value - what you actually want to be set in the variable field
* @param fieldNames - the names of the field you are changing. Should be both for obfuscated and compiled code.
*/
public static void setPrivateFinalValue(Class<?> classToAccess, Object instance, Object value, String fieldNames[])
{
Field field = ReflectionHelper.findField(classToAccess, ObfuscationReflectionHelper.remapFieldNames(classToAccess.getName(), fieldNames));
try
{
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(instance, value);
}
catch(Exception e)
{
e.printStackTrace();
}
}

}
@@ -1,9 +1,11 @@
Items:
item.chromaticum.name=Chromaticum
item.crystalChroma.name=Chroma Crystal


Blocks:
tile.oreChroma.name=Chroma Ore
tile.chromaTower.name=Chroma Tower


Gui:

Large diffs are not rendered by default.