grinderrecipe fixes

This commit is contained in:
KitsuShadow
2015-08-30 05:40:12 -04:00
parent e2245c0519
commit c87cae4e94
3 changed files with 75 additions and 39 deletions

View File

@@ -39,8 +39,8 @@ public class CrankBlock extends Block implements ITileEntityProvider{
TileEntCrank tile = (TileEntCrank) world.getTileEntity(x, y, z);
if(tile.isPowered == false){
tile.isPowered = true;
}
/*if(tile.getBlockMetadata()==0){
/*if(tile.getBlockMetadata()==0){
if(world.getBlock(x, y+1, z) instanceof LatheBase){
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x, y+1, z);
tileLathe.isPowered=true;
@@ -49,29 +49,29 @@ public class CrankBlock extends Block implements ITileEntityProvider{
tileLathe.markForUpdate();
}
}*/
if(tile.getBlockMetadata()==1){
if(world.getBlock(x, y-1, z) instanceof CrankGrinder){
TileEntCrankGrinder tileGrinder = (TileEntCrankGrinder) world.getTileEntity(x, y-1, z);
if(tileGrinder.getStackInSlot(1)!=null){
tileGrinder.isPowered=true;
tileGrinder.power+=15;
tileGrinder.workCount+=20;
tileGrinder.getStackInSlot(1).setItemDamage(tileGrinder.getStackInSlot(1).getItemDamage()+1);
if(tile.getBlockMetadata()==1){
if(world.getBlock(x, y-1, z) instanceof CrankGrinder){
TileEntCrankGrinder tileGrinder = (TileEntCrankGrinder) world.getTileEntity(x, y-1, z);
if(tileGrinder.getStackInSlot(1)!=null){
tileGrinder.isPowered=true;
tileGrinder.power+=15;
tileGrinder.workCount+=20;
tileGrinder.getStackInSlot(1).setItemDamage(tileGrinder.getStackInSlot(1).getItemDamage()+1);
}
tileGrinder.markDirty();
tileGrinder.markForUpdate();
}
tileGrinder.markDirty();
tileGrinder.markForUpdate();
}
}
if(tile.getBlockMetadata()==2){
if(world.getBlock(x, y, z+1) instanceof LatheBase){
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x, y, z+1);
tileLathe.isPowered=true;
tileLathe.power+=20;
tileLathe.markDirty();
tileLathe.markForUpdate();
if(tile.getBlockMetadata()==2){
if(world.getBlock(x, y, z+1) instanceof LatheBase){
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x, y, z+1);
tileLathe.isPowered=true;
tileLathe.power+=20;
tileLathe.markDirty();
tileLathe.markForUpdate();
}
}
}
/*if(tile.getBlockMetadata()==3){
/*if(tile.getBlockMetadata()==3){
if(world.getBlock(x, y, z-1) instanceof LatheBase){
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x, y, z-1);
tileLathe.isPowered=true;
@@ -80,16 +80,16 @@ public class CrankBlock extends Block implements ITileEntityProvider{
tileLathe.markForUpdate();
}
}*/
if(tile.getBlockMetadata()==4){
if(world.getBlock(x+1, y, z) instanceof LatheBase){
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x+1, y, z);
tileLathe.isPowered=true;
tileLathe.power+=20;
tileLathe.markDirty();
tileLathe.markForUpdate();
if(tile.getBlockMetadata()==4){
if(world.getBlock(x+1, y, z) instanceof LatheBase){
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x+1, y, z);
tileLathe.isPowered=true;
tileLathe.power+=20;
tileLathe.markDirty();
tileLathe.markForUpdate();
}
}
}
/*if(tile.getBlockMetadata()==5){
/*if(tile.getBlockMetadata()==5){
if(world.getBlock(x-1, y, z) instanceof LatheBase){
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x-1, y, z);
tileLathe.isPowered=true;
@@ -98,12 +98,12 @@ public class CrankBlock extends Block implements ITileEntityProvider{
tileLathe.markForUpdate();
}
}*/
tile.markDirty();
tile.markForUpdate();
return true;
tile.markDirty();
tile.markForUpdate();
return true;
}
}
return true;
return false;
}
@Override

View File

@@ -16,8 +16,9 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import nmd.primal.energy.util.GrinderRecipes;
public class TileEntCrankGrinder extends TileEntity implements IInventory {
public class TileEntCrankGrinder extends TileEntity implements IInventory, GrinderRecipes {
private ItemStack[] inv;
private int i;
@@ -61,9 +62,12 @@ public class TileEntCrankGrinder extends TileEntity implements IInventory {
if(workCount>=100){
if(this.getStackInSlot(0)!=null){
if(this.getStackInSlot(0).getItem().equals(Item.getItemFromBlock(Blocks.redstone_ore))){
//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(Items.redstone, 2+random.nextInt(4)));
EntityItem eItem = new EntityItem(world, x+0.5f, y+0.35f, z+0.5f, new ItemStack(GrinderRecipes.grinderIn.get(this.getStackInSlot(0).getItem()),4));
world.spawnEntityInWorld(eItem);
workCount=0;
this.markForUpdate();

View File

@@ -0,0 +1,32 @@
package nmd.primal.energy.util;
import java.util.Hashtable;
import java.util.Random;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import nmd.primal.energy.item.ModItems;
public interface GrinderRecipes {
static final Hashtable<Item, Item> grinderIn = new Hashtable <Item, Item>(){{
//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())));
}};
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));
}};
}