Fix Smeltery null crash, remove crystalline content

This commit is contained in:
mDiyo committed 2013-11-10 17:05:50 -08:00
1 parent fdcb651ef4
commit 2553eb2377
179 files changed
+4578 -5290

No files matched your search

+1 -1
View File
@@ -98,7 +98,7 @@ public class TConstruct
proxy.addNames();
proxy.readManuals();
proxy.registerKeys();
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
GameRegistry.registerWorldGenerator(new TBaseWorldGenerator());
-181
View File
@@ -1,181 +0,0 @@
package tconstruct.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
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.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.FakePlayer;
import tconstruct.blocks.logic.EssenceExtractorLogic;
import tconstruct.common.TContent;
import tconstruct.library.TConstructRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EssenceExtractor extends BlockContainer
{
@SideOnly(Side.CLIENT)
private Icon field_94461_a;
@SideOnly(Side.CLIENT)
private Icon field_94460_b;
public EssenceExtractor(int par1)
{
super(par1, Material.rock);
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F);
this.setLightOpacity(0);
this.setCreativeTab(TConstructRegistry.blockTab);
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock ()
{
return false;
}
@SideOnly(Side.CLIENT)
/**
* A randomly called display update to be able to add particles or other items for display
*/
public void randomDisplayTick (World par1World, int par2, int par3, int par4, Random par5Random)
{
super.randomDisplayTick(par1World, par2, par3, par4, par5Random);
for (int l = par2 - 2; l <= par2 + 2; ++l)
{
for (int i1 = par4 - 2; i1 <= par4 + 2; ++i1)
{
if (l > par2 - 2 && l < par2 + 2 && i1 == par4 - 1)
{
i1 = par4 + 2;
}
if (par5Random.nextInt(16) == 0)
{
for (int j1 = par3; j1 <= par3 + 1; ++j1)
{
if (par1World.getBlockId(l, j1, i1) == Block.bookShelf.blockID)
{
if (!par1World.isAirBlock((l - par2) / 2 + par2, j1, (i1 - par4) / 2 + par4))
{
break;
}
par1World.spawnParticle("enchantmenttable", (double) par2 + 0.5D, (double) par3 + 2.0D, (double) par4 + 0.5D,
(double) ((float) (l - par2) + par5Random.nextFloat()) - 0.5D, (double) ((float) (j1 - par3) - par5Random.nextFloat() - 1.0F),
(double) ((float) (i1 - par4) + par5Random.nextFloat()) - 0.5D);
}
}
}
}
}
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube ()
{
return false;
}
@SideOnly(Side.CLIENT)
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public Icon getIcon (int par1, int par2)
{
return par1 == 0 ? this.field_94460_b : (par1 == 1 ? this.field_94461_a : this.blockIcon);
}
/**
* Returns a new instance of a block's tile entity class. Called on placing the block.
*/
public TileEntity createNewTileEntity (World par1World)
{
return new EssenceExtractorLogic();
}
/* Right-click to form a crystal */
@Override
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player)
{
if (world.isRemote)
{
return;
}
else
{
EssenceExtractorLogic logic = (EssenceExtractorLogic) world.getBlockTileEntity(x, y, z);
int amount = logic.removeEssence();
if (amount > 0)
{
ItemStack crystal = new ItemStack(TContent.essenceCrystal, 1);
NBTTagCompound tags = new NBTTagCompound();
tags.setInteger("Essence", amount);
crystal.setTagCompound(tags);
EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, crystal);
world.spawnEntityInWorld(entityitem);
if (!(player instanceof FakePlayer))
entityitem.onCollideWithPlayer(player);
}
}
}
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated (World par1World, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
if (par1World.isRemote)
{
return true;
}
else
{
EssenceExtractorLogic logic = (EssenceExtractorLogic) par1World.getBlockTileEntity(x, y, z);
logic.addEssence(player);
logic.getEssenceMessage(player);
return true;
}
}
/**
* Called when the block is placed in the world.
*/
public void onBlockPlacedBy (World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving, ItemStack par6ItemStack)
{
super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLiving, par6ItemStack);
if (par6ItemStack.hasDisplayName())
{
((EssenceExtractorLogic) par1World.getBlockTileEntity(par2, par3, par4)).func_94134_a(par6ItemStack.getDisplayName());
}
}
@SideOnly(Side.CLIENT)
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerIcons (IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("tinker:extractor_side");
this.field_94461_a = par1IconRegister.registerIcon("tinker:extractor_top");
this.field_94460_b = par1IconRegister.registerIcon("tinker:extractor_bottom");
}
}
-77
View File
@@ -1,77 +0,0 @@
package tconstruct.blocks;
import java.util.List;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import tconstruct.blocks.logic.TerraformerLogic;
import tconstruct.library.TConstructRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Terraformer extends BlockContainer
{
public Terraformer(int id)
{
super(id, Material.iron);
this.setCreativeTab(TConstructRegistry.blockTab);
setStepSound(soundMetalFootstep);
}
@Override
public TileEntity createNewTileEntity (World world)
{
return new TerraformerLogic();
}
@Override
public int damageDropped (int meta)
{
return meta;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < textureNames.length - 1; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
/* Rendering */
@SideOnly(Side.CLIENT)
public Icon[] icons;
@SideOnly(Side.CLIENT)
static String[] textureNames = { "crystal_machine_top", "terrafreezer", "terrafumer", "terrawaver", "terraleecher", "terragrower", "terranether", "terralighter", "terracrystal" };
@Override
@SideOnly(Side.CLIENT)
public void registerIcons (IconRegister iconRegister)
{
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:machines/" + textureNames[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon (int side, int meta)
{
if (side == 0 || side == 1)
return icons[0];
return icons[meta + 1];
}
}
@@ -1,245 +0,0 @@
package tconstruct.blocks.logic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityEnchantmentTable;
import java.text.DecimalFormat;
import java.util.Random;
public class EssenceExtractorLogic extends TileEntityEnchantmentTable
{
/** Used by the render to make the book 'bounce' */
public int tickCount;
/** Value used for determining how the page flip should look. */
public float pageFlip;
/** The last tick's pageFlip value. */
public float pageFlipPrev;
public float field_70373_d;
public float field_70374_e;
/** The amount that the book is open. */
public float bookSpread;
/** The amount that the book is open. */
public float bookSpreadPrev;
public float bookRotation2;
public float bookRotationPrev;
public float bookRotation;
private static Random rand = new Random();
private String field_94136_s;
public int essenceAmount;
static DecimalFormat df = new DecimalFormat("##.##");
/*public EssenceExtractorLogic()
{
df.setRoundingMode(RoundingMode.DOWN);
}*/
/**
* Writes a tile entity to NBT.
*/
public void writeToNBT (NBTTagCompound tags)
{
super.writeToNBT(tags);
if (this.func_94135_b())
{
tags.setString("CustomName", this.field_94136_s);
}
tags.setInteger("Essence", essenceAmount);
}
/**
* Reads a tile entity from NBT.
*/
public void readFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
if (tags.hasKey("CustomName"))
{
this.field_94136_s = tags.getString("CustomName");
}
essenceAmount = tags.getInteger("Essence");
}
/**
* Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count
* ticks and creates a new spawn inside its implementation.
*/
public void updateEntity ()
{
super.updateEntity();
this.bookSpreadPrev = this.bookSpread;
this.bookRotationPrev = this.bookRotation2;
EntityPlayer entityplayer = this.worldObj.getClosestPlayer((double) ((float) this.xCoord + 0.5F), (double) ((float) this.yCoord + 0.5F), (double) ((float) this.zCoord + 0.5F), 3.0D);
if (entityplayer != null)
{
double d0 = entityplayer.posX - (double) ((float) this.xCoord + 0.5F);
double d1 = entityplayer.posZ - (double) ((float) this.zCoord + 0.5F);
this.bookRotation = (float) Math.atan2(d1, d0);
this.bookSpread += 0.1F;
if (this.bookSpread < 0.5F || rand.nextInt(40) == 0)
{
float f = this.field_70373_d;
do
{
this.field_70373_d += (float) (rand.nextInt(4) - rand.nextInt(4));
} while (f == this.field_70373_d);
}
}
else
{
this.bookRotation += 0.02F;
this.bookSpread -= 0.1F;
}
while (this.bookRotation2 >= (float) Math.PI)
{
this.bookRotation2 -= ((float) Math.PI * 2F);
}
while (this.bookRotation2 < -(float) Math.PI)
{
this.bookRotation2 += ((float) Math.PI * 2F);
}
while (this.bookRotation >= (float) Math.PI)
{
this.bookRotation -= ((float) Math.PI * 2F);
}
while (this.bookRotation < -(float) Math.PI)
{
this.bookRotation += ((float) Math.PI * 2F);
}
float f1;
for (f1 = this.bookRotation - this.bookRotation2; f1 >= (float) Math.PI; f1 -= ((float) Math.PI * 2F))
{
;
}
while (f1 < -(float) Math.PI)
{
f1 += ((float) Math.PI * 2F);
}
this.bookRotation2 += f1 * 0.4F;
if (this.bookSpread < 0.0F)
{
this.bookSpread = 0.0F;
}
if (this.bookSpread > 1.0F)
{
this.bookSpread = 1.0F;
}
++this.tickCount;
this.pageFlipPrev = this.pageFlip;
float f2 = (this.field_70373_d - this.pageFlip) * 0.4F;
float f3 = 0.2F;
if (f2 < -f3)
{
f2 = -f3;
}
if (f2 > f3)
{
f2 = f3;
}
this.field_70374_e += (f2 - this.field_70374_e) * 0.9F;
this.pageFlip += this.field_70374_e;
}
public String func_94133_a ()
{
return this.func_94135_b() ? this.field_94136_s : "container.enchant";
}
public boolean func_94135_b ()
{
return this.field_94136_s != null && this.field_94136_s.length() > 0;
}
public void func_94134_a (String par1Str)
{
this.field_94136_s = par1Str;
}
public void addEssence (EntityPlayer player)
{
int amount = player.experienceTotal;
essenceAmount += amount;
player.addExperienceLevel(-player.experienceLevel - 1);
}
public int removeEssence ()
{
int amount = this.essenceAmount;
this.essenceAmount = 0;
return amount;
}
public void getEssenceMessage (EntityPlayer player)
{
player.addChatMessage("Total Essence: " + this.essenceAmount);
player.addChatMessage("Stored Levels: " + getEssencelevels(this.essenceAmount));
}
public static String getEssencelevels (int essence)
{
if (essence < 255) //0-14
{
float ret = essence / 17f;
return String.valueOf(df.format(ret));
}
else if (essence < 825)
{
int amount = essence - 255;
int levels = 15;
int offset = 3;
int sub = 17 + offset;
while (amount - sub >= 0)
{
amount -= sub;
sub += offset;
levels++;
}
float ret = levels + amount / (float) sub;
return String.valueOf(df.format(ret));
}
else
{
int amount = essence - 825;
int levels = 30;
int offset = 7;
int sub = 62 + offset;
while (amount - sub >= 0)
{
amount -= sub;
sub += offset;
levels++;
}
float ret = levels + amount / (float) sub;
return String.valueOf(df.format(ret));
}
}
}
@@ -1,131 +0,0 @@
package tconstruct.blocks.logic;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
public class TerraformerLogic extends TileEntity
{
Random random = new Random();
boolean init;
int type;
@Override
public void updateEntity ()
{
if (!init)
{
init = true;
type = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
}
if (worldObj.isRemote)
{
switch (type)
{
case 0: //Freezer
for (int i = 0; i < 32; i++)
worldObj.spawnParticle("snowshovel", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
break;
case 1: //Fumer
for (int i = 0; i < 5; i++)
worldObj.spawnParticle("lava", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
for (int i = 0; i < 3; i++)
worldObj.spawnParticle("explode", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
for (int i = 0; i < 5; i++)
worldObj.spawnParticle("smoke", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
break;
case 2: //Waver
for (int i = 0; i < 50; i++)
worldObj.spawnParticle("splash", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
break;
case 3: //Leecher
for (int i = 0; i < 16; i++)
worldObj.spawnParticle("enchantmenttable", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, -1, 0);
break;
case 4: //Grower
break;
case 5: //Nether
for (int i = 0; i < 40; i++)
worldObj.spawnParticle("depthsuspend", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
for (int i = 0; i < 3; i++)
worldObj.spawnParticle("largesmoke", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
break;
case 6: //Lighter
break;
case 7: //Crystal
for (int i = 0; i < 8; i++)
worldObj.spawnParticle("fireworksSpark", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
break;
case 8: //Ender
for (int i = 0; i < 16; i++)
worldObj.spawnParticle("portal", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
for (int i = 0; i < 6; i++)
worldObj.spawnParticle("witchMagic", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
break;
case 9: //Void
for (int i = 0; i < 16; i++)
worldObj.spawnParticle("portal", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
for (int i = 0; i < 8; i++)
worldObj.spawnParticle("dripWater", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
for (int i = 0; i < 8; i++)
worldObj.spawnParticle("dripLava", xCoord + random.nextFloat() * 25 - 12, yCoord + random.nextFloat() * 10, zCoord + random.nextFloat() * 25 - 12, 0, 0, 0);
break;
case 10: //Desert
break;
}
/* Good combos:
* smoke + flame, 20+5
* portal + witchMagic, 16+6
* mobSpellAmbient + spell + mobSpell, 20+3+3
* lava + explode + smoke, 10+6+10
* happyVillager + deathsuspend + enchantmenttable, 16+64+20
*
* Good values:
* fireworksSpark, 16
* depthsuspend, 40
* enchantmenttable, 16, x5
* explode, 110
* splash, 50
* snowshovel, 32
* heart, 16
*/
}
else
{
if (worldObj.getTotalWorldTime() % 5 == 0)
{
switch (type)
{
case 0:
snow();
break;
}
}
}
}
void snow ()
{
int x = xCoord + random.nextInt(25) - 12, y = yCoord + random.nextInt(6) - 1, z = zCoord + random.nextInt(25) - 12;
Block block = Block.blocksList[worldObj.getBlockId(x, y, z)];
if (block == Block.waterStill || block == Block.waterMoving)
{
worldObj.setBlock(x, y, z, Block.ice.blockID);
}
else if (block == Block.snow)
{
int meta = worldObj.getBlockMetadata(x, y, z);
if (meta < 7)
worldObj.setBlockMetadataWithNotify(x, y, z, meta + 1, 3);
}
else if (block == null || block.isBlockReplaceable(worldObj, x, y, z))
{
if (worldObj.doesBlockHaveSolidTopSurface(x, y - 1, z))
{
worldObj.setBlock(x, y, z, Block.snow.blockID);
}
}
}
}
+7 -4
View File
@@ -195,10 +195,13 @@ public class SmelteryGui extends NewContainerGui
while (liquidSize > 0)
{
int size = liquidSize >= 16 ? 16 : liquidSize;
drawLiquidRect(cornerX + basePos, (cornerY + 68) - size - base, renderIndex, 16, size);
drawLiquidRect(cornerX + basePos + 16, (cornerY + 68) - size - base, renderIndex, 16, size);
drawLiquidRect(cornerX + basePos + 32, (cornerY + 68) - size - base, renderIndex, 16, size);
drawLiquidRect(cornerX + basePos + 48, (cornerY + 68) - size - base, renderIndex, 4, size);
if (renderIndex != null)
{
drawLiquidRect(cornerX + basePos, (cornerY + 68) - size - base, renderIndex, 16, size);
drawLiquidRect(cornerX + basePos + 16, (cornerY + 68) - size - base, renderIndex, 16, size);
drawLiquidRect(cornerX + basePos + 32, (cornerY + 68) - size - base, renderIndex, 16, size);
drawLiquidRect(cornerX + basePos + 48, (cornerY + 68) - size - base, renderIndex, 4, size);
}
liquidSize -= size;
base += size;
}
-18
View File
@@ -176,11 +176,6 @@ public class TContent implements IFuelHandler
public static Block stainedGlassMagicSlab;
public static Block stainedGlassClearMagicSlab;
//Crystalline
public static Block essenceExtractor;
public static Item essenceCrystal;
public static Block terraformer;
//Liquids
public static Material liquidMetal;
@@ -794,15 +789,6 @@ public class TContent implements IFuelHandler
stainedGlassClearPane = new GlassPaneStained(PHConstruct.stainedGlassClearPane);
GameRegistry.registerBlock(stainedGlassClearPane, StainedGlassClearPaneItem.class, "GlassPaneClearStained");
//Crystalline
essenceExtractor = new EssenceExtractor(PHConstruct.essenceExtractor).setHardness(12f).setUnlocalizedName("extractor.essence");
GameRegistry.registerBlock(essenceExtractor, "extractor.essence");
GameRegistry.registerTileEntity(EssenceExtractorLogic.class, "extractor.essence");
terraformer = new Terraformer(PHConstruct.terraformer).setHardness(50f).setUnlocalizedName("terraformer");
GameRegistry.registerBlock(terraformer, TerraformerItem.class, "terraformer");
GameRegistry.registerTileEntity(TerraformerLogic.class, "TerraFreezer");
//Rail
woodenRail = new WoodRail(PHConstruct.woodenRail).setStepSound(Block.soundWoodFootstep).setCreativeTab(TConstructRegistry.blockTab).setUnlocalizedName("rail.wood");
GameRegistry.registerBlock(woodenRail, "rail.wood");
@@ -943,9 +929,6 @@ public class TContent implements IFuelHandler
//heavyBoots = new TArmorBase(PHConstruct.heavyBoots, 3).setUnlocalizedName("tconstruct.HeavyBoots");
//glove = new Glove(PHConstruct.glove).setUnlocalizedName("tconstruct.Glove");
knapsack = new Knapsack(PHConstruct.knapsack).setUnlocalizedName("tconstruct.storage");
//Crystalline
essenceCrystal = new EssenceCrystal(PHConstruct.essenceCrystal).setUnlocalizedName("tconstruct.crystal.essence");
goldHead = new GoldenHead(PHConstruct.goldHead, 4, 1.2F, false).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 10, 0, 1.0F).setUnlocalizedName("goldenhead");
LiquidCasting basinCasting = TConstruct.getBasinCasting();
@@ -1399,7 +1382,6 @@ public class TContent implements IFuelHandler
GameRegistry.addRecipe(new ItemStack(craftingSlabWood, 1, 3), "b", 'b', new ItemStack(toolStationWood, 1, 13));
GameRegistry.addRecipe(new ItemStack(craftingSlabWood, 1, 5), "b", 'b', new ItemStack(toolForge, 1, Short.MAX_VALUE));
// EssenceExtractor Recipe
GameRegistry.addRecipe(new ItemStack(essenceExtractor, 1, 0), " b ", "eme", "mmm", 'b', Item.book, 'e', Item.emerald, 'm', Block.whiteStone);
//Slime Recipes
GameRegistry.addRecipe(new ItemStack(slimeGel, 1, 0), "##", "##", '#', strangeFood);
GameRegistry.addRecipe(new ItemStack(strangeFood, 4, 0), "#", '#', new ItemStack(slimeGel, 1, 0));
-102
View File
@@ -1,102 +0,0 @@
package tconstruct.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import tconstruct.blocks.logic.EssenceExtractorLogic;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EssenceCrystal extends Item
{
public EssenceCrystal(int id)
{
super(id);
this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public int getMaxItemUseDuration (ItemStack par1ItemStack)
{
return 32;
}
@Override
public EnumAction getItemUseAction (ItemStack par1ItemStack)
{
return EnumAction.eat;
}
@Override
public ItemStack onItemRightClick (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
@Override
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
{
if (stack.hasTagCompound())
{
EntityXPOrb entity = new EntityXPOrb(world, player.posX, player.posY + 1, player.posZ, stack.getTagCompound().getInteger("Essence"));
spawnEntity(player.posX, player.posY + 1, player.posZ, entity, world, player);
if (!player.capabilities.isCreativeMode)
stack.stackSize--;
}
return stack;
}
public static void spawnEntity (double x, double y, double z, Entity entity, World world, EntityPlayer player)
{
if (!world.isRemote)
{
world.spawnEntityInWorld(entity);
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons (IconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("tinker:materials/material_essencecrystal");
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
if (stack.hasTagCompound())
{
int amount = stack.getTagCompound().getInteger("Essence");
list.add("Stored Levels: " + EssenceExtractorLogic.getEssencelevels(amount));
}
else
{
list.add("Stored Levels: 0");
}
}
@Override
public void getSubItems (int id, CreativeTabs tab, List list)
{
int[] amount = new int[] { 17, 85, 170, 255, 385, 590, 825 };
for (int i = 0; i < amount.length; i++)
{
ItemStack crystal = new ItemStack(id, 1, 0);
NBTTagCompound tags = new NBTTagCompound();
tags.setInteger("Essence", amount[i]);
crystal.setTagCompound(tags);
list.add(crystal);
}
}
}
@@ -1,50 +0,0 @@
package tconstruct.items.blocks;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TerraformerItem extends ItemBlock
{
static String blockType[] = { "freezer", "fumer", "waver", "leecher", "grower", "nether", "lighter", "crystal" };
//static String[] textureNames = { "crystal_machine_top", "terrafreezer", "terrafumer", "terrawaver", "terraleecher", "terragrower", "terranether", "terralighter", "terracrystal" };
public TerraformerItem(int id)
{
super(id);
setMaxDamage(0);
setHasSubtypes(true);
}
public int getMetadata (int meta)
{
return meta;
}
public String getUnlocalizedName (ItemStack itemstack)
{
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
return (new StringBuilder()).append("tile.terraformer.").append(blockType[pos]).toString();
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage())
{
case 0:
list.add("\u00a7b\u00a7oCold to the touch");
break;
case 1:
list.add("\u00a74\u00a7oHot to the touch");
break;
}
}
}
@@ -1,39 +0,0 @@
package tconstruct.plugins.waila;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.item.ItemStack;
import tconstruct.blocks.logic.EssenceExtractorLogic;
import java.util.List;
public class EssenceExtractorDataProvider implements IWailaDataProvider
{
@Override
public ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return null;
}
@Override
public List<String> getWailaHead (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return currenttip;
}
@Override
public List<String> getWailaBody (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
if (accessor.getTileEntity() instanceof EssenceExtractorLogic)
{
EssenceExtractorLogic te = (EssenceExtractorLogic) accessor.getTileEntity();
currenttip.add("Total Essence: " + te.essenceAmount);
currenttip.add("Stored Levels: " + EssenceExtractorLogic.getEssencelevels(te.essenceAmount));
}
return currenttip;
}
}
@@ -18,9 +18,6 @@ public class PHConstruct
* Second: Create the actual config file
* Note: Configs are a pain, but absolutely necessary for every mod.
*/
//File file = new File(TConstruct.proxy.getLocation() + "/config");
//file.mkdir();
//File newFile = new File(TConstruct.proxy.getLocation() + "/config/TinkersWorkshop.txt");
File newFile = new File(location + "/TinkersWorkshop.txt");
/* Some basic debugging will go a long way */
@@ -133,7 +130,6 @@ public class PHConstruct
blood = config.getBlock("Liquid Cow", 3217).getInt(3217);
moltenEnder = config.getBlock("Molten Ender", 3218).getInt(3218);
terraformer = config.getBlock("Terraformer", 3219).getInt(3219);
signalBus = config.getBlock("Signal Bus", 3221).getInt(3221);
signalTerminal = config.getBlock("Signal Terminal", 3222).getInt(3222);
@@ -150,7 +146,6 @@ public class PHConstruct
punji = config.getBlock("Punji", 3232).getInt(3232);
woodCrafter = config.getBlock("Crafting Station", 3233).getInt(3233);
essenceExtractor = config.getBlock("Essence Extractor", 3234).getInt(3234);
slimePoolBlue = config.getBlock("Liquid Blue Slime", 3235).getInt(3235);
slimeGel = config.getBlock("Congealed Slime", 3237).getInt(3237);
@@ -263,7 +258,6 @@ public class PHConstruct
glove = config.getItem("Equipables", "Gloves", 14111).getInt(14111);
knapsack = config.getItem("Equipables", "Knapsack", 14112).getInt(14112);
goldHead = config.getItem("Patterns and Misc", "Golden Head", 14113).getInt(14113);
essenceCrystal = config.getItem("Patterns and Misc", "Essence Crystal", 14114).getInt(14114);
jerky = config.getItem("Patterns and Misc", "Jerky", 14115).getInt(14115);
spoolWire = config.getItem("Logic", "SpoolWire", 14120).getInt(14120);
@@ -444,11 +438,6 @@ public class PHConstruct
public static int stainedGlassClear;
public static int stainedGlassClearPane;
//Crystalline
public static int essenceExtractor;
public static int essenceCrystal;
public static int terraformer;
//Liquids
public static int metalFlowing;
public static int metalStill;