Fixes, pullcart start
This commit is contained in:
parent
0ddf7ae8b5
commit
9dc02480c4
BIN
resources/tinkertextures/armory.png
Normal file
BIN
resources/tinkertextures/armory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
BIN
resources/tinkertextures/entity/wagon.png
Normal file
BIN
resources/tinkertextures/entity/wagon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
resources/tinkertextures/mob/armorstandtexture.png
Normal file
BIN
resources/tinkertextures/mob/armorstandtexture.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
78
tinker/armory/Armory.java
Normal file
78
tinker/armory/Armory.java
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
package tinker.armory;
|
||||||
|
|
||||||
|
import tinker.armory.content.ArmorStandItem;
|
||||||
|
import tinker.armory.content.Toolrack;
|
||||||
|
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 = "tinker.armory.client.ArmoryProxyClient", serverSide = "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();
|
||||||
|
stoneRack = new Toolrack(PHArmory.rackBlock, Material.rock);
|
||||||
|
GameRegistry.registerBlock(stoneRack, tinker.armory.content.ToolrackItem.class, "ToolRack");
|
||||||
|
GameRegistry.registerTileEntity(tinker.armory.content.ToolrackLogic.class, "InfiToolrack");
|
||||||
|
/*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).setItemName("armorstand");
|
||||||
|
LanguageRegistry.instance().addName(armorStandItem, "Armor Stand");
|
||||||
|
|
||||||
|
EntityRegistry.registerModEntity(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 stoneRack;
|
||||||
|
public static Block woodRack;
|
||||||
|
public static Block armorStand;
|
||||||
|
public static Block pedestal;
|
||||||
|
|
||||||
|
public static Item armorStandItem;
|
||||||
|
|
||||||
|
public static String texture = "/tinkertextures/armory.png";
|
||||||
|
}
|
46
tinker/armory/ArmoryGuiHandler.java
Normal file
46
tinker/armory/ArmoryGuiHandler.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package tinker.armory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import tinker.armory.client.ArmorStandGui;
|
||||||
|
import 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;
|
||||||
|
}
|
||||||
|
}
|
15
tinker/armory/ArmoryProxyCommon.java
Normal file
15
tinker/armory/ArmoryProxyCommon.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package tinker.armory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class ArmoryProxyCommon
|
||||||
|
{
|
||||||
|
public void registerRenderer() {}
|
||||||
|
public void addNames() {}
|
||||||
|
public void addRecipes() {}
|
||||||
|
|
||||||
|
public File getMinecraftDir()
|
||||||
|
{
|
||||||
|
return new File(".");
|
||||||
|
}
|
||||||
|
}
|
88
tinker/armory/PHArmory.java
Normal file
88
tinker/armory/PHArmory.java
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
package 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);
|
||||||
|
rackBlock = config.getBlock("Tool Rack", 3257).getInt(3257);
|
||||||
|
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 rackBlock;
|
||||||
|
/*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;*/
|
||||||
|
|
||||||
|
}
|
83
tinker/armory/client/ArmorStandContainer.java
Normal file
83
tinker/armory/client/ArmorStandContainer.java
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
package tinker.armory.client;
|
||||||
|
|
||||||
|
import 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;
|
||||||
|
}
|
||||||
|
}
|
40
tinker/armory/client/ArmorStandGui.java
Normal file
40
tinker/armory/client/ArmorStandGui.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package tinker.armory.client;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import tinker.armory.content.EntityEquipment;
|
||||||
|
|
||||||
|
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);
|
||||||
|
int var5 = this.guiLeft;
|
||||||
|
int var6 = this.guiTop;
|
||||||
|
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
|
||||||
|
}
|
||||||
|
}
|
96
tinker/armory/client/ArmorStandModelStatue.java
Normal file
96
tinker/armory/client/ArmorStandModelStatue.java
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* Armor stand model by Fudgy_Fetus
|
||||||
|
*/
|
||||||
|
package 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
tinker/armory/client/ArmoryProxyClient.java
Normal file
28
tinker/armory/client/ArmoryProxyClient.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package tinker.armory.client;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import tinker.armory.ArmoryProxyCommon;
|
||||||
|
import tinker.armory.content.ArmorStandEntity;
|
||||||
|
import 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 RenderToolrack());
|
||||||
|
ClientRegistry.bindTileEntitySpecialRenderer(ToolrackLogic.class, new ToolrackSpecialRender());
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(tinker.armory.content.ArmorStandEntity.class, new RenderArmorStandEntity(new ArmorStandModelStatue(), 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getMinecraftDir()
|
||||||
|
{
|
||||||
|
return Minecraft.getMinecraftDir();
|
||||||
|
}
|
||||||
|
}
|
512
tinker/armory/client/RenderArmorStandEntity.java
Normal file
512
tinker/armory/client/RenderArmorStandEntity.java
Normal file
@ -0,0 +1,512 @@
|
|||||||
|
package 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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
5
tinker/armory/client/RenderPedestal.java
Normal file
5
tinker/armory/client/RenderPedestal.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package tinker.armory.client;
|
||||||
|
|
||||||
|
public class RenderPedestal {
|
||||||
|
|
||||||
|
}
|
125
tinker/armory/client/RenderToolrack.java
Normal file
125
tinker/armory/client/RenderToolrack.java
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
package 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 tinker.armory.content.Toolrack;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
|
|
||||||
|
public class RenderToolrack implements ISimpleBlockRenderingHandler
|
||||||
|
{
|
||||||
|
public static int rackModel;
|
||||||
|
private static final float[][] modelCubes = new float[][] {
|
||||||
|
{0.0F, 0.625F, 0.0F, 1.0F, 0.8125F, 0.125F}, {0.1875F, 0.3125F, 0.0F, 0.25F, 0.9375F, 0.125F}, {0.75f, 0.3125F, 0.0F, 0.8125F, 0.875F, 0.125F}, {0.0F, 0.25F, 0.0F, 1.0F, 0.3125F, 0.3125F}};
|
||||||
|
|
||||||
|
public RenderToolrack()
|
||||||
|
{
|
||||||
|
rackModel = RenderingRegistry.getNextAvailableRenderId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRenderId()
|
||||||
|
{
|
||||||
|
return this.rackModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldRender3DInInventory()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean renderWorldBlock(IBlockAccess var1, int x, int y, int z, Block block, int modelID, RenderBlocks var7)
|
||||||
|
{
|
||||||
|
if (modelID == this.rackModel)
|
||||||
|
return this.renderRackBlock(var7, var1, x, y, z, (Toolrack)block);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderInventoryBlock(Block var1, int var2, int var3, RenderBlocks var4)
|
||||||
|
{
|
||||||
|
if (var3 == this.rackModel)
|
||||||
|
{
|
||||||
|
this.renderRackItem(var4, (Toolrack)var1, var2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderRackItem(RenderBlocks var1, Toolrack block, int metadata)
|
||||||
|
{
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
||||||
|
for (int iter = 0; iter < modelCubes.length; ++iter)
|
||||||
|
{
|
||||||
|
float[] var6 = modelCubes[iter];
|
||||||
|
block.setBlockBounds(var6[0], var6[1], var6[2], var6[3], var6[4], var6[5]);
|
||||||
|
GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||||
|
var1.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, metadata));
|
||||||
|
tessellator.draw();
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||||
|
var1.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, metadata));
|
||||||
|
tessellator.draw();
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||||
|
var1.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, metadata));
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glTranslatef(0.5F, 0.5F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean renderRackBlock(RenderBlocks render, IBlockAccess world, int x, int y, int z, Toolrack block)
|
||||||
|
{
|
||||||
|
int meta = world.getBlockMetadata(x, y, z) / 4;
|
||||||
|
int iter;
|
||||||
|
float[] size;
|
||||||
|
|
||||||
|
if (meta == 0)
|
||||||
|
{
|
||||||
|
for (iter = 0; iter < modelCubes.length; ++iter)
|
||||||
|
{
|
||||||
|
size = modelCubes[iter];
|
||||||
|
block.setBlockBounds(size[0], size[1], size[2], size[3], size[4], size[5]);
|
||||||
|
render.renderStandardBlock(block, x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (meta == 1)
|
||||||
|
{
|
||||||
|
for (iter = 0; iter < modelCubes.length; ++iter)
|
||||||
|
{
|
||||||
|
size = modelCubes[iter];
|
||||||
|
block.setBlockBounds(size[2], size[1], size[0], size[5], size[4], size[3]);
|
||||||
|
render.renderStandardBlock(block, x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (meta == 2)
|
||||||
|
{
|
||||||
|
for (iter = 0; iter < modelCubes.length; ++iter)
|
||||||
|
{
|
||||||
|
size = modelCubes[iter];
|
||||||
|
block.setBlockBounds(size[0], size[1], 1.0F - size[5], size[3], size[4], 1.0F - size[2]);
|
||||||
|
render.renderStandardBlock(block, x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (meta == 3)
|
||||||
|
{
|
||||||
|
for (iter = 0; iter < modelCubes.length; ++iter)
|
||||||
|
{
|
||||||
|
size = modelCubes[iter];
|
||||||
|
block.setBlockBounds(1.0F - size[5], size[1], size[0], 1.0F - size[2], size[4], size[3]);
|
||||||
|
render.renderStandardBlock(block, x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
block.setBounds(meta);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
58
tinker/armory/client/SlotArmorCopy.java
Normal file
58
tinker/armory/client/SlotArmorCopy.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package 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;
|
||||||
|
}
|
||||||
|
}
|
179
tinker/armory/client/ToolrackSpecialRender.java
Normal file
179
tinker/armory/client/ToolrackSpecialRender.java
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
package tinker.armory.client;
|
||||||
|
|
||||||
|
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 tinker.armory.content.ToolrackLogic;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class ToolrackSpecialRender 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)
|
||||||
|
{
|
||||||
|
//System.out.println("Rendering "+logic.getInvName());
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef((float)posX + 0.3F, (float)posY + 0.5F, (float)posZ + 0.28F); //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 col;
|
||||||
|
|
||||||
|
if (stack.getItem().requiresMultipleRenderPasses())
|
||||||
|
{
|
||||||
|
for (iconIndex = 0; iconIndex <= 1; ++iconIndex)
|
||||||
|
{
|
||||||
|
col = stack.getItem().getIconFromDamageForRenderPass(stack.getItemDamage(), iconIndex);
|
||||||
|
int color = stack.getItem().getColorFromItemStack(stack, iconIndex);
|
||||||
|
setColor(color);
|
||||||
|
this.drawItem(col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iconIndex = stack.getIconIndex();
|
||||||
|
col = Item.itemsList[stack.itemID].getColorFromItemStack(stack, 0);
|
||||||
|
setColor(col);
|
||||||
|
this.drawItem(iconIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glTranslatef(0.4F, 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);
|
||||||
|
}
|
||||||
|
}
|
5
tinker/armory/content/ArmorStandBlock.java
Normal file
5
tinker/armory/content/ArmorStandBlock.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package tinker.armory.content;
|
||||||
|
|
||||||
|
public class ArmorStandBlock {
|
||||||
|
|
||||||
|
}
|
157
tinker/armory/content/ArmorStandEntity.java
Normal file
157
tinker/armory/content/ArmorStandEntity.java
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
package tinker.armory.content;
|
||||||
|
|
||||||
|
import tinker.armory.Armory;
|
||||||
|
import 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");
|
||||||
|
}
|
||||||
|
}
|
83
tinker/armory/content/ArmorStandItem.java
Normal file
83
tinker/armory/content/ArmorStandItem.java
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
package tinker.armory.content;
|
||||||
|
|
||||||
|
import 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;
|
||||||
|
}
|
||||||
|
}
|
97
tinker/armory/content/EntityEquipment.java
Normal file
97
tinker/armory/content/EntityEquipment.java
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
package 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; }
|
||||||
|
}
|
192
tinker/armory/content/Toolrack.java
Normal file
192
tinker/armory/content/Toolrack.java
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
package tinker.armory.content;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import tinker.armory.client.RenderToolrack;
|
||||||
|
|
||||||
|
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 Toolrack extends BlockContainer
|
||||||
|
{
|
||||||
|
public Toolrack(int id, Material material)
|
||||||
|
{
|
||||||
|
super(id, material);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean renderAsNormalBlock()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpaqueCube()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRenderType()
|
||||||
|
{
|
||||||
|
return RenderToolrack.rackModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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.2F, 0.0F, 1.0F, 0.9F, 0.25F);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
tinker/armory/content/ToolrackItem.java
Normal file
29
tinker/armory/content/ToolrackItem.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package 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 getItemNameIS(ItemStack itemstack)
|
||||||
|
{
|
||||||
|
return (new StringBuilder()).append("block.").append(blockType[itemstack.getItemDamage()]).append("Toolrack").toString();
|
||||||
|
}
|
||||||
|
public static final String blockType[] =
|
||||||
|
{
|
||||||
|
"stone", "stonebrick", "brick", "obsidian"
|
||||||
|
};
|
||||||
|
}
|
201
tinker/armory/content/ToolrackLogic.java
Normal file
201
tinker/armory/content/ToolrackLogic.java
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
package 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);
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,5 @@
|
|||||||
package tinker.common;
|
package tinker.common;
|
||||||
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
|
||||||
import net.minecraftforge.common.ISidedInventory;
|
|
||||||
|
|
||||||
public interface IFacingLogic
|
public interface IFacingLogic
|
||||||
{
|
{
|
||||||
public boolean canFaceVertical();
|
public boolean canFaceVertical();
|
||||||
|
6
tinker/common/IMechanicalLogic.java
Normal file
6
tinker/common/IMechanicalLogic.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package tinker.common;
|
||||||
|
|
||||||
|
public interface IMechanicalLogic
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -17,8 +17,8 @@ public enum EnumMaterial
|
|||||||
Cobalt (4, 800, 800, 3, 1.8F, 2, 0),
|
Cobalt (4, 800, 800, 3, 1.8F, 2, 0),
|
||||||
Ardite (4, 800, 800, 3, 1.8F, 0, 0),
|
Ardite (4, 800, 800, 3, 1.8F, 0, 0),
|
||||||
Manyullyn (5, 1200, 1000, 4, 2.5F, 0, 0),
|
Manyullyn (5, 1200, 1000, 4, 2.5F, 0, 0),
|
||||||
Copper (1, 180, 500, 2, 1.8F, 0, 0),
|
Copper (1, 180, 500, 2, 1.15F, 0, 0),
|
||||||
Bronze (2, 250, 600, 2, 2.5F, 1, 0),
|
Bronze (2, 250, 600, 2, 1.3F, 1, 0),
|
||||||
Demonite (5, 1790, 900, 5, 1.66F, 0, 0),
|
Demonite (5, 1790, 900, 5, 1.66F, 0, 0),
|
||||||
Holyshell (5, 1000, 700, 1, 1.5F, 0, 0);
|
Holyshell (5, 1000, 700, 1, 1.5F, 0, 0);
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ public class PHConstruct {
|
|||||||
ores = config.getBlock("Ore Block", 1475).getInt(1475);
|
ores = config.getBlock("Ore Block", 1475).getInt(1475);
|
||||||
craftedSoil = config.getBlock("Special Soil", 1476).getInt(1476);
|
craftedSoil = config.getBlock("Special Soil", 1476).getInt(1476);
|
||||||
searedBrick = config.getBlock("Seared Brick", 1477).getInt(1477);
|
searedBrick = config.getBlock("Seared Brick", 1477).getInt(1477);
|
||||||
|
axle = config.getBlock("Axle", 1478).getInt(1478);
|
||||||
|
|
||||||
blankPattern = config.getItem("Patterns and Misc", "Blank Patterns", 14019).getInt(14019);
|
blankPattern = config.getItem("Patterns and Misc", "Blank Patterns", 14019).getInt(14019);
|
||||||
materials = config.getItem("Patterns and Misc", "Materials", 14020).getInt(14020);
|
materials = config.getItem("Patterns and Misc", "Materials", 14020).getInt(14020);
|
||||||
@ -92,18 +93,17 @@ public class PHConstruct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Blocks
|
//Blocks
|
||||||
public static int blankPattern;
|
|
||||||
public static int woodCrafter;
|
public static int woodCrafter;
|
||||||
public static int stoneCrafter;
|
|
||||||
public static int netherCrafter;
|
|
||||||
public static int heldItemBlock;
|
public static int heldItemBlock;
|
||||||
public static int ores;
|
public static int ores;
|
||||||
public static int lavaTank;
|
public static int lavaTank;
|
||||||
public static int smeltery;
|
public static int smeltery;
|
||||||
public static int craftedSoil;
|
public static int craftedSoil;
|
||||||
public static int searedBrick;
|
public static int searedBrick;
|
||||||
|
public static int axle;
|
||||||
|
|
||||||
//Patterns and misc
|
//Patterns and misc
|
||||||
|
public static int blankPattern;
|
||||||
public static int materials;
|
public static int materials;
|
||||||
public static int toolRod;
|
public static int toolRod;
|
||||||
public static int toolShard;
|
public static int toolShard;
|
||||||
|
@ -27,7 +27,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||||||
* @author: mDiyo
|
* @author: mDiyo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "mc1.4.7_1.0.3")
|
@Mod(modid = "TConstruct", name = "TConstruct", version = "mc1.4.7_1.0.6")
|
||||||
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels={"TConstruct"}, packetHandler = tinker.tconstruct.TConstructPacketHandler.class)
|
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels={"TConstruct"}, packetHandler = tinker.tconstruct.TConstructPacketHandler.class)
|
||||||
public class TConstruct
|
public class TConstruct
|
||||||
{
|
{
|
||||||
|
@ -38,6 +38,7 @@ import tinker.tconstruct.tools.Rapier;
|
|||||||
import tinker.tconstruct.tools.Shovel;
|
import tinker.tconstruct.tools.Shovel;
|
||||||
import tinker.tconstruct.tools.ToolCore;
|
import tinker.tconstruct.tools.ToolCore;
|
||||||
import cpw.mods.fml.common.IFuelHandler;
|
import cpw.mods.fml.common.IFuelHandler;
|
||||||
|
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class TConstructContent
|
public class TConstructContent
|
||||||
@ -85,20 +86,20 @@ public class TConstructContent
|
|||||||
//Crafting blocks
|
//Crafting blocks
|
||||||
public static Block woodCrafter;
|
public static Block woodCrafter;
|
||||||
public static Block smeltery;
|
public static Block smeltery;
|
||||||
//public static Block stoneCrafter;
|
|
||||||
//public static Block netherCrafter;
|
|
||||||
|
|
||||||
public static Block heldItemBlock;
|
public static Block heldItemBlock;
|
||||||
public static Block ores;
|
public static Block ores;
|
||||||
public static Block lavaTank;
|
public static Block lavaTank;
|
||||||
public static Block craftedSoil;
|
public static Block craftedSoil;
|
||||||
public static Block searedBrick;
|
public static Block searedBrick;
|
||||||
|
//public static Block axle;
|
||||||
|
|
||||||
//Tool modifiers
|
//Tool modifiers
|
||||||
public static ModElectric modE;
|
public static ModElectric modE;
|
||||||
|
|
||||||
public TConstructContent()
|
public TConstructContent()
|
||||||
{
|
{
|
||||||
|
createEntities();
|
||||||
createItems();
|
createItems();
|
||||||
registerMaterials();
|
registerMaterials();
|
||||||
addToolRecipes();
|
addToolRecipes();
|
||||||
@ -107,6 +108,11 @@ public class TConstructContent
|
|||||||
GameRegistry.registerFuelHandler(this);
|
GameRegistry.registerFuelHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void createEntities()
|
||||||
|
{
|
||||||
|
EntityRegistry.registerModEntity(tinker.tconstruct.entity.EntityWagon.class, "Small Wagon", 0, TConstruct.instance, 32, 5, true);
|
||||||
|
}
|
||||||
|
|
||||||
void createItems ()
|
void createItems ()
|
||||||
{
|
{
|
||||||
woodCrafter = new ToolStationBlock(PHConstruct.woodCrafter, Material.wood);
|
woodCrafter = new ToolStationBlock(PHConstruct.woodCrafter, Material.wood);
|
||||||
|
89
tinker/tconstruct/blocks/Axle.java
Normal file
89
tinker/tconstruct/blocks/Axle.java
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
package tinker.tconstruct.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import tinker.tconstruct.client.AxleRender;
|
||||||
|
|
||||||
|
public class Axle extends Block
|
||||||
|
{
|
||||||
|
|
||||||
|
public Axle(int id, Material material)
|
||||||
|
{
|
||||||
|
super(id, material);
|
||||||
|
this.setHardness(0.3f);
|
||||||
|
this.setBlockBounds(0, 0, 0, 1, 0.25f, 1);
|
||||||
|
//this.setCreativeTab(ToolConstruct.materialTab);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public String getTextureFile()
|
||||||
|
{
|
||||||
|
return "/tinkertextures/ConstructBlocks.png";
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public int getBlockTextureFromSideAndMetadata (int side, int meta)
|
||||||
|
{
|
||||||
|
//return 22 + meta*6 + side;
|
||||||
|
return 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean renderAsNormalBlock ()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpaqueCube ()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRenderType ()
|
||||||
|
{
|
||||||
|
return AxleRender.axleModelID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 TConstructGuiHandler.frypanID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getModInstance ()
|
||||||
|
{
|
||||||
|
return TConstruct.instance;
|
||||||
|
}*/
|
||||||
|
}
|
72
tinker/tconstruct/client/AxleRender.java
Normal file
72
tinker/tconstruct/client/AxleRender.java
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
package tinker.tconstruct.client;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
135
tinker/tconstruct/client/RenderWagon.java
Normal file
135
tinker/tconstruct/client/RenderWagon.java
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
package tinker.tconstruct.client;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
import net.minecraft.client.model.ModelMinecart;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import tinker.tconstruct.entity.EntityWagon;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class RenderWagon extends Render
|
||||||
|
{
|
||||||
|
/** instance of ModelMinecart for rendering */
|
||||||
|
protected ModelBase modelMinecart;
|
||||||
|
|
||||||
|
public RenderWagon()
|
||||||
|
{
|
||||||
|
this.shadowSize = 0.5F;
|
||||||
|
this.modelMinecart = new ModelMinecart();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the Minecart.
|
||||||
|
*/
|
||||||
|
public void renderTheMinecart(EntityWagon wagon, double par2, double par4, double par6, float par8, float par9)
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
long var10 = (long)wagon.entityId * 493286711L;
|
||||||
|
var10 = var10 * var10 * 4392167121L + var10 * 98761L;
|
||||||
|
float var12 = (((float)(var10 >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
||||||
|
float var13 = (((float)(var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
||||||
|
float var14 = (((float)(var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
||||||
|
GL11.glTranslatef(var12, var13, var14);
|
||||||
|
double var15 = wagon.lastTickPosX + (wagon.posX - wagon.lastTickPosX) * (double)par9;
|
||||||
|
double var17 = wagon.lastTickPosY + (wagon.posY - wagon.lastTickPosY) * (double)par9;
|
||||||
|
double var19 = wagon.lastTickPosZ + (wagon.posZ - wagon.lastTickPosZ) * (double)par9;
|
||||||
|
double var21 = 0.30000001192092896D;
|
||||||
|
Vec3 var23 = wagon.func_70489_a(var15, var17, var19);
|
||||||
|
float var24 = wagon.prevRotationPitch + (wagon.rotationPitch - wagon.prevRotationPitch) * par9;
|
||||||
|
|
||||||
|
if (var23 != null)
|
||||||
|
{
|
||||||
|
Vec3 var25 = wagon.func_70495_a(var15, var17, var19, var21);
|
||||||
|
Vec3 var26 = wagon.func_70495_a(var15, var17, var19, -var21);
|
||||||
|
|
||||||
|
if (var25 == null)
|
||||||
|
{
|
||||||
|
var25 = var23;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (var26 == null)
|
||||||
|
{
|
||||||
|
var26 = var23;
|
||||||
|
}
|
||||||
|
|
||||||
|
par2 += var23.xCoord - var15;
|
||||||
|
par4 += (var25.yCoord + var26.yCoord) / 2.0D - var17;
|
||||||
|
par6 += var23.zCoord - var19;
|
||||||
|
Vec3 var27 = var26.addVector(-var25.xCoord, -var25.yCoord, -var25.zCoord);
|
||||||
|
|
||||||
|
if (var27.lengthVector() != 0.0D)
|
||||||
|
{
|
||||||
|
var27 = var27.normalize();
|
||||||
|
par8 = (float)(Math.atan2(var27.zCoord, var27.xCoord) * 180.0D / Math.PI);
|
||||||
|
var24 = (float)(Math.atan(var27.yCoord) * 73.0D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
|
||||||
|
GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glRotatef(-var24, 0.0F, 0.0F, 1.0F);
|
||||||
|
float var28 = (float)wagon.func_70496_j() - par9;
|
||||||
|
float var30 = (float)wagon.getDamage() - par9;
|
||||||
|
|
||||||
|
if (var30 < 0.0F)
|
||||||
|
{
|
||||||
|
var30 = 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (var28 > 0.0F)
|
||||||
|
{
|
||||||
|
GL11.glRotatef(MathHelper.sin(var28) * var28 * var30 / 10.0F * (float)wagon.func_70493_k(), 1.0F, 0.0F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wagon.minecartType != 0)
|
||||||
|
{
|
||||||
|
this.loadTexture("/terrain.png");
|
||||||
|
float var29 = 0.75F;
|
||||||
|
GL11.glScalef(var29, var29, var29);
|
||||||
|
|
||||||
|
if (wagon.minecartType == 1)
|
||||||
|
{
|
||||||
|
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
|
||||||
|
(new RenderBlocks()).renderBlockAsItem(Block.chest, 0, wagon.getBrightness(par9));
|
||||||
|
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glTranslatef(0.5F, 0.0F, -0.5F);
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
else if (wagon.minecartType == 2)
|
||||||
|
{
|
||||||
|
GL11.glTranslatef(0.0F, 0.3125F, 0.0F);
|
||||||
|
(new RenderBlocks()).renderBlockAsItem(Block.stoneOvenIdle, 0, wagon.getBrightness(par9));
|
||||||
|
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glTranslatef(0.0F, -0.3125F, 0.0F);
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glScalef(1.0F / var29, 1.0F / var29, 1.0F / var29);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loadTexture("/tinkertextures/entity/wagon.png");
|
||||||
|
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||||
|
this.modelMinecart.render(wagon, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.renderTheMinecart((EntityWagon)par1Entity, par2, par4, par6, par8, par9);
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ package tinker.tconstruct.client;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.model.ModelBoat;
|
||||||
import net.minecraftforge.client.MinecraftForgeClient;
|
import net.minecraftforge.client.MinecraftForgeClient;
|
||||||
import tinker.tconstruct.TConstructContent;
|
import tinker.tconstruct.TConstructContent;
|
||||||
import tinker.tconstruct.TProxyCommon;
|
import tinker.tconstruct.TProxyCommon;
|
||||||
@ -16,8 +17,9 @@ public class TProxyClient extends TProxyCommon
|
|||||||
public void registerRenderer()
|
public void registerRenderer()
|
||||||
{
|
{
|
||||||
RenderingRegistry.registerBlockHandler(new TableRender());
|
RenderingRegistry.registerBlockHandler(new TableRender());
|
||||||
RenderingRegistry.registerBlockHandler(new TankRender());
|
//RenderingRegistry.registerBlockHandler(new TankRender());
|
||||||
RenderingRegistry.registerBlockHandler(new FrypanRender());
|
RenderingRegistry.registerBlockHandler(new FrypanRender());
|
||||||
|
//RenderingRegistry.registerBlockHandler(new AxleRender());
|
||||||
|
|
||||||
MinecraftForgeClient.preloadTexture(TConstructContent.craftingTexture);
|
MinecraftForgeClient.preloadTexture(TConstructContent.craftingTexture);
|
||||||
MinecraftForgeClient.preloadTexture(TConstructContent.baseHeads);
|
MinecraftForgeClient.preloadTexture(TConstructContent.baseHeads);
|
||||||
@ -36,6 +38,8 @@ public class TProxyClient extends TProxyCommon
|
|||||||
MinecraftForgeClient.preloadTexture(TConstructContent.frypanTexture);
|
MinecraftForgeClient.preloadTexture(TConstructContent.frypanTexture);
|
||||||
MinecraftForgeClient.preloadTexture(TConstructContent.signTexture);
|
MinecraftForgeClient.preloadTexture(TConstructContent.signTexture);
|
||||||
MinecraftForgeClient.preloadTexture(TConstructContent.blockTexture);
|
MinecraftForgeClient.preloadTexture(TConstructContent.blockTexture);
|
||||||
|
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(tinker.tconstruct.entity.EntityWagon.class, new RenderWagon());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,57 +67,40 @@ public class PatternShaperContainer extends Container
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer entityplayer, int slot)
|
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
/*ItemStack itemstack = null;
|
/*ItemStack stack = null;
|
||||||
Slot slot = (Slot)inventorySlots.get(i);
|
Slot slot = (Slot)this.inventorySlots.get(slotID);
|
||||||
|
|
||||||
if (slot != null && slot.getHasStack())
|
if (slot != null && slot.getHasStack())
|
||||||
{
|
{
|
||||||
ItemStack itemstack1 = slot.getStack();
|
ItemStack slotStack = slot.getStack();
|
||||||
itemstack = itemstack1.copy();
|
stack = slotStack.copy();
|
||||||
if (i == 0)
|
|
||||||
|
if (slotID < logic.getSizeInventory())
|
||||||
{
|
{
|
||||||
if (!mergeItemStack(itemstack1, 10, 46, true))
|
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i >= 10 && i < 37)
|
else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory()-1, false))
|
||||||
{
|
|
||||||
if (!mergeItemStack(itemstack1, 37, 46, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (i >= 37 && i < 46)
|
|
||||||
{
|
|
||||||
if (!mergeItemStack(itemstack1, 10, 37, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!mergeItemStack(itemstack1, 10, 46, false))
|
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (itemstack1.stackSize == 0)
|
|
||||||
|
if (slotStack.stackSize == 0)
|
||||||
{
|
{
|
||||||
slot.putStack(null);
|
slot.putStack((ItemStack)null);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
}
|
}
|
||||||
if (itemstack1.stackSize != itemstack.stackSize)
|
|
||||||
{
|
|
||||||
slot.onPickupFromSlot(entityplayer, itemstack1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return itemstack;*/
|
|
||||||
|
return stack;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class PatternShaperGui extends GuiContainer
|
|||||||
if (button.id == 0)
|
if (button.id == 0)
|
||||||
{
|
{
|
||||||
patternIndex++;
|
patternIndex++;
|
||||||
if (patternIndex > TConstructContent.patternOutputs.length)
|
if (patternIndex > TConstructContent.patternOutputs.length - 1)
|
||||||
patternIndex = 0;
|
patternIndex = 0;
|
||||||
}
|
}
|
||||||
else if (button.id == 1)
|
else if (button.id == 1)
|
||||||
@ -109,13 +109,12 @@ public class PatternShaperGui extends GuiContainer
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
outputStream.writeByte(2);
|
outputStream.writeByte(2);
|
||||||
outputStream.writeInt(logic.worldObj.getWorldInfo().getDimension());
|
outputStream.writeInt(logic.worldObj.provider.dimensionId);
|
||||||
outputStream.writeInt(logic.xCoord);
|
outputStream.writeInt(logic.xCoord);
|
||||||
outputStream.writeInt(logic.yCoord);
|
outputStream.writeInt(logic.yCoord);
|
||||||
outputStream.writeInt(logic.zCoord);
|
outputStream.writeInt(logic.zCoord);
|
||||||
outputStream.writeShort(stack.itemID);
|
outputStream.writeShort(stack.itemID);
|
||||||
outputStream.writeShort(stack.getItemDamage());
|
outputStream.writeShort(stack.getItemDamage());
|
||||||
//outputStream.writeUTF(toolName);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,9 @@ import net.minecraft.entity.player.InventoryPlayer;
|
|||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import tinker.tconstruct.logic.ToolStationLogic;
|
import tinker.tconstruct.logic.ToolStationLogic;
|
||||||
|
import tinker.tconstruct.tools.ToolCore;
|
||||||
|
|
||||||
public class ToolStationContainer extends Container
|
public class ToolStationContainer extends Container
|
||||||
{
|
{
|
||||||
@ -87,16 +89,21 @@ public class ToolStationContainer extends Container
|
|||||||
{
|
{
|
||||||
ItemStack slotStack = slot.getStack();
|
ItemStack slotStack = slot.getStack();
|
||||||
stack = slotStack.copy();
|
stack = slotStack.copy();
|
||||||
|
|
||||||
if (slotID < logic.getSizeInventory())
|
if (slotID < logic.getSizeInventory())
|
||||||
{
|
{
|
||||||
System.out.println("Merging itemstack, true");
|
if (slotID == 0)
|
||||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
|
{
|
||||||
|
if (!this.mergeCraftedStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true, player))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!this.mergeItemStack(slotStack, 1, logic.getSizeInventory() - 1, false))
|
else if (!this.mergeItemStack(slotStack, 1, logic.getSizeInventory(), false))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -114,58 +121,110 @@ public class ToolStationContainer extends Container
|
|||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Override
|
protected void craftTool(ItemStack stack)
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
|
||||||
{
|
{
|
||||||
//this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)
|
NBTTagCompound tags = stack.getTagCompound();
|
||||||
ItemStack itemstack = null;
|
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
|
||||||
Slot slot = (Slot)inventorySlots.get(slotID);
|
{
|
||||||
if (slot != null && slot.getHasStack())
|
tags.getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||||
|
for (int i = 1; i <= 3; i++)
|
||||||
|
logic.decrStackSize(i, 1);
|
||||||
|
/*if (!player.worldObj.isRemote)
|
||||||
|
player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean mergeCraftedStack(ItemStack stack, int slotsStart, int slotsTotal, boolean playerInventory, EntityPlayer player)
|
||||||
|
{
|
||||||
|
boolean failedToMerge = false;
|
||||||
|
int slotIndex = slotsStart;
|
||||||
|
|
||||||
|
if (playerInventory)
|
||||||
{
|
{
|
||||||
ItemStack slotStack = slot.getStack();
|
slotIndex = slotsTotal - 1;
|
||||||
itemstack = slotStack.copy();
|
}
|
||||||
if (slotID == 0)
|
|
||||||
|
Slot otherInventorySlot;
|
||||||
|
ItemStack copyStack = null;
|
||||||
|
|
||||||
|
/*if (stack.isStackable())
|
||||||
|
{
|
||||||
|
while (stack.stackSize > 0 && (!playerInventory && slotIndex < slotsTotal || playerInventory && slotIndex >= slotsStart))
|
||||||
{
|
{
|
||||||
if (!mergeItemStack(slotStack, 4, 40, true)) //10 = size of crafting grid, 46 = total, 0 == output slot
|
otherInventorySlot = (Slot)this.inventorySlots.get(slotIndex);
|
||||||
|
copyStack = otherInventorySlot.getStack();
|
||||||
|
|
||||||
|
if (copyStack != null && copyStack.itemID == stack.itemID && (!stack.getHasSubtypes() || stack.getItemDamage() == copyStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack, copyStack))
|
||||||
{
|
{
|
||||||
return null;
|
int totalSize = copyStack.stackSize + stack.stackSize;
|
||||||
|
|
||||||
|
if (totalSize <= stack.getMaxStackSize())
|
||||||
|
{
|
||||||
|
stack.stackSize = 0;
|
||||||
|
copyStack.stackSize = totalSize;
|
||||||
|
otherInventorySlot.onSlotChanged();
|
||||||
|
failedToMerge = true;
|
||||||
|
}
|
||||||
|
else if (copyStack.stackSize < stack.getMaxStackSize())
|
||||||
|
{
|
||||||
|
stack.stackSize -= stack.getMaxStackSize() - copyStack.stackSize;
|
||||||
|
copyStack.stackSize = stack.getMaxStackSize();
|
||||||
|
otherInventorySlot.onSlotChanged();
|
||||||
|
failedToMerge = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerInventory)
|
||||||
|
{
|
||||||
|
--slotIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++slotIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (slotID >= 4 && slotID < 37)
|
}*/
|
||||||
|
|
||||||
|
if (stack.stackSize > 0)
|
||||||
|
{
|
||||||
|
if (playerInventory)
|
||||||
{
|
{
|
||||||
if (!mergeItemStack(slotStack, 37, 40, false))
|
slotIndex = slotsTotal - 1;
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (slotID >= 37 && slotID < 40)
|
|
||||||
{
|
|
||||||
if (!mergeItemStack(slotStack, 4, 37, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!mergeItemStack(slotStack, 4, 40, false))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (slotStack.stackSize == 0)
|
|
||||||
{
|
|
||||||
slot.putStack(null);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
slot.onSlotChanged();
|
slotIndex = slotsStart;
|
||||||
}
|
}
|
||||||
if (slotStack.stackSize != itemstack.stackSize)
|
|
||||||
|
while (!playerInventory && slotIndex < slotsTotal || playerInventory && slotIndex >= slotsStart)
|
||||||
{
|
{
|
||||||
slot.onPickupFromSlot(player, slotStack);
|
otherInventorySlot = (Slot)this.inventorySlots.get(slotIndex);
|
||||||
}
|
copyStack = otherInventorySlot.getStack();
|
||||||
else
|
|
||||||
{
|
if (copyStack == null)
|
||||||
return null;
|
{
|
||||||
|
craftTool(stack);
|
||||||
|
otherInventorySlot.putStack(stack.copy());
|
||||||
|
otherInventorySlot.onSlotChanged();
|
||||||
|
stack.stackSize = 0;
|
||||||
|
failedToMerge = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerInventory)
|
||||||
|
{
|
||||||
|
--slotIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++slotIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return itemstack;
|
|
||||||
}*/
|
if (!failedToMerge)
|
||||||
|
player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);
|
||||||
|
|
||||||
|
return failedToMerge;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ public class ToolStationGui extends GuiContainer
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
outputStream.writeByte(1);
|
outputStream.writeByte(1);
|
||||||
outputStream.writeInt(logic.worldObj.getWorldInfo().getDimension());
|
outputStream.writeInt(logic.worldObj.provider.dimensionId);
|
||||||
outputStream.writeInt(logic.xCoord);
|
outputStream.writeInt(logic.xCoord);
|
||||||
outputStream.writeInt(logic.yCoord);
|
outputStream.writeInt(logic.yCoord);
|
||||||
outputStream.writeInt(logic.zCoord);
|
outputStream.writeInt(logic.zCoord);
|
||||||
|
@ -60,7 +60,7 @@ public class ToolBuilder
|
|||||||
|
|
||||||
//System.out.println("Tool name: "+item.getToolName());
|
//System.out.println("Tool name: "+item.getToolName());
|
||||||
int head = headStack.getItemDamage();
|
int head = headStack.getItemDamage();
|
||||||
System.out.println("Head:"+head);
|
//System.out.println("Head:"+head);
|
||||||
int handle = handleStack.getItemDamage();
|
int handle = handleStack.getItemDamage();
|
||||||
int accessory = -1;
|
int accessory = -1;
|
||||||
if (accessoryStack != null)
|
if (accessoryStack != null)
|
||||||
|
1492
tinker/tconstruct/entity/EntityWagon.java
Normal file
1492
tinker/tconstruct/entity/EntityWagon.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -133,11 +133,11 @@ public class FrypanLogic extends EquipLogic
|
|||||||
|
|
||||||
public void cookItems ()
|
public void cookItems ()
|
||||||
{
|
{
|
||||||
System.out.println("Trying to cook");
|
//System.out.println("Trying to cook");
|
||||||
if (!canCook())
|
if (!canCook())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
System.out.println("Can cook");
|
//System.out.println("Can cook");
|
||||||
for (int id = 2; id < 10; id++) //Check every slot
|
for (int id = 2; id < 10; id++) //Check every slot
|
||||||
{
|
{
|
||||||
if (canCook())
|
if (canCook())
|
||||||
|
@ -44,7 +44,7 @@ public class PartCrafterLogic extends InventoryLogic
|
|||||||
//return ((PatternHolderLogic) tile).getGuiContainer(player.inventory, world, x, y, z);
|
//return ((PatternHolderLogic) tile).getGuiContainer(player.inventory, world, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("Regular container");
|
//System.out.println("Regular container");
|
||||||
return new PartCrafterContainer(inventoryplayer, this);
|
return new PartCrafterContainer(inventoryplayer, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ public class PartCrafterLogic extends InventoryLogic
|
|||||||
int decrease = cost / value;
|
int decrease = cost / value;
|
||||||
if (cost % value != 0)
|
if (cost % value != 0)
|
||||||
decrease++;
|
decrease++;
|
||||||
super.decrStackSize(1, decrease); //Call super to avoid crafting again
|
super.decrStackSize(2, decrease); //Call super to avoid crafting again
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,14 @@ public class PatternShaperLogic extends InventoryLogic
|
|||||||
return new PatternShaperContainer(inventoryplayer, this);
|
return new PatternShaperContainer(inventoryplayer, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
public void onInventoryChanged()
|
||||||
|
{
|
||||||
|
if (inventory[0] == null)
|
||||||
|
inventory[1] = null;
|
||||||
|
super.onInventoryChanged();
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int slot, ItemStack itemstack)
|
public void setInventorySlotContents(int slot, ItemStack itemstack)
|
||||||
{
|
{
|
||||||
@ -40,9 +48,12 @@ public class PatternShaperLogic extends InventoryLogic
|
|||||||
{
|
{
|
||||||
if (slot == 1)
|
if (slot == 1)
|
||||||
{
|
{
|
||||||
super.decrStackSize(0, 1);
|
|
||||||
if (getStackInSlot(0) != null)
|
if (getStackInSlot(0) != null)
|
||||||
return super.decrStackSize(slot, 0);
|
{
|
||||||
|
ItemStack ret = super.decrStackSize(slot, 0);
|
||||||
|
decrStackSize(0, 1);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (slot == 0)
|
else if (slot == 0)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ public class ModBlaze extends ToolMod
|
|||||||
@Override
|
@Override
|
||||||
public void modify (ItemStack[] input, ItemStack tool)
|
public void modify (ItemStack[] input, ItemStack tool)
|
||||||
{
|
{
|
||||||
System.out.println("Moood");
|
//System.out.println("Moood");
|
||||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||||
if (tags.hasKey(key))
|
if (tags.hasKey(key))
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ public class ModBoolean extends ToolMod
|
|||||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||||
|
|
||||||
tags.setBoolean(key, true);
|
tags.setBoolean(key, true);
|
||||||
System.out.println("Key: "+key+" "+tags.getBoolean(key));
|
//System.out.println("Key: "+key+" "+tags.getBoolean(key));
|
||||||
|
|
||||||
int modifiers = tags.getInteger("Modifiers");
|
int modifiers = tags.getInteger("Modifiers");
|
||||||
modifiers -= 1;
|
modifiers -= 1;
|
||||||
|
@ -98,17 +98,17 @@ public abstract class ToolMod
|
|||||||
|
|
||||||
else if (tags.hasKey("Effect2"))
|
else if (tags.hasKey("Effect2"))
|
||||||
{
|
{
|
||||||
System.out.println("Adding Effect 3");
|
//System.out.println("Adding Effect 3");
|
||||||
tags.setInteger("Effect3", effectIndex);
|
tags.setInteger("Effect3", effectIndex);
|
||||||
}
|
}
|
||||||
else if (tags.hasKey("Effect1"))
|
else if (tags.hasKey("Effect1"))
|
||||||
{
|
{
|
||||||
System.out.println("Adding Effect 2");
|
//System.out.println("Adding Effect 2");
|
||||||
tags.setInteger("Effect2", effectIndex);
|
tags.setInteger("Effect2", effectIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
System.out.println("Adding Effect 1");
|
//System.out.println("Adding Effect 1");
|
||||||
tags.setInteger("Effect1", effectIndex);
|
tags.setInteger("Effect1", effectIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,6 @@ public class Broadsword extends Weapon
|
|||||||
|
|
||||||
public float getDurabilityModifier ()
|
public float getDurabilityModifier ()
|
||||||
{
|
{
|
||||||
return 1.3f;
|
return 1.2f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public abstract class DualHarvestTool extends HarvestTool
|
|||||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
|
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
System.out.println("Woo~");
|
//System.out.println("Woo~");
|
||||||
world.setBlockWithNotify(x, y, z, 0);
|
world.setBlockWithNotify(x, y, z, 0);
|
||||||
if (!player.capabilities.isCreativeMode)
|
if (!player.capabilities.isCreativeMode)
|
||||||
onBlockDestroyed(stack, world, bID, x, y, z, player);
|
onBlockDestroyed(stack, world, bID, x, y, z, player);
|
||||||
|
@ -37,7 +37,7 @@ public abstract class HarvestTool extends ToolCore
|
|||||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
|
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
System.out.println("Woo~");
|
//System.out.println("Woo~");
|
||||||
world.setBlockWithNotify(x, y, z, 0);
|
world.setBlockWithNotify(x, y, z, 0);
|
||||||
if (!player.capabilities.isCreativeMode)
|
if (!player.capabilities.isCreativeMode)
|
||||||
onBlockDestroyed(stack, world, bID, x, y, z, player);
|
onBlockDestroyed(stack, world, bID, x, y, z, player);
|
||||||
|
@ -285,6 +285,10 @@ public abstract class ToolCore extends Item
|
|||||||
return colorCode + "4"; //Ardite
|
return colorCode + "4"; //Ardite
|
||||||
case 13:
|
case 13:
|
||||||
return colorCode + "5"; //Manyullyn
|
return colorCode + "5"; //Manyullyn
|
||||||
|
case 14:
|
||||||
|
return colorCode + "c"; //Copper
|
||||||
|
case 15:
|
||||||
|
return colorCode + "6"; //Bronze
|
||||||
}
|
}
|
||||||
return colorCode;
|
return colorCode;
|
||||||
}
|
}
|
||||||
@ -319,6 +323,10 @@ public abstract class ToolCore extends Item
|
|||||||
return ""; //Ardite
|
return ""; //Ardite
|
||||||
case 13:
|
case 13:
|
||||||
return "Awareness"; //Manyullyn
|
return "Awareness"; //Manyullyn
|
||||||
|
case 14:
|
||||||
|
return ""; //Copper
|
||||||
|
case 15:
|
||||||
|
return ""; //Bronze
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -333,17 +341,19 @@ public abstract class ToolCore extends Item
|
|||||||
return "\u00A73Reinforced II";
|
return "\u00A73Reinforced II";
|
||||||
else if (head == 3 || handle == 3 || accessory == 3)
|
else if (head == 3 || handle == 3 || accessory == 3)
|
||||||
return "\u00A7fReinforced I";
|
return "\u00A7fReinforced I";
|
||||||
|
else if (head == 15 || handle == 15 || accessory == 15)
|
||||||
|
return "\u00A76Reinforced I";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static String[] toolMaterialNames = {
|
static String[] toolMaterialNames = {
|
||||||
"Wooden ", "Stone ", "Iron ", "Flint ", "Cactus ", "Bone ", "Obsidian ", "Nethrrack ", "Slime ", "Paper ", "Cobalt ", "Ardite ", "Manyullyn "
|
"Wooden ", "Stone ", "Iron ", "Flint ", "Cactus ", "Bone ", "Obsidian ", "Nethrrack ", "Slime ", "Paper ", "Cobalt ", "Ardite ", "Manyullyn " , "Copper ", "Bronze "
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Creative mode tools */
|
/* Creative mode tools */
|
||||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 13; i++)
|
for (int i = 0; i < 15; i++)
|
||||||
{
|
{
|
||||||
Item accessory = getAccessoryItem();
|
Item accessory = getAccessoryItem();
|
||||||
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, i) : null;
|
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, i) : null;
|
||||||
@ -369,7 +379,7 @@ public abstract class ToolCore extends Item
|
|||||||
if (tags.hasKey("Moss"))
|
if (tags.hasKey("Moss"))
|
||||||
{
|
{
|
||||||
int chance = tags.getInteger("Moss");
|
int chance = tags.getInteger("Moss");
|
||||||
if (random.nextInt(200) < chance)
|
if (random.nextInt(800) < chance)
|
||||||
{
|
{
|
||||||
AbilityHelper.damageTool(stack, -1, (EntityLiving)entity, true);
|
AbilityHelper.damageTool(stack, -1, (EntityLiving)entity, true);
|
||||||
}
|
}
|
||||||
@ -392,7 +402,7 @@ public abstract class ToolCore extends Item
|
|||||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
|
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
System.out.println("Woo~");
|
//System.out.println("Woo~");
|
||||||
world.setBlockWithNotify(x, y, z, 0);
|
world.setBlockWithNotify(x, y, z, 0);
|
||||||
if (!player.capabilities.isCreativeMode)
|
if (!player.capabilities.isCreativeMode)
|
||||||
onBlockDestroyed(stack, world, bID, x, y, z, player);
|
onBlockDestroyed(stack, world, bID, x, y, z, player);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user