Sophia is Awesome
This commit is contained in:
@@ -30,6 +30,7 @@ import com.kitsu.medievalcraft.block.ingots.LapisIngot;
|
||||
import com.kitsu.medievalcraft.block.ingots.RedstoneIngot;
|
||||
import com.kitsu.medievalcraft.block.ingots.RefinedIron;
|
||||
import com.kitsu.medievalcraft.block.machines.Firebox;
|
||||
import com.kitsu.medievalcraft.block.machines.Forge;
|
||||
import com.kitsu.medievalcraft.block.machines.ForgeAnvil;
|
||||
import com.kitsu.medievalcraft.block.machines.SolidFilter;
|
||||
import com.kitsu.medievalcraft.block.machines.TestForge;
|
||||
@@ -113,6 +114,7 @@ public class ModBlocks {
|
||||
public static Block shelfFour;
|
||||
public static Block firebox;
|
||||
public static Block solidFilter;
|
||||
public static Block forge;
|
||||
|
||||
//GEMS
|
||||
public static Block myDiamond, myEmerald;
|
||||
@@ -178,7 +180,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(solidFilter = new SolidFilter("solidFilter", Material.wood), "solidFilter");
|
||||
GameRegistry.registerBlock(shelfFour = new ShelfFour("shelfFour", Material.wood), "shelfFour");
|
||||
GameRegistry.registerBlock(firebox = new Firebox("firebox", Material.rock), "firebox");
|
||||
|
||||
GameRegistry.registerBlock(forge = new Forge("forge", Material.rock), "forge");
|
||||
|
||||
/*GameRegistry.registerBlock(myIronIngot = new MyIronIngot("myIronIngot", Material.iron), "myIronIngot");
|
||||
GameRegistry.registerBlock(damascusIngot = new DamascusIngot("damascusIngot", Material.iron), "damascusIngot");
|
||||
|
||||
@@ -1,52 +1,36 @@
|
||||
package com.kitsu.medievalcraft.block.machines;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileForge;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
import com.kitsu.medievalcraft.util.TileForgePlaceables;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Forge extends BlockContainer{
|
||||
public class Forge extends BlockContainer implements TileForgePlaceables{
|
||||
|
||||
private final Random random = new Random();
|
||||
/*
|
||||
*
|
||||
*
|
||||
* [Chimney]
|
||||
* [ Forge ]
|
||||
* [Firebox]
|
||||
*
|
||||
*
|
||||
* */
|
||||
|
||||
|
||||
public Forge(String unlocalizedName, Material material) {
|
||||
super(material.rock);
|
||||
this.setBlockName(unlocalizedName);
|
||||
@@ -61,6 +45,7 @@ public class Forge extends BlockContainer{
|
||||
// xmax, ymax, zmax)
|
||||
this.setBlockBounds(0.0F, 0.00F, 0.0F,
|
||||
1.0F, 0.5F, 1.0F);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
@@ -74,30 +59,58 @@ public class Forge extends BlockContainer{
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
int l;
|
||||
float f;
|
||||
float f1;
|
||||
float f2;
|
||||
for (l = 0; l < 3; ++l)
|
||||
{
|
||||
f = (float)(x+0.25) + (rand.nextFloat()/2);
|
||||
f1 = (float)y + rand.nextFloat() * 0.4F + 0.2F;
|
||||
f2 = (float)(z+0.25) + (rand.nextFloat()/2);
|
||||
world.spawnParticle("fire", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("smoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
|
||||
if(!world.isRemote){
|
||||
world.setBlockMetadataWithNotify(x, y, z, (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3), 2);
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
private boolean shouldPlace(ItemStack stack, EntityPlayer player){
|
||||
for(int i=0; i<placeMe.size();i++){
|
||||
if(player.inventory.getCurrentItem().getItem()==placeMe.get(i).getItem()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
|
||||
|
||||
//System.out.println("");
|
||||
if(!world.isRemote){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if (tileEnt.getStackInSlot(0)==null){
|
||||
if(player.inventory.getCurrentItem().getItem()==placeMe.get(0).getItem()||
|
||||
player.inventory.getCurrentItem().getItem()==placeMe.get(1).getItem()||
|
||||
player.inventory.getCurrentItem().getItem()==placeMe.get(2).getItem()||
|
||||
player.inventory.getCurrentItem().getItem()==placeMe.get(3).getItem()||
|
||||
player.inventory.getCurrentItem().getItem()==placeMe.get(4).getItem()){
|
||||
|
||||
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking()) {
|
||||
if((player.inventory.getCurrentItem()==null)){
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
|
||||
pStack.stackSize = 1;
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* if(player.inventory.getCurrentItem()!=null){
|
||||
if (tileEnt.getStackInSlot(0)==null){
|
||||
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.kitsu.medievalcraft.contain;
|
||||
|
||||
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;
|
||||
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileForge;
|
||||
|
||||
public class ContainerForge extends Container {
|
||||
|
||||
protected TileForge tileEnt;
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return tileEnt.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
public ContainerForge (InventoryPlayer inventoryPlayer, TileForge te){
|
||||
tileEnt = te;
|
||||
|
||||
//the Slot constructor takes the IInventory and the slot number in that it binds to
|
||||
//and the x-y coordinates it resides on-screen
|
||||
/* for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18));
|
||||
}
|
||||
}*/
|
||||
addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
|
||||
|
||||
//commonly used vanilla code that adds the player's inventory
|
||||
bindPlayerInventory(inventoryPlayer);
|
||||
}
|
||||
|
||||
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
|
||||
8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = (Slot) inventorySlots.get(slot);
|
||||
|
||||
//null checks and checks if the item can be stacked (maxStackSize > 1)
|
||||
if (slotObject != null && slotObject.getHasStack()) {
|
||||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
|
||||
//merges the item into player inventory since its in the tileEntity
|
||||
if (slot < 9) {
|
||||
if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//places it into the tileEntity is possible since its in the player inventory
|
||||
else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (stackInSlot.stackSize == 0) {
|
||||
slotObject.putStack((ItemStack)null);
|
||||
} else {
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
|
||||
/*if (stackInSlot.stackSize == stack.stackSize) {
|
||||
return null;
|
||||
}*/
|
||||
//slotObject.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import com.kitsu.medievalcraft.renderer.blocks.ingot.MyEmeraldRenderer;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.ingot.RedstoneIngotRenderer;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.machine.FireboxRenderer;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.machine.ForgeAnvilRenderer;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.machine.ForgeRenderer;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.machine.FourShelfRenderer;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.machine.SolidFilterRender;
|
||||
import com.kitsu.medievalcraft.renderer.blocks.machine.WaterFilterRenderer;
|
||||
@@ -83,6 +84,7 @@ import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityShelfFour;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntitySolidFilter;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityWaterFilter;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileForge;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
@@ -151,6 +153,8 @@ public class RendererRegistry {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmallBarrel.class, new SmallBarrelRender());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShelfFour.class, new FourShelfRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFirebox.class, new FireboxRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFirebox.class, new FireboxRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileForge.class, new ForgeRenderer());
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCrucibleLapis.class, new LapisCrucibleRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCrucibleIronOre.class, new IronOreCrucibleRenderer());
|
||||
|
||||
@@ -1,5 +1,126 @@
|
||||
package com.kitsu.medievalcraft.renderer.blocks.machine;
|
||||
|
||||
public class ForgeRenderer {
|
||||
import java.util.Random;
|
||||
|
||||
}
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileForge;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class ForgeRenderer extends TileEntitySpecialRenderer {
|
||||
|
||||
private final Random rand = new Random();
|
||||
private double r = rand.nextDouble();
|
||||
//public ModelFirebox model;
|
||||
EntityItem entItem = null;
|
||||
EntityItem entCoal = null;
|
||||
//boolean slotStatus;
|
||||
public static final ResourceLocation MODEL = new ResourceLocation("kitsumedievalcraft:models/Forge.obj");
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/Forge.png");
|
||||
|
||||
IModelCustom model = AdvancedModelLoader.loadModel(MODEL);
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
|
||||
TileForge tileEntity = (TileForge)tile;
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
renderBlock(tileEntity, tile.getWorldObj(), tile.xCoord,tile.yCoord, tile.zCoord, ModBlocks.forge);
|
||||
//System.out.println(tileEntity.isCoal);
|
||||
//if(tileEntity.isCoal==true){
|
||||
//System.out.println("Renderer me plz");
|
||||
ItemStack c = new ItemStack(Items.coal, 1 , 1);
|
||||
entCoal = new EntityItem(tileEntity.getWorldObj(), x, y, z, c);
|
||||
GL11.glPushMatrix();
|
||||
this.entCoal.hoverStart = 0.0F;
|
||||
RenderItem.renderInFrame = true;
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.55D, 1.3D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.15D, 1.3D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.75D, 1.3D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.35D, 1.3D, -0.79D, 0.0F, 0.0F);
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.35D, 1.0D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.95D, 1.0D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.55D, 1.0D, -0.79D, 0.0F, 0.0F);
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.55D, 0.7D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.15D, 0.7D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.75D, 0.7D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.35D, 0.7D, -0.79D, 0.0F, 0.0F);
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.35D, 0.4D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.95D, 0.4D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.55D, 0.4D, -0.79D, 0.0F, 0.0F);
|
||||
|
||||
RenderItem.renderInFrame = false;
|
||||
GL11.glPopMatrix();
|
||||
|
||||
//}
|
||||
|
||||
if(tileEntity.getStackInSlot(0) != null){
|
||||
entItem = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(0));
|
||||
GL11.glPushMatrix();
|
||||
this.entItem.hoverStart = 0.0F;
|
||||
RenderItem.renderInFrame = true;
|
||||
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
||||
GL11.glRotatef(10, 0, 1, 0);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.4D, 0.325D, 0.6D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
tileEntity.markForUpdate();
|
||||
tileEntity.markDirty();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
public void renderBlock(TileForge tl, World world, int i, int j,int k, Block block) {
|
||||
GL11.glPushMatrix();
|
||||
//GL11.glRotatef(15F, 0F, 1F, 0F);
|
||||
float scale = 0.50f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef(1.0F, 0.2F, 1.0F);
|
||||
int dir = world.getBlockMetadata(i, j, k);
|
||||
if(dir == 1){
|
||||
//GL11.glTranslatef(-1F, 0F, 1F);
|
||||
GL11.glRotated(-90F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
if(dir == 2){
|
||||
//GL11.glTranslatef(-2F, 0F, 0F);
|
||||
GL11.glRotated(-180F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
if(dir == 3){
|
||||
//GL11.glTranslatef(-1F, 0F, -1F);
|
||||
GL11.glRotated(90F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
//
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
|
||||
this.model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,8 @@ public class IronIngotIR implements IItemRenderer {
|
||||
|
||||
public static final ResourceLocation MODEL_CRUCIBLE = new ResourceLocation("kitsumedievalcraft:models/IronIngotBlock.obj");
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/IronIngotBlock.png");
|
||||
public static final ResourceLocation TEXTURE1 = new ResourceLocation("kitsumedievalcraft:models/HotIronIngotBlock.png");
|
||||
private ResourceLocation loc;
|
||||
|
||||
public IModelCustom model = AdvancedModelLoader.loadModel(MODEL_CRUCIBLE);
|
||||
|
||||
@@ -40,8 +42,7 @@ public class IronIngotIR implements IItemRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
|
||||
ItemRendererHelper helper) {
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,ItemRendererHelper helper) {
|
||||
|
||||
switch(type) {
|
||||
case EQUIPPED: {
|
||||
@@ -74,7 +75,13 @@ public class IronIngotIR implements IItemRenderer {
|
||||
GL11.glRotated(-20, 1, 0, 0);
|
||||
GL11.glScalef(0.75F, 0.75F, 0.75F);
|
||||
GL11.glTranslatef(0.0F, 0.0F, 1.15F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
if(item.getItemDamage()==0){
|
||||
loc=TEXTURE;
|
||||
}
|
||||
if(item.getItemDamage()==1){
|
||||
loc=TEXTURE1;
|
||||
}
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(loc);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
} break;
|
||||
@@ -87,20 +94,38 @@ public class IronIngotIR implements IItemRenderer {
|
||||
GL11.glRotated(30, 0, 0, 1);
|
||||
GL11.glScalef(f, f, f);
|
||||
GL11.glTranslatef(-0.2F, 1.0F, 1.15F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
if(item.getItemDamage()==0){
|
||||
loc=TEXTURE;
|
||||
}
|
||||
if(item.getItemDamage()==1){
|
||||
loc=TEXTURE1;
|
||||
}
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(loc);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
} break;
|
||||
case INVENTORY: {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
if(item.getItemDamage()==0){
|
||||
loc=TEXTURE;
|
||||
}
|
||||
if(item.getItemDamage()==1){
|
||||
loc=TEXTURE1;
|
||||
}
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(loc);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
} break;
|
||||
case ENTITY: {
|
||||
GL11.glPushMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
|
||||
if(item.getItemDamage()==0){
|
||||
loc=TEXTURE;
|
||||
}
|
||||
if(item.getItemDamage()==1){
|
||||
loc=TEXTURE1;
|
||||
}
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(loc);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
} break;
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.kitsu.medievalcraft.tileents.machine.TileEntityShelfFour;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntitySolidFilter;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityTestForge;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileEntityWaterFilter;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileForge;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
@@ -49,6 +50,7 @@ public class TileEntRegister {
|
||||
GameRegistry.registerTileEntity(TileEntitySmallBarrel.class, "SmallBarrel");
|
||||
GameRegistry.registerTileEntity(TileEntityShelfFour.class, "ShelfFour");
|
||||
GameRegistry.registerTileEntity(TileEntityFirebox.class, "Firebox");
|
||||
GameRegistry.registerTileEntity(TileForge.class, "Forge");
|
||||
|
||||
GameRegistry.registerTileEntity(TileCrucibleIronOre.class, "CrucibleIronOre");
|
||||
GameRegistry.registerTileEntity(TileCrucibleWootz.class, "CrucibleWootz");
|
||||
|
||||
@@ -22,6 +22,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.block.crucible.CrucibleBase;
|
||||
import com.kitsu.medievalcraft.block.ingots.IngotBase;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleBase;
|
||||
@@ -206,20 +207,8 @@ public class TileEntityFirebox extends TileEntity implements IInventory{
|
||||
int y = this.yCoord;
|
||||
int z = this.zCoord;
|
||||
if(!world.isRemote){
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.air)||this.getStackInSlot(0)==null){
|
||||
this.isOn = false;
|
||||
}
|
||||
if((this.getStackInSlot(0)==null)&&(world.getBlock(x, y+1, z).equals(Blocks.fire))){
|
||||
world.setBlock(x, y+1, z, Blocks.air, 0, 2);
|
||||
this.isOn=false;
|
||||
}
|
||||
if(this.isOn==true && world.getBlock(x, y+1, z).equals(Blocks.air)){
|
||||
world.setBlock(x, y+1, z, Blocks.fire, 0, 2);
|
||||
}
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
this.isOn = true;
|
||||
}
|
||||
|
||||
fireboxMaint(world, x, y, z);
|
||||
fireboxFuelDec(world, x, y, z, this.getStackInSlot(0), this.ticks);
|
||||
isFurnace(world, x, y, z);
|
||||
isCrucible(world, x, y, z);
|
||||
@@ -228,7 +217,22 @@ public class TileEntityFirebox extends TileEntity implements IInventory{
|
||||
if (worldObj.isRemote) return;
|
||||
}
|
||||
|
||||
public void fireboxFuelDec(World world, int x, int y, int z, ItemStack stack, int time){
|
||||
private void fireboxMaint(World world, int x, int y, int z){
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.air)||this.getStackInSlot(0)==null){
|
||||
this.isOn = false;
|
||||
}
|
||||
if((this.getStackInSlot(0)==null)&&(world.getBlock(x, y+1, z).equals(Blocks.fire))){
|
||||
world.setBlock(x, y+1, z, Blocks.air, 0, 2);
|
||||
this.isOn=false;
|
||||
}
|
||||
if(this.isOn==true && world.getBlock(x, y+1, z).equals(Blocks.air)){
|
||||
world.setBlock(x, y+1, z, Blocks.fire, 0, 2);
|
||||
}
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
this.isOn = true;
|
||||
}
|
||||
}
|
||||
private void fireboxFuelDec(World world, int x, int y, int z, ItemStack stack, int time){
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
if(stack!=null){
|
||||
if(isItemFuel(stack)==true){
|
||||
@@ -244,7 +248,7 @@ public class TileEntityFirebox extends TileEntity implements IInventory{
|
||||
}
|
||||
}
|
||||
}
|
||||
public static double fuelMulti(int i, ItemStack stack){
|
||||
private static double fuelMulti(int i, ItemStack stack){
|
||||
if(stack!=null){
|
||||
if(stack.stackSize<=15){
|
||||
return 0.25;
|
||||
|
||||
@@ -1,38 +1,25 @@
|
||||
package com.kitsu.medievalcraft.tileents.machine;
|
||||
|
||||
import com.kitsu.medievalcraft.block.crucible.CrucibleBase;
|
||||
import com.kitsu.medievalcraft.block.ingots.IngotBase;
|
||||
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleBase;
|
||||
import com.kitsu.medievalcraft.tileents.ingots.TileIngotBase;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFurnace;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
|
||||
public class TileForge extends TileEntity implements IInventory{
|
||||
private String tileForgeName;
|
||||
private ItemStack[] inv;
|
||||
private NBTTagCompound tag = new NBTTagCompound();
|
||||
public int heat;
|
||||
public boolean isCoal;
|
||||
|
||||
public TileForge(){
|
||||
this.inv = new ItemStack[1];
|
||||
@@ -121,7 +108,7 @@ public class TileForge extends TileEntity implements IInventory{
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,7 +147,7 @@ public class TileForge extends TileEntity implements IInventory{
|
||||
}
|
||||
//this.stack0 = tagCompound.getString("stack0");
|
||||
this.heat = tag.getInteger("HEAT");
|
||||
//this.isOn = tag.getBoolean("ISON");
|
||||
this.isCoal = tag.getBoolean("ISCOAL");
|
||||
|
||||
}
|
||||
|
||||
@@ -180,7 +167,7 @@ public class TileForge extends TileEntity implements IInventory{
|
||||
}
|
||||
tagCompound.setTag("Inventory", itemList);
|
||||
tag.setInteger("HEAT", this.heat);
|
||||
//tag.setBoolean("ISON", this.isOn);
|
||||
tag.setBoolean("ISCOAL", this.isCoal);
|
||||
}
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
@@ -203,6 +190,13 @@ public class TileForge extends TileEntity implements IInventory{
|
||||
int y = this.yCoord;
|
||||
int z = this.zCoord;
|
||||
if(!world.isRemote){
|
||||
if(!world.isRemote){
|
||||
if(this.getStackInSlot(0)!=null){
|
||||
System.out.println(this.getStackInSlot(0).getItemDamage());
|
||||
ItemStack c = new ItemStack(this.getStackInSlot(0).getItem(),1,1);
|
||||
this.setInventorySlotContents(0, c);
|
||||
}
|
||||
}
|
||||
/*if(world.getBlock(x, y+1, z).equals(Blocks.air)||this.getStackInSlot(0)==null){
|
||||
this.isOn = false;
|
||||
}
|
||||
@@ -216,7 +210,7 @@ public class TileForge extends TileEntity implements IInventory{
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
this.isOn = true;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
//fireboxFuelDec(world, x, y, z, this.getStackInSlot(0), this.ticks);
|
||||
//isFurnace(world, x, y, z);
|
||||
//isCrucible(world, x, y, z);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.kitsu.medievalcraft.util;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
|
||||
public interface TileForgePlaceables {
|
||||
|
||||
static final Hashtable<Integer, ItemStack> placeMe = new Hashtable <Integer, ItemStack>(){{
|
||||
|
||||
put(0, new ItemStack(ModBlocks.refinedIron));
|
||||
put(1, new ItemStack(ModBlocks.redstoneIngot));
|
||||
put(2, new ItemStack(ModBlocks.lapisIngot));
|
||||
put(3, new ItemStack(ModBlocks.ironPlate));
|
||||
put(4, new ItemStack(ModBlocks.damascus));
|
||||
|
||||
}};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user