grinderrecipe fixes
This commit is contained in:
@@ -39,7 +39,7 @@ public class CrankBlock extends Block implements ITileEntityProvider{
|
|||||||
TileEntCrank tile = (TileEntCrank) world.getTileEntity(x, y, z);
|
TileEntCrank tile = (TileEntCrank) world.getTileEntity(x, y, z);
|
||||||
if(tile.isPowered == false){
|
if(tile.isPowered == false){
|
||||||
tile.isPowered = true;
|
tile.isPowered = true;
|
||||||
}
|
|
||||||
/*if(tile.getBlockMetadata()==0){
|
/*if(tile.getBlockMetadata()==0){
|
||||||
if(world.getBlock(x, y+1, z) instanceof LatheBase){
|
if(world.getBlock(x, y+1, z) instanceof LatheBase){
|
||||||
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x, y+1, z);
|
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x, y+1, z);
|
||||||
@@ -102,8 +102,8 @@ public class CrankBlock extends Block implements ITileEntityProvider{
|
|||||||
tile.markForUpdate();
|
tile.markForUpdate();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,8 +16,9 @@ import net.minecraft.network.Packet;
|
|||||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
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 ItemStack[] inv;
|
||||||
private int i;
|
private int i;
|
||||||
@@ -61,9 +62,12 @@ public class TileEntCrankGrinder extends TileEntity implements IInventory {
|
|||||||
|
|
||||||
if(workCount>=100){
|
if(workCount>=100){
|
||||||
if(this.getStackInSlot(0)!=null){
|
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);
|
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);
|
world.spawnEntityInWorld(eItem);
|
||||||
workCount=0;
|
workCount=0;
|
||||||
this.markForUpdate();
|
this.markForUpdate();
|
||||||
|
|||||||
32
src/main/java/nmd/primal/energy/util/GrinderRecipes.java
Normal file
32
src/main/java/nmd/primal/energy/util/GrinderRecipes.java
Normal 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));
|
||||||
|
|
||||||
|
}};
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user