Initial crashless build

This commit is contained in:
mDiyo 2013-03-11 00:05:11 -07:00
parent 2f5d798753
commit 1bb3c4cf7b
1333 changed files with 30423 additions and 30821 deletions

View File

@ -1,3 +1,3 @@
Tinker's Construct - 1.4.7
Tinker's Construct - 1.5
Modify all the things, then do it again!

View File

@ -0,0 +1,82 @@
package mods.tinker.armory;
import mods.tinker.armory.content.ArmorStandItem;
import mods.tinker.armory.content.DisplayBlock;
import mods.tinker.armory.content.Shelf;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
/**
* Tinkering with the Armory
* Every good castle has a place to put its tools
* Armor stands are entites!
* @author: mDiyo
*/
@Mod(modid = "Armory", name = "Tinker's Armory", version = "1.4.7_A3")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Armory
{
/* Proxies for sides, used for client-only processing */
@SidedProxy(clientSide = "mods.tinker.armory.client.ArmoryProxyClient", serverSide = "mods.tinker.armory.ArmoryProxyCommon")
public static ArmoryProxyCommon proxy;
/* Instance of this mod, used for grabbing prototype fields */
@Instance("Armory")
public static Armory instance;
@PreInit
public void preInit(FMLPreInitializationEvent evt)
{
/*PHArmory.initProps();
toolrack = new DisplayBlock(PHArmory.toolrack, Material.rock);
GameRegistry.registerBlock(toolrack, mods.tinker.armory.content.ToolrackItem.class, "ToolRack");
GameRegistry.registerTileEntity(mods.tinker.armory.content.ShieldrackLogic.class, "Display");
shelf = new Shelf(PHArmory.shieldrack, Material.rock);
GameRegistry.registerBlock(shelf, mods.tinker.armory.content.ToolrackItem.class, "Shelf");
GameRegistry.registerTileEntity(mods.tinker.armory.content.ToolrackLogic.class, "aShelf");*/
/*armorStand = new ArmorStand(1501, Material.rock);
GameRegistry.registerBlock(armorStand, mDiyo.inficraft.armory.ArmorStandItem.class);
GameRegistry.registerTileEntity(mDiyo.inficraft.armory.ArmorStandLogic.class, "InfiArmorStand");*/
/*armorStandItem = new ArmorStandItem(PHArmory.armorItem).setUnlocalizedName("armorstand");
LanguageRegistry.instance().addName(armorStandItem, "Armor Stand");
EntityRegistry.registerModEntity(mods.tinker.armory.content.ArmorStandEntity.class, "Armor Stand", 0, this, 32, 5, true);
NetworkRegistry.instance().registerGuiHandler(instance, new ArmoryGuiHandler());
GameRegistry.addRecipe(new ItemStack(Armory.instance.armorStandItem, 1, 0), " c ", "csc", " b ", 's', Item.stick, 'c', Block.cobblestone, 'b', Block.stoneSingleSlab);*/
}
@Init
public void init(FMLInitializationEvent evt)
{
proxy.registerRenderer();
proxy.addNames();
proxy.addRecipes();
}
/* Prototype fields, used elsewhere */
public static Block shelf;
public static Block toolrack;
public static Block armorStand;
public static Block pedestal;
public static Item armorStandItem;
public static String texture = "/tinkertextures/armory.png";
}

View File

@ -0,0 +1,45 @@
package mods.tinker.armory;
import java.util.List;
import mods.tinker.armory.client.ArmorStandGui;
import mods.tinker.armory.content.EntityEquipment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class ArmoryGuiHandler implements IGuiHandler
{
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
List<Entity> list = world.getLoadedEntityList();
for (Entity entity : list)
{
if (ID == entity.entityId)
{
return ((EntityEquipment)entity).getContainer(player);
}
}
System.out.println("Returning a null server entity");
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
List<Entity> list = world.getLoadedEntityList();
for (Entity entity : list)
{
if (ID == entity.entityId)
{
return new ArmorStandGui(player, (EntityEquipment)entity);
}
}
System.out.println("Returning a null client entity");
return null;
}
}

View File

@ -0,0 +1,15 @@
package mods.tinker.armory;
import java.io.File;
public class ArmoryProxyCommon
{
public void registerRenderer() {}
public void addNames() {}
public void addRecipes() {}
public File getMinecraftDir()
{
return new File(".");
}
}

View File

@ -0,0 +1,90 @@
package mods.tinker.armory;
import java.io.File;
import java.io.IOException;
import net.minecraftforge.common.Configuration;
public class PHArmory
{
public static void initProps()
{
/* Here we will set up the config file for the mod
* First: Create a folder inside the config folder
* Second: Create the actual config file
* Note: Configs are a pain, but absolutely necessary for every mod.
*/
File file = new File(Armory.proxy.getMinecraftDir() + "/config/InfiCraft");
file.mkdir();
File newFile = new File(Armory.proxy.getMinecraftDir() + "/config/InfiCraft/Armory.txt");
/* Some basic debugging will go a long way */
try
{
newFile.createNewFile();
System.out.println("Successfully read configuration file for mod_FloraBerries");
}
catch (IOException e)
{
System.out.println("Could not read configuration file for mod_FloraBerries. Reason:");
System.out.println(e);
}
/* [Forge] Configuration class, used as config method */
Configuration config = new Configuration(newFile);
/* Load the configuration file */
config.load();
/* Define the mod's IDs.
* Avoid values below 4096 for items and in the 250-450 and 2216-2226 range for blocks
*/
//armorBlock = config.getBlock("Armor Stand", 3257).getInt(3257);
toolrack = config.getBlock("Toolrack", 3201).getInt(3201);
shieldrack = config.getBlock("Shield Rack", 3202).getInt(3202);
armorItem = config.getItem("Armor Stand Item", 4570).getInt(4570);
/*berryBlockID = config.getBlock("Berry_Bush", 3257).getInt(3257);
berryItemID = config.getItem("Berry_Food", 12402).getInt(12402);
raspSpawnDensity = config.get("general", "Raspberry_Spawn_Density", 14).getInt(14);
raspSpawnHeight = config.get("general", "Raspberry_Spawn_Height", 64).getInt(64);
raspSpawnRange = config.get("general", "Raspberry_Spawn_Range", 128).getInt(128);
blueSpawnDensity = config.get("general", "Blueberry_Spawn_Density", 12).getInt(12);
blueSpawnHeight = config.get("general", "Blueberry_Spawn_Height", 64).getInt(64);
blueSpawnRange = config.get("general", "Blueberry_Spawn_Range", 128).getInt(128);
blackSpawnDensity = config.get("general", "Blackberry_Spawn_Density", 10).getInt(10);
blackSpawnHeight = config.get("general", "Blackberry_Spawn_Height", 64).getInt(64);
blackSpawnRange = config.get("general", "Blackberry_Spawn_Range", 128).getInt(128);
geoSpawnDensity = config.get("general", "Geoberry_Spawn_Density", 14).getInt(14);
geoSpawnHeight = config.get("general", "Geoberry_Spawn_Height", 64).getInt(64);
geoSpawnRange = config.get("general", "Geoberry_Spawn_Range", 128).getInt(128);*/
/* Save the configuration file */
config.save();
}
/* Prototype fields, used elsewhere */
public static int armorBlock;
public static int armorItem;
public static int toolrack;
public static int shieldrack;
/*public static int raspSpawnDensity;
public static int raspSpawnHeight;
public static int raspSpawnRange;
public static int blueSpawnDensity;
public static int blueSpawnHeight;
public static int blueSpawnRange;
public static int blackSpawnDensity;
public static int blackSpawnHeight;
public static int blackSpawnRange;
public static int geoSpawnDensity;
public static int geoSpawnHeight;
public static int geoSpawnRange;
public static int berryItemID;
public static int berryBlockID;*/
}

View File

@ -0,0 +1,83 @@
package mods.tinker.armory.client;
import mods.tinker.armory.content.EntityEquipment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ArmorStandContainer extends Container
{
EntityEquipment stand;
InventoryPlayer player;
public ArmorStandContainer(InventoryPlayer inventoryplayer, EntityEquipment equipment)
{
stand = equipment;
player = inventoryplayer;
this.addSlotToContainer(new Slot(equipment, 0, 62, 26));
for (int slot = 0; slot < 4; ++slot)
{
this.addSlotToContainer(new SlotArmorCopy(this, equipment, slot + 1, 80, 8 + (3-slot) * 18, 3-slot));
}
// Slot: inventory, slot index, xDisplay, yDisplay
int var3;
for (var3 = 0; var3 < 3; ++var3)
{
for (int var4 = 0; var4 < 9; ++var4)
{
this.addSlotToContainer(new Slot(player, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
}
}
for (var3 = 0; var3 < 9; ++var3)
{
this.addSlotToContainer(new Slot(player, var3, 8 + var3 * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityplayer, int slot)
{
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(slot);
if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (slot < 5)
{
if (!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true))
{
return null;
}
} else if (!this.mergeItemStack(var5, 0, 5, false))
{
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack) null);
} else
{
var4.onSlotChanged();
}
}
return var3;
}
}

View File

@ -0,0 +1,40 @@
package mods.tinker.armory.client;
import mods.tinker.armory.content.EntityEquipment;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ArmorStandGui extends GuiContainer
{
public ArmorStandGui(EntityPlayer player, EntityEquipment equipment)
{
super(equipment.getContainer(player));
this.allowUserInput = true;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString("Armor Stand", 8, 8, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3)
{
//int var4 = this.mc.renderEngine.getTexture("/infitextures/gui/armorstand.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
//this.mc.renderEngine.bindTexture(var4);
this.mc.renderEngine.func_98187_b("/tinkertextures/gui/armorstand.png");
int var5 = this.guiLeft;
int var6 = this.guiTop;
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
}
}

View File

@ -0,0 +1,96 @@
/*
* Armor stand model by Fudgy_Fetus
*/
package mods.tinker.armory.client;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ArmorStandModelStatue extends ModelBase
{
ModelRenderer head;
ModelRenderer body;
ModelRenderer rightarm;
ModelRenderer leftarm;
ModelRenderer bottompedestal;
ModelRenderer toppedestal;
ModelRenderer standstick;
public ArmorStandModelStatue()
{
textureWidth = 128;
textureHeight = 64;
head = new ModelRenderer(this, 0, 0);
head.addBox(-4F, -8F, -4F, 8, 8, 8);
head.setRotationPoint(0F, 0F, 0F);
head.setTextureSize(128, 64);
head.mirror = true;
setRotation(head, 0F, 0F, 0F);
body = new ModelRenderer(this, 16, 16);
body.addBox(-4F, 0F, -2F, 8, 12, 4);
body.setRotationPoint(0F, 0F, 0F);
body.setTextureSize(128, 64);
body.mirror = true;
setRotation(body, 0F, 0F, 0F);
rightarm = new ModelRenderer(this, 40, 16);
rightarm.addBox(-3F, -2F, -2F, 4, 7, 4);
rightarm.setRotationPoint(-5F, 2F, 0F);
rightarm.setTextureSize(128, 64);
rightarm.mirror = true;
setRotation(rightarm, 0F, 0F, 0F);
leftarm = new ModelRenderer(this, 40, 16);
leftarm.addBox(-1F, -2F, -2F, 4, 7, 4);
leftarm.setRotationPoint(5F, 2F, 0F);
leftarm.setTextureSize(128, 64);
leftarm.mirror = true;
setRotation(leftarm, 0F, 0F, 0F);
bottompedestal = new ModelRenderer(this, 56, 15);
bottompedestal.addBox(0F, 0F, 0F, 16, 2, 16);
bottompedestal.setRotationPoint(-8F, 26F, -8F);
bottompedestal.setTextureSize(128, 64);
bottompedestal.mirror = true;
setRotation(bottompedestal, 0F, 0F, 0F);
toppedestal = new ModelRenderer(this, 60, 0);
toppedestal.addBox(0F, 0F, 0F, 14, 1, 14);
toppedestal.setRotationPoint(-7F, 25F, -7F);
toppedestal.setTextureSize(128, 64);
toppedestal.mirror = true;
setRotation(toppedestal, 0F, 0F, 0F);
standstick = new ModelRenderer(this, 0, 16);
standstick.addBox(0F, 0F, 0F, 2, 13, 2);
standstick.setRotationPoint(-1F, 12F, -1F);
standstick.setTextureSize(128, 64);
standstick.mirror = true;
setRotation(standstick, 0F, 0F, 0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float rotation)
{
super.render(entity, f, f1, f2, f3, f4, rotation);
setRotationAngles(f, f1, f2, f3, f4, rotation, entity);
head.render(rotation);
body.render(rotation);
rightarm.render(rotation);
leftarm.render(rotation);
bottompedestal.render(rotation);
toppedestal.render(rotation);
standstick.render(rotation);
}
void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
@Override
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity par7Entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, par7Entity);
}
}

View File

@ -0,0 +1,27 @@
package mods.tinker.armory.client;
import java.io.File;
import mods.tinker.armory.ArmoryProxyCommon;
import mods.tinker.armory.content.ToolrackLogic;
import net.minecraft.client.Minecraft;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class ArmoryProxyClient extends ArmoryProxyCommon
{
@Override
public void registerRenderer()
{
RenderingRegistry.registerBlockHandler(new RenderShelf());
RenderingRegistry.registerBlockHandler(new RenderDisplay());
ClientRegistry.bindTileEntitySpecialRenderer(ToolrackLogic.class, new ShelfSpecialRender());
RenderingRegistry.registerEntityRenderingHandler(mods.tinker.armory.content.ArmorStandEntity.class, new RenderArmorStandEntity(new ArmorStandModelStatue(), 0));
}
@Override
public File getMinecraftDir()
{
return Minecraft.getMinecraftDir();
}
}

View File

@ -0,0 +1,514 @@
package mods.tinker.armory.client;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
import net.minecraft.block.Block;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderArmorStandEntity extends RenderLiving
{
protected ModelBase mainModel;
protected float sizeIncrease;
protected ModelBiped armorChestplate;
protected ModelBiped armorBody;
/** List of armor texture filenames. */
public static String[] bipedArmorFilenamePrefix = new String[] {"cloth", "chain", "iron", "diamond", "gold"};
public RenderArmorStandEntity(ModelBase model, float par2)
{
this(model, par2, 1.0F);
}
public RenderArmorStandEntity(ModelBase model, float par2, float par3)
{
super(model, par2);
this.mainModel = model;
this.sizeIncrease = par3;
this.func_82421_b();
}
protected void func_82421_b()
{
this.armorChestplate = new ModelBiped(1.0F);
this.armorBody = new ModelBiped(0.5F);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3)
{
ItemStack stack = par1EntityLiving.getCurrentArmor(3 - par2);
if (stack != null)
{
Item item = stack.getItem();
if (item instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)item;
this.loadTexture(ForgeHooksClient.getArmorTexture(stack, "/armor/" + bipedArmorFilenamePrefix[itemarmor.renderIndex%4] + "_" + (par2 == 2 ? 2 : 1) + ".png"));
ModelBiped biped = par2 == 2 ? this.armorBody : this.armorChestplate;
biped.bipedHead.showModel = par2 == 0;
biped.bipedHeadwear.showModel = par2 == 0;
biped.bipedBody.showModel = par2 == 1 || par2 == 2;
biped.bipedRightArm.showModel = par2 == 1;
biped.bipedLeftArm.showModel = par2 == 1;
biped.bipedRightLeg.showModel = par2 == 2 || par2 == 3;
biped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3;
this.setRenderPassModel(biped);
if (biped != null)
{
biped.onGround = this.mainModel.onGround;
}
if (biped != null)
{
biped.isRiding = this.mainModel.isRiding;
}
if (biped != null)
{
biped.isChild = this.mainModel.isChild;
}
float var8 = 1.0F;
if (itemarmor.getArmorMaterial() == EnumArmorMaterial.CLOTH)
{
int var9 = itemarmor.getColor(stack);
float var10 = (float)(var9 >> 16 & 255) / 255.0F;
float var11 = (float)(var9 >> 8 & 255) / 255.0F;
float var12 = (float)(var9 & 255) / 255.0F;
GL11.glColor3f(var8 * var10, var8 * var11, var8 * var12);
if (stack.isItemEnchanted())
{
return 31;
}
return 16;
}
GL11.glColor3f(var8, var8, var8);
if (stack.isItemEnchanted())
{
return 15;
}
return 1;
}
}
return -1;
}
protected void func_82408_c(EntityLiving par1EntityLiving, int par2, float par3)
{
ItemStack var4 = par1EntityLiving.getCurrentArmor(3 - par2);
if (var4 != null)
{
Item var5 = var4.getItem();
if (var5 instanceof ItemArmor)
{
ItemArmor var6 = (ItemArmor)var5;
this.loadTexture("/armor/" + bipedArmorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + "_b.png");
float var7 = 1.0F;
GL11.glColor3f(var7, var7, var7);
}
}
}
public void doRenderLiving(EntityLiving par1EntityLiving, double posX, double posY, double posZ, float par8, float par9)
{
float var10 = 1.0F;
GL11.glColor3f(var10, var10, var10);
ItemStack var11 = par1EntityLiving.getHeldItem();
this.func_82420_a(par1EntityLiving, var11);
double var12 = posY - (double)par1EntityLiving.yOffset+0.25;
//Insert super here
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
this.mainModel.onGround = this.renderSwingProgress(par1EntityLiving, par9);
if (this.renderPassModel != null)
{
this.renderPassModel.onGround = this.mainModel.onGround;
}
this.mainModel.isRiding = par1EntityLiving.isRiding();
if (this.renderPassModel != null)
{
this.renderPassModel.isRiding = this.mainModel.isRiding;
}
this.mainModel.isChild = par1EntityLiving.isChild();
if (this.renderPassModel != null)
{
this.renderPassModel.isChild = this.mainModel.isChild;
}
try
{
//float rotate1 = this.interRotation(par1EntityLiving.prevRenderYawOffset, par1EntityLiving.renderYawOffset, par9);
float rotate2 = this.interRotation(par1EntityLiving.prevRotationYawHead, par1EntityLiving.rotationYawHead, par9);
float rotate1 = rotate2;
//float rotate2 = rotate1;
float rotate3 = par1EntityLiving.prevRotationPitch + (par1EntityLiving.rotationPitch - par1EntityLiving.prevRotationPitch) * par9;
this.renderLivingAt(par1EntityLiving, posX, posY, posZ);
//float rotationExisted = this.handleRotationFloat(par1EntityLiving, par9); // Makes the armor breathe
float rotationExisted = 0;
this.rotateCorpse(par1EntityLiving, rotationExisted, rotate1, par9);
float var14 = 0.0625F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(-1.0F, -1.0F, 1.0F);
this.preRenderCallback(par1EntityLiving, par9);
GL11.glTranslatef(0.0F, -24.0F * var14 - 0.0078125F - 0.25F, 0.0F);
//float var15 = par1EntityLiving.prevLegYaw + (par1EntityLiving.legYaw - par1EntityLiving.prevLegYaw) * par9;
//float var16 = par1EntityLiving.legSwing - par1EntityLiving.legYaw * (1.0F - par9);
float var15 = 1f;
float var16 = 1f;
if (par1EntityLiving.isChild())
{
var16 *= 3.0F;
}
if (var15 > 1.0F)
{
var15 = 1.0F;
}
GL11.glEnable(GL11.GL_ALPHA_TEST);
this.mainModel.setLivingAnimations(par1EntityLiving, var16, var15, par9);
this.renderModel(par1EntityLiving, var16, var15, rotationExisted, rotate2 - rotate1, rotate3, var14);
float var19;
int var18;
float var20;
float var22;
for (int armorIter = 0; armorIter < 4; ++armorIter) //Armor
{
var18 = this.shouldRenderPass(par1EntityLiving, armorIter, par9);
if (var18 > 0)
{
this.renderPassModel.setLivingAnimations(par1EntityLiving, var16, var15, par9);
this.renderPassModel.render(par1EntityLiving, 0, 0, rotationExisted, rotate2 - rotate1, rotate3, var14);
if ((var18 & 240) == 16)
{
this.func_82408_c(par1EntityLiving, armorIter, par9);
this.renderPassModel.render(par1EntityLiving, var16, var15, rotationExisted, rotate2 - rotate1, rotate3, var14);
}
if ((var18 & 15) == 15)
{
var19 = (float)par1EntityLiving.ticksExisted + par9;
this.loadTexture("%blur%/misc/glint.png");
GL11.glEnable(GL11.GL_BLEND);
var20 = 0.5F;
GL11.glColor4f(var20, var20, var20, 1.0F);
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDepthMask(false);
for (int var21 = 0; var21 < 2; ++var21)
{
GL11.glDisable(GL11.GL_LIGHTING);
var22 = 0.76F;
GL11.glColor4f(0.5F * var22, 0.25F * var22, 0.8F * var22, 1.0F);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
float var23 = var19 * (0.001F + (float)var21 * 0.003F) * 20.0F;
float var24 = 0.33333334F;
GL11.glScalef(var24, var24, var24);
GL11.glRotatef(30.0F - (float)var21 * 60.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, var23, 0.0F);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
this.renderPassModel.render(par1EntityLiving, var16, var15, rotationExisted, rotate2 - rotate1, rotate3, var14);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glDepthMask(true);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
}
GL11.glDepthMask(true);
this.renderEquippedItems(par1EntityLiving, par9);
float var26 = par1EntityLiving.getBrightness(par9);
var18 = this.getColorMultiplier(par1EntityLiving, var26, par9);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
if ((var18 >> 24 & 255) > 0 || par1EntityLiving.hurtTime > 0 || par1EntityLiving.deathTime > 0)
{
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthFunc(GL11.GL_EQUAL);
if (par1EntityLiving.hurtTime > 0 || par1EntityLiving.deathTime > 0)
{
GL11.glColor4f(var26, 0.0F, 0.0F, 0.4F);
this.mainModel.render(par1EntityLiving, var16, var15, rotationExisted, rotate2 - rotate1, rotate3, var14);
for (int var27 = 0; var27 < 4; ++var27)
{
if (this.inheritRenderPass(par1EntityLiving, var27, par9) >= 0)
{
GL11.glColor4f(var26, 0.0F, 0.0F, 0.4F);
this.renderPassModel.render(par1EntityLiving, var16, var15, rotationExisted, rotate2 - rotate1, rotate3, var14);
}
}
}
if ((var18 >> 24 & 255) > 0)
{
var19 = (float)(var18 >> 16 & 255) / 255.0F;
var20 = (float)(var18 >> 8 & 255) / 255.0F;
float var29 = (float)(var18 & 255) / 255.0F;
var22 = (float)(var18 >> 24 & 255) / 255.0F;
GL11.glColor4f(var19, var20, var29, var22);
this.mainModel.render(par1EntityLiving, var16, var15, rotationExisted, rotate2 - rotate1, rotate3, var14);
for (int var28 = 0; var28 < 4; ++var28)
{
if (this.inheritRenderPass(par1EntityLiving, var28, par9) >= 0)
{
GL11.glColor4f(var19, var20, var29, var22);
this.renderPassModel.render(par1EntityLiving, var16, var15, rotationExisted, rotate2 - rotate1, rotate3, var14);
}
}
}
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
catch (Exception var25)
{
var25.printStackTrace();
}
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glEnable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
this.passSpecialRender(par1EntityLiving, posX, posY, posZ);
}
public float interRotation(float par1, float par2, float par3)
{
float var4;
for (var4 = par2 - par1; var4 < -180.0F; var4 += 360.0F)
{
;
}
while (var4 >= 180.0F)
{
var4 -= 360.0F;
}
return par1 + par3 * var4;
}
@Override
protected float renderSwingProgress(EntityLiving par1EntityLiving, float par2)
{
return 0;
}
protected void func_82420_a(EntityLiving par1EntityLiving, ItemStack par2ItemStack)
{
this.armorChestplate.heldItemRight = this.armorBody.heldItemRight = par2ItemStack != null ? 1 : 0;
}
protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
{
float var3 = 1.0F;
GL11.glColor3f(var3, var3, var3);
super.renderEquippedItems(par1EntityLiving, par2);
ItemStack var4 = par1EntityLiving.getHeldItem();
ItemStack var5 = par1EntityLiving.getCurrentArmor(3);
float var6;
if (var5 != null)
{
GL11.glPushMatrix();
//this.mainModel.head.postRender(0.0625F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var5, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var5, BLOCK_3D));
if (var5.getItem() instanceof ItemBlock)
{
if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var5.itemID].getRenderType()))
{
var6 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(var6, -var6, -var6);
}
this.renderManager.itemRenderer.renderItem(par1EntityLiving, var5, 0);
}
else if (var5.getItem().itemID == Item.skull.itemID)
{
var6 = 1.0625F;
GL11.glScalef(var6, -var6, -var6);
String var7 = "";
if (var5.hasTagCompound() && var5.getTagCompound().hasKey("SkullOwner"))
{
var7 = var5.getTagCompound().getString("SkullOwner");
}
TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, var5.getItemDamage(), var7);
}
GL11.glPopMatrix();
}
if (var4 != null)
{
GL11.glPushMatrix();
if (this.mainModel.isChild)
{
var6 = 0.5F;
GL11.glTranslatef(0.0F, 0.625F, 0.0F);
GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F);
GL11.glScalef(var6, var6, var6);
}
//this.mainModel.bipedRightArm.postRender(0.0625F);
GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var4, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var4, BLOCK_3D));
if (var4.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var4.itemID].getRenderType())))
{
var6 = 0.5F;
GL11.glTranslatef(-0.4325F, 0.1875F, -0.3125F);
var6 *= 0.75F;
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(-var6, -var6, var6);
}
else if (var4.itemID == Item.bow.itemID)
{
var6 = 0.625F;
GL11.glTranslatef(-0.5F, 0.125F, 0.3125F);
GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(var6, -var6, var6);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else if (Item.itemsList[var4.itemID].isFull3D())
{
var6 = 0.625F;
if (Item.itemsList[var4.itemID].shouldRotateAroundWhenRendering())
{
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
}
this.func_82422_c();
GL11.glScalef(var6, -var6, var6);
GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else
{
var6 = 0.375F;
GL11.glTranslatef(-0.125F, 0.1875F, -0.1875F);
GL11.glScalef(var6, var6, var6);
GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
}
this.renderManager.itemRenderer.renderItem(par1EntityLiving, var4, 0);
if (var4.getItem().requiresMultipleRenderPasses())
{
for (int x = 1; x < var4.getItem().getRenderPasses(var4.getItemDamage()); x++)
{
this.renderManager.itemRenderer.renderItem(par1EntityLiving, var4, x);
}
}
GL11.glPopMatrix();
}
}
protected void func_82422_c()
{
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
}
/**
* 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 doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
@Override
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderLiving((EntityLiving)par1Entity, par2, par4, par6, par8, par9);
}
}

View File

@ -0,0 +1,119 @@
package mods.tinker.armory.client;
import mods.tinker.armory.content.DisplayLogic;
import mods.tinker.common.BlockSkinRenderHelper;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class RenderDisplay implements ISimpleBlockRenderingHandler
{
public static int displayModel;
public RenderDisplay()
{
displayModel = RenderingRegistry.getNextAvailableRenderId();
}
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == displayModel)
{
if (metadata == 5)
{
renderer.setRenderBounds(0.0F, 0.0, 0.0F, 1.0F, 0.875F, 1.0F);
renderDo(renderer, block, metadata);
}
else
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
renderDo(renderer, block, metadata);
}
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == displayModel)
{
int metadata = world.getBlockMetadata(x, y, z);
TileEntity te = world.getBlockTileEntity(x, y, z);
ItemStack topStack = ((DisplayLogic)te).getFrontDisplay();
Block topSkin = Block.blocksList[topStack.itemID];
int topMeta = topStack.getItemDamage();
ItemStack bottomStack = ((DisplayLogic)te).getBackDisplay();
Block bottomSkin = Block.blocksList[bottomStack.itemID];
int bottomMeta = bottomStack.getItemDamage();
renderer.setRenderBounds(0.125, 0.125F, 0.0F, 0.375, 0.875F, 0.0625);
BlockSkinRenderHelper.renderMetadataBlock(bottomSkin, bottomMeta, x, y, z, renderer, world);
renderer.setRenderBounds(0.6125, 0.125F, 0.0F, 0.875, 0.875F, 0.0625);
BlockSkinRenderHelper.renderMetadataBlock(bottomSkin, bottomMeta, x, y, z, renderer, world);
renderer.setRenderBounds(0.0F, 0.5F, 0.0F, 1.0F, 0.625F, 0.09375);
BlockSkinRenderHelper.renderMetadataBlock(topSkin, topMeta, x, y, z, renderer, world);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 0.125);
BlockSkinRenderHelper.renderMetadataBlock(topSkin, topMeta, x, y, z, renderer, world);
}
return false;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return displayModel;
}
private void renderDo(RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}

View File

@ -0,0 +1,5 @@
package mods.tinker.armory.client;
public class RenderPedestal {
}

View File

@ -0,0 +1,108 @@
package mods.tinker.armory.client;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class RenderShelf implements ISimpleBlockRenderingHandler
{
public static int shelfModelID;
public RenderShelf()
{
shelfModelID = RenderingRegistry.getNextAvailableRenderId();
}
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == shelfModelID)
{
if (metadata == 5)
{
renderer.setRenderBounds(0.0F, 0.0, 0.0F, 1.0F, 0.875F, 1.0F);
renderDo(renderer, block, metadata);
}
else
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
renderDo(renderer, block, metadata);
}
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == shelfModelID)
{
int metadata = world.getBlockMetadata(x, y, z);
renderer.setRenderBounds(0.125, 0.125F, 0.0F, 0.375, 0.875F, 0.0625);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.6125, 0.125F, 0.0F, 0.875, 0.875F, 0.0625);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.5F, 0.0F, 1.0F, 0.625F, 0.09375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 0.125);
renderer.renderStandardBlock(block, x, y, z);
}
return false;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return shelfModelID;
}
private void renderDo(RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}

View File

@ -0,0 +1,181 @@
package mods.tinker.armory.client;
import mods.tinker.armory.content.ToolrackLogic;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/* Special renderer, only used for drawing tools */
@SideOnly(Side.CLIENT)
public class ShelfSpecialRender extends TileEntitySpecialRenderer
{
@Override
public void renderTileEntityAt(TileEntity logic, double var2, double var4, double var6, float var8)
{
//this.render((ToolrackLogic)logic, var2, var4, var6, var8);
}
/*public void render(ToolrackLogic logic, double posX, double posY, double posZ, float var8)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)posX + 0.25F, (float)posY + 0.5F, (float)posZ + 0.094F); //Center on the block
int facing = logic.getBlockMetadata() / 4;
GL11.glRotatef(90.0F * (float)facing, 0.0F, 1.0F, 0.0F); //Rotation angle
//GL11.glTranslatef(-0.25F, 0.25F, -0.3F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
for (int slot = 0; slot < logic.getSizeInventory(); slot++)
{
ItemStack stack = logic.getStackInSlot(slot);
if (stack != null)
{
this.bindTextureByName(stack.getItem().getTextureFile());
GL11.glPushMatrix();
GL11.glScalef(0.5F, 0.5F, 0.5F);
//GL11.glScalef(3F, 3F, 3F);
//GL11.glRotatef(logic.getAngle(var10), 0.0F, 0.0F, 1.0F);
GL11.glRotatef(45f, 0.0F, 0.0F, 1.0F);
int iconIndex;
int color;
Item item = stack.getItem();
int damage = stack.getItemDamage();
if (item.requiresMultipleRenderPasses())
{
for (int renderPass = 0; renderPass <= item.getRenderPasses(damage); ++renderPass)
{
iconIndex = item.getIconIndex(stack, renderPass);
color = stack.getItem().getColorFromItemStack(stack, iconIndex);
setColor(color);
this.drawItem(iconIndex);
}
}
else
{
iconIndex = stack.getIconIndex();
color = Item.itemsList[stack.itemID].getColorFromItemStack(stack, 0);
setColor(color);
this.drawItem(iconIndex);
}
GL11.glPopMatrix();
}
GL11.glTranslatef(0.475F, 0.0F, 0.001F);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}*/
void drawItem(int iconIndex)
{
//System.out.println("Drawing an item");
Tessellator tessellator = Tessellator.instance;
float topLeft = (float)(iconIndex % 16 * 16 + 0) / 256.0F;
float topRight = (float)(iconIndex % 16 * 16 + 16) / 256.0F;
float botLeft = (float)(iconIndex / 16 * 16 + 0) / 256.0F;
float botRight = (float)(iconIndex / 16 * 16 + 16) / 256.0F;
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV(-0.5D, -0.5D, 0.0D, (double)topLeft, (double)botRight);
tessellator.addVertexWithUV(0.5D, -0.5D, 0.0D, (double)topRight, (double)botRight);
tessellator.addVertexWithUV(0.5D, 0.5D, 0.0D, (double)topRight, (double)botLeft);
tessellator.addVertexWithUV(-0.5D, 0.5D, 0.0D, (double)topLeft, (double)botLeft);
tessellator.addVertexWithUV(-0.5D, 0.5D, 0.0D, (double)topLeft, (double)botLeft);
tessellator.addVertexWithUV(0.5D, 0.5D, 0.0D, (double)topRight, (double)botLeft);
tessellator.addVertexWithUV(0.5D, -0.5D, 0.0D, (double)topRight, (double)botRight);
tessellator.addVertexWithUV(-0.5D, -0.5D, 0.0D, (double)topLeft, (double)botRight);
tessellator.draw();
/*tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
float var6 = 1.0F;
float var7 = 0.0625F;
int var8;
float var9;
float var10;
float var11;
int tileSize = TextureFXManager.instance().getTextureDimensions(GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D)).width / 16;
float tx = 1.0f / (32 * tileSize);
float tz = 1.0f / tileSize;
for (var8 = 0; var8 < tileSize; ++var8)
{
var9 = (float)var8 / tileSize;
var10 = topLeft + (topRight - topLeft) * var9 - tx;
var11 = var6 * var9;
tessellator.addVertexWithUV((double)var11, 0.0D, (double)(0.0F - var7), (double)var10, (double)botRight);
tessellator.addVertexWithUV((double)var11, 0.0D, 0.0D, (double)var10, (double)botRight);
tessellator.addVertexWithUV((double)var11, 1.0D, 0.0D, (double)var10, (double)botLeft);
tessellator.addVertexWithUV((double)var11, 1.0D, (double)(0.0F - var7), (double)var10, (double)botLeft);
}
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
for (var8 = 0; var8 < tileSize; ++var8)
{
var9 = (float)var8 / tileSize;
var10 = topLeft + (topRight - topLeft) * var9 - tx;
var11 = var6 * var9 + tz;
tessellator.addVertexWithUV((double)var11, 1.0D, (double)(0.0F - var7), (double)var10, (double)botLeft);
tessellator.addVertexWithUV((double)var11, 1.0D, 0.0D, (double)var10, (double)botLeft);
tessellator.addVertexWithUV((double)var11, 0.0D, 0.0D, (double)var10, (double)botRight);
tessellator.addVertexWithUV((double)var11, 0.0D, (double)(0.0F - var7), (double)var10, (double)botRight);
}
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
for (var8 = 0; var8 < tileSize; ++var8)
{
var9 = (float)var8 / tileSize;
var10 = botRight + (botLeft - botRight) * var9 - tx;
var11 = var6 * var9 + tz;
tessellator.addVertexWithUV(0.0D, (double)var11, 0.0D, (double)topLeft, (double)var10);
tessellator.addVertexWithUV((double)var6, (double)var11, 0.0D, (double)topRight, (double)var10);
tessellator.addVertexWithUV((double)var6, (double)var11, (double)(0.0F - var7), (double)topRight, (double)var10);
tessellator.addVertexWithUV(0.0D, (double)var11, (double)(0.0F - var7), (double)topLeft, (double)var10);
}
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1.0F, 0.0F);
for (var8 = 0; var8 < tileSize; ++var8)
{
var9 = (float)var8 / tileSize;
var10 = botRight + (botLeft - botRight) * var9 - tx;
var11 = var6 * var9;
tessellator.addVertexWithUV((double)var6, (double)var11, 0.0D, (double)topRight, (double)var10);
tessellator.addVertexWithUV(0.0D, (double)var11, 0.0D, (double)topLeft, (double)var10);
tessellator.addVertexWithUV(0.0D, (double)var11, (double)(0.0F - var7), (double)topLeft, (double)var10);
tessellator.addVertexWithUV((double)var6, (double)var11, (double)(0.0F - var7), (double)topRight, (double)var10);
}
tessellator.draw();*/
}
static void setColor(int var0)
{
float var1 = (float)(var0 >> 16 & 255) / 255.0F;
float var2 = (float)(var0 >> 8 & 255) / 255.0F;
float var3 = (float)(var0 & 255) / 255.0F;
GL11.glColor4f(var1, var2, var3, 1.0F);
}
}

View File

@ -0,0 +1,58 @@
package mods.tinker.armory.client;
import net.minecraft.block.Block;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SlotArmorCopy extends Slot
{
/**
* The armor type that can be placed on that slot, it uses the same values of armorType field on ItemArmor.
*/
final int armorType;
/**
* The parent class of this clot, ContainerPlayer, SlotArmor is a Anon inner class.
*/
final Container parent;
public SlotArmorCopy(Container container, IInventory par2IInventory, int par3, int par4, int par5, int par6)
{
super(par2IInventory, par3, par4, par5);
this.parent = container;
this.armorType = par6;
}
/**
* Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case
* of armor slots)
*/
public int getSlotStackLimit()
{
return 1;
}
/**
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
*/
public boolean isItemValid(ItemStack par1ItemStack)
{
return par1ItemStack == null ? false : (par1ItemStack.getItem() instanceof ItemArmor ? ((ItemArmor)par1ItemStack.getItem()).armorType == this.armorType : (par1ItemStack.getItem().itemID != Block.pumpkin.blockID && par1ItemStack.getItem().itemID != Item.skull.itemID ? false : this.armorType == 0));
}
//@SideOnly(Side.CLIENT)
/**
* Returns the icon index on items.png that is used as background image of the slot.
*/
/*public int getBackgroundIconIndex()
{
return 15 + this.armorType * 16;
}*/
}

View File

@ -0,0 +1,5 @@
package mods.tinker.armory.content;
public class ArmorStandBlock {
}

View File

@ -0,0 +1,171 @@
package mods.tinker.armory.content;
import mods.tinker.armory.Armory;
import mods.tinker.armory.client.ArmorStandContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class ArmorStandEntity extends EntityEquipment
{
//Container inventory;
public ArmorStandEntity(World world)
{
super(world);
this.texture = "/tinkertextures/mob/armorstandtexture.png";
//inventory = new ArmorStandContainer(this);
}
public boolean interact (EntityPlayer player)
{
//if (player.getCurrentEquippedItem() == null)
if (player.isSneaking())
{
//faceEntity(player, 10.0F, (float)this.getVerticalFaceSpeed());
//int facing = (int) ((player.rotationYawHead + 225) * 16 / 360) % 16;
int facing = (int) (player.rotationYawHead + 191) % 360;
facing = (int) (facing / 22.5f);
//System.out.println("Facing: "+facing);
//System.out.println("Facing: "+facing + " Angle: "+facing*22.5f);
setRotation(facing * 22.5f, 0);
}
else
player.openGui(Armory.instance, entityId, worldObj, (int) posX, (int) posY, (int) posZ);
return true;
}
@Override
protected void setRotation (float rotation, float vertical)
{
this.rotationYaw = rotation;
this.rotationYawHead = rotation;
this.rotationPitch = vertical;
}
@Override
public Container getContainer (EntityPlayer player)
{
return new ArmorStandContainer(player.inventory, this);
}
@Override
public int getSizeInventory ()
{
return 5;
}
@Override
public ItemStack getStackInSlot (int slot)
{
return getCurrentItemOrArmor(slot);
}
@Override
public ItemStack decrStackSize (int slot, int stackSize)
{
if (getCurrentItemOrArmor(slot) != null)
{
if (getCurrentItemOrArmor(slot).stackSize <= stackSize)
{
ItemStack itemstack = getCurrentItemOrArmor(slot);
setCurrentItemOrArmor(slot, null);
return itemstack;
}
ItemStack itemstack1 = getCurrentItemOrArmor(slot).splitStack(stackSize);
if (getCurrentItemOrArmor(slot).stackSize == 0)
{
setCurrentItemOrArmor(slot, null);
}
return itemstack1;
}
else
{
return null;
}
}
@Override
public ItemStack getStackInSlotOnClosing (int var1)
{
return null;
}
@Override
public void setInventorySlotContents (int slot, ItemStack itemstack)
{
setCurrentItemOrArmor(slot, itemstack);
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
{
itemstack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInvName ()
{
return "Inventory";
}
@Override
public int getInventoryStackLimit ()
{
return 1;
}
@Override
public void onInventoryChanged ()
{
}
@Override
public boolean isUseableByPlayer (EntityPlayer var1)
{
return true;
}
public void openChest ()
{
}
public void closeChest ()
{
}
protected int getDropItemId()
{
return Armory.armorStandItem.itemID;
}
@Override
public void writeEntityToNBT(NBTTagCompound tags)
{
super.writeEntityToNBT(tags);
tags.setFloat("rotationYaw", rotationYaw);
tags.setFloat("rotationYawHead", rotationYawHead);
}
@Override
public void readEntityFromNBT(NBTTagCompound tags)
{
super.readEntityFromNBT(tags);
rotationYaw = tags.getFloat("rotationYaw");
rotationYawHead = tags.getFloat("rotationYawHead");
}
@Override
public boolean func_94042_c ()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean func_94041_b (int i, ItemStack itemstack)
{
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,83 @@
package mods.tinker.armory.content;
import mods.tinker.armory.Armory;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ArmorStandItem extends Item
{
public ArmorStandItem(int id)
{
super(id);
setCreativeTab(CreativeTabs.tabMisc);
}
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
{
int var11 = world.getBlockId(x, y, z);
if (var11 == Block.snow.blockID)
{
side = 1;
}
else if (var11 != Block.vine.blockID && var11 != Block.tallGrass.blockID && var11 != Block.deadBush.blockID
&& (Block.blocksList[var11] == null || !Block.blocksList[var11].isBlockReplaceable(world, x, y, z)))
{
if (side == 0)
--y;
if (side == 1)
++y;
if (side == 2)
--z;
if (side == 3)
++z;
if (side == 4)
--x;
if (side == 5)
++x;
}
if (stack.stackSize == 0)
{
return false;
}
else if (!player.canPlayerEdit(x, y, z, side, stack))
{
return false;
}
if (spawnEntity(x, y, z, new ArmorStandEntity(world), world, player) )
{
stack.stackSize--;
return true;
}
player.swingItem();
return false;
}
public static boolean spawnEntity(double x, double y, double z, Entity entity, World world, EntityPlayer player)
{
if (!world.isRemote)
{
entity.setPosition(x+0.5, y, z+0.5);
world.spawnEntityInWorld(entity);
world.playAuxSFX(2001, (int)x, (int)y, (int)z, Block.stone.blockID);
return true;
}
return false;
}
public String getTextureFile()
{
return Armory.texture;
}
}

View File

@ -0,0 +1,67 @@
package mods.tinker.armory.content;
import mods.tinker.armory.client.RenderDisplay;
import mods.tinker.common.InventoryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class DisplayBlock extends InventoryBlock
{
public DisplayBlock(int id, Material material)
{
super(id, material);
}
@Override
public TileEntity createNewTileEntity (World world, int metadata)
{
return new ShieldrackLogic();
//return null;
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
return null;
}
@Override
public Object getModInstance ()
{
return null;
}
public int getRenderType()
{
return RenderDisplay.displayModel;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public String[] getTextureNames ()
{
// TODO Auto-generated method stub
return new String[] { "toolstation_top" };
}
public void func_94332_a (IconRegister par1IconRegister)
{
this.field_94336_cN = par1IconRegister.func_94245_a(Block.blockSteel.getUnlocalizedName());
}
}

View File

@ -0,0 +1,30 @@
package mods.tinker.armory.content;
import mods.tinker.common.InventoryLogic;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public abstract class DisplayLogic extends InventoryLogic
{
public DisplayLogic(int invSize)
{
super(invSize + 2); //Skin blocks
}
public ItemStack getFrontDisplay()
{
if (inventory[0] == null || !(inventory[0].getItem() instanceof ItemBlock))
return new ItemStack(Block.planks, 1, 1);
else
return inventory[0];
}
public ItemStack getBackDisplay()
{
if (inventory[1] == null || !(inventory[1].getItem() instanceof ItemBlock))
return new ItemStack(Block.cloth, 1, 3);
else
return inventory[1];
}
}

View File

@ -0,0 +1,97 @@
package mods.tinker.armory.content;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
/*
* Dummy class, used for rendering equipment and nothing else!
*/
public abstract class EntityEquipment extends EntityLiving
implements IInventory
{
public EntityEquipment(World par1World)
{
super(par1World);
equipmentDropChances = new float[] { 1f, 1f, 1f, 1f, 1f };
}
public abstract Container getContainer(EntityPlayer player);
public String getTexture()
{
return this.texture;
}
protected void kill()
{
this.attackEntityFrom(DamageSource.outOfWorld, 1000);
}
protected void dropFewItems(boolean par1, int par2)
{
this.dropItem(this.getDropItemId(), 1);
}
protected void dropEquipment(boolean par1, int par2)
{
for (int var3 = 0; var3 < this.getLastActiveItems().length; ++var3)
{
ItemStack var4 = this.getCurrentItemOrArmor(var3);
boolean var5 = this.equipmentDropChances[var3] > 1.0F;
if (var4 != null && (par1 || var5) && this.rand.nextFloat() - (float)par2 * 0.01F < this.equipmentDropChances[var3])
{
if (!var5 && var4.isItemStackDamageable())
{
int var6 = Math.max(var4.getMaxDamage() - 25, 1);
int var7 = var4.getMaxDamage() - this.rand.nextInt(this.rand.nextInt(var6) + 1);
if (var7 > var6)
{
var7 = var6;
}
if (var7 < 1)
{
var7 = 1;
}
//var4.setItemDamage(var7);
}
this.entityDropItem(var4, 0.0F);
}
}
}
public int getMaxHealth() { return 5; }
public boolean canBePushed() { return false; }
protected int decreaseAirSupply(int par1) { return 0; }
//public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { return false; }
//protected void damageEntity(DamageSource par1DamageSource, int par2) { super.damageEntity(par1DamageSource, par2); }
protected void updateFallState(double par1, boolean par3) {}
public void knockBack(Entity par1Entity, int par2, double par3, double par5) {}
protected void fall(float par1) {}
public void moveEntityWithHeading(float par1, float par2) {}
public boolean canBreatheUnderwater() { return true; }
public void onLivingUpdate() { }
public boolean isBlocking() { return true; }
protected void jump() {}
protected boolean canDespawn() { return true; }
//protected void despawnEntity() { super.despawnEntity(); }
protected void updateAITasks() {}
protected void updateEntityActionState() {}
protected void updateArmSwingProgress() {}
public boolean getCanSpawnHere() { return false; }
protected void updatePotionEffects() {}
public void addPotionEffect(PotionEffect par1PotionEffect) {}
public boolean isPotionApplicable(PotionEffect par1PotionEffect) { return false; }
}

View File

@ -0,0 +1,191 @@
package mods.tinker.armory.content;
import java.util.List;
import mods.tinker.armory.client.RenderShelf;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class Shelf extends BlockContainer
{
public Shelf(int id, Material material)
{
super(id, material);
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
public int getRenderType()
{
return RenderShelf.shelfModelID;
}
@Override
public TileEntity createNewTileEntity(World world)
{
return new ToolrackLogic();
}
/*public int getBlockTextureFromSideAndMetadata(int side, int meta)
{
return 6;
}
public void addCollidingBlockToList(World var1, int var2, int var3, int var4, AxisAlignedBB var5, List var6, Entity var7)
{
this.setBounds(var1.getBlockMetadata(var2, var3, var4));
super.addCollidingBlockToList(var1, var2, var3, var4, var5, var6, var7);
}*/
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4)
{
this.setBounds(var1.getBlockMetadata(var2, var3, var4));
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int size, float hitX, float hitY, float hitZ)
{
System.out.println("Activating tool rack");
if (world.isRemote)
{
System.out.println("World's remote");
return true;
}
else
{
ToolrackLogic logic = (ToolrackLogic)world.getBlockTileEntity(x, y, z);
//if (logic != null && player instanceof EntityPlayerMP)
if (logic != null)
{
System.out.println("Logic exists");
int facing = world.getBlockMetadata(x, y, z) / 4;
byte slot = 0;
double var13 = (double)x + 0.5D - player.posX;
double var15 = (double)z + 0.5D - player.posZ;
if (facing == 0)
{
var15 -= 0.25D;
}
else if (facing == 1)
{
var13 -= 0.25D;
}
else if (facing == 2)
{
var15 += 0.25D;
}
else if (facing == 3)
{
var13 += 0.25D;
}
double var17 = var13 + var15 * Math.tan(Math.toRadians((double)player.rotationYaw));
double var19 = var15 - var13 * Math.tan(Math.toRadians((double)(player.rotationYaw + 90.0F)));
if (facing == 0 && var17 < 0.0D || facing == 1 && var19 > 0.0D || facing == 2 && var17 > 0.0D || facing == 3 && var19 < 0.0D)
{
slot = 1;
}
ItemStack stack = player.getCurrentEquippedItem();
if (!logic.isItemInColumn(slot) && stack != null && logic.canHoldItem(stack))
{
//logic.setInventorySlotContents(slot, stack);
stack = player.inventory.decrStackSize(player.inventory.currentItem, 1);
logic.setInventorySlotContents(slot, stack);
}
else
{
ItemStack insideStack = logic.takeItemInColumn(slot);
if (insideStack == null)
{
insideStack = logic.takeItemInColumn(1 - slot);
}
if (insideStack != null)
{
this.spawnItem(world, x, y, z, insideStack);
}
}
world.markBlockForUpdate(x, y, z);
}
return true;
}
}
protected void spawnItem(World world, int x, int y, int z, ItemStack stack)
{
if (!world.isRemote)
{
EntityItem var6 = new EntityItem(world, (double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, stack);
var6.delayBeforeCanPickup = 5;
int var7 = world.getBlockMetadata(x, y, z) & 3;
var6.motionX = var6.motionY = var6.motionZ = 0.0D;
if (var7 == 0)
{
var6.motionZ = 0.05D;
}
else if (var7 == 1)
{
var6.motionX = 0.05D;
}
else if (var7 == 2)
{
var6.motionZ = -0.05D;
}
else if (var7 == 3)
{
var6.motionX = -0.05D;
}
world.spawnEntityInWorld(var6);
}
}
public void setBounds(int metadata)
{
int facing = metadata / 4;
if (facing == 0)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.875F, 0.125F);
}
/*else if (facing == 1)
{
this.setBlockBounds(0.0F, 0.2F, 0.0F, 0.25F, 0.9F, 1.0F);
}
else if (facing == 2)
{
this.setBlockBounds(0.0F, 0.2F, 0.75F, 1.0F, 0.9F, 1.0F);
}
else if (facing == 3)
{
this.setBlockBounds(0.75F, 0.2F, 0.0F, 1.0F, 0.9F, 1.0F);
}*/
}
}

View File

@ -0,0 +1,27 @@
package mods.tinker.armory.content;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.world.World;
public class ShieldrackLogic extends DisplayLogic
{
public ShieldrackLogic()
{
super(3);
}
@Override
public String getDefaultName ()
{
return "armory.shieldrack";
}
@Override
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
{
return null;
}
}

View File

@ -0,0 +1,29 @@
package mods.tinker.armory.content;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ToolrackItem extends ItemBlock
{
public ToolrackItem(int id)
{
super(id);
setMaxDamage(0);
setHasSubtypes(true);
}
@Override
public int getMetadata(int md)
{
return md;
}
public String getUnlocalizedName(ItemStack itemstack)
{
return (new StringBuilder()).append("block.").append(blockType[itemstack.getItemDamage()]).append("Toolrack").toString();
}
public static final String blockType[] =
{
"stone", "stonebrick", "brick", "obsidian"
};
}

View File

@ -0,0 +1,215 @@
package mods.tinker.armory.content;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
public class ToolrackLogic extends TileEntity
implements IInventory
{
ItemStack[] tools;
public ToolrackLogic()
{
tools = new ItemStack[2];
}
@Override
public int getSizeInventory()
{
return 2;
}
@Override
public ItemStack getStackInSlot(int slot)
{
return tools[slot];
}
@Override
public ItemStack decrStackSize(int slot, int quantity)
{
if (this.tools[slot] == null)
return null;
else
{
ItemStack stack;
if (this.tools[slot].stackSize <= quantity)
{
stack = this.tools[slot];
this.tools[slot] = null;
}
else
{
stack = this.tools[slot].splitStack(quantity);
if (this.tools[slot].stackSize == 0)
{
this.tools[slot] = null;
}
}
this.onInventoryChanged();
return stack;
}
}
@Override
public ItemStack getStackInSlotOnClosing(int var1)
{
return null;
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
this.updateItem(slot, stack);
if (stack != null && stack.stackSize > this.getInventoryStackLimit())
{
stack.stackSize = this.getInventoryStackLimit();
}
this.onInventoryChanged();
}
void updateItem(int slot, ItemStack stack)
{
this.tools[slot] = stack.copy();
//System.out.println("Item name: "+tools[slot].getItemName());
//float var3 = 45.0F;
/*if (mod_ToolRack.reversedItems.contains(Integer.valueOf(var2.itemID)))
{
var3 = -45.0F;
}
else if (mod_ToolRack.straightItems.contains(Integer.valueOf(var2.itemID)))
{
var3 = 0.0F;
}*/
//this.rotations[var1] = var3;
}
public boolean canHoldItem(ItemStack stack)
{
return stack.getMaxStackSize() == 1;
//return var1.getMaxStackSize() == 1 || mod_ToolRack.additionalTools.contains(Integer.valueOf(var1.itemID));
}
public boolean isItemInColumn(int var1)
{
return this.tools[var1] != null;
}
public ItemStack takeItemInColumn(int var1)
{
return this.tools[var1] != null ? this.decrStackSize(var1, 1) : null;
}
@Override
public String getInvName()
{
return "Toolrack";
}
@Override
public int getInventoryStackLimit()
{
return 1;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player)
{
return true;
}
@Override
public void openChest()
{
}
@Override
public void closeChest()
{
}
@Override
public void readFromNBT(NBTTagCompound var1)
{
super.readFromNBT(var1);
NBTTagList tagList = var1.getTagList("Items");
this.tools = new ItemStack[this.getSizeInventory()];
for (int iter = 0; iter < tagList.tagCount(); ++iter)
{
NBTTagCompound tagCompund = (NBTTagCompound)tagList.tagAt(iter);
int slot = tagCompund.getByte("Slot");
if (slot >= 0 && slot < this.tools.length)
{
this.updateItem(slot, ItemStack.loadItemStackFromNBT(tagCompund));
}
}
}
@Override
public void writeToNBT(NBTTagCompound var1)
{
super.writeToNBT(var1);
NBTTagList tagList = new NBTTagList();
for (byte iter = 0; iter < this.tools.length; ++iter)
{
if (this.tools[iter] != null)
{
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", iter);
this.tools[iter].writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
}
var1.setTag("Items", tagList);
}
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound compound = new NBTTagCompound();
this.writeToNBT(compound);
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, compound);
}
@Override
public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
{
readFromNBT(pkt.customParam1);
}
@Override
public boolean func_94042_c ()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean func_94041_b (int i, ItemStack itemstack)
{
// TODO Auto-generated method stub
return false;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
package mods.tinker.common;
public class CoordTuple
{
public final int x;
public final int y;
public final int z;
public CoordTuple(int posX, int posY, int posZ)
{
x = posX;
y = posY;
z = posZ;
}
public boolean equals(CoordTuple coord)
{
if (coord == null)
return false;
else if (coord == this)
return true;
else if (coord.x == this.x && coord.y == this.y && coord.z == this.z)
return true;
else
return false;
}
public boolean equals(int posX, int posY, int posZ)
{
if (this.x == posX && this.y == posY && this.z == posZ)
return true;
else
return false;
}
}

View File

@ -0,0 +1,7 @@
package mods.tinker.common;
public interface IActiveLogic
{
public boolean getActive();
public void setActive(boolean flag);
}

View File

@ -0,0 +1,11 @@
package mods.tinker.common;
import net.minecraft.entity.EntityLiving;
import net.minecraftforge.common.ForgeDirection;
public interface IFacingLogic
{
public byte getRenderDirection();
public ForgeDirection getForgeDirection();
public void setDirection(float yaw, float pitch, EntityLiving player);
}

View File

@ -0,0 +1,10 @@
package mods.tinker.common;
import mods.tinker.tconstruct.crafting.PatternBuilder.MaterialSet;
import net.minecraft.item.ItemStack;
public interface IPattern
{
public int getPatternCost (int metadata);
public ItemStack getPatternOutput(ItemStack stack, MaterialSet set);
}

View File

@ -0,0 +1,8 @@
package mods.tinker.common;
import net.minecraft.item.ItemStack;
public interface IToolPart
{
public int getMaterialID(ItemStack stack);
}

View File

@ -0,0 +1,149 @@
package mods.tinker.common;
import mods.tinker.tconstruct.TConstruct;
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.IBlockAccess;
import net.minecraft.world.World;
public abstract class InventoryBlock extends BlockContainer
{
protected InventoryBlock(int id, Material material)
{
super(id, material);
}
/* Logic backend */
public TileEntity createNewTileEntity (World var1) { return null; }
public abstract TileEntity createNewTileEntity(World world, int metadata);
public abstract Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer);
public abstract Object getModInstance();
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
{
if (player.isSneaking())
return false;
Integer integer = getGui(world, x, y, z, player);
if (integer == null || integer == -1)
{
return false;
}
else
{
player.openGui(getModInstance(), integer, world, x, y, z);
return true;
}
}
/* Inventory */
@Override
public void breakBlock (World par1World, int x, int y, int z, int par5, int par6)
{
TileEntity te = par1World.getBlockTileEntity(x, y, z);
if (te != null && te instanceof InventoryLogic)
{
InventoryLogic logic = (InventoryLogic) te;
for (int iter = 0; iter < logic.getSizeInventory(); ++iter)
{
ItemStack stack = logic.getStackInSlot(iter);
if (stack != null && logic.canDropInventorySlot(iter))
{
float jumpX = TConstruct.tRand.nextFloat() * 0.8F + 0.1F;
float jumpY = TConstruct.tRand.nextFloat() * 0.8F + 0.1F;
float jumpZ = TConstruct.tRand.nextFloat() * 0.8F + 0.1F;
while (stack.stackSize > 0)
{
int itemSize = TConstruct.tRand.nextInt(21) + 10;
if (itemSize > stack.stackSize)
{
itemSize = stack.stackSize;
}
stack.stackSize -= itemSize;
EntityItem entityitem = new EntityItem(par1World, (double) ((float) x + jumpX), (double) ((float) y + jumpY), (double) ((float) z + jumpZ),
new ItemStack(stack.itemID, itemSize, stack.getItemDamage()));
if (stack.hasTagCompound())
{
entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
}
float offset = 0.05F;
entityitem.motionX = (double) ((float) TConstruct.tRand.nextGaussian() * offset);
entityitem.motionY = (double) ((float) TConstruct.tRand.nextGaussian() * offset + 0.2F);
entityitem.motionZ = (double) ((float) TConstruct.tRand.nextGaussian() * offset);
par1World.spawnEntityInWorld(entityitem);
}
}
}
}
super.breakBlock(par1World, x, y, z, par5, par6);
}
/* Placement */
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving, ItemStack stack)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic instanceof IFacingLogic)
{
IFacingLogic direction = (IFacingLogic) logic;
if (entityliving == null)
{
direction.setDirection(0F, 0F, null);
}
else
{
direction.setDirection(entityliving.rotationYaw * 4F, entityliving.rotationPitch, entityliving);
}
}
}
public static boolean isActive(IBlockAccess world, int x, int y, int z)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic instanceof IActiveLogic)
{
return ((IActiveLogic)logic).getActive();
}
return false;
}
public int damageDropped (int meta)
{
return meta;
}
/* Textures */
public Icon[] icons;
public abstract String[] getTextureNames();
public void func_94332_a(IconRegister iconRegister)
{
String[] textureNames = getTextureNames();
//System.out.println("TextureNames: :"+this.getClass().getSimpleName());
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.func_94245_a("tinker:"+textureNames[i]);
}
}
}

View File

@ -0,0 +1,168 @@
package mods.tinker.common;
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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
/*
* A simple logic class for storing items
* Abstract to avoid instantiation
*/
public abstract class InventoryLogic extends TileEntity
implements IInventory
{
protected ItemStack[] inventory;
protected String invName;
public InventoryLogic(int invSize)
{
inventory = new ItemStack[invSize];
}
/* Inventory management */
@Override
public ItemStack getStackInSlot(int slot)
{
return inventory[slot];
}
public boolean isStackInSlot(int slot)
{
return inventory[slot] != null;
}
@Override
public int getSizeInventory()
{
return inventory.length;
}
@Override
public int getInventoryStackLimit ()
{
return 64;
}
public boolean canDropInventorySlot(int slot)
{
return true;
}
@Override
public void setInventorySlotContents(int slot, ItemStack itemstack)
{
inventory[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
{
itemstack.stackSize = getInventoryStackLimit();
}
}
@Override
public ItemStack decrStackSize(int slot, int quantity)
{
if (inventory[slot] != null)
{
if (inventory[slot].stackSize <= quantity)
{
ItemStack stack = inventory[slot];
inventory[slot] = null;
return stack;
}
ItemStack split = inventory[slot].splitStack(quantity);
if (inventory[slot].stackSize == 0)
{
inventory[slot] = null;
}
return split;
}
else
{
return null;
}
}
/* Supporting methods */
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this)
return false;
else
return entityplayer.getDistance((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64D;
}
public abstract Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z);
/* NBT */
@Override
public void readFromNBT(NBTTagCompound tags)
{
super.readFromNBT(tags);
NBTTagList nbttaglist = tags.getTagList("Items");
inventory = new ItemStack[getSizeInventory()];
for (int iter = 0; iter < nbttaglist.tagCount(); iter++)
{
NBTTagCompound tagList = (NBTTagCompound)nbttaglist.tagAt(iter);
byte slotID = tagList.getByte("Slot");
if (slotID >= 0 && slotID < inventory.length)
{
inventory[slotID] = ItemStack.loadItemStackFromNBT(tagList);
}
}
}
@Override
public void writeToNBT(NBTTagCompound tags)
{
super.writeToNBT(tags);
NBTTagList nbttaglist = new NBTTagList();
for (int iter = 0; iter < inventory.length; iter++)
{
//System.out.println("Heyo");
if (inventory[iter] != null)
{
NBTTagCompound tagList = new NBTTagCompound();
tagList.setByte("Slot", (byte)iter);
inventory[iter].writeToNBT(tagList);
nbttaglist.appendTag(tagList);
}
}
tags.setTag("Items", nbttaglist);
}
/* Default implementations of hardly used methods */
public ItemStack getStackInSlotOnClosing (int slot) { return null; }
public void openChest () {}
public void closeChest () {}
protected abstract String getDefaultName();
public String getInvName()
{
return this.func_94042_c() ? this.invName : getDefaultName();
}
public boolean func_94042_c()
{
return this.invName != null && this.invName.length() > 0;
}
@Override
public boolean func_94041_b (int i, ItemStack itemstack)
{
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,149 @@
package mods.tinker.common;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public abstract class ToolMod
{
public final String key;
public final List stacks;
public final int effectIndex; //255 is always blank
public ToolMod(ItemStack[] items, int effect, String dataKey)
{
//recipeItems = items;
List<ItemStack> itemstacks = new ArrayList<ItemStack>();
for (int iter = 0; iter < items.length; iter++)
itemstacks.add(items[iter]);
stacks = itemstacks;
effectIndex = effect;
key = dataKey;
}
/** Checks to see if the inputs match the stored items
* Note: Works like ShapelessRecipes
*
* @param input The ItemStacks to compare against
* @param tool Item to modify, used for restrictions
* @return Whether the recipe matches the input
*/
public boolean matches (ItemStack[] input, ItemStack tool)
{
if (!canModify(tool, input))
return false;
ArrayList list = new ArrayList(this.stacks);
for (int iter = 0; iter < input.length; ++iter)
{
ItemStack craftingStack = input[iter];
if (craftingStack != null)
{
boolean canCraft = false;
Iterator iterate = list.iterator();
while (iterate.hasNext())
{
ItemStack removeStack = (ItemStack) iterate.next();
if (craftingStack.itemID == removeStack.itemID && (removeStack.getItemDamage() == -1 || craftingStack.getItemDamage() == removeStack.getItemDamage()))
{
canCraft = true;
list.remove(removeStack);
break;
}
}
if (!canCraft)
{
return false;
}
}
}
return list.isEmpty();
}
/**
*
* @param tool Tool to compare against
* @return Whether the tool can be modified
*/
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
return tags.getInteger("Modifiers") > 0;
}
/** Modifies the tool. Adds nbttags, changes existing ones, ticks down modification counter, etc
*
* @param input ItemStacks to pull info from
* @param tool The tool to modify
*/
public abstract void modify (ItemStack[] input, ItemStack tool);
public void addMatchingEffect (ItemStack tool)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
if (tags.hasKey("Effect3") || tags.hasKey(key))
return;
else if (tags.hasKey("Effect2"))
{
//System.out.println("Adding Effect 3");
tags.setInteger("Effect3", effectIndex);
}
else if (tags.hasKey("Effect1"))
{
//System.out.println("Adding Effect 2");
tags.setInteger("Effect2", effectIndex);
}
else
{
//System.out.println("Adding Effect 1");
tags.setInteger("Effect1", effectIndex);
}
}
protected int addModifierTip (ItemStack tool, String modifierTip)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
int tipNum = 0;
while (true)
{
tipNum++;
String tip = "Tooltip" + tipNum;
if (!tags.hasKey(tip))
{
tags.setString(tip, "");
String modTip = "ModifierTip" + tipNum;
tags.setString(modTip, modifierTip);
return tipNum;
}
}
}
protected int addToolTip (ItemStack tool, String tooltip, String modifierTip)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
int tipNum = 0;
while (true)
{
tipNum++;
String tip = "Tooltip" + tipNum;
if (!tags.hasKey(tip))
{
tags.setString(tip, tooltip);
String modTip = "ModifierTip" + tipNum;
tags.setString(modTip, modifierTip);
return tipNum;
}
}
}
}

View File

@ -0,0 +1,25 @@
package mods.tinker.common.fancyitem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class FancyEntityItem extends EntityItem
{
public FancyEntityItem(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public FancyEntityItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack)
{
this(par1World, par2, par4, par6);
this.setEntityItemStack(par8ItemStack);
this.lifespan = (par8ItemStack.getItem() == null ? 6000 : par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World));
}
public FancyEntityItem(World par1World)
{
super(par1World);
}
}

View File

@ -0,0 +1,603 @@
package mods.tinker.common.fancyitem;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderEngine;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraftforge.client.ForgeHooksClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class FancyItemRender extends Render
{
private RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
private Random random = new Random();
public boolean field_77024_a = true;
/** Defines the zLevel of rendering of item on GUI. */
public float zLevel = 0.0F;
public static boolean field_82407_g = false;
public FancyItemRender()
{
this.shadowSize = 0.15F;
this.shadowOpaque = 0.75F;
}
/**
* Renders the item
*/
public void doRenderItem (EntityItem par1EntityItem, double par2, double par4, double par6, float par8, float par9)
{
this.random.setSeed(187L);
ItemStack itemstack = par1EntityItem.getEntityItem();
if (itemstack.getItem() != null)
{
GL11.glPushMatrix();
float f2 = shouldBob() ? MathHelper.sin(((float) par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F : 0F;
float f3 = (((float) par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI);
byte b0 = getMiniBlockCount(itemstack);
GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
int i;
float f4;
float f5;
float f6;
Block block = null;
if (itemstack.itemID < Block.blocksList.length)
{
block = Block.blocksList[itemstack.itemID];
}
if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, renderBlocks))
{
;
}
else if (itemstack.func_94608_d() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
if (field_82407_g)
{
GL11.glScalef(1.25F, 1.25F, 1.25F);
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
}
this.loadTexture("/terrain.png");
float f7 = 0.25F;
int j = block.getRenderType();
if (j == 1 || j == 19 || j == 12 || j == 2)
{
f7 = 0.5F;
}
GL11.glScalef(f7, f7, f7);
for (i = 0; i < b0; ++i)
{
GL11.glPushMatrix();
if (i > 0)
{
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
GL11.glTranslatef(f5, f4, f6);
}
f5 = 1.0F;
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
GL11.glPopMatrix();
}
}
else
{
float f8;
if (itemstack.getItem().requiresMultipleRenderPasses())
{
if (field_82407_g)
{
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
}
else
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
this.loadTexture("/gui/items.png");
for (int k = 0; k <= itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
{
this.random.setSeed(187L);
Icon icon = itemstack.getItem().getIcon(itemstack, k);
f8 = 1.0F;
if (this.field_77024_a)
{
i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k);
f5 = (float) (i >> 16 & 255) / 255.0F;
f4 = (float) (i >> 8 & 255) / 255.0F;
f6 = (float) (i & 255) / 255.0F;
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8);
}
else
{
this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F);
}
}
}
else
{
if (field_82407_g)
{
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
}
else
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
Icon icon1 = itemstack.getIconIndex();
if (itemstack.func_94608_d() == 0)
{
this.loadTexture("/terrain.png");
}
else
{
this.loadTexture("/gui/items.png");
}
if (this.field_77024_a)
{
int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
f8 = (float) (l >> 16 & 255) / 255.0F;
float f9 = (float) (l >> 8 & 255) / 255.0F;
f5 = (float) (l & 255) / 255.0F;
f4 = 1.0F;
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
}
else
{
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
}
}
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
/**
* Renders a dropped item
*/
private void renderDroppedItem (EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
{
Tessellator tessellator = Tessellator.instance;
if (par2Icon == null)
{
par2Icon = this.renderManager.renderEngine.func_96448_c(par1EntityItem.getEntityItem().func_94608_d());
}
float f4 = par2Icon.func_94209_e();
float f5 = par2Icon.func_94212_f();
float f6 = par2Icon.func_94206_g();
float f7 = par2Icon.func_94210_h();
float f8 = 1.0F;
float f9 = 0.5F;
float f10 = 0.25F;
float f11;
GL11.glPushMatrix();
if (field_82407_g)
{
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
}
else
{
GL11.glRotatef((((float) par1EntityItem.age + par4) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
float f12 = 0.0625F;
f11 = 0.021875F;
ItemStack itemstack = par1EntityItem.getEntityItem();
int j = itemstack.stackSize;
byte b0 = getMiniItemCount(itemstack);
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
for (int k = 0; k < b0; ++k)
{
// Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
if (k > 0 && shouldSpreadItems())
{
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
GL11.glTranslatef(x, y, f12 + f11);
}
else
{
GL11.glTranslatef(0f, 0f, f12 + f11);
}
if (itemstack.func_94608_d() == 0 && itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null)
{
this.loadTexture("/terrain.png");
}
else
{
this.loadTexture("/gui/items.png");
}
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, par2Icon.func_94213_j(), par2Icon.func_94208_k(), f12);
if (itemstack != null && itemstack.hasEffect())
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
this.renderManager.renderEngine.func_98187_b("%blur%/misc/glint.png");
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f13 = 0.76F;
GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f14 = 0.125F;
GL11.glScalef(f14, f14, f14);
float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f15, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f14, f14, f14);
f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f15, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
}
GL11.glPopMatrix();
}
/**
* Renders the item's icon or block into the UI at the specified position.
*/
public void renderItemIntoGUI (FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
{
int k = par3ItemStack.itemID;
int l = par3ItemStack.getItemDamage();
Icon icon = par3ItemStack.getIconIndex();
float f;
float f1;
float f2;
Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
if (par3ItemStack.func_94608_d() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
{
par2RenderEngine.func_98187_b("/terrain.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) (par4 - 2), (float) (par5 + 3), -3.0F + this.zLevel);
GL11.glScalef(10.0F, 10.0F, 10.0F);
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
GL11.glScalef(1.0F, 1.0F, -1.0F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
int i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
f2 = (float) (i1 >> 16 & 255) / 255.0F;
f = (float) (i1 >> 8 & 255) / 255.0F;
f1 = (float) (i1 & 255) / 255.0F;
if (this.field_77024_a)
{
GL11.glColor4f(f2, f, f1, 1.0F);
}
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
this.itemRenderBlocks.useInventoryTint = this.field_77024_a;
this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F);
this.itemRenderBlocks.useInventoryTint = true;
GL11.glPopMatrix();
}
else
{
int j1;
if (Item.itemsList[k].requiresMultipleRenderPasses())
{
GL11.glDisable(GL11.GL_LIGHTING);
par2RenderEngine.func_98187_b("/gui/items.png");
for (j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
{
Icon icon1 = Item.itemsList[k].getIcon(par3ItemStack, j1);
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
f = (float) (k1 >> 16 & 255) / 255.0F;
f1 = (float) (k1 >> 8 & 255) / 255.0F;
float f3 = (float) (k1 & 255) / 255.0F;
if (this.field_77024_a)
{
GL11.glColor4f(f, f1, f3, 1.0F);
}
this.func_94149_a(par4, par5, icon1, 16, 16);
}
GL11.glEnable(GL11.GL_LIGHTING);
}
else
{
GL11.glDisable(GL11.GL_LIGHTING);
if (par3ItemStack.func_94608_d() == 0)
{
par2RenderEngine.func_98187_b("/terrain.png");
}
else
{
par2RenderEngine.func_98187_b("/gui/items.png");
}
if (icon == null)
{
icon = par2RenderEngine.func_96448_c(par3ItemStack.func_94608_d());
}
j1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
float f4 = (float) (j1 >> 16 & 255) / 255.0F;
f2 = (float) (j1 >> 8 & 255) / 255.0F;
f = (float) (j1 & 255) / 255.0F;
if (this.field_77024_a)
{
GL11.glColor4f(f4, f2, f, 1.0F);
}
this.func_94149_a(par4, par5, icon, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
}
}
GL11.glEnable(GL11.GL_CULL_FACE);
}
/**
* Render the item's icon or block into the GUI, including the glint effect.
*/
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
{
if (par3ItemStack != null)
{
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, field_77024_a, zLevel, (float) par4, (float) par5))
{
this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5);
}
if (par3ItemStack.hasEffect())
{
GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
par2RenderEngine.func_98187_b("%blur%/misc/glint.png");
this.zLevel -= 50.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.func_77018_a(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
this.zLevel += 50.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
}
}
private void func_77018_a (int par1, int par2, int par3, int par4, int par5)
{
for (int j1 = 0; j1 < 2; ++j1)
{
if (j1 == 0)
{
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
if (j1 == 1)
{
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
}
float f = 0.00390625F;
float f1 = 0.00390625F;
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
float f3 = 0.0F;
Tessellator tessellator = Tessellator.instance;
float f4 = 4.0F;
if (j1 == 1)
{
f4 = -1.0F;
}
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
tessellator.draw();
}
}
/**
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
* specified position.
*/
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
{
this.func_94148_a(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5, (String) null);
}
public void func_94148_a (FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5, String par6Str)
{
if (par3ItemStack != null)
{
if (par3ItemStack.stackSize > 1 || par6Str != null)
{
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
if (par3ItemStack.isItemDamaged())
{
int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage());
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
Tessellator tessellator = Tessellator.instance;
int i1 = 255 - l << 16 | l << 8;
int j1 = (255 - l) / 4 << 16 | 16128;
this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1);
this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
}
/**
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args:
* tessellator, x, y, width, height, color
*/
private void renderQuad (Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
{
par1Tessellator.startDrawingQuads();
par1Tessellator.setColorOpaque_I(par6);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + 0), 0.0D);
par1Tessellator.draw();
}
public void func_94149_a (int par1, int par2, Icon par3Icon, int par4, int par5)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.func_94209_e(), (double) par3Icon.func_94210_h());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.func_94212_f(), (double) par3Icon.func_94210_h());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.func_94212_f(), (double) par3Icon.func_94206_g());
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.func_94209_e(), (double) par3Icon.func_94206_g());
tessellator.draw();
}
/**
* 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 doRender(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 (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderItem((EntityItem) par1Entity, par2, par4, par6, par8, par9);
}
/**
* Items should spread out when rendered in 3d?
* @return
*/
public boolean shouldSpreadItems ()
{
return true;
}
/**
* Items should have a bob effect
* @return
*/
public boolean shouldBob ()
{
return true;
}
public byte getMiniBlockCount (ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 5)
ret = 3;
if (stack.stackSize > 20)
ret = 4;
if (stack.stackSize > 40)
ret = 5;
return ret;
}
/**
* Allows for a subclass to override how many rendered items appear in a
* "mini item 3d stack"
* @param stack
* @return
*/
public byte getMiniItemCount (ItemStack stack)
{
byte ret = 1;
if (stack.stackSize > 1)
ret = 2;
if (stack.stackSize > 15)
ret = 3;
if (stack.stackSize > 31)
ret = 4;
return ret;
}
}

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1012 B

After

Width:  |  Height:  |  Size: 1012 B

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

View File

@ -0,0 +1,494 @@
package mods.tinker.tconstruct;
import ic2.api.ICustomElectricItem;
import ic2.api.IElectricItem;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import mods.tinker.tconstruct.tools.ToolCore;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.EnchantmentThorns;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.stats.AchievementList;
import net.minecraft.stats.StatList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import cpw.mods.fml.client.FMLClientHandler;
public class AbilityHelper
{
static Minecraft mc;
static Random random = new Random();
/* Normal interactions */
public static boolean onBlockChanged (ItemStack stack, World world, int bID, int x, int y, int z, EntityLiving player, Random random)
{
if (!stack.hasTagCompound())
return false;
int durability = 0;
NBTTagCompound tags = stack.getTagCompound();
if (tags.getCompoundTag("InfiTool").hasKey("Unbreaking"))
durability = tags.getCompoundTag("InfiTool").getInteger("Unbreaking");
if (random.nextInt(10) < 10 - durability)
{
damageTool(stack, 1, tags, player, false);
}
return true;
}
public static void onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity, ToolCore tool)
{
if (entity.canAttackWithItem())
{
if (!entity.func_85031_j(player)) // can't attack this entity
{
NBTTagCompound tags = stack.getTagCompound();
NBTTagCompound toolTags = stack.getTagCompound().getCompoundTag("InfiTool");
int damage = toolTags.getInteger("Attack");
boolean broken = toolTags.getBoolean("Broken");
int durability = tags.getCompoundTag("InfiTool").getInteger("Damage");
float shoddy = tags.getCompoundTag("InfiTool").getFloat("Shoddy");
float damageModifier = -shoddy * durability / 100f;
if (player.isPotionActive(Potion.damageBoost))
{
damage += 3 << player.getActivePotionEffect(Potion.damageBoost).getAmplifier();
}
if (player.isPotionActive(Potion.weakness))
{
damage -= 2 << player.getActivePotionEffect(Potion.weakness).getAmplifier();
}
float knockback = 0;
int enchantDamage = 0;
if (entity instanceof EntityLiving)
{
enchantDamage = EnchantmentHelper.getEnchantmentModifierLiving(player, (EntityLiving)entity);
knockback += EnchantmentHelper.getKnockbackModifier(player, (EntityLiving)entity);
}
damage += damageModifier;
if (player.isSprinting())
{
knockback++;
float lunge = tool.chargeAttack();
if (lunge > 1f)
{
knockback += lunge - 1.0f;
damage *= lunge;
}
}
if (damage > 0 || enchantDamage > 0)
{
boolean criticalHit = player.fallDistance > 0.0F && !player.onGround && !player.isOnLadder() && !player.isInWater() && !player.isPotionActive(Potion.blindness) && player.ridingEntity == null && entity instanceof EntityLiving;
if (criticalHit)
{
damage += random.nextInt(damage / 2 + 2);
}
damage += enchantDamage;
boolean var6 = false;
int fireAspect = EnchantmentHelper.getFireAspectModifier(player);
if (entity instanceof EntityLiving && fireAspect > 0 && !entity.isBurning())
{
var6 = true;
entity.setFire(1);
}
if (broken)
damage = 1;
boolean causedDamage = false;
if (tool.pierceArmor())
causedDamage = entity.attackEntityFrom(causePlayerPiercingDamage(player), damage);
else
causedDamage = entity.attackEntityFrom(DamageSource.causePlayerDamage(player), damage);
if (causedDamage)
{
damageTool(stack, 1, player, false);
int drain = toolTags.getInteger("Necrotic");
if (drain > 0)
player.heal(drain);
if (knockback > 0)
{
entity.addVelocity((double)(-MathHelper.sin(player.rotationYaw * (float)Math.PI / 180.0F) * (float)knockback * 0.5F), 0.1D, (double)(MathHelper.cos(player.rotationYaw * (float)Math.PI / 180.0F) * (float)knockback * 0.5F));
player.motionX *= 0.6D;
player.motionZ *= 0.6D;
player.setSprinting(false);
}
if (criticalHit)
{
player.onCriticalHit(entity);
}
if (enchantDamage > 0)
{
player.onEnchantmentCritical(entity);
}
if (damage >= 18)
{
player.triggerAchievement(AchievementList.overkill);
}
player.setLastAttackingEntity(entity);
if (entity instanceof EntityLiving)
{
EnchantmentThorns.func_92096_a(player, (EntityLiving)entity, random);
}
}
if (entity instanceof EntityLiving)
{
stack.hitEntity((EntityLiving)entity, player);
if (entity.isEntityAlive())
{
alertPlayerWolves(player, (EntityLiving)entity, true);
}
player.addStat(StatList.damageDealtStat, damage);
if ((fireAspect > 0 || toolTags.hasKey("Fiery")) && causedDamage)
{
fireAspect *= 4;
if (toolTags.hasKey("Fiery"))
{
fireAspect += toolTags.getInteger("Fiery")/5+1;
}
entity.setFire(fireAspect);
}
else if (var6)
{
entity.extinguish();
}
}
player.addExhaustion(0.3F);
}
}
}
}
static void alertPlayerWolves(EntityPlayer player, EntityLiving living, boolean par2)
{
if (!(living instanceof EntityCreeper) && !(living instanceof EntityGhast))
{
if (living instanceof EntityWolf)
{
EntityWolf var3 = (EntityWolf)living;
if (var3.isTamed() && player.username.equals(var3.getOwnerName()))
{
return;
}
}
if (!(living instanceof EntityPlayer) || player.func_96122_a((EntityPlayer)living))
{
List var6 = player.worldObj.getEntitiesWithinAABB(EntityWolf.class, AxisAlignedBB.getAABBPool().getAABB(player.posX, player.posY, player.posZ, player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D));
Iterator var4 = var6.iterator();
while (var4.hasNext())
{
EntityWolf var5 = (EntityWolf)var4.next();
if (var5.isTamed() && var5.getEntityToAttack() == null && player.username.equals(var5.getOwnerName()) && (!par2 || !var5.isSitting()))
{
var5.setSitting(false);
var5.setTarget(living);
}
}
}
}
}
/* Tool specific */
public static void damageTool (ItemStack stack, int dam, EntityLiving entity, boolean ignoreCharge)
{
NBTTagCompound tags = stack.getTagCompound();
damageTool(stack, dam, tags, entity, ignoreCharge);
}
public static void damageTool (ItemStack stack, int dam, NBTTagCompound tags, EntityLiving entity, boolean ignoreCharge)
{
if (ignoreCharge || !damageElectricTool(stack, tags, entity))
{
int damage = tags.getCompoundTag("InfiTool").getInteger("Damage");
int damageTrue = damage + dam;
//System.out.println("Damaging tool, damageTrue "+damageTrue+", ignoring charge: "+ignoreCharge);
int maxDamage = tags.getCompoundTag("InfiTool").getInteger("TotalDurability");
if (damage + dam <= 0)
{
return;
}
else if ((damage + dam) > maxDamage)
{
breakTool(stack, tags, entity);
stack.setItemDamage(0);
}
else
{
tags.getCompoundTag("InfiTool").setInteger("Damage", damage + dam);
int toolDamage = damage * 100 / maxDamage;
int stackDamage = stack.getItemDamage();
stack.setItemDamage(damage * 100 / maxDamage);
}
//stack.setItemDamage(1 + (maxDamage - damage) * (stack.getMaxDamage() - 1) / maxDamage);
}
}
public static boolean damageElectricTool (ItemStack stack, NBTTagCompound tags, Entity entity)
{
if (!tags.hasKey("charge"))
return false;
int charge = tags.getInteger("charge");
int mineSpeed = tags.getCompoundTag("InfiTool").getInteger("MiningSpeed");
if (tags.getCompoundTag("InfiTool").hasKey("MiningSpeed2"))
mineSpeed = (mineSpeed + tags.getCompoundTag("InfiTool").getInteger("MiningSpeed2")) / 2;
mineSpeed /= 15;
if (charge < mineSpeed)
{
if (charge > 0)
tags.setInteger("charge", 0);
return false;
}
/*if (entity instanceof EntityPlayer && ElectricItem.use(stack, mineSpeed, (EntityPlayer) entity))
return true;*/
charge -= mineSpeed;
ToolCore tool = (ToolCore) stack.getItem();
stack.setItemDamage(1 + (tool.getMaxCharge() - charge) * (stack.getMaxDamage() - 1) / tool.getMaxCharge());
tags.setInteger("charge", charge);
if (entity instanceof EntityPlayer)
chargeFromArmor(stack, (EntityPlayer) entity);
return true;
}
static void chargeFromArmor (ItemStack stack, EntityPlayer player)
{
boolean inContainer = false;
for (int armorIter = 0; armorIter < 4; ++armorIter)
{
ItemStack armor = player.inventory.armorInventory[armorIter];
if (armor != null && armor.getItem() instanceof IElectricItem)
{
IElectricItem electricArmor = (IElectricItem) armor.getItem();
ToolCore tool = (ToolCore) stack.getItem();
if (electricArmor.canProvideEnergy() && electricArmor.getTier() >= ((IElectricItem) stack.getItem()).getTier())
{
int chargeAmount = tool.charge(stack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, true);
chargeAmount = discharge(armor, chargeAmount, Integer.MAX_VALUE, true, false);
if (chargeAmount > 0)
{
tool.charge(stack, chargeAmount, Integer.MAX_VALUE, true, false);
inContainer = true;
}
}
}
}
if (inContainer)
{
player.openContainer.detectAndSendChanges();
}
}
public static int discharge (ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
{
IElectricItem ielectricitem = (IElectricItem) itemStack.getItem();
if (ielectricitem instanceof ICustomElectricItem)
{
return ((ICustomElectricItem) ielectricitem).discharge(itemStack, amount, tier, ignoreTransferLimit, simulate);
}
else if (amount >= 0 && itemStack.stackSize <= 1 && ielectricitem.getTier() <= tier)
{
if (amount > ielectricitem.getTransferLimit() && !ignoreTransferLimit)
{
amount = ielectricitem.getTransferLimit();
}
NBTTagCompound tags = itemStack.getTagCompound();//StackUtil.getOrCreateNbtData(itemStack);
int charge = tags.getInteger("charge");
if (amount > charge)
{
amount = charge;
}
charge -= amount;
if (!simulate)
{
tags.setInteger("charge", charge);
itemStack.itemID = charge > 0 ? ielectricitem.getChargedItemId() : ielectricitem.getEmptyItemId();
if (itemStack.getItem() instanceof IElectricItem)
{
ielectricitem = (IElectricItem) itemStack.getItem();
if (itemStack.getMaxDamage() > 2)
{
itemStack.setItemDamage(1 + (ielectricitem.getMaxCharge() - charge) * (itemStack.getMaxDamage() - 2) / ielectricitem.getMaxCharge());
}
else
{
itemStack.setItemDamage(0);
}
}
else
{
itemStack.setItemDamage(0);
}
}
return amount;
}
else
{
return 0;
}
}
public static void breakTool (ItemStack stack, NBTTagCompound tags, Entity player)
{
tags.getCompoundTag("InfiTool").setBoolean("Broken", true);
player.worldObj.playSound(player.posX, player.posY, player.posZ, "random.break", 1f, 1f, true);
}
public static void repairTool (ItemStack stack, NBTTagCompound tags)
{
tags.getCompoundTag("InfiTool").setBoolean("Broken", false);
tags.getCompoundTag("InfiTool").setInteger("Damage", 0);
}
public static DamageSource causePiercingDamage (EntityLiving mob)
{
return new PiercingEntityDamage("mob", mob);
}
public static DamageSource causePlayerPiercingDamage (EntityPlayer player)
{
return new PiercingEntityDamage("player", player);
}
public static void thrust (ItemStack stack, World world, EntityPlayer player)
{
if (mc == null)
mc = FMLClientHandler.instance().getClient();
if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == EnumMovingObjectType.ENTITY)
{
mc.playerController.attackEntity(player, mc.objectMouseOver.entityHit);
mc.playerController.attackEntity(player, mc.objectMouseOver.entityHit);
mc.playerController.attackEntity(player, mc.objectMouseOver.entityHit);
}
}
public static void knockbackEntity (EntityLiving living, double boost)
{
living.motionX *= boost;
//living.motionY *= boost/2;
living.motionZ *= boost;
}
public static boolean hoeGround (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, Random random)
{
if (!player.canPlayerEdit(x, y, z, side, stack))
{
return false;
}
else
{
UseHoeEvent event = new UseHoeEvent(player, stack, world, x, y, z);
if (MinecraftForge.EVENT_BUS.post(event))
{
return false;
}
if (event.getResult() == Result.ALLOW)
{
onBlockChanged(stack, world, 0, x, y, z, player, random);
return true;
}
int bID = world.getBlockId(x, y, z);
int bIDabove = world.getBlockId(x, y + 1, z);
if ((side == 0 || bIDabove != 0 || bID != Block.grass.blockID) && bID != Block.dirt.blockID)
{
return false;
}
else
{
Block block = Block.tilledField;
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (world.isRemote)
{
return true;
}
else
{
world.func_94575_c(x, y, z, block.blockID);
onBlockChanged(stack, world, 0, x, y, z, player, random);
return true;
}
}
}
}
public static void spawnItemAtPlayer(EntityPlayer player, ItemStack stack)
{
if (!player.worldObj.isRemote)
{
EntityItem entityitem = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, stack);
entityitem.delayBeforeCanPickup = 10;
player.worldObj.spawnEntityInWorld(entityitem);
}
}
}

View File

@ -0,0 +1,225 @@
package mods.tinker.tconstruct;
import java.io.File;
import java.io.IOException;
import net.minecraftforge.common.Configuration;
public class PHConstruct {
public static void initProps()
{
/* Here we will set up the config file for the mod
* First: Create a folder inside the config folder
* 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");
/* Some basic debugging will go a long way */
try
{
newFile.createNewFile();
}
catch (IOException e)
{
System.out.println("Could not create configuration file for TConstruct. Reason:");
System.out.println(e);
}
/* [Forge] Configuration class, used as config method */
Configuration config = new Configuration(newFile);
/* Load the configuration file */
config.load();
/* Define the mod's IDs.
* Avoid values below 4096 for items and in the 250-450 range for blocks
*/
removeToolRecipes = config.get("Diffuclty Changes", "Remove vanilla tool recipes", false).getBoolean(false);
keepHunger = config.get("Diffuclty Changes", "Keep hunger on death", true).getBoolean(true);
keepLevels = config.get("Diffuclty Changes", "Keep levels on death", true).getBoolean(true);
woodCrafter = config.getBlock("Wood Tool Station", 1471).getInt(1471);
heldItemBlock = config.getBlock("Held Item Block", 1472).getInt(1472);
lavaTank = config.getBlock("Lava Tank", 1473).getInt(1473);
smeltery = config.getBlock("Smeltery", 1474).getInt(1474);
oreSlag = config.getBlock("Ores Slag", 1475).getInt(1475);
craftedSoil = config.getBlock("Special Soil", 1476).getInt(1476);
searedTable = config.getBlock("Seared Table", 1477).getInt(1477);
metalBlock = config.getBlock("Metal Storage", 1478).getInt(1478);
metalFlowing = config.getBlock("Liquid Metal Flowing", 1479).getInt(1479);
metalStill = config.getBlock("Liquid Metal Still", 1480).getInt(1480);
//landmine = config.getBlock("Landmine", 1481).getInt(1481);
manual = config.getItem("Patterns and Misc", "Tinker's Manual", 14018).getInt(14018);
blankPattern = config.getItem("Patterns and Misc", "Blank Patterns", 14019).getInt(14019);
materials = config.getItem("Patterns and Misc", "Materials", 14020).getInt(14020);
toolRod = config.getItem("Patterns and Misc", "Tool Rod", 14021).getInt(14021);
toolShard = config.getItem("Patterns and Misc", "Tool Shard", 14022).getInt(14022);
woodPattern = config.getItem("Patterns and Misc", "Wood Pattern", 14023).getInt(14023);
metalPattern = config.getItem("Patterns and Misc", "Metal Pattern", 14024).getInt(14024);
pickaxeHead = config.getItem("Tool Parts", "Pickaxe Head", 14026).getInt(14026);
shovelHead = config.getItem("Tool Parts", "Shovel Head", 14027).getInt(14027);
axeHead = config.getItem("Tool Parts", "Axe Head", 14028).getInt(14028);
hoeHead = config.getItem("Tool Parts", "Hoe Head", 14029).getInt(14029);
swordBlade = config.getItem("Tool Parts", "Sword Blade", 14030).getInt(14030);
largeGuard = config.getItem("Tool Parts", "Large Guard", 14031).getInt(14031);
medGuard = config.getItem("Tool Parts", "Medium Guard", 14032).getInt(14032);
crossbar = config.getItem("Tool Parts", "Crossbar", 14033).getInt(14033);
binding = config.getItem("Tool Parts", "Tool Binding", 14034).getInt(14034);
frypanHead = config.getItem("Tool Parts", "Frypan Head", 14035).getInt(14035);
signHead = config.getItem("Tool Parts", "Sign Head", 14036).getInt(14036);
lumberHead = config.getItem("Tool Parts", "Lumber Axe Head", 14037).getInt(14037);
pickaxe = config.getItem("Tools", "Pickaxe", 14051).getInt(14051);
shovel = config.getItem("Tools", "Shovel", 14052).getInt(14052);
axe = config.getItem("Tools", "Axe", 14053).getInt(14053);
hoe = config.getItem("Tools", "Hoe", 14054).getInt(14054);
broadsword = config.getItem("Tools", "Broadsword", 14055).getInt(14055);
longsword = config.getItem("Tools", "Longsword", 14056).getInt(14056);
rapier = config.getItem("Tools", "Rapier", 14057).getInt(14057);
frypan = config.getItem("Tools", "Frying Pan", 14058).getInt(14058);
battlesign = config.getItem("Tools", "Battlesign", 14059).getInt(14059);
mattock = config.getItem("Tools", "Mattock", 14060).getInt(14060);
lumberaxe = config.getItem("Tools", "Lumber Axe", 14061).getInt(14061);
longbow = config.getItem("Tools", "Longbow", 14062).getInt(14062);
buckets = config.getItem("Patterns and Misc", "Buckets", 14101).getInt(14101);
uselessItem = config.getItem("Patterns and Misc", "Title Icon", 14102).getInt(14102);
boolean ic2 = true;
boolean xycraft = true;
try
{
Class c = Class.forName("ic2.core.IC2");
ic2 = false;
}
catch (Exception e) {}
try
{
Class c = Class.forName("soaryn.xycraft.core.XyCraft");
xycraft = false;
}
catch (Exception e) {}
generateCopper = config.get("Worldgen", "Generate Copper", ic2).getBoolean(ic2);
generateTin = config.get("Worldgen", "Generate Tin", ic2).getBoolean(ic2);
generateAluminum = config.get("Worldgen", "Generate Aluminum", xycraft).getBoolean(xycraft);
generateCobalt = config.get("Worldgen", "Generate Cobalt", true).getBoolean(true);
generateArdite = config.get("Worldgen", "Generate Ardite", true).getBoolean(true);
copperDensity = config.get("Worldgen", "Copper Density", 8).getInt(8);
copperHeight = config.get("Worldgen", "Copper Height", 20).getInt(20);
copperRange = config.get("Worldgen", "Copper Range", 40).getInt(40);
tinDensity = config.get("Worldgen", "Tin Density", 8).getInt(8);
tinHeight = config.get("Worldgen", "Tin Height", 0).getInt(0);
tinRange = config.get("Worldgen", "Tin Range", 40).getInt(40);
aluminumDensity = config.get("Worldgen", "Aluminum Density", 9).getInt(9);
aluminumHeight = config.get("Worldgen", "Aluminum Height", 0).getInt(0);
aluminumRange = config.get("Worldgen", "Aluminum Range", 64).getInt(64);
netherDensity = config.get("Worldgen", "Nether Ores Density", 8).getInt(8);
/* Save the configuration file */
config.save();
}
//Blocks
public static int woodCrafter;
public static int heldItemBlock;
public static int ores;
public static int lavaTank;
public static int smeltery;
public static int searedTable;
public static int craftedSoil;
public static int oreSlag;
public static int metalBlock;
//public static int axle;
//Traps
//public static int landmine;
//Liquids
public static int metalFlowing;
public static int metalStill;
//Patterns and misc
public static int blankPattern;
public static int materials;
public static int toolRod;
public static int toolShard;
public static int woodPattern;
public static int metalPattern;
public static int manual;
public static int buckets;
public static int uselessItem;
//Tools
public static int pickaxe;
public static int shovel;
public static int axe;
public static int hoe;
public static int broadsword;
public static int longsword;
public static int rapier;
public static int frypan;
public static int battlesign;
public static int longbow;
public static int mattock;
public static int lumberaxe;
//Tool parts
public static int swordBlade;
public static int largeGuard;
public static int medGuard;
public static int crossbar;
public static int pickaxeHead;
public static int axeHead;
public static int shovelHead;
public static int hoeHead;
public static int frypanHead;
public static int signHead;
public static int lumberHead;
public static int binding;
//Ore values
public static boolean generateCopper;
public static boolean generateTin;
public static boolean generateAluminum;
public static boolean generateCobalt;
public static boolean generateArdite;
public static int copperDensity;
public static int copperHeight;
public static int copperRange;
public static int tinDensity;
public static int tinHeight;
public static int tinRange;
public static int aluminumDensity;
public static int aluminumHeight;
public static int aluminumRange;
public static int netherDensity;
//Difficulty modifiers
public static boolean removeToolRecipes;
public static boolean keepHunger;
public static boolean keepLevels;
}

View File

@ -0,0 +1,13 @@
package mods.tinker.tconstruct;
import net.minecraft.entity.Entity;
import net.minecraft.util.EntityDamageSource;
public class PiercingEntityDamage extends EntityDamageSource
{
public PiercingEntityDamage(String str, Entity entity)
{
super(str, entity);
this.setDamageBypassesArmor();
}
}

View File

@ -0,0 +1,86 @@
package mods.tinker.tconstruct;
import java.util.Random;
import mods.tinker.tconstruct.player.TPlayerHandler;
import mods.tinker.tconstruct.worldgen.TBaseWorldGenerator;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
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.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
/** TConstruct, the tool mod.
* Craft your tools with style, then modify until the original is gone!
* @author: mDiyo
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.4.7_1.1.14", dependencies = "before:*")
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.TPacketHandler.class)
public class TConstruct
{
public static int ingotLiquidValue = 144;
/* Instance of this mod, used for grabbing prototype fields */
@Instance("TConstruct")
public static TConstruct instance;
/* Proxies for sides, used for graphics processing */
@SidedProxy(clientSide = "mods.tinker.tconstruct.client.TProxyClient", serverSide = "mods.tinker.tconstruct.TProxyCommon")
public static TProxyCommon proxy;
public TConstruct()
{
//Take that, any mod that does ore dictionary registration in preinit!
events = new TEventHandler();
MinecraftForge.EVENT_BUS.register(events);
}
@PreInit
public void preInit (FMLPreInitializationEvent evt)
{
PHConstruct.initProps();
materialTab = new TabTools("TConstructMaterials");
toolTab = new TabTools("TConstructTools");
blockTab = new TabTools("TConstructBlocks");
content = new TContent();
proxy.registerRenderer();
proxy.addNames();
proxy.readManuals();
proxy.registerKeys();
}
@Init
public void init (FMLInitializationEvent evt)
{
GameRegistry.registerWorldGenerator(new TBaseWorldGenerator());
playerTracker = new TPlayerHandler();
MinecraftForge.EVENT_BUS.register(playerTracker);
GameRegistry.registerPlayerTracker(playerTracker);
NetworkRegistry.instance().registerGuiHandler(instance, new TGuiHandler());
}
@PostInit
public void postInit (FMLPostInitializationEvent evt)
{
content.modIntegration();
content.oreRegistry();
}
public static TEventHandler events;
public static TPlayerHandler playerTracker;
public static TContent content;
public static Random tRand = new Random();
public static TabTools toolTab;
public static TabTools materialTab;
public static TabTools blockTab;
}

View File

@ -0,0 +1,91 @@
package mods.tinker.tconstruct;
import java.util.ArrayList;
import java.util.HashMap;
import mods.tinker.tconstruct.client.gui.ToolGuiElement;
import mods.tinker.tconstruct.tools.ToolCore;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/** A registry to store any relevant API work
*
* @author mDiyo
*/
public class TConstructRegistry
{
public static TConstructRegistry instance = new TConstructRegistry();
public static ArrayList<ToolCore> tools = new ArrayList<ToolCore>(20);
public static ArrayList<ToolGuiElement> toolButtons = new ArrayList<ToolGuiElement>(20);
public static HashMap<Integer, ToolMaterial> toolMaterials = new HashMap<Integer, ToolMaterial>(60);
@SideOnly(Side.CLIENT)
//Tools
public static void addToolMapping (ToolCore tool)
{
tools.add(tool);
}
public static ArrayList<ToolCore> getToolMapping ()
{
return tools;
}
//Rendering
//itemMap.func_94245_a
/*public static void addMaterialRenderMapping(int materialID, String textureLocation)
{
for (ToolCore tool : TConstructRegistry.getToolMapping())
{
tool.partTextures.put(materialID, textureLocation);
}
}
public static void addEffectRenderMapping(int materialID, String textureLocation)
{
for (ToolCore tool : TConstructRegistry.getToolMapping())
{
tool.effectTextures.put(materialID, textureLocation);
}
}*/
//Materials
public static void addToolMaterial (int materialID, String materialName, int craftingTier, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float shoddy)
{
ToolMaterial mat = toolMaterials.get(materialID);
if (mat == null)
{
toolMaterials.put(materialID, new ToolMaterial(materialName, craftingTier, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, shoddy));
}
else
throw new RuntimeException("TConstruct material ID " + materialID + " is already occupied by " + mat.materialName);
}
public static ToolMaterial getMaterial (int key)
{
return (toolMaterials.get(key));
}
//Gui
public static void addToolButton (ToolGuiElement element)
{
toolButtons.add(element);
}
public static void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body, String texture)
{
toolButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, texture));
}
public static ArrayList<ToolGuiElement> getToolButtons ()
{
return toolButtons;
}
}

View File

@ -0,0 +1,651 @@
package mods.tinker.tconstruct;
import mods.tinker.common.IPattern;
import mods.tinker.common.fancyitem.FancyEntityItem;
import mods.tinker.tconstruct.blocks.EquipBlock;
import mods.tinker.tconstruct.blocks.LavaTankBlock;
import mods.tinker.tconstruct.blocks.MetalOre;
import mods.tinker.tconstruct.blocks.SearedBlock;
import mods.tinker.tconstruct.blocks.SmelteryBlock;
import mods.tinker.tconstruct.blocks.TConstructBlock;
import mods.tinker.tconstruct.blocks.ToolStationBlock;
import mods.tinker.tconstruct.blocks.liquids.LiquidMetalFlowing;
import mods.tinker.tconstruct.blocks.liquids.LiquidMetalStill;
import mods.tinker.tconstruct.crafting.LiquidCasting;
import mods.tinker.tconstruct.crafting.PatternBuilder;
import mods.tinker.tconstruct.crafting.Smeltery;
import mods.tinker.tconstruct.crafting.ToolBuilder;
import mods.tinker.tconstruct.entity.CartEntity;
import mods.tinker.tconstruct.entity.Crystal;
import mods.tinker.tconstruct.entity.Skyla;
import mods.tinker.tconstruct.items.CraftedSoilItemBlock;
import mods.tinker.tconstruct.items.CraftingItem;
import mods.tinker.tconstruct.items.FilledBucket;
import mods.tinker.tconstruct.items.LavaTankItemBlock;
import mods.tinker.tconstruct.items.LiquidItemBlock;
import mods.tinker.tconstruct.items.MetalItemBlock;
import mods.tinker.tconstruct.items.MetalOreItemBlock;
import mods.tinker.tconstruct.items.MetalPattern;
import mods.tinker.tconstruct.items.Pattern;
import mods.tinker.tconstruct.items.PatternManual;
import mods.tinker.tconstruct.items.SearedTableItemBlock;
import mods.tinker.tconstruct.items.SmelteryItemBlock;
import mods.tinker.tconstruct.items.TitleIcon;
import mods.tinker.tconstruct.items.ToolPart;
import mods.tinker.tconstruct.items.ToolShard;
import mods.tinker.tconstruct.items.ToolStationItemBlock;
import mods.tinker.tconstruct.logic.CastingTableLogic;
import mods.tinker.tconstruct.logic.FaucetLogic;
import mods.tinker.tconstruct.logic.FrypanLogic;
import mods.tinker.tconstruct.logic.LavaTankLogic;
import mods.tinker.tconstruct.logic.LiquidTextureLogic;
import mods.tinker.tconstruct.logic.MultiServantLogic;
import mods.tinker.tconstruct.logic.PartCrafterLogic;
import mods.tinker.tconstruct.logic.PatternChestLogic;
import mods.tinker.tconstruct.logic.PatternShaperLogic;
import mods.tinker.tconstruct.logic.SmelteryDrainLogic;
import mods.tinker.tconstruct.logic.SmelteryLogic;
import mods.tinker.tconstruct.logic.ToolStationLogic;
import mods.tinker.tconstruct.modifiers.ModBlaze;
import mods.tinker.tconstruct.modifiers.ModBoolean;
import mods.tinker.tconstruct.modifiers.ModDurability;
import mods.tinker.tconstruct.modifiers.ModElectric;
import mods.tinker.tconstruct.modifiers.ModInteger;
import mods.tinker.tconstruct.modifiers.ModLapisBase;
import mods.tinker.tconstruct.modifiers.ModLapisIncrease;
import mods.tinker.tconstruct.modifiers.ModRedstone;
import mods.tinker.tconstruct.modifiers.ModRepair;
import mods.tinker.tconstruct.tools.Axe;
import mods.tinker.tconstruct.tools.BattleSign;
import mods.tinker.tconstruct.tools.Broadsword;
import mods.tinker.tconstruct.tools.FryingPan;
import mods.tinker.tconstruct.tools.Longsword;
import mods.tinker.tconstruct.tools.Mattock;
import mods.tinker.tconstruct.tools.Pickaxe;
import mods.tinker.tconstruct.tools.Rapier;
import mods.tinker.tconstruct.tools.Shovel;
import mods.tinker.tconstruct.tools.ToolCore;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialLiquid;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.liquids.LiquidContainerData;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
public class TContent implements IFuelHandler
{
//Patterns and other materials
public static Item blankPattern;
public static Item materials;
public static Item toolRod;
public static Item toolShard;
public static Item woodPattern;
public static Item metalPattern;
public static Item manualBook;
public static Item buckets;
public static Item titleIcon;
//public static Item stonePattern;
//public static Item netherPattern;
//Tools
public static ToolCore pickaxe;
public static ToolCore shovel;
public static ToolCore axe;
public static ToolCore broadsword;
public static ToolCore longsword;
public static ToolCore rapier;
public static ToolCore frypan;
public static ToolCore battlesign;
//public static ToolCore longbow;
public static ToolCore mattock;
public static ToolCore lumberaxe;
//Tool parts
public static Item pickaxeHead;
public static Item shovelHead;
public static Item axeHead;
public static Item swordBlade;
public static Item largeGuard;
public static Item medGuard;
public static Item crossbar;
public static Item binding;
public static Item frypanHead;
public static Item signHead;
public static Item lumberHead;
//Crafting blocks
public static Block woodCrafter;
public static Block heldItemBlock;
public static Block craftedSoil;
public static Block smeltery;
public static Block lavaTank;
public static Block searedBlock;
public static Block oreSlag;
public static Block metalBlock;
//Traps
public static Block landmine;
//Liquids
public static Block liquidMetalFlowing;
public static Block liquidMetalStill;
public static Material liquidMetal;
//public static Block axle;
//Tool modifiers
public static ModElectric modE;
public TContent()
{
createEntities();
registerBlocks();
registerItems();
registerMaterials();
addToolRecipes();
addSmelteryRecipes();
addCraftingRecipes();
setupToolTabs();
GameRegistry.registerFuelHandler(this);
}
void createEntities ()
{
EntityRegistry.registerModEntity(FancyEntityItem.class, "Fancy Item", 0, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 1, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true);
}
void registerBlocks ()
{
//Tool Station
woodCrafter = new ToolStationBlock(PHConstruct.woodCrafter, Material.wood);
GameRegistry.registerBlock(woodCrafter, ToolStationItemBlock.class, "ToolStationBlock");
GameRegistry.registerTileEntity(ToolStationLogic.class, "ToolStation");
GameRegistry.registerTileEntity(PartCrafterLogic.class, "PartCrafter");
GameRegistry.registerTileEntity(PatternChestLogic.class, "PatternHolder");
GameRegistry.registerTileEntity(PatternShaperLogic.class, "PatternShaper");
heldItemBlock = new EquipBlock(PHConstruct.heldItemBlock, Material.wood);
GameRegistry.registerBlock(heldItemBlock, "HeldItemBlock");
GameRegistry.registerTileEntity(FrypanLogic.class, "FrypanLogic");
String[] soilTypes = new String[] {
"slimesand",
"grout"
};
craftedSoil = new TConstructBlock(PHConstruct.craftedSoil, Material.sand, 3.0F, soilTypes);
craftedSoil.stepSound = Block.soundGravelFootstep;
GameRegistry.registerBlock(craftedSoil, CraftedSoilItemBlock.class, "CraftedSoil");
String[] metalTypes = new String[] {
"compressed_cobalt",
"compressed_ardite",
"compressed_manyullyn",
"compressed_copper",
"compressed_bronze",
"compressed_tin",
"compressed_aluminum",
"compressed_alubrass",
"compressed_alumite",
"compressed_steel"
};
metalBlock = new TConstructBlock(PHConstruct.metalBlock, Material.iron, 10.0F, metalTypes);
metalBlock.stepSound = Block.soundMetalFootstep;
GameRegistry.registerBlock(metalBlock, MetalItemBlock.class, "MetalBlock");
//Smeltery
smeltery = new SmelteryBlock(PHConstruct.smeltery).setUnlocalizedName("Smeltery");
GameRegistry.registerBlock(smeltery, SmelteryItemBlock.class, "Smeltery");
GameRegistry.registerTileEntity(SmelteryLogic.class, "TConstruct.Smeltery");
GameRegistry.registerTileEntity(SmelteryDrainLogic.class, "TConstruct.SmelteryDrain");
GameRegistry.registerTileEntity(MultiServantLogic.class, "TConstruct.Servants");
lavaTank = new LavaTankBlock(PHConstruct.lavaTank).setUnlocalizedName("LavaTank");
lavaTank.setStepSound(Block.soundGlassFootstep);
GameRegistry.registerBlock(lavaTank, LavaTankItemBlock.class, "LavaTank");
GameRegistry.registerTileEntity(LavaTankLogic.class, "TConstruct.LavaTank");
searedBlock = new SearedBlock(PHConstruct.searedTable).setUnlocalizedName("SearedBlock");
GameRegistry.registerBlock(searedBlock, SearedTableItemBlock.class, "SearedBlock");
GameRegistry.registerTileEntity(CastingTableLogic.class, "CastingTable");
GameRegistry.registerTileEntity(FaucetLogic.class, "Faucet");
String[] oreTypes = new String[] {
"nether_slag",
"nether_cobalt",
"nether_ardite",
"ore_copper",
"ore_tin",
"ore_aluminum",
"ore_slag"
};
oreSlag = new MetalOre(PHConstruct.oreSlag, Material.iron, 10.0F, oreTypes);
GameRegistry.registerBlock(oreSlag, MetalOreItemBlock.class, "SearedBrick");
MinecraftForge.setBlockHarvestLevel(oreSlag, 0, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(oreSlag, 1, "pickaxe", 4);
MinecraftForge.setBlockHarvestLevel(oreSlag, 2, "pickaxe", 4);
MinecraftForge.setBlockHarvestLevel(oreSlag, 3, "pickaxe", 1);
MinecraftForge.setBlockHarvestLevel(oreSlag, 4, "pickaxe", 1);
MinecraftForge.setBlockHarvestLevel(oreSlag, 5, "pickaxe", 1);
//Traps
/*landmine = new Landmine(PHConstruct.landmine, 0, EnumMobType.mobs, Material.cactus).setUnlocalizedName("landmine");
GameRegistry.registerBlock(landmine, "landmine");*/
//Liquids
liquidMetal = new MaterialLiquid(MapColor.tntColor);
liquidMetalFlowing = new LiquidMetalFlowing(PHConstruct.metalFlowing).setUnlocalizedName("liquid.metalFlow");
liquidMetalStill = new LiquidMetalStill(PHConstruct.metalStill).setUnlocalizedName("liquid.metalStill");
GameRegistry.registerBlock(liquidMetalFlowing, LiquidItemBlock.class, "metalFlow");
GameRegistry.registerBlock(liquidMetalStill, LiquidItemBlock.class, "metalStill");
GameRegistry.registerTileEntity(LiquidTextureLogic.class, "LiquidTexture");
}
void registerItems ()
{
titleIcon = new TitleIcon(PHConstruct.uselessItem).setUnlocalizedName("tconstruct.titleicon");
String[] blanks = new String[] {"blankpattern", "blankcast"};
blankPattern = new CraftingItem(PHConstruct.blankPattern, blanks, blanks).setUnlocalizedName("tconstruct.blankpattern");
String[] craftingMaterials = new String[] {
"PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot", "ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone",
"CopperIngot", "TinIngot", "AluminumIngot", "RawAluminum", "BronzeIngot", "AlBrassIngot", "AlumiteIngot", "SteelIngot" };
String[] craftingTextures = new String[] {
"material_paper_stack", "material_slime_crystal", "material_seared_brick", "material_cobalt_ingot", "material_ardite_ingot", "material_manyullyn_ingot",
"material_mossball", "material_lava_crystal", "material_necrotic_bone", "material_copper_ingot", "material_tin_ingot", "material_aluminum_ingot",
"material_raw_aluminum", "material_bronze_ingot", "material_alubrass_ingot", "material_alumite_ingot", "material_steel_ingot" };
materials = new CraftingItem(PHConstruct.materials, craftingMaterials, craftingTextures).setUnlocalizedName("tconstruct.Materials");
toolRod = new ToolPart(PHConstruct.toolRod, "ToolRod", "_rod").setUnlocalizedName("tconstruct.ToolRod");
toolShard = new ToolShard(PHConstruct.toolShard, "ToolShard", "_shard").setUnlocalizedName("tconstruct.ToolShard");
woodPattern = new Pattern(PHConstruct.woodPattern, "WoodPattern").setUnlocalizedName("tconstruct.Pattern");
metalPattern = new MetalPattern(PHConstruct.metalPattern, "MetalPattern").setUnlocalizedName("tconstruct.MetalPattern");
//stonePattern = new Pattern(PHTools.stonePattern, 64, patternTexture).setUnlocalizedName("tconstruct.Pattern");
//netherPattern = new Pattern(PHTools.netherPattern, 128, patternTexture).setUnlocalizedName("tconstruct.Pattern");
manualBook = new PatternManual(PHConstruct.manual);
buckets = new FilledBucket(PHConstruct.buckets);
pickaxe = new Pickaxe(PHConstruct.pickaxe, pickaxeTexture);
shovel = new Shovel(PHConstruct.shovel, shovelTexture);
axe = new Axe(PHConstruct.axe, axeTexture);
broadsword = new Broadsword(PHConstruct.broadsword, broadswordTexture);
longsword = new Longsword(PHConstruct.longsword, longswordTexture);
rapier = new Rapier(PHConstruct.rapier, rapierTexture);
frypan = new FryingPan(PHConstruct.frypan, frypanTexture);
battlesign = new BattleSign(PHConstruct.battlesign, signTexture);
//longbow = new RangedWeapon(PHConstruct.longbow, bowTexture);
mattock = new Mattock(PHConstruct.mattock, mattockTexture);
//lumberaxe = new LumberAxe(PHConstruct.lumberaxe, lumberaxeTexture);
pickaxeHead = new ToolPart(PHConstruct.pickaxeHead, "PickaxeHead", "_pickaxe_head").setUnlocalizedName("tconstruct.PickaxeHead");
shovelHead = new ToolPart(PHConstruct.shovelHead, "ShovelHead", "_shovel_head").setUnlocalizedName("tconstruct.ShovelHead");
axeHead = new ToolPart(PHConstruct.axeHead, "AxeHead", "_axe_head").setUnlocalizedName("tconstruct.AxeHead");
swordBlade = new ToolPart(PHConstruct.swordBlade, "SwordBlade", "_sword_blade").setUnlocalizedName("tconstruct.SwordBlade");
largeGuard = new ToolPart(PHConstruct.largeGuard, "LargeGuard", "_large_guard").setUnlocalizedName("tconstruct.LargeGuard");
medGuard = new ToolPart(PHConstruct.medGuard, "MediumGuard", "_medium_guard").setUnlocalizedName("tconstruct.MediumGuard");
crossbar = new ToolPart(PHConstruct.crossbar, "Crossbar", "_crossbar").setUnlocalizedName("tconstruct.Crossbar");
binding = new ToolPart(PHConstruct.binding, "Binding", "_binding").setUnlocalizedName("tconstruct.Binding");
frypanHead = new ToolPart(PHConstruct.frypanHead, "FrypanHead", "_frypan_head").setUnlocalizedName("tconstruct.FrypanHead");
signHead = new ToolPart(PHConstruct.signHead, "SignHead", "_battlesign_head").setUnlocalizedName("tconstruct.SignHead");
//lumberHead = new ToolPart(PHConstruct.lumberHead, 0, broadheads).setUnlocalizedName("tconstruct.LumberHead");
}
void registerMaterials ()
{
TConstructRegistry.addToolMaterial(0, "Wood", 1, 0, 59, 200, 0, 1.0F, 0, 0f);
TConstructRegistry.addToolMaterial(1, "Stone", 1, 1, 131, 400, 1, 0.5F, 0, 1f);
TConstructRegistry.addToolMaterial(2, "Iron", 1, 2, 250, 600, 2, 1.3F, 1, 0f);
TConstructRegistry.addToolMaterial(3, "Flint", 1, 1, 171, 525, 2, 0.7F, 0, 1f);
TConstructRegistry.addToolMaterial(4, "Cactus", 1, 1, 150, 500, 2, 1.0F, 0, -1f);
TConstructRegistry.addToolMaterial(5, "Bone", 1, 1, 200, 500, 2, 1.0F, 0, 0f);
TConstructRegistry.addToolMaterial(6, "Obsidian", 1, 3, 89, 700, 2, 0.8F, 3, 0f);
TConstructRegistry.addToolMaterial(7, "Netherrack", 1, 2, 131, 400, 1, 1.2F, 0, 1f);
TConstructRegistry.addToolMaterial(8, "Slime", 1, 3, 1500, 150, 0, 5.0F, 0, 0f);
TConstructRegistry.addToolMaterial(9, "Paper", 1, 0, 131, 200, 0, 0.1F, 0, 0f);
TConstructRegistry.addToolMaterial(10, "Cobalt", 2, 4, 800, 800, 3, 1.75F, 2, 0f);
TConstructRegistry.addToolMaterial(11, "Ardite", 2, 4, 600, 800, 3, 2.0F, 0, 0f);
TConstructRegistry.addToolMaterial(12, "Manyullyn", 2, 5, 1200, 1000, 4, 2.5F, 0, 0f);
TConstructRegistry.addToolMaterial(13, "Copper", 1, 1, 180, 500, 2, 1.15F, 0, 0f);
TConstructRegistry.addToolMaterial(14, "Bronze", 1, 2, 250, 600, 2, 1.3F, 1, 0f);
TConstructRegistry.addToolMaterial(15, "Alumite", 2, 4, 550, 800, 3, 1.3F, 2, 0f);
TConstructRegistry.addToolMaterial(16, "Steel", 2, 3, 750, 800, 3, 1.3F, 2, 0f);
//Thaumcraft
TConstructRegistry.addToolMaterial(21, "Thaumium", 2, 2, 250, 600, 2, 1.3F, 1, 0f);
//Metallurgy
TConstructRegistry.addToolMaterial(22, "Heptazion", 2, 2, 300, 800, 1, 1.0F, 0, 0f);
TConstructRegistry.addToolMaterial(23, "Damascus Steel", 2, 3, 500, 600, 2, 1.35F, 1, 0f);
TConstructRegistry.addToolMaterial(24, "Angmallen", 2, 2, 300, 800, 2, 0.8F, 0, 0f);
TConstructRegistry.addToolMaterial(25, "Promethium", 1, 1, 200, 400, 1, 1.0F, 0, 0.5f);
TConstructRegistry.addToolMaterial(26, "Deep Iron", 1, 2, 250, 600, 2, 1.3F, 1, 0f);
TConstructRegistry.addToolMaterial(27, "Oureclase", 2, 3, 750, 800, 2, 1.2F, 0, 0f);
TConstructRegistry.addToolMaterial(28, "Aredrite", 2, 3, 1000, 400, 2, 1.5F, 0, 1.0f);
TConstructRegistry.addToolMaterial(29, "Astral Silver", 1, 4, 35, 1200, 1, 0.5F, 0, 0f);
TConstructRegistry.addToolMaterial(30, "Carmot", 1, 4, 50, 1200, 1, 0.5F, 0, 0f);
TConstructRegistry.addToolMaterial(31, "Mithril", 2, 4, 1000, 900, 3, 1.25F, 3, 0f);
TConstructRegistry.addToolMaterial(32, "Orichalcum", 2, 5, 1350, 900, 3, 1.25F, 0, 0f);
TConstructRegistry.addToolMaterial(33, "Adamantine", 3, 6, 1550, 1000, 4, 1.5F, 1, 0f);
TConstructRegistry.addToolMaterial(34, "Atlarus", 3, 6, 1750, 1000, 4, 1.6F, 2, 0f);
TConstructRegistry.addToolMaterial(35, "Black Steel", 2, 2, 500, 800, 2, 1.3F, 2, 0f);
TConstructRegistry.addToolMaterial(36, "Quicksilver", 2, 4, 1100, 1400, 3, 1.0F, 1, 0f);
TConstructRegistry.addToolMaterial(37, "Haderoth", 2, 4, 1250, 1200, 3, 1.0F, 2, 0f);
TConstructRegistry.addToolMaterial(38, "Celenegil", 3, 5, 1600, 1400, 3, 1.0F, 2, 0f);
TConstructRegistry.addToolMaterial(39, "Tartarite", 3, 7, 3000, 1400, 5, 1.6667F, 4, 0f);
PatternBuilder pb = PatternBuilder.instance;
pb.registerFullMaterial(Block.planks, 2, "Wood", new ItemStack(Item.stick, 2), new ItemStack(Item.stick), 0);
pb.registerFullMaterial(Block.stone, 2, "Stone", 1);
pb.registerMaterial(Block.cobblestone, 2, "Stone");
pb.registerFullMaterial(Item.ingotIron, 2, "Iron", 2);
pb.registerFullMaterial(Item.flint, 2, "Flint", 3);
pb.registerFullMaterial(Block.cactus, 2, "Cactus", 4);
pb.registerFullMaterial(Item.bone, 2, "Bone", new ItemStack(Item.dyePowder, 1, 15), new ItemStack(Item.bone), 5);
pb.registerFullMaterial(Block.obsidian, 2, "Obsidian", 6);
pb.registerFullMaterial(Block.netherrack, 2, "Netherrack", 7);
pb.registerFullMaterial(new ItemStack(materials, 1, 1), 2, "Slime", new ItemStack(toolShard, 1, 8), new ItemStack(toolRod, 1, 8), 8);
pb.registerFullMaterial(new ItemStack(materials, 1, 0), 2, "Paper", new ItemStack(Item.paper, 2), new ItemStack(toolRod, 1, 9), 9);
pb.registerMaterialSet("Cobalt", new ItemStack(toolShard, 1, 10), new ItemStack(toolRod, 1, 10), 10);
pb.registerMaterialSet("Ardite", new ItemStack(toolShard, 1, 11), new ItemStack(toolRod, 1, 11), 11);
pb.registerMaterialSet("Manyullyn", new ItemStack(toolShard, 1, 12), new ItemStack(toolRod, 1, 12), 12);
pb.registerMaterialSet("Copper", new ItemStack(toolShard, 1, 13), new ItemStack(toolRod, 1, 13), 13);
pb.registerMaterialSet("Bronze", new ItemStack(toolShard, 1, 14), new ItemStack(toolRod, 1, 14), 14);
pb.registerMaterialSet("Alumite", new ItemStack(toolShard, 1, 15), new ItemStack(toolRod, 1, 15), 15);
pb.registerMaterialSet("Steel", new ItemStack(toolShard, 1, 16), new ItemStack(toolRod, 1, 16), 16);
pb.addToolPattern((IPattern) woodPattern);
}
public static Item[] patternOutputs;
public static LiquidStack[] liquids;
void addToolRecipes ()
{
patternOutputs = new Item[] { toolRod, pickaxeHead, shovelHead, axeHead, swordBlade, largeGuard, medGuard, crossbar, binding, frypanHead, signHead };
ToolBuilder tb = ToolBuilder.instance;
tb.addToolRecipe(pickaxe, pickaxeHead, binding);
tb.addToolRecipe(broadsword, swordBlade, largeGuard);
tb.addToolRecipe(axe, axeHead);
tb.addToolRecipe(shovel, shovelHead);
tb.addToolRecipe(longsword, swordBlade, medGuard);
tb.addToolRecipe(rapier, swordBlade, crossbar);
tb.addToolRecipe(frypan, frypanHead);
tb.addToolRecipe(battlesign, signHead);
tb.addToolRecipe(mattock, axeHead, shovelHead);
//tb.addToolRecipe(longbow, toolRod, toolRod);
//tb.addToolRecipe(lumberaxe, lumberHead);
tb.registerToolMod(new ModRepair());
tb.registerToolMod(new ModDurability(new ItemStack[] { new ItemStack(Item.diamond) }, 0, 500, 0f, 3, "Diamond", "\u00a7bDurability +500", "\u00a7b"));
tb.registerToolMod(new ModDurability(new ItemStack[] { new ItemStack(Item.emerald) }, 1, 0, 0.5f, 2, "Emerald", "\u00a72Durability +50%", "\u00a72"));
modE = new ModElectric();
tb.registerToolMod(modE);
tb.registerToolMod(new ModRedstone(new ItemStack[] { new ItemStack(Item.redstone) }, 2, 1));
tb.registerToolMod(new ModRedstone(new ItemStack[] { new ItemStack(Item.redstone), new ItemStack(Item.redstone) }, 2, 2));
tb.registerToolMod(new ModLapisIncrease(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 4) }, 10, 1));
tb.registerToolMod(new ModLapisIncrease(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 4) }, 10, 2));
tb.registerToolMod(new ModLapisIncrease(new ItemStack[] { new ItemStack(Block.blockLapis) }, 10, 9));
tb.registerToolMod(new ModLapisIncrease(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Block.blockLapis) }, 10, 10));
tb.registerToolMod(new ModLapisIncrease(new ItemStack[] { new ItemStack(Block.blockLapis), new ItemStack(Block.blockLapis) }, 10, 18));
tb.registerToolMod(new ModLapisBase(new ItemStack[] { new ItemStack(Block.blockLapis), new ItemStack(Block.blockLapis) }, 10));
tb.registerToolMod(new ModInteger(new ItemStack[] { new ItemStack(materials, 1, 6) }, 4, "Moss", 3, "\u00a72", "Auto-Repair"));
tb.registerToolMod(new ModBlaze(new ItemStack[] { new ItemStack(Item.blazePowder) }, 7, 1));
tb.registerToolMod(new ModBlaze(new ItemStack[] { new ItemStack(Item.blazePowder), new ItemStack(Item.blazePowder) }, 7, 2));
tb.registerToolMod(new ModBoolean(new ItemStack[] { new ItemStack(materials, 1, 7) }, 6, "Lava", "\u00a74", "Auto-Smelt"));
tb.registerToolMod(new ModInteger(new ItemStack[] { new ItemStack(materials, 1, 8) }, 8, "Necrotic", 1, "\u00a78", "Life Steal"));
ItemStack ingotcast = new ItemStack(metalPattern, 1, 0);
LiquidCasting lc = LiquidCasting.instance;
//Blank
lc.addCastingRecipe(new ItemStack(blankPattern, 1, 1), new LiquidStack(liquidMetalStill.blockID, 1, 8), 50);
//Ingots
lc.addCastingRecipe(new ItemStack(Item.ingotIron), new LiquidStack(liquidMetalStill.blockID, 1, 0), ingotcast, 50); //Iron
lc.addCastingRecipe(new ItemStack(Item.ingotGold), new LiquidStack(liquidMetalStill.blockID, 1, 1), ingotcast, 50); //gold
lc.addCastingRecipe(new ItemStack(materials, 1, 9), new LiquidStack(liquidMetalStill.blockID, 1, 2), ingotcast, 50); //copper
lc.addCastingRecipe(new ItemStack(materials, 1, 10), new LiquidStack(liquidMetalStill.blockID, 1, 3), ingotcast, 50); //tin
lc.addCastingRecipe(new ItemStack(materials, 1, 11), new LiquidStack(liquidMetalStill.blockID, 1, 4), ingotcast, 50); //aluminum
lc.addCastingRecipe(new ItemStack(materials, 1, 3), new LiquidStack(liquidMetalStill.blockID, 1, 5), ingotcast, 50); //cobalt
lc.addCastingRecipe(new ItemStack(materials, 1, 4), new LiquidStack(liquidMetalStill.blockID, 1, 6), ingotcast, 50); //ardite
lc.addCastingRecipe(new ItemStack(materials, 1, 13), new LiquidStack(liquidMetalStill.blockID, 1, 7), ingotcast, 50); //bronze
lc.addCastingRecipe(new ItemStack(materials, 1, 14), new LiquidStack(liquidMetalStill.blockID, 1, 8), ingotcast, 50); //albrass
lc.addCastingRecipe(new ItemStack(materials, 1, 5), new LiquidStack(liquidMetalStill.blockID, 1, 9), ingotcast, 50); //manyullyn
lc.addCastingRecipe(new ItemStack(materials, 1, 15), new LiquidStack(liquidMetalStill.blockID, 1, 10), ingotcast, 50); //alumite
// obsidian
lc.addCastingRecipe(new ItemStack(materials, 1, 16), new LiquidStack(liquidMetalStill.blockID, 1, 12), ingotcast, 50); //steel
liquids = new LiquidStack[] { new LiquidStack(liquidMetalStill.blockID, 1, 0), new LiquidStack(liquidMetalStill.blockID, 1, 2), new LiquidStack(liquidMetalStill.blockID, 1, 5), new LiquidStack(liquidMetalStill.blockID, 1, 6), new LiquidStack(liquidMetalStill.blockID, 1, 9), new LiquidStack(liquidMetalStill.blockID, 1, 7), new LiquidStack(liquidMetalStill.blockID, 1, 10), new LiquidStack(liquidMetalStill.blockID, 1, 12) };
int[] liquidDamage = new int[] { 2, 13, 10, 11, 12, 14, 15, 16 };
for (int iter = 0; iter < patternOutputs.length; iter++)
{
ItemStack cast = new ItemStack(metalPattern, 1, iter + 1);
for (int iterTwo = 0; iterTwo < liquids.length; iterTwo++)
{
lc.addCastingRecipe(new ItemStack(patternOutputs[iter], 1, liquidDamage[iterTwo]), liquids[iterTwo], cast, 50);
}
}
}
void addSmelteryRecipes ()
{
//Ore
Smeltery.addMelting(Block.oreIron, 0, 600, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 0));
Smeltery.addMelting(Block.oreGold, 0, 550, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 1));
//Items
Smeltery.addMelting(new ItemStack(Item.ingotIron, 4), Block.blockSteel.blockID, 0, 500, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 0));
Smeltery.addMelting(new ItemStack(Item.ingotGold, 4), Block.blockGold.blockID, 0, 450, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 1));
Smeltery.addMelting(new ItemStack(Item.goldNugget, 4), Block.blockGold.blockID, 0, 450, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue / 9, 1));
//Blocks
Smeltery.addMelting(Block.blockSteel, 0, 600, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 0));
Smeltery.addMelting(Block.blockGold, 0, 550, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 1));
Smeltery.addMelting(Block.obsidian, 0, 800, new LiquidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 11));
//Alloys
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 4, 7), new LiquidStack(liquidMetalStill.blockID, 3, 2), new LiquidStack(liquidMetalStill.blockID, 1, 3)); //Bronze
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 4, 8), new LiquidStack(liquidMetalStill.blockID, 3, 4), new LiquidStack(liquidMetalStill.blockID, 1, 2)); //Aluminum Brass
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 2, 9), new LiquidStack(liquidMetalStill.blockID, 1, 5), new LiquidStack(liquidMetalStill.blockID, 1, 6)); //Manyullyn
Smeltery.addAlloyMixing(new LiquidStack(liquidMetalStill.blockID, 9, 10), new LiquidStack(liquidMetalStill.blockID, 5, 4), new LiquidStack(liquidMetalStill.blockID, 2, 0), new LiquidStack(liquidMetalStill.blockID, 2, 11)); //Alumite
}
void addCraftingRecipes ()
{
/*GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 0), "c", 'c', Block.workbench);
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 1), "cc", 'c', Block.workbench);*/
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 0), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', Block.workbench);
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 1), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 0));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 2), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 1));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 3), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 2));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 4), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 3));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 5), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', Block.chest);
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 10), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.planks, 1, 0));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 11), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.planks, 1, 1));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 12), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.planks, 1, 2));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 13), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.planks, 1, 3));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(woodCrafter, 1, 1), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "logWood"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(woodCrafter, 1, 10), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "plankWood"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blankPattern, 1, 0), "ps", "sp", 'p', "plankWood", 's', Item.stick));
GameRegistry.addRecipe(new ItemStack(manualBook), "wp", 'w', new ItemStack(blankPattern, 1, 0), 'p', Item.paper);
GameRegistry.addRecipe(new ItemStack(materials, 1, 0), "pp", "pp", 'p', Item.paper); //Paper stack
GameRegistry.addRecipe(new ItemStack(materials, 1, 6), "ppp", "ppp", "ppp", 'p', Block.cobblestoneMossy); //Moss ball
GameRegistry.addRecipe(new ItemStack(materials, 1, 7), "xcx", "cbc", "xcx", 'b', Item.bucketLava, 'c', Item.coal, 'x', Block.netherrack); //Auto-smelt
GameRegistry.addShapelessRecipe(new ItemStack(materials, 1, 8), Item.bone, Item.rottenFlesh, Item.chickenRaw, Item.beefRaw, Item.porkRaw, Item.fishRaw); //Necrotic bone
GameRegistry.addShapelessRecipe(new ItemStack(craftedSoil, 1, 0), Item.slimeBall, Item.slimeBall, Item.slimeBall, Item.slimeBall, Block.sand, Block.dirt); //Slimy sand
GameRegistry.addShapelessRecipe(new ItemStack(craftedSoil, 1, 1), Item.clay, Block.sand, Block.gravel); //Grout, Add stone dust?
FurnaceRecipes.smelting().addSmelting(craftedSoil.blockID, 0, new ItemStack(materials, 1, 1), 2f); //Slime
FurnaceRecipes.smelting().addSmelting(craftedSoil.blockID, 1, new ItemStack(materials, 1, 2), 2f); //Seared brick item
//GameRegistry.addRecipe(new ItemStack(oreSlag, 1, 0), "pp", "pp", 'p', new ItemStack(materials, 1, 2)); //Seared brick block
FurnaceRecipes.smelting().addSmelting(oreSlag.blockID, 1, new ItemStack(materials, 1, 3), 3f);
FurnaceRecipes.smelting().addSmelting(oreSlag.blockID, 2, new ItemStack(materials, 1, 4), 3f);
FurnaceRecipes.smelting().addSmelting(oreSlag.blockID, 3, new ItemStack(materials, 1, 9), 0.5f);
FurnaceRecipes.smelting().addSmelting(oreSlag.blockID, 4, new ItemStack(materials, 1, 10), 0.5f);
FurnaceRecipes.smelting().addSmelting(oreSlag.blockID, 5, new ItemStack(materials, 1, 12), 0.5f);
//Smeltery
ItemStack searedBrick = new ItemStack(materials, 1, 2);
GameRegistry.addRecipe(new ItemStack(smeltery, 1, 0), "bbb", "b b", "bbb", 'b', searedBrick);
GameRegistry.addRecipe(new ItemStack(smeltery, 1, 1), "b b", "b b", "bbb", 'b', searedBrick);
GameRegistry.addRecipe(new ItemStack(smeltery, 1, 2), "bb", "bb", 'b', searedBrick);
GameRegistry.addRecipe(new ItemStack(lavaTank, 1, 0), "bbb", "bgb", "bbb", 'b', searedBrick, 'g', Block.glass);
GameRegistry.addRecipe(new ItemStack(lavaTank, 1, 1), "bgb", "ggg", "bgb", 'b', searedBrick, 'g', Block.glass);
GameRegistry.addRecipe(new ItemStack(lavaTank, 1, 2), "bgb", "bgb", "bgb", 'b', searedBrick, 'g', Block.glass);
GameRegistry.addRecipe(new ItemStack(searedBlock, 1, 0), "bbb", "b b", "b b", 'b', searedBrick);
GameRegistry.addRecipe(new ItemStack(searedBlock, 1, 1), "b b", " b ", 'b', searedBrick);
}
void setupToolTabs ()
{
TConstruct.materialTab.init(new ItemStack(titleIcon));
TConstruct.blockTab.init(new ItemStack(woodCrafter));
ItemStack tool = new ItemStack(longsword, 1, 0);
NBTTagCompound compound = new NBTTagCompound();
compound.setCompoundTag("InfiTool", new NBTTagCompound());
compound.getCompoundTag("InfiTool").setInteger("RenderHead", 2);
compound.getCompoundTag("InfiTool").setInteger("RenderHandle", 0);
compound.getCompoundTag("InfiTool").setInteger("RenderAccessory", 10);
tool.setTagCompound(compound);
TConstruct.toolTab.init(tool);
}
public void oreRegistry ()
{
OreDictionary.registerOre("oreCobalt", new ItemStack(oreSlag, 1, 1));
OreDictionary.registerOre("oreArdite", new ItemStack(oreSlag, 1, 2));
OreDictionary.registerOre("oreCopper", new ItemStack(oreSlag, 1, 3));
OreDictionary.registerOre("oreTin", new ItemStack(oreSlag, 1, 4));
OreDictionary.registerOre("oreNaturalAluminum", new ItemStack(oreSlag, 1, 5));
OreDictionary.registerOre("ingotCobalt", new ItemStack(materials, 1, 3));
OreDictionary.registerOre("ingotArdite", new ItemStack(materials, 1, 4));
OreDictionary.registerOre("ingotManyullyn", new ItemStack(materials, 1, 5));
OreDictionary.registerOre("ingotCopper", new ItemStack(materials, 1, 9));
OreDictionary.registerOre("ingotTin", new ItemStack(materials, 1, 10));
OreDictionary.registerOre("ingotAluminum", new ItemStack(materials, 1, 11));
OreDictionary.registerOre("naturalAluminum", new ItemStack(materials, 1, 12));
OreDictionary.registerOre("ingotBronze", new ItemStack(materials, 1, 13));
OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(materials, 1, 14));
OreDictionary.registerOre("ingotAlumite", new ItemStack(materials, 1, 15));
OreDictionary.registerOre("ingotSteel", new ItemStack(materials, 1, 16));
OreDictionary.registerOre("blockCobalt", new ItemStack(metalBlock, 1, 0));
OreDictionary.registerOre("blockArdite", new ItemStack(metalBlock, 1, 1));
OreDictionary.registerOre("blockManyullyn", new ItemStack(metalBlock, 1, 2));
OreDictionary.registerOre("blockCopper", new ItemStack(metalBlock, 1, 3));
OreDictionary.registerOre("blockBronze", new ItemStack(metalBlock, 1, 4));
OreDictionary.registerOre("blockTin", new ItemStack(metalBlock, 1, 5));
OreDictionary.registerOre("blockNaturalAluminum", new ItemStack(metalBlock, 1, 6));
OreDictionary.registerOre("blockAluminumBrass", new ItemStack(metalBlock, 1, 7));
OreDictionary.registerOre("blockAlumite", new ItemStack(metalBlock, 1, 8));
OreDictionary.registerOre("blockSteel", new ItemStack(metalBlock, 1, 9));
String[] liquidNames = new String[] { "Iron", "Gold", "Copper", "Tin", "Aluminum", "Cobalt", "Ardite", "Bronze", "Brass", "Manyullyn", "Alumite", "Obsidian", "Steel" };
for (int iter = 0; iter < liquidNames.length; iter++)
{
LiquidStack liquidstack = new LiquidStack(liquidMetalStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, iter);
LiquidDictionary.getOrCreateLiquid("Molten " + liquidNames[iter], liquidstack);
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(liquidstack, new ItemStack(buckets, 1, iter), new ItemStack(Item.bucketEmpty)));
}
}
public void modIntegration ()
{
/* IC2 */
ItemStack reBattery = ic2.api.Items.getItem("reBattery");
if (reBattery != null)
modE.batteries.add(reBattery);
ItemStack chargedReBattery = ic2.api.Items.getItem("chargedReBattery");
if (chargedReBattery != null)
modE.batteries.add(new ItemStack(chargedReBattery.getItem(), 1, -1));
ItemStack electronicCircuit = ic2.api.Items.getItem("electronicCircuit");
if (electronicCircuit != null)
modE.circuits.add(electronicCircuit);
/* Thaumcraft */
//Object obj = getItem("itemResource", "thaumcraft.common.Config");
}
public static Object getItem (String name, String classPackage)
{
try
{
Class c = Class.forName(classPackage);
Object ret = c.getField(name);
if (ret != null && (ret instanceof ItemStack || ret instanceof Item))
return ret;
return null;
}
catch (Exception e)
{
System.out.println("[TConstruct] Could not find item for " + name);
return null;
}
}
public static String blockTexture = "/tinkertextures/ConstructBlocks.png";
public static String blankSprite = "/tinkertextures/blanksprite.png";
public static String liquidTexture = "/tinkertextures/LiquidWhite.png";
public static String craftingTexture = "/tinkertextures/materials.png";
public static String patternTexture = "/tinkertextures/patterns.png";
public static String baseHeads = "/tinkertextures/tools/baseheads.png";
public static String baseAccessories = "/tinkertextures/tools/baseaccessories.png";
public static String swordparts = "/tinkertextures/tools/swordparts.png";
public static String jokeparts = "/tinkertextures/tools/jokeparts.png";
public static String broadheads = "/tinkertextures/tools/broadheads.png";
public static String pickaxeTexture = "/tinkertextures/tools/pickaxe/";
public static String broadswordTexture = "/tinkertextures/tools/broadsword/";
public static String shovelTexture = "/tinkertextures/tools/shovel/";
public static String axeTexture = "/tinkertextures/tools/axe/";
public static String longswordTexture = "/tinkertextures/tools/longsword/";
public static String rapierTexture = "/tinkertextures/tools/rapier/";
public static String frypanTexture = "/tinkertextures/tools/frypan/";
public static String signTexture = "/tinkertextures/tools/battlesign/";
public static String bowTexture = "/tinkertextures/tools/bow/";
public static String mattockTexture = "/tinkertextures/tools/mattock/";
public static String lumberaxeTexture = "/tinkertextures/tools/lumberaxe/";
@Override
public int getBurnTime (ItemStack fuel)
{
if (fuel.itemID == materials.itemID && fuel.getItemDamage() == 7)
return 26400;
return 0;
}
}

View File

@ -0,0 +1,120 @@
package mods.tinker.tconstruct;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.EnumSet;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.potion.Potion;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.network.PacketDispatcher;
public class TControls extends KeyHandler
{
static KeyBinding grabKey = new KeyBinding("key.grab", 29);
static KeyBinding jumpKey;
Minecraft mc;
EntityClientPlayerMP player;
boolean jumping;
boolean doubleJump = true;
boolean climbing = false;
boolean onGround = false;
public TControls()
{
super(new KeyBinding[] { Minecraft.getMinecraft().gameSettings.keyBindJump, grabKey }, new boolean[] { false, false });
mc = Minecraft.getMinecraft();
jumpKey = mc.gameSettings.keyBindJump;
System.out.println("Controls registered");
}
//I will be wanting these later
/*@Override
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
super.tickStart(type, tickData);
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
super.tickEnd(type, tickData);
}*/
@Override
public String getLabel ()
{
return null;
}
@Override
public void keyDown (EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat)
{
if (kb == jumpKey && tickEnd) //Double jump
{
if (jumping && !doubleJump)
{
if (player == null)
player = mc.thePlayer;
player.motionY = 0.42D;
player.fallDistance = 0;
if (player.isPotionActive(Potion.jump))
{
player.motionY += (double) ((float) (player.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);
}
doubleJump = true;
updateServer(mc.thePlayer.username);
}
if (!jumping)
jumping = mc.thePlayer.isAirBorne;
}
}
@Override
public void keyUp (EnumSet<TickType> types, KeyBinding kb, boolean tickEnd)
{
//landOnGround();
}
@Override
public EnumSet<TickType> ticks ()
{
return EnumSet.of(TickType.CLIENT);
}
public void landOnGround ()
{
doubleJump = false;
jumping = false;
}
void updateServer (String name)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(10);
outputStream.writeUTF(name);
}
catch (Exception ex)
{
ex.printStackTrace();
}
Packet250CustomPayload packet = new Packet250CustomPayload();
packet.channel = "TConstruct";
packet.data = bos.toByteArray();
packet.length = bos.size();
PacketDispatcher.sendPacketToServer(packet);
}
}

View File

@ -0,0 +1,257 @@
package mods.tinker.tconstruct;
import mods.tinker.tconstruct.crafting.PatternBuilder;
import mods.tinker.tconstruct.crafting.Smeltery;
import mods.tinker.tconstruct.logic.LiquidTextureLogic;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
public class TEventHandler
{
/* Ore Dictionary */
@ForgeSubscribe
public void registerOre (OreRegisterEvent evt)
{
if (evt.Name == "battery")
TConstruct.content.modE.batteries.add(evt.Ore);
else if (evt.Name == "basicCircuit")
TConstruct.content.modE.circuits.add(evt.Ore);
//Ingots
else if (evt.Name == "ingotCopper")
{
PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Copper");
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 2));
}
else if (evt.Name == "ingotTin")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 3));
}
else if (evt.Name == "ingotBronze")
{
PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Bronze");
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 4, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 7));
}
else if (evt.Name == "ingotCobalt")
{
PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Cobalt");
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 0, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 5));
}
else if (evt.Name == "ingotArdite")
{
PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Ardite");
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 1, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 6));
}
else if (evt.Name == "ingotManyullyn")
{
PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Manyullyn");
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 2, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 9));
}
else if (evt.Name == "ingotAluminum")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 4));
}
else if (evt.Name == "naturalAluminum")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 4));
}
else if (evt.Name == "ingotAluminumBrass")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 7, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 8));
}
else if (evt.Name == "ingotAlumite")
{
PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Alumite");
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 8, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 10));
}
else if (evt.Name == "ingotSteel")
{
PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Steel");
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 9, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 12));
}
//Ores
else if (evt.Name == "oreCopper")
{
Smeltery.addMelting(evt.Ore, 550, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*2, 2));
}
else if (evt.Name == "oreTin")
{
Smeltery.addMelting(evt.Ore, 275, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*2, 3));
}
else if (evt.Name == "oreNaturalAluminum")
{
Smeltery.addMelting(evt.Ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*2, 4));
}
else if (evt.Name == "oreCobalt")
{
Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*2, 5));
}
else if (evt.Name == "oreArdite")
{
Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*2, 6));
}
//Blocks
else if (evt.Name == "blockCopper")
{
Smeltery.addMelting(evt.Ore, 550, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*9, 2));
}
else if (evt.Name == "blockTin")
{
Smeltery.addMelting(evt.Ore, 275, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*9, 3));
}
else if (evt.Name == "blockBronze")
{
Smeltery.addMelting(evt.Ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*9, 7));
}
else if (evt.Name == "blockNaturalAluminum")
{
Smeltery.addMelting(evt.Ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*9, 4));
}
else if (evt.Name == "blockCobalt")
{
Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*9, 5));
}
else if (evt.Name == "blockArdite")
{
Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*9, 6));
}
else if (evt.Name == "blockManyullyn")
{
Smeltery.addMelting(evt.Ore, 800, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*9, 9));
}
else if (evt.Name == "blockAluminumBrass")
{
Smeltery.addMelting(evt.Ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*9, 8));
}
else if (evt.Name == "blockAlumite")
{
Smeltery.addMelting(evt.Ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*9, 10));
}
else if (evt.Name == "blockSteel")
{
Smeltery.addMelting(evt.Ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue*9, 12));
}
//Dust
else if (evt.Name == "dustCopper")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 2));
}
else if (evt.Name == "dustTin")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 3));
}
else if (evt.Name == "dustBronze")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 4, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 7));
}
else if (evt.Name == "dustCobalt")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 0, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 5));
}
else if (evt.Name == "dustArdite")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 1, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 6));
}
else if (evt.Name == "dustManyullyn")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 2, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 9));
}
else if (evt.Name == "dustAluminum")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 4));
}
else if (evt.Name == "naturalAluminum")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 4));
}
else if (evt.Name == "dustAluminumBrass")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 7, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 8));
}
else if (evt.Name == "dustAlumite")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 8, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 10));
}
else if (evt.Name == "dustSteel")
{
Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 4, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 9, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, 12));
}
}
@ForgeSubscribe
public void bucketFill (FillBucketEvent evt)
{
if (evt.current.getItem() == Item.bucketEmpty && evt.target.typeOfHit == EnumMovingObjectType.TILE)
{
int hitX = evt.target.blockX;
int hitY = evt.target.blockY;
int hitZ = evt.target.blockZ;
if (!evt.entityPlayer.canPlayerEdit(hitX, hitY, hitZ, evt.target.sideHit, evt.current))
{
return;
//return evt.current;
}
int bID = evt.world.getBlockId(hitX, hitY, hitZ);
int meta = -1;
if (bID == TContent.liquidMetalStill.blockID)
{
LiquidTextureLogic logic = (LiquidTextureLogic) evt.world.getBlockTileEntity(hitX, hitY, hitZ);
meta = logic.getLiquidType();
}
if (meta != -1)
{
evt.world.func_94571_i(hitX, hitY, hitZ); //Set air block
evt.result = new ItemStack(TContent.buckets, 1, meta);
evt.setResult(Result.ALLOW);
}
}
}
}

View File

@ -0,0 +1,83 @@
package mods.tinker.tconstruct;
import java.util.WeakHashMap;
import mods.tinker.common.InventoryLogic;
import mods.tinker.tconstruct.client.TProxyClient;
import mods.tinker.tconstruct.client.gui.FrypanGui;
import mods.tinker.tconstruct.client.gui.GuiManual;
import mods.tinker.tconstruct.client.gui.PartCrafterGui;
import mods.tinker.tconstruct.client.gui.PatternChestGui;
import mods.tinker.tconstruct.client.gui.PatternShaperGui;
import mods.tinker.tconstruct.client.gui.SmelteryGui;
import mods.tinker.tconstruct.client.gui.ToolStationGui;
import mods.tinker.tconstruct.container.SmelteryContainer;
import mods.tinker.tconstruct.logic.FrypanLogic;
import mods.tinker.tconstruct.logic.PartCrafterLogic;
import mods.tinker.tconstruct.logic.PatternChestLogic;
import mods.tinker.tconstruct.logic.PatternShaperLogic;
import mods.tinker.tconstruct.logic.SmelteryLogic;
import mods.tinker.tconstruct.logic.ToolStationLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class TGuiHandler implements IGuiHandler
{
public static int stationID = 0;
public static int partID = 1;
public static int pchestID = 2;
public static int pshaperID = 3;
public static int frypanID = 4;
public static int smeltery = 7;
public static int manualGui = -1;
public static WeakHashMap<String, Container> openContainers = new WeakHashMap<String, Container>();
@Override
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
{
if (ID < 0)
return null;
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile != null && tile instanceof InventoryLogic)
{
Object o = ((InventoryLogic) tile).getGuiContainer(player.inventory, world, x, y, z);
if (o instanceof SmelteryContainer)
{
openContainers.put(player.username, (Container) o);
}
return o;
}
return null;
}
@Override
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
{
if (ID == stationID)
return new ToolStationGui(player.inventory, (ToolStationLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == partID)
return new PartCrafterGui(player.inventory, (PartCrafterLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == pchestID)
return new PatternChestGui(player.inventory, (PatternChestLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == frypanID)
return new FrypanGui(player.inventory, (FrypanLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == smeltery)
return new SmelteryGui(player.inventory, (SmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == pshaperID)
return new PatternShaperGui(player.inventory, (PatternShaperLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == manualGui)
{
ItemStack stack = player.getCurrentEquippedItem();
return new GuiManual(stack, TProxyClient.getManualFromStack(stack));
}
return null;
}
}

View File

@ -0,0 +1,132 @@
package mods.tinker.tconstruct;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import mods.tinker.common.InventoryLogic;
import mods.tinker.tconstruct.container.SmelteryContainer;
import mods.tinker.tconstruct.logic.ToolStationLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
public class TPacketHandler implements IPacketHandler
{
@Override
public void onPacketData (INetworkManager manager, Packet250CustomPayload packet, Player player)
{
Side side = FMLCommonHandler.instance().getEffectiveSide();
if (packet.channel.equals("TConstruct"))
{
//System.out.println("Recieved a packet for TConstruct");
if (side == Side.SERVER)
handleServerPacket(packet);
else
handleClientPacket(packet);
}
}
void handleClientPacket (Packet250CustomPayload packet)
{
//System.out.println("Handling client packet");
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
byte packetType;
int dimension;
byte packetID;
try
{
packetID = inputStream.readByte();
dimension = inputStream.readInt();
World world = DimensionManager.getWorld(dimension);
}
catch (IOException e)
{
System.out.println("Failed at reading client packet for TConstruct.");
e.printStackTrace();
return;
}
}
void handleServerPacket (Packet250CustomPayload packet)
{
//System.out.println("Handling server packet");
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
//byte packetType;
//int dimension;
byte packetID;
try
{
packetID = inputStream.readByte();
if (packetID == 1) //Tool Station
{
int dimension = inputStream.readInt();
World world = DimensionManager.getWorld(dimension);
int x = inputStream.readInt();
int y = inputStream.readInt();
int z = inputStream.readInt();
TileEntity te = world.getBlockTileEntity(x, y, z);
String toolName = inputStream.readUTF();
if (te instanceof ToolStationLogic)
{
((ToolStationLogic) te).setToolname(toolName);
}
}
else if (packetID == 2) //Stencil Table
{
int dimension = inputStream.readInt();
World world = DimensionManager.getWorld(dimension);
int x = inputStream.readInt();
int y = inputStream.readInt();
int z = inputStream.readInt();
TileEntity te = world.getBlockTileEntity(x, y, z);
Short itemID = inputStream.readShort();
Short itemDamage = inputStream.readShort();
if (te instanceof InventoryLogic)
{
((InventoryLogic) te).setInventorySlotContents(1, new ItemStack(itemID, 1, itemDamage));
}
}
else if (packetID == 3) //Smeltery
{
int rowPos = inputStream.readInt();
String user = inputStream.readUTF();
SmelteryContainer container = (SmelteryContainer) TGuiHandler.openContainers.get(user);
//System.out.println("Recieved a scroll packet for row "+rowPos);
container.updateRows(rowPos);
}
else if (packetID == 10) //Double jump
{
String user = inputStream.readUTF();
//EntityPlayer player = FMLCommonHandler.instance().getSidedDelegate().getServer().getConfigurationManager().getPlayerForUsername(user);
EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
player.fallDistance = 0;
}
}
catch (IOException e)
{
System.out.println("Failed at reading server packet for TConstruct.");
e.printStackTrace();
return;
}
}
}

View File

@ -0,0 +1,25 @@
package mods.tinker.tconstruct;
import java.io.File;
/**
* Common proxy class for InfiTools
*/
public class TProxyCommon
{
/* Registers any rendering code. Does nothing server-side */
public void registerRenderer() {}
/* Ties an internal name to a visible one. Does nothing server-side */
public void addNames() {}
public void readManuals() {}
public void registerKeys() {}
public File getLocation()
{
return new File(".");
}
}

View File

@ -0,0 +1,24 @@
package mods.tinker.tconstruct;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
public class TabTools extends CreativeTabs
{
ItemStack display;
public TabTools(String label)
{
super(label);
}
public void init(ItemStack stack)
{
display = stack;
}
public ItemStack getIconItemStack()
{
return display;
}
}

View File

@ -0,0 +1,94 @@
package mods.tinker.tconstruct;
/**
* This class is temporary. A full material registry is planned
*/
public class ToolMaterial
{
/*Wood (0, 59, 200, 0, 1.0F, 0, 0),
Stone (1, 131, 400, 1, 0.5F, 0, 1f),
Iron (2, 250, 600, 2, 1.3F, 1, 0),
Flint (1, 171, 525, 2, 0.7F, 0, 1f),
Cactus (1, 150, 500, 2, 1.0F, 0, -1f),
Bone (1, 200, 500, 2, 1.0F, 0, 0),
Obsidian (3, 89, 700, 2, 0.8F, 3, 0),
Netherrack (2, 131, 400, 1, 1.2F, 0, 1f),
Slime (3, 1500, 150, 0, 5.0F, 0, 0),
Paper (0, 131, 200, 0, 0.1F, 0, 0),
Cobalt (4, 800, 800, 3, 1.8F, 2, 0),
Ardite (4, 800, 800, 3, 1.8F, 0, 0),
Manyullyn (5, 1200, 1000, 4, 2.5F, 0, 0),
Copper (1, 180, 500, 2, 1.15F, 0, 0),
Bronze (2, 250, 600, 2, 1.3F, 1, 0),
Demonite (5, 1790, 900, 5, 1.66F, 0, 0),
Holyshell (5, 1000, 700, 1, 1.5F, 0, 0);*/
//mining level, durability, mining speed, baseDamage, handle modifier, Reinforced level, shoddy/spiny level
public final String materialName;
public final int craftingTier;
public final int harvestLevel;
public final int durability;
public final int miningspeed; // <-- divided by 100
public final int attack;
public final float handleModifier;
public final int reinforced;
public final float shoddy;
public ToolMaterial(String name, int tier, int level, int dur, int speed, int damage, float handle, int unb, float shd)
{
this.materialName = name;
this.craftingTier = tier;
this.harvestLevel = level;
this.durability = dur;
this.miningspeed = speed;
this.attack = damage;
this.handleModifier = handle;
this.reinforced = unb;
this.shoddy = shd;
}
public String name()
{
return materialName;
}
public int tier()
{
return craftingTier;
}
public int durability()
{
return this.durability;
}
public int toolSpeed()
{
return this.miningspeed;
}
public int attack()
{
return this.attack;
}
public int harvestLevel()
{
return this.harvestLevel;
}
public float handleDurability()
{
return this.handleModifier;
}
public int reinforced()
{
return this.reinforced;
}
public float shoddy()
{
return this.shoddy;
}
}

View File

@ -0,0 +1,101 @@
package mods.tinker.tconstruct.blocks;
import java.util.Random;
import mods.tinker.common.InventoryBlock;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.TGuiHandler;
import mods.tinker.tconstruct.client.FrypanRender;
import mods.tinker.tconstruct.logic.FrypanLogic;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EquipBlock extends InventoryBlock
{
public EquipBlock(int id, Material material)
{
super(id, material);
this.setHardness(0.3f);
this.setBlockBounds(0, 0, 0, 1, 0.25f, 1);
//this.setCreativeTab(ToolConstruct.materialTab);
}
@Override
public String[] getTextureNames ()
{
return new String[] { "toolstation_top" };
}
@SideOnly(Side.CLIENT)
public void func_94332_a (IconRegister par1IconRegister)
{
this.field_94336_cN = par1IconRegister.func_94245_a(Block.blockSteel.getUnlocalizedName());
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public int getRenderType ()
{
return FrypanRender.frypanModelID;
}
@Override
public int idDropped (int par1, Random par2Random, int par3)
{
return 0;
}
public TileEntity createNewTileEntity (World world, int metadata)
{
return new FrypanLogic();
}
public void randomDisplayTick (World world, int x, int y, int z, Random random)
{
if (isActive(world, x, y, z))
{
float f = (float) x + 0.5F;
float f1 = (float) y + 0.25F + (random.nextFloat() * 6F) / 16F;
float f2 = (float) z + 0.5F;
float f4 = random.nextFloat() * 0.6F - 0.3F;
world.spawnParticle("smoke", f, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", f, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
}
}
public int getLightValue (IBlockAccess world, int x, int y, int z)
{
return !isActive(world, x, y, z) ? 0 : 9;
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
return TGuiHandler.frypanID;
}
@Override
public Object getModInstance ()
{
return TConstruct.instance;
}
}

View File

@ -0,0 +1,247 @@
package mods.tinker.tconstruct.blocks;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import mods.tinker.tconstruct.TConstruct;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.EnumMobType;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class Landmine extends Block
{
/** The mob type that can trigger this pressure plate. */
private EnumMobType triggerMobType;
public Landmine(int par1, EnumMobType par3EnumMobType, Material par4Material)
{
super(par1, par4Material);
this.triggerMobType = EnumMobType.mobs;
this.setCreativeTab(TConstruct.blockTab);
this.setTickRandomly(true);
float var5 = 0.0625F;
this.setBlockBounds(var5, 0.0F, var5, 1.0F - var5, 0.03125F, 1.0F - var5);
}
/**
* How many world ticks before ticking
*/
public int tickRate()
{
return 20;
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return null;
}
/**
* 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;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return true;
}
/**
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) || BlockFence.isIdAFence(par1World.getBlockId(par2, par3 - 1, par4));
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
boolean var6 = false;
if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !BlockFence.isIdAFence(par1World.getBlockId(par2, par3 - 1, par4)))
{
var6 = true;
}
if (var6)
{
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
//par1World.setBlockWithNotify(par2, par3, par4, 0);
}
}
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
if (!par1World.isRemote)
{
if (par1World.getBlockMetadata(par2, par3, par4) != 0)
{
this.setStateIfMobInteractsWithPlate(par1World, par2, par3, par4);
}
}
}
/**
* Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
*/
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
if (!par1World.isRemote)
{
if (par1World.getBlockMetadata(par2, par3, par4) != 1)
{
this.setStateIfMobInteractsWithPlate(par1World, par2, par3, par4);
}
}
}
/**
* Checks if there are mobs on the plate. If a mob is on the plate and it is off, it turns it on, and vice versa.
*/
private void setStateIfMobInteractsWithPlate(World world, int posX, int posY, int posZ)
{
boolean var5 = world.getBlockMetadata(posX, posY, posZ) == 1;
boolean var6 = false;
float var7 = 0.125F;
List var8 = null;
if (this.triggerMobType == EnumMobType.everything)
{
var8 = world.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getAABBPool().getAABB((double)((float)posX + var7), (double)posY, (double)((float)posZ + var7), (double)((float)(posX + 1) - var7), (double)posY + 0.25D, (double)((float)(posZ + 1) - var7)));
}
if (this.triggerMobType == EnumMobType.mobs)
{
var8 = world.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)posX + var7), (double)posY, (double)((float)posZ + var7), (double)((float)(posX + 1) - var7), (double)posY + 0.25D, (double)((float)(posZ + 1) - var7)));
}
if (this.triggerMobType == EnumMobType.players)
{
var8 = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)posX + var7), (double)posY, (double)((float)posZ + var7), (double)((float)(posX + 1) - var7), (double)posY + 0.25D, (double)((float)(posZ + 1) - var7)));
}
if (!var8.isEmpty())
{
Iterator var9 = var8.iterator();
while (var9.hasNext())
{
Entity var10 = (Entity)var9.next();
if (!var10.doesEntityNotTriggerPressurePlate())
{
var6 = true;
break;
}
}
}
if (var6 && !var5)
{
//world.setBlockWithNotify(posX, posY, posZ, 0);
world.createExplosion((Entity)null, posX, posY, posZ, 2.0F, true);
/*par1World.setBlockMetadataWithNotify(posX, posY, posZ, 1);
par1World.notifyBlocksOfNeighborChange(posX, posY, posZ, this.blockID);
par1World.notifyBlocksOfNeighborChange(posX, posY - 1, posZ, this.blockID);
par1World.markBlockRangeForRenderUpdate(posX, posY, posZ, posX, posY, posZ);
par1World.playSoundEffect((double)posX + 0.5D, (double)posY + 0.1D, (double)posZ + 0.5D, "random.click", 0.3F, 0.6F);*/
}
/*if (!var6 && var5)
{
par1World.setBlockMetadataWithNotify(posX, posY, posZ, 0);
par1World.notifyBlocksOfNeighborChange(posX, posY, posZ, this.blockID);
par1World.notifyBlocksOfNeighborChange(posX, posY - 1, posZ, this.blockID);
par1World.markBlockRangeForRenderUpdate(posX, posY, posZ, posX, posY, posZ);
par1World.playSoundEffect((double)posX + 0.5D, (double)posY + 0.1D, (double)posZ + 0.5D, "random.click", 0.3F, 0.5F);
}
if (var6)
{
par1World.scheduleBlockUpdate(posX, posY, posZ, this.blockID, this.tickRate());
}*/
}
/**
* ejects contained items into the world, and notifies neighbours of an update, as appropriate
*/
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
{
if (par6 > 0)
{
par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID);
par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID);
}
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
boolean var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4) == 1;
float var6 = 0.0625F;
if (var5)
{
this.setBlockBounds(var6, 0.0F, var6, 1.0F - var6, 0.03125F, 1.0F - var6);
}
else
{
this.setBlockBounds(var6, 0.0F, var6, 1.0F - var6, 0.0625F, 1.0F - var6);
}
}
/**
* Sets the block's bounds for rendering it as an item
*/
public void setBlockBoundsForItemRender()
{
float var1 = 0.5F;
float var2 = 0.125F;
float var3 = 0.5F;
this.setBlockBounds(0.5F - var1, 0.5F - var2, 0.5F - var3, 0.5F + var1, 0.5F + var2, 0.5F + var3);
}
/**
* Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility
* and stop pistons
*/
public int getMobilityFlag()
{
return 1;
}
}

View File

@ -0,0 +1,170 @@
package mods.tinker.tconstruct.blocks;
import java.util.List;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.client.TankRender;
import mods.tinker.tconstruct.logic.LavaTankLogic;
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.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
public class LavaTankBlock extends BlockContainer
{
public Icon[] icons;
public LavaTankBlock(int id)
{
super(id, Material.rock);
setHardness(12);
setCreativeTab(TConstruct.blockTab);
setUnlocalizedName("TConstruct.LavaTank");
setStepSound(Block.soundGlassFootstep);
}
public String[] getTextureNames()
{
String[] textureNames = {
"lavatank_side",
"lavatank_top",
"searedgague_top",
"searedgague_side",
"searedgague_bottom",
"searedwindow_top",
"searedwindow_side",
"searedwindow_bottom" };
return textureNames;
}
public void func_94332_a(IconRegister iconRegister)
{
String[] textureNames = getTextureNames();
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.func_94245_a("tinker:"+textureNames[i]);
}
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
{
//if (side == 0 && world.getBlockMetadata(x, y, z) == 0)
//return super.shouldSideBeRendered(world, x, y, z, side);
int bID = world.getBlockId(x, y, z);
return bID == this.blockID ? false : super.shouldSideBeRendered(world, x, y, z, side);
//return true;
}
@Override
public String getTextureFile ()
{
return TContent.blockTexture;
}
@Override
public int getRenderType ()
{
return TankRender.tankModelID;
}
public Icon getBlockTextureFromSideAndMetadata (int side, int meta)
{
if (meta == 0)
{
if (side == 0 || side == 1)
{
return icons[1];
}
else
{
return icons[0];
}
}
else
{
return icons[meta*3+getTextureIndex(side)-1];
}
}
public int getTextureIndex (int side)
{
if (side == 0)
return 2;
if (side == 1)
return 0;
return 1;
}
@Override
public TileEntity createTileEntity (World world, int metadata)
{
return new LavaTankLogic();
}
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
{
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(player.getCurrentEquippedItem());
if (liquid != null)
{
LavaTankLogic logic = (LavaTankLogic) world.getBlockTileEntity(x, y, z);
int amount = logic.fill(0, liquid, true);
if (amount > 0)
return true;
else
return false;
}
else
{
}
return false;
}
@Override
public TileEntity createNewTileEntity (World world)
{
return createTileEntity(world, 0);
}
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 3; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
/* Data */
public int damageDropped (int meta)
{
return meta;
}
}

View File

@ -0,0 +1,22 @@
package mods.tinker.tconstruct.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
public class MetalOre extends TConstructBlock
{
public MetalOre(int id, Material material, float hardness, String[] tex)
{
super(id, material, hardness, tex);
}
public float getBlockHardness (World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta <= 2)
return 10f;
else
return 3f;
//return this.blockHardness;
}
}

View File

@ -0,0 +1,285 @@
package mods.tinker.tconstruct.blocks;
import java.util.List;
import mods.tinker.common.InventoryBlock;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.client.SearedRender;
import mods.tinker.tconstruct.logic.CastingTableLogic;
import mods.tinker.tconstruct.logic.FaucetLogic;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class SearedBlock extends InventoryBlock
{
public SearedBlock(int id)
{
super(id, Material.rock);
this.setCreativeTab(TConstruct.blockTab);
//blockIndexInTexture = 32;
setHardness(12);
setStepSound(soundMetalFootstep);
}
@Override
public TileEntity createNewTileEntity (World world, int metadata)
{
switch (metadata)
{
case 0:
return new CastingTableLogic();
case 1:
return new FaucetLogic();
default:
return null;
}
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
int meta = world.getBlockMetadata(x, y, z);
switch (meta)
{
case 0:
return null;
case 1:
return null;
default:
return null;
}
}
@Override
public Object getModInstance ()
{
return TConstruct.instance;
}
/* Activation */
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
{
int md = world.getBlockMetadata(x, y, z);
if (md == 0)
{
return activateCastingTable(world, x, y, z, player);
}
else if (md == 1)
{
if (player.isSneaking())
return false;
FaucetLogic logic = (FaucetLogic) world.getBlockTileEntity(x, y, z);
logic.setActive(true);
return true;
}
else
return super.onBlockActivated(world, x, y, z, player, side, clickX, clickY, clickZ);
}
boolean activateCastingTable (World world, int x, int y, int z, EntityPlayer player)
{
if (!world.isRemote)
{
//System.out.println("Castses");
CastingTableLogic logic = (CastingTableLogic) world.getBlockTileEntity(x, y, z);
if (logic.liquid != null)
return true;
if (!logic.isStackInSlot(0) && !logic.isStackInSlot(1))
{
ItemStack stack = player.getCurrentEquippedItem();
stack = player.inventory.decrStackSize(player.inventory.currentItem, 1);
logic.setInventorySlotContents(0, stack);
}
else
{
if (logic.isStackInSlot(1))
{
ItemStack stack = logic.decrStackSize(1, 1);
if (stack != null)
addItemToInventory(player, world, x, y, z, stack);
}
else if (logic.isStackInSlot(0))
{
ItemStack stack = logic.decrStackSize(0, 1);
if (stack != null)
addItemToInventory(player, world, x, y, z, stack);
}
}
world.markBlockForUpdate(x, y, z);
}
return true;
}
protected void addItemToInventory (EntityPlayer player, World world, int x, int y, int z, ItemStack stack)
{
if (!world.isRemote)
{
EntityItem entityitem = new EntityItem(world, (double) x + 0.5D, (double) y + 0.9325D, (double) z + 0.5D, stack);
world.spawnEntityInWorld(entityitem);
entityitem.onCollideWithPlayer(player);
}
}
/* Rendering */
@Override
public int getRenderType ()
{
return SearedRender.searedModel;
}
@Override
public String[] getTextureNames()
{
String[] textureNames = {
"castingtable_top",
"castingtable_side",
"castingtable_bottom",
"faucet"};
return textureNames;
}
@Override
public Icon getBlockTextureFromSideAndMetadata (int side, int meta)
{
if (meta == 0)
return icons[getTextureIndex(side)];
else
return icons[3];
}
public int getTextureIndex (int side)
{
if (side == 0)
return 2;
if (side == 1)
return 0;
return 1;
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 2; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
@Override
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0)
{
this.setBlockBounds(0, 0, 0, 1, 1, 1);
}
if (meta == 1)
{
FaucetLogic logic = (FaucetLogic) world.getBlockTileEntity(x, y, z);
float xMin = 0.25F;
float xMax = 0.75F;
float zMin = 0.25F;
float zMax = 0.75F;
switch (logic.getRenderDirection())
{
case 2:
zMin = 0.625F;
zMax = 1.0F;
break;
case 3:
zMax = 0.375F;
zMin = 0F;
break;
case 4:
xMin = 0.625F;
xMax = 1.0F;
break;
case 5:
xMax = 0.375F;
xMin = 0F;
break;
}
this.setBlockBounds(xMin, 0.25F, zMin, xMax, 0.625F, zMax);
}
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0)
{
return AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 1, z + 1);
}
if (meta == 1)
{
FaucetLogic logic = (FaucetLogic) world.getBlockTileEntity(x, y, z);
if (logic != null)
{
float xMin = 0.25F;
float xMax = 0.75F;
float zMin = 0.25F;
float zMax = 0.75F;
switch (logic.getRenderDirection())
{
case 2:
zMin = 0.625F;
zMax = 1.0F;
break;
case 3:
zMax = 0.375F;
zMin = 0F;
break;
case 4:
xMin = 0.625F;
xMax = 1.0F;
break;
case 5:
xMax = 0.375F;
xMin = 0F;
break;
}
return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + xMin), (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x + xMax), (double) y + 0.625, (double) ((float) z + zMax));
}
}
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
}

View File

@ -0,0 +1,246 @@
package mods.tinker.tconstruct.blocks;
import java.util.List;
import java.util.Random;
import mods.tinker.common.IFacingLogic;
import mods.tinker.common.InventoryBlock;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.TGuiHandler;
import mods.tinker.tconstruct.client.SmelteryRender;
import mods.tinker.tconstruct.logic.MultiServantLogic;
import mods.tinker.tconstruct.logic.SmelteryDrainLogic;
import mods.tinker.tconstruct.logic.SmelteryLogic;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class SmelteryBlock extends InventoryBlock
{
Random rand;
public SmelteryBlock(int id)
{
super(id, Material.rock);
//blockIndexInTexture = 64;
setHardness(12F);
setStepSound(soundMetalFootstep);
rand = new Random();
this.setCreativeTab(TConstruct.blockTab);
this.setUnlocalizedName("tconstruct.Smeltery");
}
/* Rendering */
@Override
public int getRenderType ()
{
return SmelteryRender.smelteryModel;
}
@Override
public String[] getTextureNames()
{
String[] textureNames = {
"smeltery_side",
"smeltery_inactive",
"smeltery_active",
"drain_side",
"drain_out",
"drain_basin",
"searedbrick",
};
return textureNames;
}
public Icon getBlockTextureFromSideAndMetadata (int side, int meta)
{
if (meta < 2)
{
int sideTex = side == 3 ? 1 : 0;
return icons[sideTex + meta*3];
}
else
{
return icons[6];
}
}
public Icon getBlockTexture (IBlockAccess world, int x, int y, int z, int side)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
short direction = (logic instanceof IFacingLogic) ? ((IFacingLogic) logic).getRenderDirection() : 0;
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) //Smeltery
{
if (side == direction)
{
if (isActive(world, x, y, z))
{
return icons[2];
}
else
{
return icons[1];
}
}
else
{
return icons[0];
}
}
if (meta == 1) //Drain
{
if (side == direction)
return icons[5];
else if (side / 2 == direction / 2)
return icons[4];
else
return icons[3];
}
else //Brick
{
return icons[6];
}
}
public int damageDropped (int meta)
{
return meta;
}
public int quantityDropped (Random random)
{
return 1;
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
return TGuiHandler.smeltery;
}
public void randomDisplayTick (World world, int x, int y, int z, Random random)
{
if (isActive(world, x, y, z))
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
byte face = 0;
if (logic instanceof IFacingLogic)
face = ((IFacingLogic) logic).getRenderDirection();
float f = (float) x + 0.5F;
float f1 = (float) y + 0.5F + (random.nextFloat() * 6F) / 16F;
float f2 = (float) z + 0.5F;
float f3 = 0.52F;
float f4 = random.nextFloat() * 0.6F - 0.3F;
switch (face)
{
case 4:
world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
break;
case 5:
world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
break;
case 2:
world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
break;
case 3:
world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
break;
}
}
}
public int getLightValue (IBlockAccess world, int x, int y, int z)
{
return !isActive(world, x, y, z) ? 0 : 9;
}
//@Override
/*public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 9; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}*/
@Override
public Object getModInstance ()
{
return TConstruct.instance;
}
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
{
if (player.isSneaking() || world.getBlockMetadata(x, y, z) != 0)
return false;
Integer integer = getGui(world, x, y, z, player);
if (integer == null || integer == -1)
{
return false;
}
else
{
player.openGui(getModInstance(), integer, world, x, y, z);
return true;
}
}
@Override
public TileEntity createNewTileEntity (World world, int metadata)
{
switch (metadata)
{
case 0: return new SmelteryLogic();
case 1: return new SmelteryDrainLogic();
case 2: return new MultiServantLogic();
default: return null;
}
}
@Override
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLiving entityliving, ItemStack stack)
{
super.onBlockPlacedBy(world, x, y, z, entityliving, stack);
if (world.getBlockMetadata(x, y, z) == 0)
onBlockPlacedElsewhere(world, x, y, z, entityliving);
}
public void onBlockPlacedElsewhere (World world, int x, int y, int z, EntityLiving entityliving)
{
SmelteryLogic logic = (SmelteryLogic) world.getBlockTileEntity(x, y, z);
logic.checkValidPlacement();
}
@Override
public void breakBlock (World world, int x, int y, int z, int par5, int par6) //Don't drop inventory
{
world.removeBlockTileEntity(x, y, z);
}
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 3; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
}

View File

@ -0,0 +1,55 @@
package mods.tinker.tconstruct.blocks;
import java.util.List;
import mods.tinker.tconstruct.TConstruct;
import net.minecraft.block.Block;
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.util.Icon;
public class TConstructBlock extends Block
{
public String[] textureNames;
public Icon[] icons;
public TConstructBlock(int id, Material material, float hardness, String[] tex)
{
super(id, material);
setHardness(hardness);
this.setCreativeTab(TConstruct.blockTab);
textureNames = tex;
}
@Override
public int damageDropped (int meta)
{
return meta;
}
public void func_94332_a(IconRegister iconRegister)
{
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.func_94245_a("tinker:"+textureNames[i]);
}
}
@Override
public Icon getBlockTextureFromSideAndMetadata (int side, int meta)
{
return icons[meta];
}
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < icons.length; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
}

View File

@ -0,0 +1,203 @@
package mods.tinker.tconstruct.blocks;
import java.util.List;
import mods.tinker.common.InventoryBlock;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.client.TableRender;
import mods.tinker.tconstruct.logic.PartCrafterLogic;
import mods.tinker.tconstruct.logic.PatternChestLogic;
import mods.tinker.tconstruct.logic.PatternShaperLogic;
import mods.tinker.tconstruct.logic.ToolStationLogic;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class ToolStationBlock extends InventoryBlock
{
public ToolStationBlock(int id, Material material)
{
super(id, material);
this.setCreativeTab(TConstruct.blockTab);
this.setHardness(2f);
}
/* Rendering */
@Override
public String[] getTextureNames()
{
String[] textureNames = {
"toolstation_top",
"toolstation_side",
"toolstation_bottom",
"partbuilder_oak_top",
"partbuilder_oak_side",
"partbuilder_oak_bottom",
"partbuilder_spruce_top",
"partbuilder_spruce_side",
"partbuilder_spruce_bottom",
"partbuilder_birch_top",
"partbuilder_birch_side",
"partbuilder_birch_bottom",
"partbuilder_jungle_top",
"partbuilder_jungle_side",
"partbuilder_jungle_bottom",
"patternchest_top",
"patternchest_side",
"patternchest_bottom",
"stenciltable_oak_top",
"stenciltable_oak_side",
"stenciltable_oak_bottom",
"stenciltable_spruce_top",
"stenciltable_spruce_side",
"stenciltable_spruce_bottom",
"stenciltable_birch_top",
"stenciltable_birch_side",
"stenciltable_birch_bottom",
"stenciltable_jungle_top",
"stenciltable_jungle_side",
"stenciltable_jungle_bottom"};
return textureNames;
}
@Override
public Icon getBlockTextureFromSideAndMetadata (int side, int meta)
{
if (meta <= 4)
{
return icons[meta*3+getTextureIndex(side)];
}
else if (meta <= 9)
{
return icons[15+getTextureIndex(side)];
}
else
{
return icons[meta*3+getTextureIndex(side)-12];
}
}
public int getTextureIndex (int side)
{
if (side == 0)
return 2;
if (side == 1)
return 0;
return 1;
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public int getRenderType ()
{
return TableRender.tabelModelID;
}
@Override
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 5)
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125, (double) z + this.maxZ);
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
}
public TileEntity createNewTileEntity (World world, int metadata)
{
switch (metadata)
{
case 0:
return new ToolStationLogic();
case 1:
return new PartCrafterLogic();
case 2:
return new PartCrafterLogic();
case 3:
return new PartCrafterLogic();
case 4:
return new PartCrafterLogic();
case 5:
return new PatternChestLogic();
case 6:
return new PatternChestLogic();
case 7:
return new PatternChestLogic();
case 8:
return new PatternChestLogic();
case 9:
return new PatternChestLogic();
case 10:
return new PatternShaperLogic();
case 11:
return new PatternShaperLogic();
case 12:
return new PatternShaperLogic();
case 13:
return new PatternShaperLogic();
/*case 14:
return new CastingTableLogic();*/
default:
return null;
}
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
int md = world.getBlockMetadata(x, y, z);
if (md == 0)
return 0;
else if (md < 5)
return 1;
else if (md < 10)
return 2;
else
return 3;
//return -1;
}
@Override
public Object getModInstance ()
{
return TConstruct.instance;
}
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 6; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
for (int iter = 10; iter < 14; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
}
}

View File

@ -0,0 +1,647 @@
package mods.tinker.tconstruct.blocks.liquids;
import java.util.Random;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.client.FluidRender;
import mods.tinker.tconstruct.logic.LiquidTextureLogic;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public abstract class LiquidMetalBase extends Block
{
protected LiquidMetalBase(int par1, Material par2Material)
{
super(par1, par2Material);
}
/*@Override
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic != null && logic instanceof LiquidTextureLogic)
return ((LiquidTextureLogic) logic).getTexturePos();
int meta = world.getBlockMetadata(x, y, z);
return getBlockTextureFromSideAndMetadata(side, meta);
}
public int getBlockTextureFromSideAndMetadata(int side, int meta)
{
int tex = (meta % 5) * 3;
tex += (meta / 5) * 32;
if (side == 0 || side == 1)
return tex;
else
return tex+1;
}*/
@Override
public int getRenderType ()
{
return FluidRender.fluidModel;
}
@Override
public String getTextureFile ()
{
return TContent.liquidTexture;
}
@SideOnly(Side.CLIENT)
public static double getFlowDirection(IBlockAccess par0IBlockAccess, int par1, int par2, int par3, Material par4Material)
{
Vec3 var5 = ((LiquidMetalBase) TContent.liquidMetalFlowing).getFlowVector(par0IBlockAccess, par1, par2, par3);
/*if (par4Material == Material.water)
{
var5 = ((BlockFluid)Block.waterMoving).getFlowVector(par0IBlockAccess, par1, par2, par3);
}
if (par4Material == Material.lava)
{
var5 = ((BlockFluid)Block.lavaMoving).getFlowVector(par0IBlockAccess, par1, par2, par3);
}*/
return var5.xCoord == 0.0D && var5.zCoord == 0.0D ? -1000.0D : Math.atan2(var5.zCoord, var5.xCoord) - (Math.PI / 2D);
}
private Vec3 getFlowVector(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
Vec3 var5 = par1IBlockAccess.getWorldVec3Pool().getVecFromPool(0.0D, 0.0D, 0.0D);
int var6 = this.getEffectiveFlowDecay(par1IBlockAccess, par2, par3, par4);
for (int var7 = 0; var7 < 4; ++var7)
{
int var8 = par2;
int var10 = par4;
if (var7 == 0)
{
var8 = par2 - 1;
}
if (var7 == 1)
{
var10 = par4 - 1;
}
if (var7 == 2)
{
++var8;
}
if (var7 == 3)
{
++var10;
}
int var11 = this.getEffectiveFlowDecay(par1IBlockAccess, var8, par3, var10);
int var12;
if (var11 < 0)
{
if (!par1IBlockAccess.getBlockMaterial(var8, par3, var10).blocksMovement())
{
var11 = this.getEffectiveFlowDecay(par1IBlockAccess, var8, par3 - 1, var10);
if (var11 >= 0)
{
var12 = var11 - (var6 - 8);
var5 = var5.addVector((double)((var8 - par2) * var12), (double)((par3 - par3) * var12), (double)((var10 - par4) * var12));
}
}
}
else if (var11 >= 0)
{
var12 = var11 - var6;
var5 = var5.addVector((double)((var8 - par2) * var12), (double)((par3 - par3) * var12), (double)((var10 - par4) * var12));
}
}
if (par1IBlockAccess.getBlockMetadata(par2, par3, par4) >= 8)
{
boolean var13 = false;
if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3, par4 - 1, 2))
{
var13 = true;
}
if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3, par4 + 1, 3))
{
var13 = true;
}
if (var13 || this.isBlockSolid(par1IBlockAccess, par2 - 1, par3, par4, 4))
{
var13 = true;
}
if (var13 || this.isBlockSolid(par1IBlockAccess, par2 + 1, par3, par4, 5))
{
var13 = true;
}
if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3 + 1, par4 - 1, 2))
{
var13 = true;
}
if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3 + 1, par4 + 1, 3))
{
var13 = true;
}
if (var13 || this.isBlockSolid(par1IBlockAccess, par2 - 1, par3 + 1, par4, 4))
{
var13 = true;
}
if (var13 || this.isBlockSolid(par1IBlockAccess, par2 + 1, par3 + 1, par4, 5))
{
var13 = true;
}
if (var13)
{
var5 = var5.normalize().addVector(0.0D, -6.0D, 0.0D);
}
}
var5 = var5.normalize();
return var5;
}
public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return this.blockMaterial != Material.lava;
}
@SideOnly(Side.CLIENT)
public int getBlockColor()
{
return 16777215;
}
@SideOnly(Side.CLIENT)
/**
* Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render.
*/
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
if (this.blockMaterial != Material.water)
{
return 16777215;
}
else
{
int var5 = 0;
int var6 = 0;
int var7 = 0;
for (int var8 = -1; var8 <= 1; ++var8)
{
for (int var9 = -1; var9 <= 1; ++var9)
{
int var10 = par1IBlockAccess.getBiomeGenForCoords(par2 + var9, par4 + var8).getWaterColorMultiplier();
var5 += (var10 & 16711680) >> 16;
var6 += (var10 & 65280) >> 8;
var7 += var10 & 255;
}
}
return (var5 / 9 & 255) << 16 | (var6 / 9 & 255) << 8 | var7 / 9 & 255;
}
}
/**
* Returns the percentage of the fluid block that is air, based on the given flow decay of the fluid.
*/
public static float getFluidHeightPercent(int par0)
{
if (par0 >= 8)
{
par0 = 0;
}
return (float)(par0 + 1) / 9.0F;
}
/**
* Returns the block texture based on the side being looked at. Args: side
*/
/*public int getBlockTextureFromSide(int par1)
{
return par1 != 0 && par1 != 1 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture;
}*/
/**
* Returns the amount of fluid decay at the coordinates, or -1 if the block at the coordinates is not the same
* material as the fluid.
*/
protected int getFlowDecay(World par1World, int par2, int par3, int par4)
{
return par1World.getBlockMaterial(par2, par3, par4) == this.blockMaterial ? par1World.getBlockMetadata(par2, par3, par4) : -1;
}
/**
* Returns the flow decay but converts values indicating falling liquid (values >=8) to their effective source block
* value of zero.
*/
protected int getEffectiveFlowDecay(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
if (par1IBlockAccess.getBlockMaterial(par2, par3, par4) != this.blockMaterial)
{
return -1;
}
else
{
int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
if (var5 >= 8)
{
var5 = 0;
}
return var5;
}
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* 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;
}
/**
* Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag
*/
public boolean canCollideCheck(int par1, boolean par2)
{
return par2 && par1 == 0;
}
/**
* Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the
* adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side
*/
public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
Material var6 = par1IBlockAccess.getBlockMaterial(par2, par3, par4);
return var6 == this.blockMaterial ? false : (par5 == 1 ? true : (var6 == Material.ice ? false : super.isBlockSolid(par1IBlockAccess, par2, par3, par4, par5)));
}
@SideOnly(Side.CLIENT)
/**
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
* coordinates. Args: blockAccess, x, y, z, side
*/
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
Material var6 = par1IBlockAccess.getBlockMaterial(par2, par3, par4);
return var6 == this.blockMaterial ? false : (par5 == 1 ? true : (var6 == Material.ice ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5)));
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return null;
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return 0;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random par1Random)
{
return 0;
}
/**
* Can add to the passed in vector for a movement vector to be applied to the entity. Args: x, y, z, entity, vec3d
*/
public void velocityToAddToEntity(World par1World, int par2, int par3, int par4, Entity par5Entity, Vec3 par6Vec3)
{
Vec3 var7 = this.getFlowVector(par1World, par2, par3, par4);
par6Vec3.xCoord += var7.xCoord;
par6Vec3.yCoord += var7.yCoord;
par6Vec3.zCoord += var7.zCoord;
}
/**
* How many world ticks before ticking
*/
public int tickRate()
{
return 30;
}
@SideOnly(Side.CLIENT)
/**
* Goes straight to getLightBrightnessForSkyBlocks for Blocks, does some fancy computing for Fluids
*/
public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
int var5 = par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, 0);
int var6 = par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3 + 1, par4, 0);
int var7 = var5 & 255;
int var8 = var6 & 255;
int var9 = var5 >> 16 & 255;
int var10 = var6 >> 16 & 255;
return (var7 > var8 ? var7 : var8) | (var9 > var10 ? var9 : var10) << 16;
}
@SideOnly(Side.CLIENT)
/**
* How bright to render this block based on the light its receiving. Args: iBlockAccess, x, y, z
*/
public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
float var5 = par1IBlockAccess.getLightBrightness(par2, par3, par4);
float var6 = par1IBlockAccess.getLightBrightness(par2, par3 + 1, par4);
return var5 > var6 ? var5 : var6;
}
@SideOnly(Side.CLIENT)
/**
* Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
*/
public int getRenderBlockPass()
{
return this.blockMaterial == Material.water ? 1 : 0;
}
@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)
{
int var6;
if (this.blockMaterial == Material.water)
{
if (par5Random.nextInt(10) == 0)
{
var6 = par1World.getBlockMetadata(par2, par3, par4);
if (var6 <= 0 || var6 >= 8)
{
par1World.spawnParticle("suspended", (double)((float)par2 + par5Random.nextFloat()), (double)((float)par3 + par5Random.nextFloat()), (double)((float)par4 + par5Random.nextFloat()), 0.0D, 0.0D, 0.0D);
}
}
for (var6 = 0; var6 < 0; ++var6)
{
int var7 = par5Random.nextInt(4);
int var8 = par2;
int var9 = par4;
if (var7 == 0)
{
var8 = par2 - 1;
}
if (var7 == 1)
{
++var8;
}
if (var7 == 2)
{
var9 = par4 - 1;
}
if (var7 == 3)
{
++var9;
}
if (par1World.getBlockMaterial(var8, par3, var9) == Material.air && (par1World.getBlockMaterial(var8, par3 - 1, var9).blocksMovement() || par1World.getBlockMaterial(var8, par3 - 1, var9).isLiquid()))
{
float var10 = 0.0625F;
double var11 = (double)((float)par2 + par5Random.nextFloat());
double var13 = (double)((float)par3 + par5Random.nextFloat());
double var15 = (double)((float)par4 + par5Random.nextFloat());
if (var7 == 0)
{
var11 = (double)((float)par2 - var10);
}
if (var7 == 1)
{
var11 = (double)((float)(par2 + 1) + var10);
}
if (var7 == 2)
{
var15 = (double)((float)par4 - var10);
}
if (var7 == 3)
{
var15 = (double)((float)(par4 + 1) + var10);
}
double var17 = 0.0D;
double var19 = 0.0D;
if (var7 == 0)
{
var17 = (double)(-var10);
}
if (var7 == 1)
{
var17 = (double)var10;
}
if (var7 == 2)
{
var19 = (double)(-var10);
}
if (var7 == 3)
{
var19 = (double)var10;
}
par1World.spawnParticle("splash", var11, var13, var15, var17, 0.0D, var19);
}
}
}
if (this.blockMaterial == Material.water && par5Random.nextInt(64) == 0)
{
var6 = par1World.getBlockMetadata(par2, par3, par4);
if (var6 > 0 && var6 < 8)
{
par1World.playSound((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), "liquid.water", par5Random.nextFloat() * 0.25F + 0.75F, par5Random.nextFloat() * 1.0F + 0.5F, false);
}
}
double var21;
double var23;
double var22;
if (this.blockMaterial == Material.lava && par1World.getBlockMaterial(par2, par3 + 1, par4) == Material.air && !par1World.isBlockOpaqueCube(par2, par3 + 1, par4))
{
if (par5Random.nextInt(100) == 0)
{
var21 = (double)((float)par2 + par5Random.nextFloat());
var22 = (double)par3 + this.maxY;
var23 = (double)((float)par4 + par5Random.nextFloat());
par1World.spawnParticle("lava", var21, var22, var23, 0.0D, 0.0D, 0.0D);
par1World.playSound(var21, var22, var23, "liquid.lavapop", 0.2F + par5Random.nextFloat() * 0.2F, 0.9F + par5Random.nextFloat() * 0.15F, false);
}
if (par5Random.nextInt(200) == 0)
{
par1World.playSound((double)par2, (double)par3, (double)par4, "liquid.lava", 0.2F + par5Random.nextFloat() * 0.2F, 0.9F + par5Random.nextFloat() * 0.15F, false);
}
}
if (par5Random.nextInt(10) == 0 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !par1World.getBlockMaterial(par2, par3 - 2, par4).blocksMovement())
{
var21 = (double)((float)par2 + par5Random.nextFloat());
var22 = (double)par3 - 1.05D;
var23 = (double)((float)par4 + par5Random.nextFloat());
if (this.blockMaterial == Material.water)
{
par1World.spawnParticle("dripWater", var21, var22, var23, 0.0D, 0.0D, 0.0D);
}
else
{
par1World.spawnParticle("dripLava", var21, var22, var23, 0.0D, 0.0D, 0.0D);
}
}
}
/**
* Called whenever the block is added into the world. Args: world, x, y, z
*/
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
this.checkForHarden(par1World, par2, par3, par4);
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
this.checkForHarden(par1World, par2, par3, par4);
}
/**
* Forces lava to check to see if it is colliding with water, and then decide what it should harden to.
*/
private void checkForHarden(World par1World, int par2, int par3, int par4)
{
if (par1World.getBlockId(par2, par3, par4) == this.blockID)
{
if (this.blockMaterial == Material.lava)
{
boolean var5 = false;
if (var5 || par1World.getBlockMaterial(par2, par3, par4 - 1) == Material.water)
{
var5 = true;
}
if (var5 || par1World.getBlockMaterial(par2, par3, par4 + 1) == Material.water)
{
var5 = true;
}
if (var5 || par1World.getBlockMaterial(par2 - 1, par3, par4) == Material.water)
{
var5 = true;
}
if (var5 || par1World.getBlockMaterial(par2 + 1, par3, par4) == Material.water)
{
var5 = true;
}
if (var5 || par1World.getBlockMaterial(par2, par3 + 1, par4) == Material.water)
{
var5 = true;
}
if (var5)
{
int var6 = par1World.getBlockMetadata(par2, par3, par4);
if (var6 == 0)
{
par1World.func_94575_c(par2, par3, par4, Block.obsidian.blockID);
}
else if (var6 <= 4)
{
par1World.func_94575_c(par2, par3, par4, Block.cobblestone.blockID);
}
this.triggerLavaMixEffects(par1World, par2, par3, par4);
}
}
}
}
/**
* Creates fizzing sound and smoke. Used when lava flows over block or mixes with water.
*/
protected void triggerLavaMixEffects(World par1World, int par2, int par3, int par4)
{
par1World.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F);
for (int var5 = 0; var5 < 8; ++var5)
{
par1World.spawnParticle("largesmoke", (double)par2 + Math.random(), (double)par3 + 1.2D, (double)par4 + Math.random(), 0.0D, 0.0D, 0.0D);
}
}
}

View File

@ -0,0 +1,328 @@
package mods.tinker.tconstruct.blocks.liquids;
import java.util.Random;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.logic.LiquidTextureLogic;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.liquids.ILiquid;
public class LiquidMetalFlowing extends LiquidMetalBase
implements ILiquid
{
boolean isOptimalFlowDirection[] = new boolean[4];
int flowCost[] = new int[4];
public LiquidMetalFlowing(int id)
{
super(id, TContent.liquidMetal);
}
/*@Override
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
{
LiquidTextureLogic logic = (LiquidTextureLogic) world.getBlockTileEntity(x, y, z);
return logic.getTexturePos() + 1;
}*/
private void updateFlow (World world, int x, int y, int z)
{
//System.out.println("x: "+x+", y: "+y+", z: "+z);
int tex = ((LiquidTextureLogic) world.getBlockTileEntity(x, y, z)).getLiquidType();
int meta = world.getBlockMetadata(x, y, z);
world.setBlockAndMetadataWithNotify(x, y, z, stillLiquidId(), meta, 2);
world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
world.markBlockForUpdate(x, y, z);
((LiquidTextureLogic) world.getBlockTileEntity(x, y, z)).setTexturePos(tex);
}
@Override
public void updateTick (World world, int x, int y, int z, Random random)
{
//System.out.println("x: "+x+", y: "+y+", z: "+z);
int tex = ((LiquidTextureLogic) world.getBlockTileEntity(x, y, z)).getLiquidType();
int l = getFlowDecay(world, x, y, z);
byte byte0 = 1;
boolean flag = true;
if (l > 0)
{
int i1 = -100;
i1 = getSmallestFlowDecay(world, x - 1, y, z, i1);
i1 = getSmallestFlowDecay(world, x + 1, y, z, i1);
i1 = getSmallestFlowDecay(world, x, y, z - 1, i1);
i1 = getSmallestFlowDecay(world, x, y, z + 1, i1);
int j1 = i1 + byte0;
if (j1 >= 8 || i1 < 0)
{
j1 = -1;
}
if (getFlowDecay(world, x, y + 1, z) >= 0)
{
int l1 = getFlowDecay(world, x, y + 1, z);
if (l1 >= 8)
{
j1 = l1;
}
else
{
j1 = l1 + 8;
}
}
if (j1 != l)
{
l = j1;
if (l < 0)
{
world.func_94571_i(x, y, z);
}
else
{
world.setBlockMetadataWithNotify(x, y, z, l, 2);
world.scheduleBlockUpdate(x, y, z, blockID, tickRate());
world.notifyBlocksOfNeighborChange(x, y, z, blockID);
}
}
else if (flag)
{
updateFlow(world, x, y, z);
}
}
else
{
updateFlow(world, x, y, z);
}
if (liquidCanDisplaceBlock(world, x, y - 1, z))
{
if (l >= 8)
{
world.setBlockAndMetadataWithNotify(x, y - 1, z, blockID, l, 3);
}
else
{
world.setBlockAndMetadataWithNotify(x, y - 1, z, blockID, l + 8, 3);
}
((LiquidTextureLogic) world.getBlockTileEntity(x, y - 1, z)).setTexturePos(tex);
}
else if (l >= 0 && (l == 0 || blockBlocksFlow(world, x, y - 1, z)))
{
boolean aflag[] = getOptimalFlowDirections(world, x, y, z);
int k1 = l + byte0;
if (l >= 8)
{
k1 = 1;
}
if (k1 >= 8)
return;
if (aflag[0])
{
flowIntoBlock(world, x - 1, y, z, k1, tex);
}
if (aflag[1])
{
flowIntoBlock(world, x + 1, y, z, k1, tex);
}
if (aflag[2])
{
flowIntoBlock(world, x, y, z - 1, k1, tex);
}
if (aflag[3])
{
flowIntoBlock(world, x, y, z + 1, k1, tex);
}
}
}
private void flowIntoBlock (World world, int x, int y, int z, int meta, int tex)
{
if (liquidCanDisplaceBlock(world, x, y, z))
{
int bID = world.getBlockId(x, y, z);
if (bID > 0)
{
Block.blocksList[bID].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
}
world.setBlockAndMetadataWithNotify(x, y, z, blockID, meta, 3);
((LiquidTextureLogic) world.getBlockTileEntity(x, y, z)).setTexturePos(tex);
}
}
private int calculateFlowCost (World world, int x, int y, int z, int l, int i1)
{
int j1 = 1000;
for (int k1 = 0; k1 < 4; k1++)
{
if (k1 == 0 && i1 == 1 || k1 == 1 && i1 == 0 || k1 == 2 && i1 == 3 || k1 == 3 && i1 == 2)
{
continue;
}
int posX = x;
int posY = y;
int posZ = z;
if (k1 == 0)
{
posX--;
}
if (k1 == 1)
{
posX++;
}
if (k1 == 2)
{
posZ--;
}
if (k1 == 3)
{
posZ++;
}
if (blockBlocksFlow(world, posX, posY, posZ) || world.getBlockMaterial(posX, posY, posZ) == blockMaterial && world.getBlockMetadata(posX, posY, posZ) == 0)
{
continue;
}
if (!blockBlocksFlow(world, posX, posY - 1, posZ))
return l;
if (l >= 4)
{
continue;
}
int k2 = calculateFlowCost(world, posX, posY, posZ, l + 1, k1);
if (k2 < j1)
{
j1 = k2;
}
}
return j1;
}
private boolean[] getOptimalFlowDirections (World world, int x, int y, int z)
{
for (int iter = 0; iter < 4; iter++)
{
flowCost[iter] = 1000;
int posX = x;
int posY = y;
int posZ = z;
if (iter == 0)
{
posX--;
}
if (iter == 1)
{
posX++;
}
if (iter == 2)
{
posZ--;
}
if (iter == 3)
{
posZ++;
}
if (blockBlocksFlow(world, posX, posY, posZ) || world.getBlockMaterial(posX, posY, posZ) == blockMaterial && world.getBlockMetadata(posX, posY, posZ) == 0)
{
continue;
}
if (!blockBlocksFlow(world, posX, posY - 1, posZ))
{
flowCost[iter] = 0;
}
else
{
flowCost[iter] = calculateFlowCost(world, posX, posY, posZ, 1, iter);
}
}
int cost = flowCost[0];
for (int k1 = 1; k1 < 4; k1++)
{
if (flowCost[k1] < cost)
{
cost = flowCost[k1];
}
}
for (int l1 = 0; l1 < 4; l1++)
{
isOptimalFlowDirection[l1] = flowCost[l1] == cost;
}
return isOptimalFlowDirection;
}
private boolean blockBlocksFlow (World world, int x, int y, int z)
{
int l = world.getBlockId(x, y, z);
if (l == Block.doorWood.blockID || l == Block.doorSteel.blockID || l == Block.signPost.blockID || l == Block.ladder.blockID || l == Block.reed.blockID)
return true;
if (l == 0)
return false;
Material material = Block.blocksList[l].blockMaterial;
return material.isSolid();
}
protected int getSmallestFlowDecay (World world, int x, int y, int z, int l)
{
int i1 = getFlowDecay(world, x, y, z);
if (i1 < 0)
return l;
if (i1 >= 8)
{
i1 = 0;
}
return l >= 0 && i1 >= l ? l : i1;
}
private boolean liquidCanDisplaceBlock (World world, int x, int y, int z)
{
Material material = world.getBlockMaterial(x, y, z);
if (material == blockMaterial)
return false;
else
return !blockBlocksFlow(world, x, y, z);
}
@Override
public void onBlockAdded (World world, int x, int y, int z)
{
//System.out.println("x: "+x+", y: "+y+", z: "+z);
super.onBlockAdded(world, x, y, z);
if (world.getBlockId(x, y, z) == blockID)
{
world.scheduleBlockUpdate(x, y, z, blockID, tickRate());
}
}
@Override
public int stillLiquidMeta ()
{
return 0;
}
@Override
public boolean isMetaSensitive ()
{
return false;
}
@Override
public int stillLiquidId ()
{
return TContent.liquidMetalStill.blockID;
}
@Override
public boolean hasTileEntity(int metadata)
{
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
return new LiquidTextureLogic();
}
}

View File

@ -0,0 +1,212 @@
package mods.tinker.tconstruct.blocks.liquids;
import java.util.Random;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.logic.LiquidTextureLogic;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.liquids.ILiquid;
public class LiquidMetalStill extends LiquidMetalBase implements ILiquid
{
public LiquidMetalStill(int id)
{
super(id, TContent.liquidMetal);
//this.setCreativeTab(TConstruct.blockTab);
}
@Override
public int stillLiquidId ()
{
return this.blockID;
}
public int flowingLiquidID ()
{
return TContent.liquidMetalFlowing.blockID;
}
@Override
public boolean isMetaSensitive ()
{
return false;
}
@Override
public int stillLiquidMeta ()
{
return 0;
}
public void updateTick (World par1World, int par2, int par3, int par4, Random par5Random)
{
int var6 = par5Random.nextInt(3);
int var7;
int var8;
for (var7 = 0; var7 < var6; ++var7)
{
par2 += par5Random.nextInt(3) - 1;
++par3;
par4 += par5Random.nextInt(3) - 1;
var8 = par1World.getBlockId(par2, par3, par4);
if (var8 == 0)
{
if (this.isFlammable(par1World, par2 - 1, par3, par4) || this.isFlammable(par1World, par2 + 1, par3, par4) || this.isFlammable(par1World, par2, par3, par4 - 1) || this.isFlammable(par1World, par2, par3, par4 + 1) || this.isFlammable(par1World, par2, par3 - 1, par4) || this.isFlammable(par1World, par2, par3 + 1, par4))
{
par1World.func_94575_c(par2, par3, par4, Block.fire.blockID);
return;
}
}
else if (Block.blocksList[var8].blockMaterial.blocksMovement())
{
return;
}
}
if (var6 == 0)
{
var7 = par2;
var8 = par4;
for (int var9 = 0; var9 < 3; ++var9)
{
par2 = var7 + par5Random.nextInt(3) - 1;
par4 = var8 + par5Random.nextInt(3) - 1;
if (par1World.isAirBlock(par2, par3 + 1, par4) && this.isFlammable(par1World, par2, par3, par4))
{
par1World.func_94575_c(par2, par3 + 1, par4, Block.fire.blockID);
}
}
}
}
@Override
public boolean isBlockReplaceable (World world, int i, int j, int k)
{
return true;
}
@Override
public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, int par5)
{
this.tryToHarden(par1World, par2, par3, par4);
if (par1World.getBlockId(par2, par3, par4) == this.blockID)
{
this.unsetStationary(par1World, par2, par3, par4);
}
}
private void tryToHarden (World par1World, int par2, int par3, int par4)
{
if (par1World.getBlockId(par2, par3, par4) == this.blockID)
{
if (this.blockMaterial == Material.lava)
{
boolean var5 = false;
if (var5 || par1World.getBlockMaterial(par2, par3, par4 - 1) == Material.water)
{
var5 = true;
}
if (var5 || par1World.getBlockMaterial(par2, par3, par4 + 1) == Material.water)
{
var5 = true;
}
if (var5 || par1World.getBlockMaterial(par2 - 1, par3, par4) == Material.water)
{
var5 = true;
}
if (var5 || par1World.getBlockMaterial(par2 + 1, par3, par4) == Material.water)
{
var5 = true;
}
if (var5 || par1World.getBlockMaterial(par2, par3 + 1, par4) == Material.water)
{
var5 = true;
}
if (var5)
{
/*int var6 = par1World.getBlockMetadata(par2, par3, par4);
if (var6 == 0)
{
par1World.setBlockWithNotify(par2, par3, par4, Block.obsidian.blockID);
}
else if (var6 <= 4)
{
par1World.setBlockWithNotify(par2, par3, par4, Block.cobblestone.blockID);
}*/
this.triggerLavaMixEffects(par1World, par2, par3, par4);
}
}
}
}
/**
* Creates fizzing sound and smoke. Used when lava flows over block or mixes with water.
*/
protected void triggerLavaMixEffects (World par1World, int par2, int par3, int par4)
{
par1World.playSoundEffect((double) ((float) par2 + 0.5F), (double) ((float) par3 + 0.5F), (double) ((float) par4 + 0.5F), "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F);
for (int var5 = 0; var5 < 8; ++var5)
{
par1World.spawnParticle("largesmoke", (double) par2 + Math.random(), (double) par3 + 1.2D, (double) par4 + Math.random(), 0.0D, 0.0D, 0.0D);
}
}
private void unsetStationary (World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
world.setBlockAndMetadataWithNotify(x, y, z, this.blockID - 1, meta, 2);
world.scheduleBlockUpdate(x, y, z, this.blockID - 1, this.tickRate(world));
/*int meta = world.getBlockMetadata(x, y, z);
int tex = ((LiquidTextureLogic) world.getBlockTileEntity(x, y, z)).getLiquidType();
world.editingBlocks = true;
world.setBlockAndMetadata(x, y, z, flowingLiquidID(), meta);
world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
world.scheduleBlockUpdate(x, y, z, flowingLiquidID(), this.tickRate());
((LiquidTextureLogic) world.getBlockTileEntity(x, y, z)).setTexturePos(tex);
world.editingBlocks = false;*/
}
public boolean getBlocksMovement (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return this.blockMaterial != Material.lava;
}
/**
* Checks to see if the block is flammable.
*/
private boolean isFlammable (World par1World, int par2, int par3, int par4)
{
return par1World.getBlockMaterial(par2, par3, par4).getCanBurn();
}
@Override
public boolean hasTileEntity (int metadata)
{
return true;
}
@Override
public TileEntity createTileEntity (World world, int metadata)
{
return new LiquidTextureLogic();
}
}

View File

@ -0,0 +1,73 @@
package mods.tinker.tconstruct.client;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class AxleRender implements ISimpleBlockRenderingHandler
{
public static int axleModelID = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
renderer.setRenderBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F);
renderDo(renderer, block, metadata);
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
renderer.setRenderBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F);
renderer.renderStandardBlock(block, x, y, z);
return false;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return axleModelID;
}
private void renderDo(RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}

View File

@ -0,0 +1,74 @@
package mods.tinker.tconstruct.client;
import mods.tinker.common.fancyitem.FancyEntityItem;
import mods.tinker.tconstruct.logic.CastingTableLogic;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/* Special renderer, only used for drawing tools */
@SideOnly(Side.CLIENT)
public class CastingTableSpecialRenderer extends TileEntitySpecialRenderer
{
@Override
public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8)
{
//System.out.println("Render!!!");
this.render((CastingTableLogic) logic, var2, var4, var6, var8);
}
public void render (CastingTableLogic logic, double posX, double posY, double posZ, float var8)
{
GL11.glPushMatrix();
float var10 = (float) (posX - 0.5F);
float var11 = (float) (posY - 0.5F);
float var12 = (float) (posZ - 0.5F);
GL11.glTranslatef(var10, var11, var12);
this.func_82402_b(logic);
GL11.glPopMatrix();
}
private void func_82402_b (CastingTableLogic logic)
{
ItemStack stack = logic.getStackInSlot(0);
if (stack != null)
renderItem(logic, stack);
stack = logic.getStackInSlot(1);
if (stack != null)
renderItem(logic, stack);
}
void renderItem(CastingTableLogic logic, ItemStack stack)
{
FancyEntityItem entityitem = new FancyEntityItem(logic.worldObj, 0.0D, 0.0D, 0.0D, stack);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
GL11.glPushMatrix();
GL11.glTranslatef(1F, 1.478F, 0.55F);
GL11.glRotatef(90F, 1, 0F, 0F);
GL11.glScalef(2F, 2F, 2F);
if (stack.getItem() instanceof ItemBlock)
{
GL11.glRotatef(90F, -1, 0F, 0F);
GL11.glTranslatef(0F, -0.1F, 0.2275F);
}
RenderItem.field_82407_g = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.field_82407_g = false;
GL11.glPopMatrix();
}
}

View File

@ -0,0 +1,439 @@
package mods.tinker.tconstruct.client;
import mods.tinker.tconstruct.blocks.liquids.LiquidMetalBase;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFluid;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class FluidRender implements ISimpleBlockRenderingHandler
{
public static int fluidModel = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
//Inventory should be an item. renderer is not here!
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
return renderBlockFluids(renderer, world, block, x, y, z);
}
@Override
public boolean shouldRender3DInInventory ()
{
return false;
}
@Override
public int getRenderId ()
{
return fluidModel;
}
public boolean renderBlockFluids(RenderBlocks renderer, IBlockAccess world, Block block, int x, int y, int z)
{
Tessellator tessellator = Tessellator.instance;
int l = block.colorMultiplier(world, x, y, z);
float f = (float)(l >> 16 & 255) / 255.0F;
float f1 = (float)(l >> 8 & 255) / 255.0F;
float f2 = (float)(l & 255) / 255.0F;
boolean flag = block.shouldSideBeRendered(world, x, y + 1, z, 1);
boolean flag1 = block.shouldSideBeRendered(world, x, y - 1, z, 0);
boolean[] aboolean = new boolean[] {block.shouldSideBeRendered(world, x, y, z - 1, 2), block.shouldSideBeRendered(world, x, y, z + 1, 3), block.shouldSideBeRendered(world, x - 1, y, z, 4), block.shouldSideBeRendered(world, x + 1, y, z, 5)};
if (!flag && !flag1 && !aboolean[0] && !aboolean[1] && !aboolean[2] && !aboolean[3])
{
return false;
}
else
{
boolean flag2 = false;
float f3 = 0.5F;
float f4 = 1.0F;
float f5 = 0.8F;
float f6 = 0.6F;
double d0 = 0.0D;
double d1 = 1.0D;
Material material = block.blockMaterial;
int i1 = world.getBlockMetadata(x, y, z);
double d2 = (double)renderer.getFluidHeight(x, y, z, material);
double d3 = (double)renderer.getFluidHeight(x, y, z + 1, material);
double d4 = (double)renderer.getFluidHeight(x + 1, y, z + 1, material);
double d5 = (double)renderer.getFluidHeight(x + 1, y, z, material);
double d6 = 0.0010000000474974513D;
float f7;
if (renderer.renderAllFaces || flag)
{
flag2 = true;
Icon icon = renderer.func_94165_a(block, 1, i1);
float f8 = (float)BlockFluid.getFlowDirection(world, x, y, z, material);
if (f8 > -999.0F)
{
icon = renderer.func_94165_a(block, 2, i1);
}
d2 -= d6;
d3 -= d6;
d4 -= d6;
d5 -= d6;
double d7;
double d8;
double d9;
double d10;
double d11;
double d12;
double d13;
double d14;
if (f8 < -999.0F)
{
d8 = (double)icon.func_94214_a(0.0D);
d12 = (double)icon.func_94207_b(0.0D);
d7 = d8;
d11 = (double)icon.func_94207_b(16.0D);
d10 = (double)icon.func_94214_a(16.0D);
d14 = d11;
d9 = d10;
d13 = d12;
}
else
{
f7 = MathHelper.sin(f8) * 0.25F;
float f9 = MathHelper.cos(f8) * 0.25F;
d8 = (double)icon.func_94214_a((double)(8.0F + (-f9 - f7) * 16.0F));
d12 = (double)icon.func_94207_b((double)(8.0F + (-f9 + f7) * 16.0F));
d7 = (double)icon.func_94214_a((double)(8.0F + (-f9 + f7) * 16.0F));
d11 = (double)icon.func_94207_b((double)(8.0F + (f9 + f7) * 16.0F));
d10 = (double)icon.func_94214_a((double)(8.0F + (f9 + f7) * 16.0F));
d14 = (double)icon.func_94207_b((double)(8.0F + (f9 - f7) * 16.0F));
d9 = (double)icon.func_94214_a((double)(8.0F + (f9 - f7) * 16.0F));
d13 = (double)icon.func_94207_b((double)(8.0F + (-f9 - f7) * 16.0F));
}
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
f7 = 1.0F;
tessellator.setColorOpaque_F(f4 * f7 * f, f4 * f7 * f1, f4 * f7 * f2);
tessellator.addVertexWithUV((double)(x + 0), (double)y + d2, (double)(z + 0), d8, d12);
tessellator.addVertexWithUV((double)(x + 0), (double)y + d3, (double)(z + 1), d7, d11);
tessellator.addVertexWithUV((double)(x + 1), (double)y + d4, (double)(z + 1), d10, d14);
tessellator.addVertexWithUV((double)(x + 1), (double)y + d5, (double)(z + 0), d9, d13);
}
if (renderer.renderAllFaces || flag1)
{
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y - 1, z));
float f10 = 1.0F;
tessellator.setColorOpaque_F(f3 * f10, f3 * f10, f3 * f10);
renderer.renderBottomFace(block, (double)x, (double)y + d6, (double)z, renderer.func_94173_a(block, 0));
flag2 = true;
}
for (int j1 = 0; j1 < 4; ++j1)
{
int k1 = x;
int l1 = z;
if (j1 == 0)
{
l1 = z - 1;
}
if (j1 == 1)
{
++l1;
}
if (j1 == 2)
{
k1 = x - 1;
}
if (j1 == 3)
{
++k1;
}
Icon icon1 = renderer.func_94165_a(block, j1 + 2, i1);
if (renderer.renderAllFaces || aboolean[j1])
{
double d15;
double d16;
double d17;
double d18;
double d19;
double d20;
if (j1 == 0)
{
d15 = d2;
d17 = d5;
d16 = (double)x;
d18 = (double)(x + 1);
d19 = (double)z + d6;
d20 = (double)z + d6;
}
else if (j1 == 1)
{
d15 = d4;
d17 = d3;
d16 = (double)(x + 1);
d18 = (double)x;
d19 = (double)(z + 1) - d6;
d20 = (double)(z + 1) - d6;
}
else if (j1 == 2)
{
d15 = d3;
d17 = d2;
d16 = (double)x + d6;
d18 = (double)x + d6;
d19 = (double)(z + 1);
d20 = (double)z;
}
else
{
d15 = d5;
d17 = d4;
d16 = (double)(x + 1) - d6;
d18 = (double)(x + 1) - d6;
d19 = (double)z;
d20 = (double)(z + 1);
}
flag2 = true;
float f11 = icon1.func_94214_a(0.0D);
f7 = icon1.func_94214_a(8.0D);
int i2 = icon1.func_94216_b();
float f12 = icon1.func_94207_b((1.0D - d15) * 16.0D * 0.5D);
float f13 = icon1.func_94207_b((1.0D - d17) * 16.0D * 0.5D);
float f14 = icon1.func_94207_b(8.0D);
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, k1, y, l1));
float f15 = 1.0F;
if (j1 < 2)
{
f15 *= f5;
}
else
{
f15 *= f6;
}
tessellator.setColorOpaque_F(f4 * f15 * f, f4 * f15 * f1, f4 * f15 * f2);
tessellator.addVertexWithUV(d16, (double)y + d15, d19, (double)f11, (double)f12);
tessellator.addVertexWithUV(d18, (double)y + d17, d20, (double)f7, (double)f13);
tessellator.addVertexWithUV(d18, (double)(y + 0), d20, (double)f7, (double)f14);
tessellator.addVertexWithUV(d16, (double)(y + 0), d19, (double)f11, (double)f14);
}
}
renderer.renderMinY = d0;
renderer.renderMaxY = d1;
return flag2;
}
}
/*public boolean renderBlockFluids(RenderBlocks renderer, IBlockAccess world, Block block, int x, int y, int z)
{
Tessellator tessellator = Tessellator.instance;
int blockColor = block.colorMultiplier(world, x, y, z);
float var7 = (float)(blockColor >> 16 & 255) / 255.0F;
float var8 = (float)(blockColor >> 8 & 255) / 255.0F;
float var9 = (float)(blockColor & 255) / 255.0F;
boolean renderTop = block.shouldSideBeRendered(world, x, y + 1, z, 1);
boolean renderBottom = block.shouldSideBeRendered(world, x, y - 1, z, 0);
boolean[] var12 = new boolean[] {block.shouldSideBeRendered(world, x, y, z - 1, 2), block.shouldSideBeRendered(world, x, y, z + 1, 3), block.shouldSideBeRendered(world, x - 1, y, z, 4), block.shouldSideBeRendered(world, x + 1, y, z, 5)};
if (!renderTop && !renderBottom && !var12[0] && !var12[1] && !var12[2] && !var12[3])
{
return false;
}
else
{
boolean var13 = false;
float var14 = 0.5F;
float var15 = 1.0F;
float var16 = 0.8F;
float var17 = 0.6F;
double var18 = 0.0D;
double var20 = 1.0D;
Material var22 = block.blockMaterial;
//int var23 = world.getBlockMetadata(x, y, z);
double var24 = (double)renderer.getFluidHeight(x, y, z, var22);
double var26 = (double)renderer.getFluidHeight(x, y, z + 1, var22);
double var28 = (double)renderer.getFluidHeight(x + 1, y, z + 1, var22);
double var30 = (double)renderer.getFluidHeight(x + 1, y, z, var22);
double var32 = 0.0010000000474974513D;
int texturePos;
int textureBase = block.getBlockTexture(world, x, y, z, 0);
int var37;
if (renderer.renderAllFaces || renderTop)
{
var13 = true;
texturePos = block.getBlockTextureFromSide(1) + textureBase;
float var35 = (float)LiquidMetalBase.getFlowDirection(world, x, y, z, var22);
if (var35 > -999.0F)
{
texturePos = block.getBlockTextureFromSide(2) + textureBase;
}
var24 -= var32;
var26 -= var32;
var28 -= var32;
var30 -= var32;
int var36 = (texturePos & 15) << 4;
var37 = texturePos & 240;
double var38 = ((double)var36 + 8.0D) / 256.0D;
double var40 = ((double)var37 + 8.0D) / 256.0D;
if (var35 < -999.0F)
{
var35 = 0.0F;
}
else
{
var38 = (double)((float)(var36 + 16) / 256.0F);
var40 = (double)((float)(var37 + 16) / 256.0F);
}
double var42 = (double)(MathHelper.sin(var35) * 8.0F) / 256.0D;
double var44 = (double)(MathHelper.cos(var35) * 8.0F) / 256.0D;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
float var46 = 1.0F;
tessellator.setColorOpaque_F(var15 * var46 * var7, var15 * var46 * var8, var15 * var46 * var9);
tessellator.addVertexWithUV((double)(x + 0), (double)y + var24, (double)(z + 0), var38 - var44 - var42, var40 - var44 + var42);
tessellator.addVertexWithUV((double)(x + 0), (double)y + var26, (double)(z + 1), var38 - var44 + var42, var40 + var44 + var42);
tessellator.addVertexWithUV((double)(x + 1), (double)y + var28, (double)(z + 1), var38 + var44 + var42, var40 + var44 - var42);
tessellator.addVertexWithUV((double)(x + 1), (double)y + var30, (double)(z + 0), var38 + var44 - var42, var40 - var44 - var42);
}
if (renderer.renderAllFaces || renderBottom)
{
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y - 1, z));
float var65 = 1.0F;
tessellator.setColorOpaque_F(var14 * var65, var14 * var65, var14 * var65);
renderer.renderBottomFace(block, (double)x, (double)y + var32, (double)z, block.getBlockTextureFromSide(0));
var13 = true;
}
for (texturePos = 0; texturePos < 4; ++texturePos)
{
int var64 = x;
var37 = z;
if (texturePos == 0)
{
var37 = z - 1;
}
if (texturePos == 1)
{
++var37;
}
if (texturePos == 2)
{
var64 = x - 1;
}
if (texturePos == 3)
{
++var64;
}
int var66 = block.getBlockTextureFromSide(texturePos + 2) + textureBase;
int var39 = (var66 & 15) << 4;
int var67 = var66 & 240;
if (renderer.renderAllFaces || var12[texturePos])
{
double var43;
double var41;
double var47;
double var45;
double var51;
double var49;
if (texturePos == 0)
{
var41 = var24;
var43 = var30;
var45 = (double)x;
var49 = (double)(x + 1);
var47 = (double)z + var32;
var51 = (double)z + var32;
}
else if (texturePos == 1)
{
var41 = var28;
var43 = var26;
var45 = (double)(x + 1);
var49 = (double)x;
var47 = (double)(z + 1) - var32;
var51 = (double)(z + 1) - var32;
}
else if (texturePos == 2)
{
var41 = var26;
var43 = var24;
var45 = (double)x + var32;
var49 = (double)x + var32;
var47 = (double)(z + 1);
var51 = (double)z;
}
else
{
var41 = var30;
var43 = var28;
var45 = (double)(x + 1) - var32;
var49 = (double)(x + 1) - var32;
var47 = (double)z;
var51 = (double)(z + 1);
}
var13 = true;
double var53 = (double)((float)(var39 + 0) / 256.0F);
double var55 = ((double)(var39 + 16) - 0.01D) / 256.0D;
double var57 = ((double)var67 + (1.0D - var41) * 16.0D) / 256.0D;
double var59 = ((double)var67 + (1.0D - var43) * 16.0D) / 256.0D;
double var61 = ((double)(var67 + 16) - 0.01D) / 256.0D;
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, var64, y, var37));
float var63 = 1.0F;
if (texturePos < 2)
{
var63 *= var16;
}
else
{
var63 *= var17;
}
tessellator.setColorOpaque_F(var15 * var63 * var7, var15 * var63 * var8, var15 * var63 * var9);
tessellator.addVertexWithUV(var45, (double)y + var41, var47, var53, var57);
tessellator.addVertexWithUV(var49, (double)y + var43, var51, var55, var59);
tessellator.addVertexWithUV(var49, (double)(y + 0), var51, var55, var61);
tessellator.addVertexWithUV(var45, (double)(y + 0), var47, var53, var61);
}
}
renderer.renderMinY = var18;
renderer.renderMaxY = var20;
return var13;
}
}*/
}

View File

@ -0,0 +1,47 @@
package mods.tinker.tconstruct.client;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class FrypanRender implements ISimpleBlockRenderingHandler
{
public static int frypanModelID = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
//Inventory should be an item. This is not here!
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.125F, 0.0F, 0.125F, 0.25F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.125F, 0.125F, 0.875F, 0.875F, 0.25F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.875F, 0.125F, 0.0F, 1.0F, 0.25F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.25F, 0.125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(1F, 0.0F, 0.4375F, 2F, 0.125F, 0.5625F);
renderer.renderStandardBlock(block, x, y, z);
return false;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return frypanModelID;
}
}

View File

@ -0,0 +1,270 @@
package mods.tinker.tconstruct.client;
import mods.tinker.common.BlockSkinRenderHelper;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.logic.CastingTableLogic;
import mods.tinker.tconstruct.logic.FaucetLogic;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.ForgeHooksClient;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class SearedRender implements ISimpleBlockRenderingHandler
{
public static int searedModel = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == searedModel)
{
if (metadata == 0)
{
//Top
renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
renderDo(renderer, block, metadata);
//Lip
renderer.setRenderBounds(0.0F, 0.9375, 0.0F, 0.0625, 1.0, 1.0F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.0625, 0.9375, 0.9375, 0.9375, 1.0, 1.0F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.9375, 0.9375, 0.0F, 1.0F, 1.0, 1.0F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.0625, 0.9375, 0.0F, 0.9375, 1.0, 0.0625);
renderDo(renderer, block, metadata);
//Legs
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.625F, 0.3125F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.6875, 0.0F, 0.0F, 1.0F, 0.625F, 0.25F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.6875, 0.3125F, 0.625F, 1.0F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
renderDo(renderer, block, metadata);
}
else
{
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.75, 0.375, 1);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.375, 0.625, 1);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.625, 0.25, 0.625, 0.75, 0.625, 1);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.375, 0.375, 0.625, 0.625, 0.625, 1);
}
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == searedModel)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0)
{
//Top
renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
//Lip
renderer.setRenderBounds(0.0F, 0.9375, 0.0F, 0.0625, 1.0, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0625, 0.9375, 0.9375, 0.9375, 1.0, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.9375, 0.9375, 0.0F, 1.0F, 1.0, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0625, 0.9375, 0.0F, 0.9375, 1.0, 0.0625);
renderer.renderStandardBlock(block, x, y, z);
//Legs
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.625F, 0.3125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.6875, 0.0F, 0.0F, 1.0F, 0.625F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.6875, 0.3125F, 0.625F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
/*CastingTableLogic logic = (CastingTableLogic) world.getBlockTileEntity(x, y, z);
if (logic.liquid != null)
{
float height = logic.liquid.amount / (logic.getCapacity() * 1.03F) / 16F;
renderer.setRenderBounds(0.0625F, 0.9375F, 0.0625F, 0.9375F, 0.9375F + height, 0.9375F);
if (logic.liquid.itemID < 4096) //Block
{
Block liquidBlock = Block.blocksList[logic.liquid.itemID];
if (liquidBlock != null)
{
ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, logic.liquid.itemMeta, x, y, z, renderer, world);
}
}
else
//Item
{
Item liquidItem = Item.itemsList[logic.liquid.itemID];
if (liquidItem != null)
{
ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(logic.liquid.itemMeta), logic.liquid.itemMeta, x, y, z, renderer, world);
}
}
}*/
}
else if (metadata == 1)
{
FaucetLogic logic = (FaucetLogic) world.getBlockTileEntity(x, y, z);
float xMin = 0.375F, zMin = 0.375F, xMax = 0.625F, zMax = 0.625F;
switch (logic.getRenderDirection())
{
case 2:
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.75, 0.375, 1);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.25, 0.375, 0.625, 0.375, 0.625, 1);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625, 0.375, 0.625, 0.75, 0.625, 1);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.375, 0.375, 0.625, 0.625, 0.625, 1);
xMax = 0.5F;
//zMin = 0.625F;
break;
case 3:
renderer.setRenderBounds(0.25, 0.25, 0, 0.75, 0.375, 0.375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.25, 0.375, 0, 0.375, 0.625, 0.375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625, 0.375, 0, 0.75, 0.625, 0.375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.375, 0.375, 0, 0.625, 0.625, 0.375);
zMax = 0.5F;
break;
case 4:
renderer.setRenderBounds(0.625, 0.25, 0.25, 1, 0.375, 0.75);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625, 0.375, 0.25, 1, 0.625, 0.375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625, 0.375, 0.625, 1, 0.625, 0.75);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625, 0.375, 0.375, 1, 0.625, 0.625);
xMin = 0.5F;
break;
case 5:
renderer.setRenderBounds(0, 0.25, 0.25, 0.375, 0.375, 0.75);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0.375, 0.25, 0.375, 0.625, 0.375);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0.375, 0.625, 0.375, 0.625, 0.75);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0, 0.375, 0.375, 0.325, 0.625, 0.625);
zMin = 0.5F;
break;
}
float yMin = 0F;
int uID = world.getBlockId(x, y-1, z);
int uMeta = world.getBlockMetadata(x, y-1, z);
if (uID == TContent.searedBlock.blockID && uMeta == 0)
{
yMin = -0.125F;
}
else if (uID == TContent.lavaTank.blockID)
{
yMin = -1F;
}
/*if (logic.liquid != null)
{
ItemStack blockToRender = new ItemStack(logic.liquid.itemID, 1, logic.liquid.itemMeta);
if (blockToRender.itemID < 4096) //Block
{
Block liquidBlock = Block.blocksList[blockToRender.itemID];
ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, blockToRender.getItemDamage(), x, y, z, renderer, world);
renderer.setRenderBounds(xMin, yMin, zMin, xMax, 0.625, zMax);
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, blockToRender.getItemDamage(), x, y, z, renderer, world);
}
else
//Item
{
Item liquidItem = Item.itemsList[blockToRender.itemID];
ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
int meta = blockToRender.getItemDamage();
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(meta), meta, x, y, z, renderer, world);
renderer.setRenderBounds(xMin, yMin, zMin, xMax, 0.625, zMax);
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(meta), meta, x, y, z, renderer, world);
}
//renderer.renderStandardBlock(block, x, y, z);
}*/
}
else
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
}
return false;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return searedModel;
}
private void renderDo (RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,204 @@
package mods.tinker.tconstruct.client;
import mods.tinker.common.BlockSkinRenderHelper;
import mods.tinker.tconstruct.crafting.Smeltery;
import mods.tinker.tconstruct.logic.SmelteryLogic;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class SmelteryRender implements ISimpleBlockRenderingHandler
{
public static int smelteryModel = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == smelteryModel)
{
renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == smelteryModel)
{
if (world.getBlockMetadata(x, y, z) == 0)
return renderSmeltery(world, x, y, z, block, modelID, renderer);
else
renderer.renderStandardBlock(block, x, y, z);
}
return false;
}
public boolean renderSmeltery (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
renderer.renderStandardBlock(block, x, y, z);
return true;
/*SmelteryLogic logic = (SmelteryLogic) world.getBlockTileEntity(x, y, z);
if (logic.validStructure)
{
int posX = logic.centerPos.x - 1, posY = logic.centerPos.y, posZ = logic.centerPos.z - 1;
//Melting
for (int i = 0; i < logic.layers; i++)
{
renderLayer(logic, i*9, posX, posY+i, posZ, renderer, world);
//System.out.println("layers:"+logic.layers);
ItemStack input = logic.getStackInSlot(i);
if (input != null && logic.getTempForSlot(i) > 20)
{
ItemStack blockToRender = Smeltery.getRenderIndex(input);
float blockHeight = input.stackSize / (float) blockToRender.stackSize;
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, MathHelper.clamp_float(blockHeight, 0.01F, 1.0F), 1.0F);
if (blockToRender.itemID < 4096) //Block
{
Block liquidBlock = Block.blocksList[blockToRender.itemID];
ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, blockToRender.getItemDamage(), posX + i % 3, posY + i / 9, posZ + i / 3, renderer, world);
}
else
//Item
{
Item liquidItem = Item.itemsList[blockToRender.itemID];
ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
int metadata = blockToRender.getItemDamage();
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(metadata), metadata, posX, posY + i / 9, posZ, renderer, world);
}
}
}
//Liquids
float base = 0F;
int yBase = 0;
int liquidBase = 0;
for (LiquidStack liquid : logic.moltenMetal)
{
int liquidSize = liquid.amount;
while (liquidSize > 0)
{
int room = 20000 - liquidBase;
int countSize = liquidSize > room ? room : liquidSize;
liquidSize -= countSize;
float height = countSize > 20000 ? 1.0F : countSize / 20000F;
renderer.setRenderBounds(0, base, 0, 1, height + base, 1);
base += height;
liquidBase += countSize;
if (liquid.itemID < 4096) //Block
{
Block liquidBlock = Block.blocksList[liquid.itemID];
ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
for (int i = 0; i < 9; i++)
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, liquid.itemMeta, posX + i % 3, posY+yBase, posZ + i / 3, renderer, world);
}
else
//Item
{
Item liquidItem = Item.itemsList[liquid.itemID];
ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
for (int i = 0; i < 9; i++)
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(liquid.itemMeta), liquid.itemMeta, posX, posY+yBase, posZ, renderer, world);
}
if (countSize == room)
{
base = 0F;
yBase++;
liquidBase = 0;
}
}
}
}
return false;*/
}
/*void renderLayer(SmelteryLogic logic, int start, int posX, int posY, int posZ, RenderBlocks renderer, IBlockAccess world)
{
renderer.setRenderBounds(-0.001F, -0.001F, -0.001F, 1.001F, 1.001F, 1.001F);
for (int i = 0; i < 9; i++)
{
//System.out.println("layers:"+logic.layers);
ItemStack input = logic.getStackInSlot(i+start);
if (input != null && logic.getTempForSlot(i+start) > 20)
{
ItemStack blockToRender = Smeltery.getRenderIndex(input);
float blockHeight = input.stackSize / (float) blockToRender.stackSize;
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, MathHelper.clamp_float(blockHeight, 0.01F, 1.0F), 1.0F);
if (blockToRender.itemID < 4096) //Block
{
Block liquidBlock = Block.blocksList[blockToRender.itemID];
ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, blockToRender.getItemDamage(), posX + i % 3, posY, posZ + i / 3, renderer, world);
}
else
//Item
{
Item liquidItem = Item.itemsList[blockToRender.itemID];
ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
int metadata = blockToRender.getItemDamage();
BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(metadata), metadata, posX + i % 3, posY, posZ + i / 3, renderer, world);
}
}
}
}*/
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return smelteryModel;
}
private void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}

View File

@ -0,0 +1,500 @@
package mods.tinker.tconstruct.client;
import java.util.Random;
import mods.tinker.tconstruct.tools.ToolCore;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderEngine;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.client.TextureFXManager;
public class SuperCustomToolRenderer implements IItemRenderer
{
RenderEngine renderEngine;
RenderManager renderManager;
Random random;
public SuperCustomToolRenderer()
{
renderEngine = Minecraft.getMinecraft().renderEngine;
renderManager = renderManager.instance;
random = new Random();
}
@Override
public boolean handleRenderType (ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
if (type == ItemRenderType.EQUIPPED || (type == ItemRenderType.ENTITY && helper == ItemRendererHelper.ENTITY_BOBBING))
return true;
else
return false;
}
@Override
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
{
/*if (type == ItemRenderType.INVENTORY)
renderInventoryItem(item, (RenderBlocks) data[0]);
if (type == ItemRenderType.EQUIPPED)
renderEquippedItem(item, (RenderBlocks) data[0], (EntityLiving) data[1]);
if (type == ItemRenderType.ENTITY)
renderEntityItem(item, (RenderBlocks) data[0], (EntityItem) data[1]);*/
}
/* Inventory */
/*void renderInventoryItem (ItemStack stack, RenderBlocks renderer)
{
ToolCore tool = (ToolCore) stack.getItem();
//int itemID = stack.itemID;
int itemDamage = stack.getItemDamage();
float var16;
GL11.glDisable(GL11.GL_LIGHTING);
for (int renderPass = 0; renderPass < tool.getRenderPasses(itemDamage); renderPass++)
{
String texturePath = tool.getIconLocation(stack, renderPass);
renderEngine.func_98187_b(texturePath);
GL11.glScalef(0.0625F, 0.0625F, 1F);
this.renderTexturedQuad();
GL11.glScalef(16F, 16F, 1F);
}
for (int renderPass = 0; renderPass < 3; renderPass++)
{
String texturePath = tool.getEffectLocation(stack, renderPass);
renderEngine.func_98187_b(texturePath);
GL11.glScalef(0.0625F, 0.0625F, 1F);
this.renderTexturedQuad();
GL11.glScalef(16F, 16F, 1F);
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
}
double zLevel = 50;
/**
* Adds a textured quad to the tesselator at the specified position with the specified texture coords, width and
* height. Args: x, y, u, v, width, height
*/
/*public void renderTexturedQuad()
{
int x = 0, y = 0, u = 0, v = 0, height = 256, width = 256;
float var7 = 0.00390625F;
float var8 = 0.00390625F;
Tessellator var9 = Tessellator.instance;
var9.startDrawingQuads();
var9.addVertexWithUV((double)(x + 0), (double)(y + height), (double)this.zLevel, (double)((float)(u + 0) * var7), (double)((float)(v + height) * var8));
var9.addVertexWithUV((double)(x + width), (double)(y + height), (double)this.zLevel, (double)((float)(u + width) * var7), (double)((float)(v + height) * var8));
var9.addVertexWithUV((double)(x + width), (double)(y + 0), (double)this.zLevel, (double)((float)(u + width) * var7), (double)((float)(v + 0) * var8));
var9.addVertexWithUV((double)(x + 0), (double)(y + 0), (double)this.zLevel, (double)((float)(u + 0) * var7), (double)((float)(v + 0) * var8));
var9.draw();
}
boolean shouldSpreadItems ()
{
return true;
}
/* Equipped */
/*void renderEquippedItem (ItemStack stack, RenderBlocks renderer, EntityLiving living)
{
for (int x = 0; x < stack.getItem().getRenderPasses(stack.getItemDamage()); x++)
{
this.doRenderEquippedItem(stack, living, x, true);
}
for (int x = 0; x < 3; x++)
{
this.doRenderEquippedItem(stack, living, x, false);
}
}
void doRenderEquippedItem (ItemStack stack, EntityLiving living, int renderPass, boolean baseSprite)
{
GL11.glPushMatrix();
Tessellator var5 = Tessellator.instance;
String texturePath = null;
if (baseSprite)
texturePath = ((ToolCore)stack.getItem()).getIconLocation(stack, renderPass);
else
texturePath = ((ToolCore)stack.getItem()).getEffectLocation(stack, renderPass);
renderEngine.func_98187_b(texturePath);
float var7 = 0;
float var8 = 1;
float var9 = 0;
float var10 = 1;
float var11 = 0.0F;
float var12 = 0.3F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(-var11, -var12, 0.0F);
float var13 = 1.5F;
GL11.glScalef(var13, var13, var13);
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-1.1875f, 0.25F, 0.45F); //Edited to position properly
renderItemIn2D(var5, var8, var9, var7, var10, 0.0625F);
if (stack != null && stack.hasEffect() && !baseSprite && renderPass == 2)
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
renderEngine.bindTexture(renderEngine.getTexture("%blur%/misc/glint.png"));
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float var14 = 0.76F;
GL11.glColor4f(0.5F * var14, 0.25F * var14, 0.8F * var14, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float var15 = 0.125F;
GL11.glScalef(var15, var15, var15);
float var16 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(var16, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
renderItemIn2D(var5, 0.0F, 0.0F, 1.0F, 1.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(var15, var15, var15);
var16 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-var16, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
renderItemIn2D(var5, 0.0F, 0.0F, 1.0F, 1.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
public static void renderItemIn2D (Tessellator par0Tessellator, float par1, float par2, float par3, float par4, float par5)
{
float var6 = 1.0F;
//GL11.glScalef(0.0625F, 0.0625F, 1F);
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 0.0F, 1.0F);
par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) par1, (double) par4);
par0Tessellator.addVertexWithUV((double) var6, 0.0D, 0.0D, (double) par3, (double) par4);
par0Tessellator.addVertexWithUV((double) var6, 1.0D, 0.0D, (double) par3, (double) par2);
par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, (double) par1, (double) par2);
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 0.0F, -1.0F);
par0Tessellator.addVertexWithUV(0.0D, 1.0D, (double) (0.0F - par5), (double) par1, (double) par2);
par0Tessellator.addVertexWithUV((double) var6, 1.0D, (double) (0.0F - par5), (double) par3, (double) par2);
par0Tessellator.addVertexWithUV((double) var6, 0.0D, (double) (0.0F - par5), (double) par3, (double) par4);
par0Tessellator.addVertexWithUV(0.0D, 0.0D, (double) (0.0F - par5), (double) par1, (double) par4);
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(-1.0F, 0.0F, 0.0F);
int var7;
float var8;
float var9;
float var10;
int tileSize = TextureFXManager.instance().getTextureDimensions(GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D)).width;
float tx = 1.0f / (32 * tileSize);
float tz = 1.0f / tileSize;
for (var7 = 0; var7 < tileSize; ++var7)
{
var8 = (float) var7 / tileSize;
var9 = par1 + (par3 - par1) * var8 - tx;
var10 = var6 * var8;
par0Tessellator.addVertexWithUV((double) var10, 0.0D, (double) (0.0F - par5), (double) var9, (double) par4);
par0Tessellator.addVertexWithUV((double) var10, 0.0D, 0.0D, (double) var9, (double) par4);
par0Tessellator.addVertexWithUV((double) var10, 1.0D, 0.0D, (double) var9, (double) par2);
par0Tessellator.addVertexWithUV((double) var10, 1.0D, (double) (0.0F - par5), (double) var9, (double) par2);
}
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(1.0F, 0.0F, 0.0F);
for (var7 = 0; var7 < tileSize; ++var7)
{
var8 = (float) var7 / tileSize;
var9 = par1 + (par3 - par1) * var8 - tx;
var10 = var6 * var8 + tz;
par0Tessellator.addVertexWithUV((double) var10, 1.0D, (double) (0.0F - par5), (double) var9, (double) par2);
par0Tessellator.addVertexWithUV((double) var10, 1.0D, 0.0D, (double) var9, (double) par2);
par0Tessellator.addVertexWithUV((double) var10, 0.0D, 0.0D, (double) var9, (double) par4);
par0Tessellator.addVertexWithUV((double) var10, 0.0D, (double) (0.0F - par5), (double) var9, (double) par4);
}
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 1.0F, 0.0F);
for (var7 = 0; var7 < tileSize; ++var7)
{
var8 = (float) var7 / tileSize;
var9 = par4 + (par2 - par4) * var8 - tx;
var10 = var6 * var8 + tz;
par0Tessellator.addVertexWithUV(0.0D, (double) var10, 0.0D, (double) par1, (double) var9);
par0Tessellator.addVertexWithUV((double) var6, (double) var10, 0.0D, (double) par3, (double) var9);
par0Tessellator.addVertexWithUV((double) var6, (double) var10, (double) (0.0F - par5), (double) par3, (double) var9);
par0Tessellator.addVertexWithUV(0.0D, (double) var10, (double) (0.0F - par5), (double) par1, (double) var9);
}
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, -1.0F, 0.0F);
for (var7 = 0; var7 < tileSize; ++var7)
{
var8 = (float) var7 / tileSize;
var9 = par4 + (par2 - par4) * var8 - tx;
var10 = var6 * var8;
par0Tessellator.addVertexWithUV((double) var6, (double) var10, 0.0D, (double) par3, (double) var9);
par0Tessellator.addVertexWithUV(0.0D, (double) var10, 0.0D, (double) par1, (double) var9);
par0Tessellator.addVertexWithUV(0.0D, (double) var10, (double) (0.0F - par5), (double) par1, (double) var9);
par0Tessellator.addVertexWithUV((double) var6, (double) var10, (double) (0.0F - par5), (double) par3, (double) var9);
}
par0Tessellator.draw();
//GL11.glScalef(16F, 16F, 1F);
}
/* Entity */
/*void renderEntityItem (ItemStack stack, RenderBlocks renderer, EntityItem entity)
{
this.random.setSeed(187L);
ItemStack var10 = entity.func_92014_d();
ToolCore tool = (ToolCore) var10.getItem();
if (var10.getItem() != null)
{
GL11.glPushMatrix();
float var11 = shouldBob() ? MathHelper.sin(((float) entity.age) / 10.0F + entity.hoverStart) * 0.1F + 0.1F : 0F;
float var12 = (((float) entity.age) / 20.0F + entity.hoverStart) * (180F / (float) Math.PI);
byte var13 = getMiniBlockCountForItemStack(var10);
//GL11.glTranslatef((float) par2, (float) par4 + var11, (float) par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
int renderIndex;
float var19;
float var20;
float var24;
int renderPass;
float var17;
for (renderPass = 0; renderPass < tool.getRenderPasses(var10.getItemDamage()); ++renderPass)
{
this.random.setSeed(187L);
var17 = 1.0F;
String texturePath = tool.getIconLocation(var10, renderPass);
renderEngine.func_98187_b(texturePath);
int var18 = Item.itemsList[tool.itemID].getColorFromItemStack(var10, renderPass);
var19 = (float) (var18 >> 16 & 255) / 255.0F;
var20 = (float) (var18 >> 8 & 255) / 255.0F;
float var21 = (float) (var18 & 255) / 255.0F;
GL11.glColor4f(var19 * var17, var20 * var17, var21 * var17, 1.0F);
this.func_77020_a(entity, 0, var13, 0, var19 * var17, var20 * var17, var21 * var17, renderPass, true);
}
for (renderPass = 0; renderPass < 3; ++renderPass)
{
this.random.setSeed(187L);
var17 = 1.0F;
String texturePath = tool.getEffectLocation(var10, renderPass);
renderEngine.func_98187_b(texturePath);
int var18 = Item.itemsList[tool.itemID].getColorFromItemStack(var10, renderPass);
var19 = (float) (var18 >> 16 & 255) / 255.0F;
var20 = (float) (var18 >> 8 & 255) / 255.0F;
float var21 = (float) (var18 & 255) / 255.0F;
GL11.glColor4f(var19 * var17, var20 * var17, var21 * var17, 1.0F);
this.func_77020_a(entity, 0, var13, 0, var19 * var17, var20 * var17, var21 * var17, renderPass, false);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
boolean shouldBob ()
{
return true;
}
public byte getMiniBlockCountForItemStack (ItemStack stack)
{
byte var13 = 1;
if (stack.stackSize > 1)
{
var13 = 2;
}
if (stack.stackSize > 5)
{
var13 = 3;
}
if (stack.stackSize > 20)
{
var13 = 4;
}
if (stack.stackSize > 40)
{
var13 = 5;
}
return var13;
}
private void func_77020_a (EntityItem par1EntityItem, int par2, int par3, float par4, float par5, float par6, float par7, int renderPass, boolean baseSprite)
{
Tessellator var8 = Tessellator.instance;
float var9 = 0;
float var10 = 1f;
float var11 = 0;
float var12 = 1f;
float var13 = 1.0F;
float var14 = 0.5F;
float var15 = 0.25F;
float var17;
if (this.renderManager.options.fancyGraphics)
{
GL11.glPushMatrix();
GL11.glRotatef((((float) par1EntityItem.age + par4) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
float var16 = 0.0625F;
var17 = 0.021875F;
ItemStack stack = par1EntityItem.func_92014_d();
ToolCore tool = (ToolCore) stack.getItem();
int var19 = stack.stackSize;
byte var24 = getMiniBlockCountForItemStack(stack);
GL11.glTranslatef(-var14, -var15, -((var16 + var17) * (float) var24 / 2.0F));
for (int var20 = 0; var20 < var24; ++var20)
{
// Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
if (var20 > 0 && shouldSpreadItems())
{
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
GL11.glTranslatef(x, y, var16 + var17);
}
else
{
GL11.glTranslatef(0f, 0f, var16 + var17);
}
//String texturePath = tool.getIconLocation(stack, renderPass);
String texturePath = null;
if (baseSprite)
texturePath = ((ToolCore)stack.getItem()).getIconLocation(stack, renderPass);
else
texturePath = ((ToolCore)stack.getItem()).getEffectLocation(stack, renderPass);
renderEngine.func_98187_b(texturePath);
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(var8, var10, var11, var9, var12, var16);
if (stack != null && stack.hasEffect())
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
this.renderManager.renderEngine.bindTexture(this.renderManager.renderEngine.getTexture("%blur%/misc/glint.png"));
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float var21 = 0.76F;
GL11.glColor4f(0.5F * var21, 0.25F * var21, 0.8F * var21, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float var22 = 0.125F;
GL11.glScalef(var22, var22, var22);
float var23 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(var23, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(var8, 0.0F, 0.0F, 1.0F, 1.0F, var16);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(var22, var22, var22);
var23 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-var23, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(var8, 0.0F, 0.0F, 1.0F, 1.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
}
GL11.glPopMatrix();
}
else
{
for (int var25 = 0; var25 < par3; ++var25)
{
GL11.glPushMatrix();
if (var25 > 0)
{
var17 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F;
float var27 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F;
float var26 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F;
GL11.glTranslatef(var17, var27, var26);
}
if (!false)
{
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
}
GL11.glColor4f(par5, par6, par7, 1.0F);
var8.startDrawingQuads();
var8.setNormal(0.0F, 1.0F, 0.0F);
var8.addVertexWithUV((double) (0.0F - var14), (double) (0.0F - var15), 0.0D, (double) var9, (double) var12);
var8.addVertexWithUV((double) (var13 - var14), (double) (0.0F - var15), 0.0D, (double) var10, (double) var12);
var8.addVertexWithUV((double) (var13 - var14), (double) (1.0F - var15), 0.0D, (double) var10, (double) var11);
var8.addVertexWithUV((double) (0.0F - var14), (double) (1.0F - var15), 0.0D, (double) var9, (double) var11);
var8.draw();
GL11.glPopMatrix();
}
}
}*/
}

View File

@ -0,0 +1,40 @@
package mods.tinker.tconstruct.client;
import mods.tinker.tconstruct.TConstructRegistry;
import mods.tinker.tconstruct.tools.ToolCore;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
public class TConstructClientRegistry
{
public static TextureMap itemMap = Minecraft.getMinecraft().renderEngine.field_94155_m;
public static void addMaterialRenderMapping (int materialID, String domain, String renderName, boolean useDefaultFolder)
{
for (ToolCore tool : TConstructRegistry.getToolMapping())
{
String[] toolIcons = new String[tool.getPartAmount() + 1];
for (int i = 0; i < tool.getPartAmount() + 1; i++)
{
String icon = domain + ":";
if (useDefaultFolder)
icon += tool.getDefaultFolder()+"/";
icon += renderName + tool.getIconSuffix(i);
toolIcons[i] = icon;
}
tool.registerPartPaths(materialID, toolIcons);
}
}
public static void addEffectRenderMapping (int materialID, String domain, String renderName, boolean useDefaultFolder)
{
for (ToolCore tool : TConstructRegistry.getToolMapping())
{
String icon = domain + ":";
if (useDefaultFolder)
icon += tool.getDefaultFolder()+"/";
icon += renderName + tool.getEffectSuffix();
tool.registerEffectPath(materialID, icon);
}
}
}

View File

@ -0,0 +1,119 @@
package mods.tinker.tconstruct.client;
import java.util.EnumSet;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
public abstract class TKeyHandler implements ITickHandler
{
protected KeyBinding[] keyBindings;
protected boolean[] keyDown;
protected boolean[] repeatings;
private boolean isDummy;
/**
* Pass an array of keybindings and a repeat flag for each one
*
* @param keyBindings
* @param repeatings
*/
public TKeyHandler(KeyBinding[] keyBindings, boolean[] repeatings)
{
assert keyBindings.length == repeatings.length : "You need to pass two arrays of identical length";
this.keyBindings = keyBindings;
this.repeatings = repeatings;
this.keyDown = new boolean[keyBindings.length];
}
/**
* Register the keys into the system. You will do your own keyboard management elsewhere. No events will fire
* if you use this method
*
* @param keyBindings
*/
public TKeyHandler(KeyBinding[] keyBindings)
{
this.keyBindings = keyBindings;
this.isDummy = true;
}
public KeyBinding[] getKeyBindings()
{
return this.keyBindings;
}
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
keyTick(type, false);
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
keyTick(type, true);
}
private void keyTick(EnumSet<TickType> type, boolean tickEnd)
{
for (int i = 0; i < keyBindings.length; i++)
{
KeyBinding keyBinding = keyBindings[i];
int keyCode = keyBinding.keyCode;
boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode));
if (state != keyDown[i] || (state && repeatings[i]))
{
if (state)
{
keyDown(type, keyBinding, tickEnd, state!=keyDown[i]);
}
else
{
keyUp(type, keyBinding, tickEnd);
}
if (tickEnd)
{
keyDown[i] = state;
}
}
}
}
/**
* Called when the key is first in the down position on any tick from the {@link #ticks()}
* set. Will be called subsequently with isRepeat set to true
*
* @see #keyUp(EnumSet, KeyBinding, boolean)
*
* @param types the type(s) of tick that fired when this key was first down
* @param tickEnd was it an end or start tick which fired the key
* @param isRepeat is it a repeat key event
*/
public abstract void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat);
/**
* Fired once when the key changes state from down to up
*
* @see #keyDown(EnumSet, KeyBinding, boolean, boolean)
*
* @param types the type(s) of tick that fired when this key was first down
* @param tickEnd was it an end or start tick which fired the key
*/
public abstract void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd);
/**
* This is the list of ticks for which the key binding should trigger. The only
* valid ticks are client side ticks, obviously.
*
* @see cpw.mods.fml.common.ITickHandler#ticks()
*/
public abstract EnumSet<TickType> ticks();
}

View File

@ -0,0 +1,403 @@
package mods.tinker.tconstruct.client;
import java.io.File;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import mods.tinker.common.fancyitem.FancyEntityItem;
import mods.tinker.common.fancyitem.FancyItemRender;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.TConstructRegistry;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.TControls;
import mods.tinker.tconstruct.TProxyCommon;
import mods.tinker.tconstruct.client.entityrender.CartRender;
import mods.tinker.tconstruct.client.entityrender.CrystalRender;
import mods.tinker.tconstruct.client.entityrender.SkylaRender;
import mods.tinker.tconstruct.client.gui.ToolGuiElement;
import mods.tinker.tconstruct.entity.CartEntity;
import mods.tinker.tconstruct.entity.Crystal;
import mods.tinker.tconstruct.entity.Skyla;
import mods.tinker.tconstruct.logic.CastingTableLogic;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import org.w3c.dom.Document;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class TProxyClient extends TProxyCommon
{
public static SmallFontRenderer smallFontRenderer;
public static Icon blankSprite;
/* Registers any rendering code. */
public void registerRenderer ()
{
Minecraft mc = Minecraft.getMinecraft();
smallFontRenderer = new SmallFontRenderer(mc.gameSettings, "/font/default.png", mc.renderEngine, false);
RenderingRegistry.registerBlockHandler(new TableRender());
RenderingRegistry.registerBlockHandler(new FrypanRender());
RenderingRegistry.registerBlockHandler(new SmelteryRender());
RenderingRegistry.registerBlockHandler(new TankRender());
RenderingRegistry.registerBlockHandler(new SearedRender());
RenderingRegistry.registerBlockHandler(new FluidRender());
//RenderingRegistry.registerBlockHandler(new AxleRender());
/*RenderEngine renderEngine = FMLClientHandler.instance().getClient().renderEngine;
renderEngine.registerTextureFX(new LiquidIronFX());
renderEngine.registerTextureFX(new LiquidIronFlowFX());
renderEngine.registerTextureFX(new LiquidGoldFX());
renderEngine.registerTextureFX(new LiquidGoldFlowFX());
renderEngine.registerTextureFX(new LiquidCopperFX());
renderEngine.registerTextureFX(new LiquidCopperFlowFX());
renderEngine.registerTextureFX(new LiquidTinFX());
renderEngine.registerTextureFX(new LiquidTinFlowFX());
renderEngine.registerTextureFX(new LiquidAluminumFX());
renderEngine.registerTextureFX(new LiquidAluminumFlowFX());
renderEngine.registerTextureFX(new LiquidCobaltFX());
renderEngine.registerTextureFX(new LiquidCobaltFlowFX());
renderEngine.registerTextureFX(new LiquidArditeFX());
renderEngine.registerTextureFX(new LiquidArditeFlowFX());
renderEngine.registerTextureFX(new LiquidBronzeFX());
renderEngine.registerTextureFX(new LiquidBronzeFlowFX());
renderEngine.registerTextureFX(new LiquidAlBrassFX());
renderEngine.registerTextureFX(new LiquidAlBrassFlowFX());
renderEngine.registerTextureFX(new LiquidManyullynFX());
renderEngine.registerTextureFX(new LiquidManyullynFlowFX());
renderEngine.registerTextureFX(new LiquidAlumiteFX());
renderEngine.registerTextureFX(new LiquidAlumiteFlowFX());
renderEngine.registerTextureFX(new LiquidObsidianFX());
renderEngine.registerTextureFX(new LiquidObsidianFlowFX());
renderEngine.registerTextureFX(new LiquidSteelFX());
renderEngine.registerTextureFX(new LiquidSteelFlowFX());
//Metallurgy
renderEngine.registerTextureFX(new LiquidManganeseFX());
renderEngine.registerTextureFX(new LiquidManganeseFlowFX());
renderEngine.registerTextureFX(new LiquidHeptazionFX());
renderEngine.registerTextureFX(new LiquidHeptazionFlowFX());
renderEngine.registerTextureFX(new LiquidDamascusSteelFX());
renderEngine.registerTextureFX(new LiquidDamascusSteelFlowFX());
renderEngine.registerTextureFX(new LiquidAngmallenFX());
renderEngine.registerTextureFX(new LiquidAngmallenFlowFX());*/
//Tools
//MinecraftForgeClient.preloadTexture(TContent.blockTexture);
/*IItemRenderer render = new SuperCustomToolRenderer();
for (ToolCore tool : TConstructRegistry.tools)
{
MinecraftForgeClient.registerItemRenderer(tool.itemID, render);
}*/
//Special Renderers
ClientRegistry.bindTileEntitySpecialRenderer(CastingTableLogic.class, new CastingTableSpecialRenderer());
//Entities
RenderingRegistry.registerEntityRenderingHandler(CartEntity.class, new CartRender());
RenderingRegistry.registerEntityRenderingHandler(Skyla.class, new SkylaRender());
RenderingRegistry.registerEntityRenderingHandler(FancyEntityItem.class, new FancyItemRender());
RenderingRegistry.registerEntityRenderingHandler(Crystal.class, new CrystalRender());
//RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class, new PlayerArmorRender()); // <-- Works, woo!
addRenderMappings();
}
/* Ties an internal name to a visible one. */
public void addNames ()
{
//LanguageRegistry.addName(TContent.lavaTank, "Lava Tank");
/*LanguageRegistry.instance().addStringLocalization("itemGroup.TConstructTools", "TConstruct Tools");
LanguageRegistry.instance().addStringLocalization("itemGroup.TConstructMaterials", "TConstruct Materials");
LanguageRegistry.instance().addStringLocalization("itemGroup.TConstructBlocks", "TConstruct Blocks");*/
String langDir = "/mods/tinker/resources/lang/";
String[] langFiles = { "en_US.xml" };
for (String langFile : langFiles)
{
try
{
LanguageRegistry.instance().loadLocalization(langDir + langFile, langFile.substring(langFile.lastIndexOf('/') + 1, langFile.lastIndexOf('.')), true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
/*LanguageRegistry.instance().addStringLocalization("crafters.ToolStation", "Tool Station");
LanguageRegistry.instance().addStringLocalization("crafters.PartBuilder", "Part Builder");
LanguageRegistry.instance().addStringLocalization("crafters.PatternShaper", "Pattern Shaper");
LanguageRegistry.instance().addStringLocalization("inventory.PatternChest", "Pattern Chest");
LanguageRegistry.instance().addStringLocalization("crafters.Smeltery", "Smeltery");
LanguageRegistry.instance().addStringLocalization("crafters.Frypan", "Frying Pan");
LanguageRegistry.instance().addStringLocalization("ToolStation.Crafter.name", "Tool Station");
LanguageRegistry.instance().addStringLocalization("ToolStation.Parts.name", "Part Builder");
LanguageRegistry.instance().addStringLocalization("ToolStation.PatternChest.name", "Pattern Chest");
LanguageRegistry.instance().addStringLocalization("ToolStation.PatternShaper.name", "Stencil Table");
LanguageRegistry.instance().addStringLocalization("ToolStation.CastingTable.name", "Casting Table");
LanguageRegistry.instance().addStringLocalization("CraftedSoil.Slime.name", "Slimy Mud");
LanguageRegistry.instance().addStringLocalization("CraftedSoil.Grout.name", "Grout");
LanguageRegistry.instance().addStringLocalization("MetalOre.NetherSlag.name", "Netherack Slag");
LanguageRegistry.instance().addStringLocalization("MetalOre.Cobalt.name", "Cobalt Ore");
LanguageRegistry.instance().addStringLocalization("MetalOre.Ardite.name", "Ardite Ore");
LanguageRegistry.instance().addStringLocalization("MetalOre.Copper.name", "Copper Ore");
LanguageRegistry.instance().addStringLocalization("MetalOre.Tin.name", "Tin Ore");
LanguageRegistry.instance().addStringLocalization("MetalOre.Aluminum.name", "Aluminum Ore");
LanguageRegistry.instance().addStringLocalization("MetalOre.Slag.name", "Stone Slag");
LanguageRegistry.instance().addStringLocalization("Smeltery.Controller.name", "Smeltery");
LanguageRegistry.instance().addStringLocalization("Smeltery.Drain.name", "Smeltery Drain");
LanguageRegistry.instance().addStringLocalization("Smeltery.Brick.name", "Seared Bricks");
LanguageRegistry.instance().addStringLocalization("Smeltery.Gague.name", "Seared Glass");
LanguageRegistry.instance().addStringLocalization("Smeltery.Window.name", "Seared Window");*/
for (int mat = 0; mat < materialTypes.length; mat++)
{
for (int type = 0; type < toolMaterialNames.length; type++)
{
String internalName = new StringBuilder().append("item.tconstruct.").append(materialTypes[mat]).append(".").append(toolMaterialNames[type]).append(".name").toString();
String visibleName = new StringBuilder().append(toolMaterialNames[type]).append(materialNames[mat]).toString();
LanguageRegistry.instance().addStringLocalization(internalName, "en_US", visibleName);
}
}
for (int i = 0; i < shardNames.length; i++)
{
String internalName = "item.tconstruct.ToolShard." + toolMaterialNames[i] + ".name";
String visibleName = shardNames[i];
LanguageRegistry.instance().addStringLocalization(internalName, "en_US", visibleName);
}
for (int i = 0; i < materialItemNames.length; i++)
{
String internalName = "item.tconstruct.Materials." + materialItemInternalNames[i] + ".name";
String visibleName = materialItemNames[i];
LanguageRegistry.instance().addStringLocalization(internalName, "en_US", visibleName);
}
for (int i = 0; i < patterns.length; i++)
{
String internalName = "item.tconstruct.Pattern." + patterns[i] + ".name";
String visibleName = patternNames[i] + " Pattern";
LanguageRegistry.instance().addStringLocalization(internalName, "en_US", visibleName);
internalName = "item.tconstruct.MetalPattern." + patterns[i] + ".name";
visibleName = patternNames[i] + " Cast";
LanguageRegistry.instance().addStringLocalization(internalName, "en_US", visibleName);
}
LanguageRegistry.addName(TContent.manualBook, "Tinker's Log");
LanguageRegistry.addName(TContent.blankPattern, "Blank Pattern");
LanguageRegistry.addName(TContent.pickaxe, "Pickaxe");
LanguageRegistry.addName(TContent.shovel, "Shovel");
LanguageRegistry.addName(TContent.axe, "Axe");
LanguageRegistry.addName(TContent.broadsword, "Broadsword");
LanguageRegistry.addName(TContent.longsword, "Longsword");
LanguageRegistry.addName(TContent.rapier, "Rapier");
LanguageRegistry.addName(TContent.frypan, "Frying Pan");
LanguageRegistry.addName(TContent.battlesign, "Battlesign");
LanguageRegistry.addName(TContent.mattock, "Mattock");
//LanguageRegistry.addName(TContent.lumberaxe, "Lumber Axe");
/*LanguageRegistry.addName(TContent.ironFlowing, "Liquid Iron");
LanguageRegistry.addName(TContent.ironStill, "Liquid Iron");
LanguageRegistry.addName(TContent.goldFlowing, "Liquid Gold");
LanguageRegistry.addName(TContent.goldStill, "Liquid Gold");
LanguageRegistry.addName(TContent.copperFlowing, "Liquid Copper");
LanguageRegistry.addName(TContent.copperStill, "Liquid Copper");
LanguageRegistry.addName(TContent.tinFlowing, "Liquid Tin");
LanguageRegistry.addName(TContent.tinStill, "Liquid Tin");
LanguageRegistry.addName(TContent.aluminumFlowing, "Liquid Aluminum");
LanguageRegistry.addName(TContent.aluminumStill, "Liquid Aluminum");
LanguageRegistry.addName(TContent.cobaltFlowing, "Liquid Cobalt");
LanguageRegistry.addName(TContent.cobaltStill, "Liquid Cobalt");
LanguageRegistry.addName(TContent.arditeFlowing, "Liquid Ardite");
LanguageRegistry.addName(TContent.arditeStill, "Liquid Ardite");
LanguageRegistry.addName(TContent.bronzeFlowing, "Liquid Bronze");
LanguageRegistry.addName(TContent.bronzeStill, "Liquid Bronze");
LanguageRegistry.addName(TContent.alBrassFlowing, "Liquid Brass");
LanguageRegistry.addName(TContent.alBrassStill, "Liquid Brass");
LanguageRegistry.addName(TContent.alumiteFlowing, "Liquid Alumite");
LanguageRegistry.addName(TContent.alumiteStill, "Liquid Alumite");
LanguageRegistry.addName(TContent.manyullynFlowing, "Liquid Manyullyn");
LanguageRegistry.addName(TContent.manyullynStill, "Liquid Manyullyn");
LanguageRegistry.addName(TContent.obsidianFlowing, "Liquid Obsidian");
LanguageRegistry.addName(TContent.obsidianStill, "Liquid Obsidian");
LanguageRegistry.addName(TContent.steelFlowing, "Liquid Steel");
LanguageRegistry.addName(TContent.steelStill, "Liquid Steel");*/
addToolButtons();
}
public static final String[] shardNames = new String[] { "Wood", "Stone Shard", "Iron Chunk", "Flint Shard", "Cactus Shard", "Bone", "Obsidian Shard", "Netherrack Shard", "Slime Crystal Fragment", "Paper", "Cobalt Chunk", "Ardite Chunk", "Manyullyn Chunk", "Copper Chunk", "Bronze Chunk", "Alumite Chunk", "Steel Chunk" };
public static final String[] materialItemInternalNames = new String[] { "PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot", "ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone", "CopperIngot", "TinIngot", "AluminumIngot", "RawAluminum", "BronzeIngot", "AlBrassIngot", "AlumiteIngot", "SteelIngot" };
public static final String[] materialItemNames = new String[] { "Paper Stack", "Slime Crystal", "Seared Brick", "Cobalt Ingot", "Ardite Ingot", "Manyullyn Ingot", "Ball of Moss", "Lava Crystal", "Necrotic Bone", "Copper Ingot", "Tin Ingot", "Aluminum Ingot", "Raw Aluminum", "Bronze Ingot", "Aluminum Brass Ingot", "Alumite Ingot", "Steel Ingot" };
public static final String[] toolMaterialNames = new String[] { "Wood", "Stone", "Iron", "Flint", "Cactus", "Bone", "Obsidian", "Netherrack", "Slime", "Paper", "Cobalt", "Ardite", "Manyullyn", "Copper", "Bronze", "Alumite", "Steel" };
public static final String[] materialTypes = new String[] { "ToolRod", "PickaxeHead", "ShovelHead", "AxeHead", "SwordBlade", "LargeGuard", "MediumGuard", "Crossbar", "Binding", "FrypanHead", "SignHead", "LumberHead" };
public static final String[] materialNames = new String[] { " Rod", " Pickaxe Head", " Shovel Head", " Axe Head", " Sword Blade", " Wide Guard", " Hand Guard", " Crossbar", " Binding", " Pan", " Board", " Broad Axe Head" };
public static final String[] patterns = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "blade", "largeguard", "medguard", "crossbar", "binding", "frypan", "sign", "lumber" };
public static final String[] patternNames = new String[] { "Ingot", "Tool Rod", "Pickaxe Head", "Shovel Head", "Axe Head", "Sword Blade", "Wide Guard", "Hand Guard", "Crossbar", "Tool Binding", "Pan", "Board", "Broad Axe Head" };
public static Document diary;
public static Document volume1;
public void readManuals ()
{
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
diary = readManual("/manuals/diary.xml", dbFactory);
volume1 = readManual("/manuals/materials.xml", dbFactory);
}
Document readManual (String location, DocumentBuilderFactory dbFactory)
{
try
{
InputStream stream = TConstruct.class.getResourceAsStream(location);
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(stream);
doc.getDocumentElement().normalize();
return doc;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
public static Document getManualFromStack (ItemStack stack)
{
switch (stack.getItemDamage())
{
case 0:
return diary;
case 1:
return volume1;
}
return null;
}
@Override
public File getLocation ()
{
return Minecraft.getMinecraftDir();
}
static int[][] slotTypes = { new int[] { 0, 3, 0 }, //Repair
new int[] { 1, 4, 0 }, //Pickaxe
new int[] { 2, 5, 0 }, //Shovel
new int[] { 2, 6, 0 }, //Axe
//new int[] {2, 9, 0}, //Lumber Axe
//new int[] {1, 7, 0}, //Ice Axe
new int[] { 3, 8, 0 }, //Mattock
new int[] { 1, 0, 1 }, //Broadsword
new int[] { 1, 1, 1 }, //Longsword
new int[] { 1, 2, 1 }, //Rapier
new int[] { 2, 3, 1 }, //Frying pan
new int[] { 2, 4, 1 } //Battlesign
};
static int[][] iconCoords = { new int[] { 0, 1, 2 }, new int[] { 13, 13, 13 }, //Repair
new int[] { 0, 0, 1 }, new int[] { 2, 3, 3 }, //Pickaxe
new int[] { 3, 0, 13 }, new int[] { 2, 3, 13 }, //Shovel
new int[] { 2, 0, 13 }, new int[] { 2, 3, 13 }, //Axe
//new int[] { 6, 0, 13 }, new int[] { 2, 3, 13 }, //Lumber Axe
//new int[] { 0, 0, 5 }, new int[] { 2, 3, 3 }, //Ice Axe
new int[] { 2, 0, 3 }, new int[] { 2, 3, 2 }, //Mattock
new int[] { 1, 0, 2 }, new int[] { 2, 3, 3 }, //Broadsword
new int[] { 1, 0, 3 }, new int[] { 2, 3, 3 }, //Longsword
new int[] { 1, 0, 4 }, new int[] { 2, 3, 3 }, //Rapier
new int[] { 4, 0, 13 }, new int[] { 2, 3, 13 }, //Frying Pan
new int[] { 5, 0, 13 }, new int[] { 2, 3, 13 } //Battlesign
};
static String[] toolNames = { "Repair and Modification", "Pickaxe", "Shovel", "Axe",
//"Lumber Axe",
//"Ice Axe",
"Mattock", "Broadsword", "Longsword", "Rapier", "Frying Pan", "Battlesign" };
static String[] toolDescriptions = { "The main way to repair or change your tools. Place a tool and a material on the left to get started.",
"The Pickaxe is a basic mining tool. It is effective on stone and ores.\n\nRequired parts:\n- Pickaxe Head\n- Tool Binding\n- Handle",
"The Shovel is a basic digging tool. It is effective on dirt, sand, and snow.\n\nRequired parts:\n- Shovel Head\n- Handle",
"The Axe is a basic chopping tool. It is effective on wood and leaves.\n\nRequired parts:\n- Axe Head\n- Handle",
//"The Lumber Axe is a broad chopping tool. It harvests wood in a wide range and can fell entire trees.\n\nRequired parts:\n- Broad Axe Head\n- Handle",
//"The Ice Axe is a tool for harvesting ice, mining, and attacking foes.\n\nSpecial Ability:\n- Wall Climb\nNatural Ability:\n- Ice Harvest\nDamage: Moderate\n\nRequired parts:\n- Pickaxe Head\n- Spike\n- Handle",
"The Cutter Mattock is a versatile farming tool. It is effective on wood, dirt, and plants.\n\nSpecial Ability: Hoe\n\nRequired parts:\n- Axe Head\n- Shovel Head\n- Handle", "The Broadsword is a defensive weapon. Blocking cuts damage in half.\n\nSpecial Ability: Block\nDamage: Moderate\nDurability: High\n\nRequired parts:\n- Sword Blade\n- Wide Guard\n- Handle",
"The Longsword is a balanced weapon. It is useful for knocking enemies away or getting in and out of battle quickly.\n\nNatural Ability:\n- Charge Boost\nDamage: Moderate\nDurability: Moderate\n\nRequired parts:\n- Sword Blade\n- Hand Guard\n- Handle", "The Rapier is an offensive weapon that relies on quick strikes to defeat foes.\n\nNatural Abilities:\n- Armor Pierce\n- Quick Strike\n- Charge Boost\nDamage: High\nDurability: Low\n\nRequired parts:\n- Sword Blade\n- Crossbar\n- Handle",
"The Frying is a heavy weapon that uses sheer weight to stun foes.\n\nSpecial Ability: Block\nNatural Ability: Bash\nShift+rClick: Place Frying Pan\nDamage: Low\nDurability: High\n\nRequired parts:\n- Pan\n- Handle",
//"The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nShift-rClick: Place sign\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Board\n- Handle"
"The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Sign Board\n- Handle" };
void addToolButtons ()
{
for (int i = 0; i < toolNames.length; i++)
{
addToolButton(slotTypes[i][0], slotTypes[i][1], slotTypes[i][2], iconCoords[i * 2], iconCoords[i * 2 + 1], toolNames[i], toolDescriptions[i]);
}
}
void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body)
{
TConstructRegistry.toolButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body));
}
void addRenderMappings ()
{
String[] partTypes = { "wood", "stone", "iron", "flint", "cactus", "bone", "obsidian", "netherrack", "slime", "paper", "cobalt", "ardite", "manyullyn", "copper", "bronze", "alumite", "steel" };
String[] effectTypes = { "diamond", "emerald", "redstone", "glowstone", "moss", "ice", "lava", "blaze", "necrotic", "electric", "lapis" };
for (int partIter = 0; partIter < partTypes.length; partIter++)
{
TConstructClientRegistry.addMaterialRenderMapping(partIter, "tinker", partTypes[partIter], true);
//materialRenderMap(partIter, partTypes[partIter]);
}
for (int effectIter = 0; effectIter < effectTypes.length; effectIter++)
{
TConstructClientRegistry.addEffectRenderMapping(effectIter, "tinker", effectTypes[effectIter], true);
//effectRenderMap(effectIter, effectTypes[effectIter]);
}
}
/*void materialRenderMap (int materialID, String partialLocation)
{
for (ToolCore tool : TConstructRegistry.getToolMapping())
{
tool.partTextures.put(materialID, tool.getToolTextureFile() + partialLocation);
}
}
void effectRenderMap (int materialID, String partialLocation)
{
for (ToolCore tool : TConstructRegistry.getToolMapping())
{
tool.effectTextures.put(materialID, tool.getToolTextureFile() + partialLocation);
}
}*/
/* Keybindings */
public static TControls controlInstance;
public void registerKeys()
{
controlInstance = new TControls();
KeyBindingRegistry.registerKeyBinding(controlInstance);
}
}

View File

@ -0,0 +1,112 @@
package mods.tinker.tconstruct.client;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class TableRender implements ISimpleBlockRenderingHandler
{
public static int tabelModelID = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == tabelModelID)
{
if (metadata == 5)
{
renderer.setRenderBounds(0.0F, 0.0, 0.0F, 1.0F, 0.875F, 1.0F);
renderDo(renderer, block, metadata);
}
else
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
renderDo(renderer, block, metadata);
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
renderDo(renderer, block, metadata);
}
}
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == tabelModelID)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 5)
{
renderer.setRenderBounds(0.0F, 0.0, 0.0F, 1.0F, 0.875F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
else
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
}
return false;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return tabelModelID;
}
private void renderDo(RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}

Some files were not shown because too many files have changed in this diff Show More