refactor all the anvil code and the slot tongs code, need to finish all the slotted tongs models now

This commit is contained in:
Mohammad-Ali Minaie
2018-04-30 01:27:50 -04:00
parent b593173489
commit b7eb357f9d
10 changed files with 356 additions and 172 deletions

View File

@@ -5,6 +5,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -34,14 +35,12 @@ public class AnvilStone extends AnvilBase {
ItemStack pItem = player.inventory.getCurrentItem(); ItemStack pItem = player.inventory.getCurrentItem();
TileAnvil tile = (TileAnvil) world.getTileEntity(pos); TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
ItemStack tempironball = new ItemStack(ModItems.ironingotball, 1); ItemStack stack12 = tile.getSlotStack(12).copy();
tempironball.getTagCompound().setBoolean("hot", true); if (hand.equals(player.swingingHand)) {
ItemStack tempironcleanball = new ItemStack(ModItems.ironcleaningotball, 1); if (!stack12.isEmpty()) {
tempironcleanball.getTagCompound().setBoolean("hot", true); if (tile != null) {
ItemStack tempsteelball = new ItemStack(ModItems.steelingotball, 1); if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) {
tempsteelball.getTagCompound().setBoolean("hot", true); NBTTagCompound nbt12 = stack12.getTagCompound();
ItemStack tempwootzball = new ItemStack(ModItems.wootzingotball, 1);
tempwootzball.getTagCompound().setBoolean("hot", true);
ItemStack tempironchunk = new ItemStack(ModItems.ironchunk, 1); ItemStack tempironchunk = new ItemStack(ModItems.ironchunk, 1);
tempironchunk.getTagCompound().setBoolean("hot", true); tempironchunk.getTagCompound().setBoolean("hot", true);
@@ -51,12 +50,7 @@ public class AnvilStone extends AnvilBase {
tempsteelchunk.getTagCompound().setBoolean("hot", true); tempsteelchunk.getTagCompound().setBoolean("hot", true);
ItemStack tempwootzchunk = new ItemStack(ModItems.wootzchunk, 1); ItemStack tempwootzchunk = new ItemStack(ModItems.wootzchunk, 1);
tempwootzchunk.getTagCompound().setBoolean("hot", true); tempwootzchunk.getTagCompound().setBoolean("hot", true);
if (stack12.getItem().equals(ModItems.ironingotball) && stack12.getTagCompound().getBoolean("hot")) {
if (tile != null) {
if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) {
if(tile.getSlotStack(12).getItem().equals(tempironball) ){
tile.setSlotStack(6, tempironchunk); tile.setSlotStack(6, tempironchunk);
tile.setSlotStack(7, tempironchunk); tile.setSlotStack(7, tempironchunk);
tile.setSlotStack(8, tempironchunk); tile.setSlotStack(8, tempironchunk);
@@ -68,7 +62,7 @@ public class AnvilStone extends AnvilBase {
tile.setSlotStack(18, tempironchunk); tile.setSlotStack(18, tempironchunk);
world.playEvent(1031, pos, 0); world.playEvent(1031, pos, 0);
} }
if(tile.getSlotStack(12).getItem().equals(tempironcleanball) ){ if (stack12.getItem().equals(ModItems.ironcleaningotball) && stack12.getTagCompound().getBoolean("hot")) {
tile.setSlotStack(6, tempironcleanchunk); tile.setSlotStack(6, tempironcleanchunk);
tile.setSlotStack(7, tempironcleanchunk); tile.setSlotStack(7, tempironcleanchunk);
tile.setSlotStack(8, tempironcleanchunk); tile.setSlotStack(8, tempironcleanchunk);
@@ -80,7 +74,7 @@ public class AnvilStone extends AnvilBase {
tile.setSlotStack(18, tempironcleanchunk); tile.setSlotStack(18, tempironcleanchunk);
world.playEvent(1031, pos, 0); world.playEvent(1031, pos, 0);
} }
if(tile.getSlotStack(12).getItem().equals(tempsteelball) ){ if (stack12.getItem().equals(ModItems.steelingotball) && stack12.getTagCompound().getBoolean("hot")) {
tile.setSlotStack(6, tempsteelchunk); tile.setSlotStack(6, tempsteelchunk);
tile.setSlotStack(7, tempsteelchunk); tile.setSlotStack(7, tempsteelchunk);
tile.setSlotStack(8, tempsteelchunk); tile.setSlotStack(8, tempsteelchunk);
@@ -91,7 +85,7 @@ public class AnvilStone extends AnvilBase {
tile.setSlotStack(17, tempsteelchunk); tile.setSlotStack(17, tempsteelchunk);
tile.setSlotStack(18, tempsteelchunk); tile.setSlotStack(18, tempsteelchunk);
} }
if(tile.getSlotStack(12).getItem().equals(tempwootzball) ){ if (stack12.getItem().equals(ModItems.wootzingotball) && stack12.getTagCompound().getBoolean("hot")) {
tile.setSlotStack(6, tempwootzchunk); tile.setSlotStack(6, tempwootzchunk);
tile.setSlotStack(7, tempwootzchunk); tile.setSlotStack(7, tempwootzchunk);
tile.setSlotStack(8, tempwootzchunk); tile.setSlotStack(8, tempwootzchunk);
@@ -103,6 +97,8 @@ public class AnvilStone extends AnvilBase {
tile.setSlotStack(18, tempwootzchunk); tile.setSlotStack(18, tempwootzchunk);
} }
} }
}
}
if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) { if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) {
String[] tempArray = new String[25]; String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) { for (int i = 0; i < 25; i++) {
@@ -122,9 +118,8 @@ public class AnvilStone extends AnvilBase {
doAnvilRecipe(pItem, tempArray, world, tile, pos, player); doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
return true; return true;
} }
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return true;
} }
return false;
} }
return false; return false;
} }

View File

@@ -43,7 +43,8 @@ public class ModItems {
public static Item stonetongs; public static Item stonetongs;
public static Item castingmud; public static Item castingmud;
public static Item bronzeingotball;
public static Item bronzechunk;
public static Item ironingotball; public static Item ironingotball;
public static Item ironchunk; public static Item ironchunk;
public static Item ironcleaningotball; public static Item ironcleaningotball;
@@ -248,6 +249,8 @@ public class ModItems {
INGOTS AND CHUNKS INGOTS AND CHUNKS
**********/ **********/
bronzeingotball = new BaseMultiItem("bronzeingotball", PrimalAPI.ToolMaterials.TOOL_BRONZE);
bronzechunk = new BaseMultiItem("bronzechunk", PrimalAPI.ToolMaterials.TOOL_BRONZE);
ironingotball = new BaseMultiItem("ironingotball", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON); ironingotball = new BaseMultiItem("ironingotball", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
ironchunk = new BaseMultiItem("ironchunk", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON); ironchunk = new BaseMultiItem("ironchunk", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
ironcleaningotball= new BaseMultiItem("ironcleaningotball", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON); ironcleaningotball= new BaseMultiItem("ironcleaningotball", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
@@ -408,6 +411,8 @@ public class ModItems {
registerRender(forgehammer); registerRender(forgehammer);
registerRender(bronzeingotball);
registerRender(bronzechunk);
registerRender(ironingotball); registerRender(ironingotball);
registerRender(ironchunk); registerRender(ironchunk);
registerRender(ironcleaningotball); registerRender(ironcleaningotball);

View File

@@ -14,6 +14,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible; import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible;
import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.items.parts.ToolPart;
@@ -37,14 +38,17 @@ public class BaseMultiItem extends BaseItem {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
BaseMultiItem item = (BaseMultiItem) stack.getItem(); BaseMultiItem item = (BaseMultiItem) stack.getItem();
Item itemStack = stack.getItem();
//TODO get the item name //TODO get the item name
if (stack.getItem() instanceof BaseMultiItem) { if (stack.getItem() instanceof BaseMultiItem) {
if(stack.getTagCompound() != null) { if(stack.getTagCompound() != null) {
if(itemStack.equals(ModItems.ironingotball)) {
if (!stack.getTagCompound().getBoolean("hot")) { if (!stack.getTagCompound().getBoolean("hot")) {
return 0.0f; return 0.0f;
} }
if (stack.getTagCompound().getBoolean("hot")) { if (stack.getTagCompound().getBoolean("hot")) {
return 0.1f; return 0.01f;
}
} }
} }
} }

View File

@@ -1,6 +1,7 @@
package nmd.primal.forgecraft.items; package nmd.primal.forgecraft.items;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -23,20 +24,27 @@ import nmd.primal.core.api.interfaces.IPickup;
import nmd.primal.core.common.helper.NBTHelper; import nmd.primal.core.common.helper.NBTHelper;
import nmd.primal.core.common.helper.PlayerHelper; import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.Anvil.AnvilBase;
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible; import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible;
import nmd.primal.forgecraft.blocks.Forge; import nmd.primal.forgecraft.blocks.Forge;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible; import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible;
import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.tiles.TileForge; import nmd.primal.forgecraft.tiles.TileForge;
import nmd.primal.forgecraft.tiles.TileNBTCrucible; import nmd.primal.forgecraft.tiles.TileNBTCrucible;
import nmd.primal.forgecraft.util.AnvilHandler;
import org.lwjgl.Sys;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import static nmd.primal.forgecraft.blocks.CustomContainerFacing.FACING;
/** /**
* Created by mminaie on 12/30/17. * Created by mminaie on 12/30/17.
*/ */
public class SlottedTongs extends Item implements IPickup { public class SlottedTongs extends Item implements IPickup, AnvilHandler{
public SlottedTongs(String unlocalizedName) { public SlottedTongs(String unlocalizedName) {
setUnlocalizedName(unlocalizedName); setUnlocalizedName(unlocalizedName);
@@ -53,6 +61,7 @@ public class SlottedTongs extends Item implements IPickup {
ItemStack slotStack = item.getSlotList().get(0); ItemStack slotStack = item.getSlotList().get(0);
//TODO get the item name //TODO get the item name
if (stack.getItem() instanceof SlottedTongs) { if (stack.getItem() instanceof SlottedTongs) {
//System.out.println(slotStack.getTagCompound());
if (slotStack.getItem() instanceof ItemNBTCrucible){ if (slotStack.getItem() instanceof ItemNBTCrucible){
if(item.getSlotList().get(0).getSubCompound("BlockEntityTag").getBoolean("hot")){ if(item.getSlotList().get(0).getSubCompound("BlockEntityTag").getBoolean("hot")){
return 0.01f; return 0.01f;
@@ -160,6 +169,76 @@ public class SlottedTongs extends Item implements IPickup {
} }
} }
} }
if(slotStack.getItem() instanceof BaseMultiItem){
Item slotItem = slotStack.getItem();
if (slotStack.getTagCompound() != null) {
if (!slotStack.getTagCompound().getBoolean("hot")) {
if (slotItem.equals(ModItems.bronzeingotball)) {
return 0.27f;
}
if (slotItem.equals(ModItems.ironingotball)) {
System.out.println("Rendering ingot ball");
return 0.28f;
}
if (slotItem.equals(ModItems.ironcleaningotball)) {
return 0.29f;
}
if (slotItem.equals(ModItems.steelingotball)) {
return 0.30f;
}
if (slotItem.equals(ModItems.wootzingotball)) {
return 0.31f;
}
if (slotItem.equals(ModItems.bronzechunk)) {
return 0.32f;
}
if (slotItem.equals(ModItems.ironchunk)) {
return 0.33f;
}
if (slotItem.equals(ModItems.ironcleanchunk)) {
return 0.34f;
}
if (slotItem.equals(ModItems.steelchunk)) {
return 0.35f;
}
if (slotItem.equals(ModItems.wootzchunk)) {
return 0.36f;
}
}
if (slotStack.getTagCompound().getBoolean("hot")) {
if (slotItem.equals(ModItems.bronzeingotball)) {
return 0.37f;
}
if (slotItem.equals(ModItems.ironingotball)) {
return 0.38f;
}
if (slotItem.equals(ModItems.ironcleaningotball)) {
return 0.39f;
}
if (slotItem.equals(ModItems.steelingotball)) {
return 0.40f;
}
if (slotItem.equals(ModItems.wootzingotball)) {
return 0.41f;
}
if (slotItem.equals(ModItems.bronzechunk)) {
return 0.42f;
}
if (slotItem.equals(ModItems.ironchunk)) {
return 0.43f;
}
if (slotItem.equals(ModItems.ironcleanchunk)) {
return 0.44f;
}
if (slotItem.equals(ModItems.steelchunk)) {
return 0.45f;
}
if (slotItem.equals(ModItems.wootzchunk)) {
return 0.46f;
}
}
}
}
} }
return 0.0F; return 0.0F;
} }
@@ -171,16 +250,28 @@ public class SlottedTongs extends Item implements IPickup {
return slotList; return slotList;
} }
public void setSlotList(ItemStack stack) {
slotList.set(0, stack);
}
public NonNullList<ItemStack> slotList = NonNullList.withSize(1, ItemStack.EMPTY); public NonNullList<ItemStack> slotList = NonNullList.withSize(1, ItemStack.EMPTY);
@Override @Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ) public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitx, float hity, float hitz)
{ {
if(!world.isRemote){ if(!world.isRemote){
//if (hand.equals(player.swingingHand)) {
IBlockState state = world.getBlockState(pos); IBlockState state = world.getBlockState(pos);
Block block = world.getBlockState(pos).getBlock(); Block block = world.getBlockState(pos).getBlock();
ItemStack itemstack = player.getHeldItem(hand); ItemStack itemstack = player.getHeldItem(hand);
if(slotList.get(0).isEmpty()){
if (block instanceof AnvilStone) {
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
doAnvilInventoryManager(itemstack, world, tile, pos, hitx, hity, hitz, state, player);
return EnumActionResult.SUCCESS;
}
if (slotList.get(0).isEmpty()) {
if (block instanceof NBTCrucible) { if (block instanceof NBTCrucible) {
ItemStack tempStack = takeBlock(world, pos, state, face, player, block).copy(); ItemStack tempStack = takeBlock(world, pos, state, face, player, block).copy();
slotList.set(0, tempStack); slotList.set(0, tempStack);
@@ -188,44 +279,47 @@ public class SlottedTongs extends Item implements IPickup {
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
} }
} }
if(!slotList.get(0).isEmpty() ){ if (!slotList.get(0).isEmpty()) {
if(slotList.get(0).getItem() instanceof ItemNBTCrucible) { if (slotList.get(0).getItem() instanceof ItemNBTCrucible) {
NBTTagCompound tag = this.slotList.get(0).getSubCompound("BlockEntityTag").copy(); NBTTagCompound tag = this.slotList.get(0).getSubCompound("BlockEntityTag").copy();
if (tag != null) { if (tag != null) {
ItemBlock temp = (ItemBlock) slotList.get(0).getItem(); ItemBlock temp = (ItemBlock) slotList.get(0).getItem();
int i = this.getMetadata(slotList.get(0).getMetadata()); int i = this.getMetadata(slotList.get(0).getMetadata());
IBlockState iblockstate1 = temp.getBlock().getStateForPlacement(world, pos, face, hitX, hitY, hitZ, i, player, hand); IBlockState iblockstate1 = temp.getBlock().getStateForPlacement(world, pos, face, hitx, hity, hitz, i, player, hand);
temp.placeBlockAt(slotList.get(0), player, world, pos.up(1), face, hitX, hitY, hitZ, iblockstate1); temp.placeBlockAt(slotList.get(0), player, world, pos.up(1), face, hitx, hity, hitz, iblockstate1);
slotList.set(0, ItemStack.EMPTY); slotList.set(0, ItemStack.EMPTY);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
} }
} }
} }
/***** /*****
TAKES the Tool Parts from the Forge TAKES anything out from the Forge
*****/ *****/
if(slotList.get(0).isEmpty()) { if (slotList.get(0).isEmpty()) {
if (world.getBlockState(pos).getBlock() instanceof Forge) { if (world.getBlockState(pos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(pos); TileForge tile = (TileForge) world.getTileEntity(pos);
for (int i = 4; i < tile.getSlotListSize(); i++) { for (int i = 2; i < tile.getSlotListSize(); i++) {
if (tile.getSlotStack(i) != ItemStack.EMPTY) {
ItemStack tempStack = tile.getSlotStack(i).copy(); ItemStack tempStack = tile.getSlotStack(i).copy();
System.out.println(tempStack);
slotList.set(0, tempStack); slotList.set(0, tempStack);
tile.setSlotStack(i, ItemStack.EMPTY); tile.setSlotStack(i, ItemStack.EMPTY);
System.out.println(slotList.get(0));
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
} }
} }
} }
}
/***** /*****
PUTS the Ingots into the Forge PUTS the Ingots into the Forge
*****/ *****/
if(!slotList.get(0).isEmpty()) { if (!slotList.get(0).isEmpty()) {
if (world.getBlockState(pos).getBlock() instanceof Forge) { if (world.getBlockState(pos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(pos); TileForge tile = (TileForge) world.getTileEntity(pos);
if( !(slotList.get(0).getItem() instanceof ToolPart)) { if (!(slotList.get(0).getItem() instanceof ToolPart)) {
for (int i = 4; i < tile.getSlotListSize(); i++) { for (int i = 2; i < tile.getSlotListSize(); i++) {
ItemStack tempStack = slotList.get(0).copy(); ItemStack tempStack = slotList.get(0).copy();
tile.setSlotStack(i, tempStack); tile.setSlotStack(i, tempStack);
slotList.set(0, ItemStack.EMPTY); slotList.set(0, ItemStack.EMPTY);
@@ -235,13 +329,13 @@ public class SlottedTongs extends Item implements IPickup {
} }
} }
/***** /*****
PUTS the Ingots into the Forge PUTS the ToolParts into the Forge
*****/ *****/
if(!slotList.get(0).isEmpty()) { if (!slotList.get(0).isEmpty()) {
if (world.getBlockState(pos).getBlock() instanceof Forge) { if (world.getBlockState(pos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(pos); TileForge tile = (TileForge) world.getTileEntity(pos);
if(slotList.get(0).getItem() instanceof ToolPart) { if (slotList.get(0).getItem() instanceof ToolPart) {
ItemStack tempStack = slotList.get(0).copy(); ItemStack tempStack = slotList.get(0).copy();
tile.setSlotStack(4, tempStack); tile.setSlotStack(4, tempStack);
slotList.set(0, ItemStack.EMPTY); slotList.set(0, ItemStack.EMPTY);
@@ -250,18 +344,37 @@ public class SlottedTongs extends Item implements IPickup {
} }
} }
if(!slotList.get(0).isEmpty() ){ /*****
if(slotList.get(0).getItem() instanceof ToolPart) { DROPS the ToolParts into the World
*****/
if (!slotList.get(0).isEmpty()) {
if (!(block instanceof AnvilBase)) {
if (slotList.get(0).getItem() instanceof ToolPart) {
ItemStack tempStack = slotList.get(0).copy(); ItemStack tempStack = slotList.get(0).copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack); PlayerHelper.spawnItemOnGround(world, pos, tempStack);
slotList.set(0, ItemStack.EMPTY); slotList.set(0, ItemStack.EMPTY);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
} }
} }
}
/*****
DROPS the Ingots into the World
*****/
if (!slotList.get(0).isEmpty()) {
if (!(block instanceof AnvilBase)) {
if (slotList.get(0).getItem() instanceof BaseMultiItem) {
ItemStack tempStack = slotList.get(0).copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
slotList.set(0, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
}
//}
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} }
return EnumActionResult.SUCCESS; return EnumActionResult.FAIL;
} }

View File

@@ -6,6 +6,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor; import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@@ -20,6 +21,7 @@ import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.BaseMultiItem; import nmd.primal.forgecraft.items.BaseMultiItem;
import nmd.primal.forgecraft.items.ForgeHammer; import nmd.primal.forgecraft.items.ForgeHammer;
import nmd.primal.forgecraft.items.SlottedTongs;
import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.tiles.TileAnvil; import nmd.primal.forgecraft.tiles.TileAnvil;
@@ -185,8 +187,8 @@ public interface AnvilHandler {
for (int x = 0; x < 5; x++) { for (int x = 0; x < 5; x++) {
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) { if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) { if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
AnvilHandler.doWork(pItem, counter, tile, world, pos, player); return AnvilHandler.doWork(pItem, counter, tile, world, pos, player);
return true; //return true;
} }
} }
counter++; counter++;
@@ -199,8 +201,7 @@ public interface AnvilHandler {
for (int x = 0; x < 5; x++) { for (int x = 0; x < 5; x++) {
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) { if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) { if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
doWork(pItem, counter, tile, world, pos, player); return AnvilHandler.doWork(pItem, counter, tile, world, pos, player);
return true;
} }
} }
counter++; counter++;
@@ -213,8 +214,7 @@ public interface AnvilHandler {
for (int z = 0; z < 5; z++) { for (int z = 0; z < 5; z++) {
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) { if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) { if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
doWork(pItem, counter, tile, world, pos, player); return AnvilHandler.doWork(pItem, counter, tile, world, pos, player);
return true;
} }
} }
counter++; counter++;
@@ -227,8 +227,7 @@ public interface AnvilHandler {
for (int z = 0; z < 5; z++) { for (int z = 0; z < 5; z++) {
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) { if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) { if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
doWork(pItem, counter, tile, world, pos, player); return AnvilHandler.doWork(pItem, counter, tile, world, pos, player);
return true;
} }
} }
counter++; counter++;
@@ -241,8 +240,39 @@ public interface AnvilHandler {
static boolean doWork(ItemStack pItem, Integer counter, TileAnvil tile, World world, BlockPos pos, EntityPlayer player) { static boolean doWork(ItemStack pItem, Integer counter, TileAnvil tile, World world, BlockPos pos, EntityPlayer player) {
if (pItem.getItem().equals(ModItems.stonetongs)) { if(!world.isRemote) {
if ((pItem.getTagCompound().getInteger("type") == 6) || if (pItem.getItem().equals(ModItems.slottedtongs)) {
SlottedTongs tongs = (SlottedTongs) pItem.getItem();
ItemStack tongStack = tongs.getSlotList().get(0).copy();
if (tongStack.isEmpty()) {
if (!tile.getSlotStack(counter).isEmpty()) {
ItemStack tempStack = tile.getSlotStack(counter).copy();
tongs.setSlotList(tempStack);
tile.setSlotStack(counter, ItemStack.EMPTY);
System.out.println("Tongs should have an item");
return true;
}
}
if (!tongStack.isEmpty()) {
if (tile.getSlotStack(counter).isEmpty()) {
ItemStack tempStack = tongs.getSlotList().get(0).copy();
tile.setSlotStack(counter, tempStack);
tongs.setSlotList(ItemStack.EMPTY);
System.out.println("Tongs should not an item");
return true;
}
}
}
}
return false;
}
/*if ((pItem.getTagCompound().getInteger("type") == 6) ||
(pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 7) ||
(pItem.getTagCompound().getInteger("type") == 8) || (pItem.getTagCompound().getInteger("type") == 8) ||
(pItem.getTagCompound().getInteger("type") == 9) || (pItem.getTagCompound().getInteger("type") == 9) ||
@@ -300,7 +330,7 @@ public interface AnvilHandler {
} }
}*/ }*/
if (tile.getSlotStack(counter).isEmpty()) { //if (tile.getSlotStack(counter).isEmpty()) {
//System.out.println("Activating"); //System.out.println("Activating");
/*if (pItem.getTagCompound().getInteger("type") == 6) { /*if (pItem.getTagCompound().getInteger("type") == 6) {
//System.out.println("Tongs meta = 6"); //System.out.println("Tongs meta = 6");
@@ -315,7 +345,7 @@ public interface AnvilHandler {
///System.out.println(counter); ///System.out.println(counter);
//System.out.println(tile.getSlotStack(counter)); //System.out.println(tile.getSlotStack(counter));
return true; return true;
}*/ }
if (pItem.getTagCompound().getInteger("type") == 8) { if (pItem.getTagCompound().getInteger("type") == 8) {
ItemStack tempStack = new ItemStack(ModItems.pickaxehead, 1); ItemStack tempStack = new ItemStack(ModItems.pickaxehead, 1);
tempStack.setTagCompound(new NBTTagCompound()); tempStack.setTagCompound(new NBTTagCompound());
@@ -388,7 +418,7 @@ public interface AnvilHandler {
pItem.getTagCompound().setInteger("tempDamage", 0); pItem.getTagCompound().setInteger("tempDamage", 0);
return true; return true;
} }
*/
/********************************* /*********************************
* Clean Iron * * Clean Iron *
*********************************/ *********************************/
@@ -405,7 +435,7 @@ public interface AnvilHandler {
///System.out.println(counter); ///System.out.println(counter);
//System.out.println(tile.getSlotStack(counter)); //System.out.println(tile.getSlotStack(counter));
return true; return true;
}*/ }
if (pItem.getTagCompound().getInteger("type") == 17) { if (pItem.getTagCompound().getInteger("type") == 17) {
ItemStack tempStack = new ItemStack(ModItems.cleanironpickaxehead, 1); ItemStack tempStack = new ItemStack(ModItems.cleanironpickaxehead, 1);
tempStack.setTagCompound(new NBTTagCompound()); tempStack.setTagCompound(new NBTTagCompound());
@@ -478,7 +508,7 @@ public interface AnvilHandler {
pItem.getTagCompound().setInteger("tempDamage", 0); pItem.getTagCompound().setInteger("tempDamage", 0);
return true; return true;
} }
*/
/********************************* /*********************************
* Steel * * Steel *
*********************************/ *********************************/
@@ -497,7 +527,7 @@ public interface AnvilHandler {
//System.out.println(tile.getSlotStack(counter)); //System.out.println(tile.getSlotStack(counter));
return true; return true;
} }
*/
if (pItem.getTagCompound().getInteger("type") == 26) { if (pItem.getTagCompound().getInteger("type") == 26) {
ItemStack tempStack = new ItemStack(ModItems.steelpickaxehead, 1); ItemStack tempStack = new ItemStack(ModItems.steelpickaxehead, 1);
tempStack.setTagCompound(new NBTTagCompound()); tempStack.setTagCompound(new NBTTagCompound());
@@ -693,9 +723,8 @@ public interface AnvilHandler {
pItem.shrink(1); pItem.shrink(1);
return true; return true;
} }
} }*/
return false;
}
static void doDrops(World world, BlockPos pos) { static void doDrops(World world, BlockPos pos) {
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops")) { if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops")) {

View File

@@ -6,6 +6,6 @@
}, },
"overrides": [ "overrides": [
{"predicate": {"type": 0.0},"model": "forgecraft:item/ingots/wroughtiron/ingot_0"}, {"predicate": {"type": 0.0},"model": "forgecraft:item/ingots/wroughtiron/ingot_0"},
{"predicate": {"type": 0.1},"model": "forgecraft:item/ingots/wroughtiron/ingot_1"} {"predicate": {"type": 0.01},"model": "forgecraft:item/ingots/wroughtiron/ingot_01"}
] ]
} }

View File

@@ -32,7 +32,27 @@
{"predicate": {"type": 0.23},"model": "forgecraft:item/slottedtongs/slottedtongs_23"}, {"predicate": {"type": 0.23},"model": "forgecraft:item/slottedtongs/slottedtongs_23"},
{"predicate": {"type": 0.24},"model": "forgecraft:item/slottedtongs/slottedtongs_24"}, {"predicate": {"type": 0.24},"model": "forgecraft:item/slottedtongs/slottedtongs_24"},
{"predicate": {"type": 0.25},"model": "forgecraft:item/slottedtongs/slottedtongs_25"}, {"predicate": {"type": 0.25},"model": "forgecraft:item/slottedtongs/slottedtongs_25"},
{"predicate": {"type": 0.26},"model": "forgecraft:item/slottedtongs/slottedtongs_26"} {"predicate": {"type": 0.26},"model": "forgecraft:item/slottedtongs/slottedtongs_26"},
{"predicate": {"type": 0.27},"model": "forgecraft:item/slottedtongs/slottedtongs_27"},
{"predicate": {"type": 0.28},"model": "forgecraft:item/slottedtongs/slottedtongs_28"},
{"predicate": {"type": 0.29},"model": "forgecraft:item/slottedtongs/slottedtongs_29"},
{"predicate": {"type": 0.30},"model": "forgecraft:item/slottedtongs/slottedtongs_30"},
{"predicate": {"type": 0.31},"model": "forgecraft:item/slottedtongs/slottedtongs_31"},
{"predicate": {"type": 0.32},"model": "forgecraft:item/slottedtongs/slottedtongs_32"},
{"predicate": {"type": 0.33},"model": "forgecraft:item/slottedtongs/slottedtongs_33"},
{"predicate": {"type": 0.34},"model": "forgecraft:item/slottedtongs/slottedtongs_34"},
{"predicate": {"type": 0.35},"model": "forgecraft:item/slottedtongs/slottedtongs_35"},
{"predicate": {"type": 0.36},"model": "forgecraft:item/slottedtongs/slottedtongs_36"},
{"predicate": {"type": 0.37},"model": "forgecraft:item/slottedtongs/slottedtongs_37"},
{"predicate": {"type": 0.38},"model": "forgecraft:item/slottedtongs/slottedtongs_38"},
{"predicate": {"type": 0.29},"model": "forgecraft:item/slottedtongs/slottedtongs_39"},
{"predicate": {"type": 0.40},"model": "forgecraft:item/slottedtongs/slottedtongs_40"},
{"predicate": {"type": 0.41},"model": "forgecraft:item/slottedtongs/slottedtongs_41"},
{"predicate": {"type": 0.42},"model": "forgecraft:item/slottedtongs/slottedtongs_42"},
{"predicate": {"type": 0.43},"model": "forgecraft:item/slottedtongs/slottedtongs_43"},
{"predicate": {"type": 0.44},"model": "forgecraft:item/slottedtongs/slottedtongs_44"},
{"predicate": {"type": 0.45},"model": "forgecraft:item/slottedtongs/slottedtongs_45"},
{"predicate": {"type": 0.46},"model": "forgecraft:item/slottedtongs/slottedtongs_46"}
] ]
} }

View File

@@ -0,0 +1,9 @@
{
"parent": "forgecraft:item/stonetongs_ingot_default",
"textures": {
"particle": "blocks/planks_oak",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:blocks/stone_slab",
"texture2": "forgecraft:items/finished_bronze"
}
}

View File

@@ -0,0 +1,9 @@
{
"parent": "forgecraft:item/stonetongs_ingot_default",
"textures": {
"particle": "blocks/planks_oak",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:blocks/stone_slab",
"texture2": "forgecraft:blocks/iron_ingot"
}
}