Grinder Recipes working

This commit is contained in:
KitsuShadow
2015-08-30 09:25:44 -04:00
parent c87cae4e94
commit a2fbde8efe
4 changed files with 38 additions and 62 deletions

View File

@@ -35,7 +35,7 @@ public class CrankBlock extends Block implements ITileEntityProvider{
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
if(!world.isRemote){
System.out.println(world.getBlockMetadata(x, y, z));
//System.out.println(world.getBlockMetadata(x, y, z));
TileEntCrank tile = (TileEntCrank) world.getTileEntity(x, y, z);
if(tile.isPowered == false){
tile.isPowered = true;
@@ -114,7 +114,7 @@ public class CrankBlock extends Block implements ITileEntityProvider{
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack)
{
int l = EnergyUtil.determineOrientationComplex(world, x, y, z, player);
System.out.println(l);
//System.out.println(l);
world.setBlockMetadataWithNotify(x, y, z, l, 2);
//}
}

View File

@@ -51,71 +51,25 @@ public class RenderCrankGrinder extends TileEntitySpecialRenderer {
float scale = 1.0F;
GL11.glScalef(scale, scale, scale);
if(tile.getStackInSlot(1)!=null){
//entItem = new EntityItem(tile.getWorldObj(), x, y, z, tile.getStackInSlot(1));
GL11.glPushMatrix();
//this.entItem.hoverStart = 0.0F;
//RenderItem.renderInFrame = true;
//GL11.glScalef(2.0f, 2.0f, 2.0f);
if(tile.isPowered == true){
GL11.glTranslatef(0.5f, 0.0f, 0.5f);
GL11.glRotatef(tile.rot*-1, 0.0F, 1.0F, 0.0F);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTUREWHEEL);
this.modelGrinder.renderAll();
//RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
}
if(tile.isPowered==false){
GL11.glTranslatef(0.5f, 0.0f, 0.5f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTUREWHEEL);
this.modelGrinder.renderAll();
}
GL11.glPopMatrix();
}
/*if(tile.getStackInSlot(0) != null){
entItem = new EntityItem(tile.getWorldObj(), x, y, z, tile.getStackInSlot(0));
GL11.glPushMatrix();
this.entItem.hoverStart = 0.0F;
RenderItem.renderInFrame = true;
GL11.glScalef(1.0f, 1.0f, 1.0f);
if(tile.getStackInSlot(0).getItem().equals(Item.getItemFromBlock(Blocks.wooden_slab))
||tile.getStackInSlot(0).getItem().equals(ModItems.saxleItem)){
GL11.glRotatef(90f, 1.0F, 0.0F, 0.0F);
}
if(tile.isPowered == true){
/*if(tile.getStackInSlot(0).getItem().equals(Item.getItemFromBlock(Blocks.wooden_slab))
||tile.getStackInSlot(0).getItem().equals(ModItems.saxleItem)){
GL11.glRotatef(tile.rot, 0.0F, 1.0F, 0.0F);
}else{
GL11.glRotatef(tile.rot, 0.0F, 0.0F, 1.0F);
}
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, -0.223D, 0.0D, 0.0F, 0.0F);
}
if(tile.isPowered==false){
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, -0.223D, 0.0D, 0.0F, 0.0F);
}
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
tile.markForUpdate();
tile.markDirty();
}*/
GL11.glTranslatef(1.0F, 0.5F, 0.0F);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
this.model.renderAll();
GL11.glPopMatrix();
}

View File

@@ -45,7 +45,7 @@ public class TileEntCrankGrinder extends TileEntity implements IInventory, Grind
if(this.isPowered==true){
this.power--;
rot-=45;
System.out.println(rot);
//System.out.println(rot);
if(rot>=360||rot<=-360){
rot=0;
}
@@ -62,18 +62,31 @@ public class TileEntCrankGrinder extends TileEntity implements IInventory, Grind
if(workCount>=100){
if(this.getStackInSlot(0)!=null){
//System.out.println(this.getStackInSlot(0));
if(GrinderRecipes.grinderCheck.contains(this.getStackInSlot(0).getItem())){
System.out.println(GrinderRecipes.grinderIn.get(this.getStackInSlot(0).getItem()));
this.decrStackSize(0, 1);
EntityItem eItem = new EntityItem(world, x+0.5f, y+0.35f, z+0.5f, new ItemStack(GrinderRecipes.grinderIn.get(this.getStackInSlot(0).getItem()),4));
ItemStack stack = GrinderRecipes.grinderIn.get(this.getStackInSlot(0).getItem());
System.out.println(stack);
stack.stackSize=GrinderRecipes.grinderSize.get(stack.getItem());
EntityItem eItem=new EntityItem(world, x+0.5f, y+0.35f, z+0.5f, stack);
world.spawnEntityInWorld(eItem);
workCount=0;
this.markForUpdate();
this.markDirty();
}
if(this.getStackInSlot(0).getItem().equals(Item.getItemFromBlock(Blocks.lapis_ore))){
this.decrStackSize(0, 1);
ItemStack stack = new ItemStack(Items.dye, 4, 4);
System.out.println(stack);
EntityItem eItem=new EntityItem(world, x+0.5f, y+0.35f, z+0.5f, stack);
world.spawnEntityInWorld(eItem);
workCount=0;
this.markForUpdate();
this.markDirty();
}
}
workCount=0;
this.markForUpdate();
this.markDirty();
}
}

View File

@@ -11,21 +11,30 @@ import nmd.primal.energy.item.ModItems;
public interface GrinderRecipes {
static final Hashtable<Item, Item> grinderIn = new Hashtable <Item, Item>(){{
static final Hashtable<Item, ItemStack> grinderIn = new Hashtable <Item, ItemStack>(){{
//put(ModItems.ironAxeForm, new ItemStack(ModItems.ironaxeHead, 1));
put(Item.getItemFromBlock(Blocks.iron_ore), ModItems.coarseironItem);
//put(Item.getItemFromBlock(Blocks.gold_ore), new ItemStack(ModItems.coarsegoldItem, 2));
//put(Item.getItemFromBlock(Blocks.redstone_ore), new ItemStack(Items.redstone, 2+(int)Math.ceil(8*Math.random())));
//put(Item.getItemFromBlock(Blocks.lapis_ore), new ItemStack(Items.dye, 4, 2+(int)Math.ceil(8*Math.random())));
put(Item.getItemFromBlock(Blocks.iron_ore), (new ItemStack(ModItems.coarseironItem)));
put(Item.getItemFromBlock(Blocks.gold_ore), (new ItemStack(ModItems.coarsegoldItem)));
put(Item.getItemFromBlock(Blocks.redstone_ore), (new ItemStack(Items.redstone)));
//put(Item.getItemFromBlock(Blocks.lapis_ore), (new ItemStack(Items.dye)));
}};
static final Hashtable<Item, Item> grinderCheck = new Hashtable <Item, Item>(){{
//put(ModItems.ironAxeForm, new ItemStack(ModItems.ironaxeHead, 1));
put(Item.getItemFromBlock(Blocks.iron_ore), Item.getItemFromBlock(Blocks.iron_ore));
//put(ModItems.saxleItem, Item.getItemFromBlock(Blocks.planks));
put(Item.getItemFromBlock(Blocks.gold_ore), Item.getItemFromBlock(Blocks.gold_ore));
put(Item.getItemFromBlock(Blocks.redstone_ore), Item.getItemFromBlock(Blocks.redstone_ore));
//put(Item.getItemFromBlock(Blocks.lapis_ore), Item.getItemFromBlock(Blocks.lapis_ore));
}};
static final Hashtable<Item, Integer> grinderSize = new Hashtable <Item, Integer>(){{
put(ModItems.coarseironItem, 2);
put(ModItems.coarsegoldItem, 2);
put(Items.redstone, 4);
//put(Items.dye, 4);
}};