refactor all the anvil code and the slot tongs code, need to finish all the slotted tongs models now
This commit is contained in:
@@ -5,6 +5,7 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -34,73 +35,68 @@ public class AnvilStone extends AnvilBase {
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
|
||||
|
||||
ItemStack tempironball = new ItemStack(ModItems.ironingotball, 1);
|
||||
tempironball.getTagCompound().setBoolean("hot", true);
|
||||
ItemStack tempironcleanball = new ItemStack(ModItems.ironcleaningotball, 1);
|
||||
tempironcleanball.getTagCompound().setBoolean("hot", true);
|
||||
ItemStack tempsteelball = new ItemStack(ModItems.steelingotball, 1);
|
||||
tempsteelball.getTagCompound().setBoolean("hot", true);
|
||||
ItemStack tempwootzball = new ItemStack(ModItems.wootzingotball, 1);
|
||||
tempwootzball.getTagCompound().setBoolean("hot", true);
|
||||
ItemStack stack12 = tile.getSlotStack(12).copy();
|
||||
if (hand.equals(player.swingingHand)) {
|
||||
if (!stack12.isEmpty()) {
|
||||
if (tile != null) {
|
||||
if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) {
|
||||
NBTTagCompound nbt12 = stack12.getTagCompound();
|
||||
|
||||
ItemStack tempironchunk = new ItemStack(ModItems.ironchunk, 1);
|
||||
tempironchunk.getTagCompound().setBoolean("hot", true);
|
||||
ItemStack tempironcleanchunk = new ItemStack(ModItems.ironcleanchunk, 1);
|
||||
tempironcleanchunk.getTagCompound().setBoolean("hot", true);
|
||||
ItemStack tempsteelchunk = new ItemStack(ModItems.steelchunk, 1);
|
||||
tempsteelchunk.getTagCompound().setBoolean("hot", true);
|
||||
ItemStack tempwootzchunk = new ItemStack(ModItems.wootzchunk, 1);
|
||||
tempwootzchunk.getTagCompound().setBoolean("hot", true);
|
||||
|
||||
|
||||
|
||||
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(7, tempironchunk);
|
||||
tile.setSlotStack(8, tempironchunk);
|
||||
tile.setSlotStack(11, tempironchunk);
|
||||
tile.setSlotStack(12, tempironchunk);
|
||||
tile.setSlotStack(13, tempironchunk);
|
||||
tile.setSlotStack(16, tempironchunk);
|
||||
tile.setSlotStack(17, tempironchunk);
|
||||
tile.setSlotStack(18, tempironchunk);
|
||||
world.playEvent(1031, pos, 0);
|
||||
}
|
||||
if(tile.getSlotStack(12).getItem().equals(tempironcleanball) ){
|
||||
tile.setSlotStack(6, tempironcleanchunk);
|
||||
tile.setSlotStack(7, tempironcleanchunk);
|
||||
tile.setSlotStack(8, tempironcleanchunk);
|
||||
tile.setSlotStack(11, tempironcleanchunk);
|
||||
tile.setSlotStack(12, tempironcleanchunk);
|
||||
tile.setSlotStack(13, tempironcleanchunk);
|
||||
tile.setSlotStack(16, tempironcleanchunk);
|
||||
tile.setSlotStack(17, tempironcleanchunk);
|
||||
tile.setSlotStack(18, tempironcleanchunk);
|
||||
world.playEvent(1031, pos, 0);
|
||||
}
|
||||
if(tile.getSlotStack(12).getItem().equals(tempsteelball) ){
|
||||
tile.setSlotStack(6, tempsteelchunk);
|
||||
tile.setSlotStack(7, tempsteelchunk);
|
||||
tile.setSlotStack(8, tempsteelchunk);
|
||||
tile.setSlotStack(11, tempsteelchunk);
|
||||
tile.setSlotStack(12, tempsteelchunk);
|
||||
tile.setSlotStack(13, tempsteelchunk);
|
||||
tile.setSlotStack(16, tempsteelchunk);
|
||||
tile.setSlotStack(17, tempsteelchunk);
|
||||
tile.setSlotStack(18, tempsteelchunk);
|
||||
}
|
||||
if(tile.getSlotStack(12).getItem().equals(tempwootzball) ){
|
||||
tile.setSlotStack(6, tempwootzchunk);
|
||||
tile.setSlotStack(7, tempwootzchunk);
|
||||
tile.setSlotStack(8, tempwootzchunk);
|
||||
tile.setSlotStack(11, tempwootzchunk);
|
||||
tile.setSlotStack(12, tempwootzchunk);
|
||||
tile.setSlotStack(13, tempwootzchunk);
|
||||
tile.setSlotStack(16, tempwootzchunk);
|
||||
tile.setSlotStack(17, tempwootzchunk);
|
||||
tile.setSlotStack(18, tempwootzchunk);
|
||||
ItemStack tempironchunk = new ItemStack(ModItems.ironchunk, 1);
|
||||
tempironchunk.getTagCompound().setBoolean("hot", true);
|
||||
ItemStack tempironcleanchunk = new ItemStack(ModItems.ironcleanchunk, 1);
|
||||
tempironcleanchunk.getTagCompound().setBoolean("hot", true);
|
||||
ItemStack tempsteelchunk = new ItemStack(ModItems.steelchunk, 1);
|
||||
tempsteelchunk.getTagCompound().setBoolean("hot", true);
|
||||
ItemStack tempwootzchunk = new ItemStack(ModItems.wootzchunk, 1);
|
||||
tempwootzchunk.getTagCompound().setBoolean("hot", true);
|
||||
if (stack12.getItem().equals(ModItems.ironingotball) && stack12.getTagCompound().getBoolean("hot")) {
|
||||
tile.setSlotStack(6, tempironchunk);
|
||||
tile.setSlotStack(7, tempironchunk);
|
||||
tile.setSlotStack(8, tempironchunk);
|
||||
tile.setSlotStack(11, tempironchunk);
|
||||
tile.setSlotStack(12, tempironchunk);
|
||||
tile.setSlotStack(13, tempironchunk);
|
||||
tile.setSlotStack(16, tempironchunk);
|
||||
tile.setSlotStack(17, tempironchunk);
|
||||
tile.setSlotStack(18, tempironchunk);
|
||||
world.playEvent(1031, pos, 0);
|
||||
}
|
||||
if (stack12.getItem().equals(ModItems.ironcleaningotball) && stack12.getTagCompound().getBoolean("hot")) {
|
||||
tile.setSlotStack(6, tempironcleanchunk);
|
||||
tile.setSlotStack(7, tempironcleanchunk);
|
||||
tile.setSlotStack(8, tempironcleanchunk);
|
||||
tile.setSlotStack(11, tempironcleanchunk);
|
||||
tile.setSlotStack(12, tempironcleanchunk);
|
||||
tile.setSlotStack(13, tempironcleanchunk);
|
||||
tile.setSlotStack(16, tempironcleanchunk);
|
||||
tile.setSlotStack(17, tempironcleanchunk);
|
||||
tile.setSlotStack(18, tempironcleanchunk);
|
||||
world.playEvent(1031, pos, 0);
|
||||
}
|
||||
if (stack12.getItem().equals(ModItems.steelingotball) && stack12.getTagCompound().getBoolean("hot")) {
|
||||
tile.setSlotStack(6, tempsteelchunk);
|
||||
tile.setSlotStack(7, tempsteelchunk);
|
||||
tile.setSlotStack(8, tempsteelchunk);
|
||||
tile.setSlotStack(11, tempsteelchunk);
|
||||
tile.setSlotStack(12, tempsteelchunk);
|
||||
tile.setSlotStack(13, tempsteelchunk);
|
||||
tile.setSlotStack(16, tempsteelchunk);
|
||||
tile.setSlotStack(17, tempsteelchunk);
|
||||
tile.setSlotStack(18, tempsteelchunk);
|
||||
}
|
||||
if (stack12.getItem().equals(ModItems.wootzingotball) && stack12.getTagCompound().getBoolean("hot")) {
|
||||
tile.setSlotStack(6, tempwootzchunk);
|
||||
tile.setSlotStack(7, tempwootzchunk);
|
||||
tile.setSlotStack(8, tempwootzchunk);
|
||||
tile.setSlotStack(11, tempwootzchunk);
|
||||
tile.setSlotStack(12, tempwootzchunk);
|
||||
tile.setSlotStack(13, tempwootzchunk);
|
||||
tile.setSlotStack(16, tempwootzchunk);
|
||||
tile.setSlotStack(17, tempwootzchunk);
|
||||
tile.setSlotStack(18, tempwootzchunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) {
|
||||
@@ -108,23 +104,22 @@ public class AnvilStone extends AnvilBase {
|
||||
for (int i = 0; i < 25; i++) {
|
||||
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
|
||||
}
|
||||
/*for (int i = 0; i < 25; i++) {
|
||||
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
|
||||
if (((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_WROUGHT_IRON) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(PrimalItems.ROCK_STONE, 3));
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.ironball, 1));
|
||||
this.breakBlock(world, pos, state);
|
||||
return true;
|
||||
}
|
||||
/*for (int i = 0; i < 25; i++) {
|
||||
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
|
||||
if (((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_WROUGHT_IRON) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(PrimalItems.ROCK_STONE, 3));
|
||||
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.ironball, 1));
|
||||
this.breakBlock(world, pos, state);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}*/
|
||||
doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
|
||||
return true;
|
||||
}
|
||||
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ public class ModItems {
|
||||
public static Item stonetongs;
|
||||
public static Item castingmud;
|
||||
|
||||
|
||||
public static Item bronzeingotball;
|
||||
public static Item bronzechunk;
|
||||
public static Item ironingotball;
|
||||
public static Item ironchunk;
|
||||
public static Item ironcleaningotball;
|
||||
@@ -248,6 +249,8 @@ public class ModItems {
|
||||
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);
|
||||
ironchunk = new BaseMultiItem("ironchunk", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
|
||||
ironcleaningotball= new BaseMultiItem("ironcleaningotball", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
|
||||
@@ -408,6 +411,8 @@ public class ModItems {
|
||||
registerRender(forgehammer);
|
||||
|
||||
|
||||
registerRender(bronzeingotball);
|
||||
registerRender(bronzechunk);
|
||||
registerRender(ironingotball);
|
||||
registerRender(ironchunk);
|
||||
registerRender(ironcleaningotball);
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
|
||||
@@ -37,14 +38,17 @@ public class BaseMultiItem extends BaseItem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
BaseMultiItem item = (BaseMultiItem) stack.getItem();
|
||||
Item itemStack = stack.getItem();
|
||||
//TODO get the item name
|
||||
if (stack.getItem() instanceof BaseMultiItem) {
|
||||
if(stack.getTagCompound() != null) {
|
||||
if (!stack.getTagCompound().getBoolean("hot")) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (stack.getTagCompound().getBoolean("hot")) {
|
||||
return 0.1f;
|
||||
if(itemStack.equals(ModItems.ironingotball)) {
|
||||
if (!stack.getTagCompound().getBoolean("hot")) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (stack.getTagCompound().getBoolean("hot")) {
|
||||
return 0.01f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package nmd.primal.forgecraft.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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.PlayerHelper;
|
||||
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.Forge;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
import nmd.primal.forgecraft.tiles.TileAnvil;
|
||||
import nmd.primal.forgecraft.tiles.TileForge;
|
||||
import nmd.primal.forgecraft.tiles.TileNBTCrucible;
|
||||
import nmd.primal.forgecraft.util.AnvilHandler;
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static nmd.primal.forgecraft.blocks.CustomContainerFacing.FACING;
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
setUnlocalizedName(unlocalizedName);
|
||||
@@ -53,6 +61,7 @@ public class SlottedTongs extends Item implements IPickup {
|
||||
ItemStack slotStack = item.getSlotList().get(0);
|
||||
//TODO get the item name
|
||||
if (stack.getItem() instanceof SlottedTongs) {
|
||||
//System.out.println(slotStack.getTagCompound());
|
||||
if (slotStack.getItem() instanceof ItemNBTCrucible){
|
||||
if(item.getSlotList().get(0).getSubCompound("BlockEntityTag").getBoolean("hot")){
|
||||
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;
|
||||
}
|
||||
@@ -171,97 +250,131 @@ public class SlottedTongs extends Item implements IPickup {
|
||||
return slotList;
|
||||
}
|
||||
|
||||
public void setSlotList(ItemStack stack) {
|
||||
slotList.set(0, stack);
|
||||
}
|
||||
|
||||
public NonNullList<ItemStack> slotList = NonNullList.withSize(1, ItemStack.EMPTY);
|
||||
|
||||
@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){
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
if(slotList.get(0).isEmpty()){
|
||||
if (block instanceof NBTCrucible) {
|
||||
ItemStack tempStack = takeBlock(world, pos, state, face, player, block).copy();
|
||||
slotList.set(0, tempStack);
|
||||
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
|
||||
//if (hand.equals(player.swingingHand)) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
|
||||
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(slotList.get(0).getItem() instanceof ItemNBTCrucible) {
|
||||
NBTTagCompound tag = this.slotList.get(0).getSubCompound("BlockEntityTag").copy();
|
||||
if (tag != null) {
|
||||
ItemBlock temp = (ItemBlock) slotList.get(0).getItem();
|
||||
int i = this.getMetadata(slotList.get(0).getMetadata());
|
||||
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);
|
||||
slotList.set(0, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****
|
||||
TAKES the Tool Parts from the Forge
|
||||
*****/
|
||||
if(slotList.get(0).isEmpty()) {
|
||||
if (world.getBlockState(pos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
for (int i = 4; i < tile.getSlotListSize(); i++) {
|
||||
ItemStack tempStack = tile.getSlotStack(i).copy();
|
||||
if (slotList.get(0).isEmpty()) {
|
||||
if (block instanceof NBTCrucible) {
|
||||
ItemStack tempStack = takeBlock(world, pos, state, face, player, block).copy();
|
||||
slotList.set(0, tempStack);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****
|
||||
PUTS the Ingots into the Forge
|
||||
*****/
|
||||
if(!slotList.get(0).isEmpty()) {
|
||||
if (world.getBlockState(pos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
if( !(slotList.get(0).getItem() instanceof ToolPart)) {
|
||||
for (int i = 4; i < tile.getSlotListSize(); i++) {
|
||||
ItemStack tempStack = slotList.get(0).copy();
|
||||
tile.setSlotStack(i, tempStack);
|
||||
if (!slotList.get(0).isEmpty()) {
|
||||
if (slotList.get(0).getItem() instanceof ItemNBTCrucible) {
|
||||
NBTTagCompound tag = this.slotList.get(0).getSubCompound("BlockEntityTag").copy();
|
||||
if (tag != null) {
|
||||
ItemBlock temp = (ItemBlock) slotList.get(0).getItem();
|
||||
int i = this.getMetadata(slotList.get(0).getMetadata());
|
||||
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);
|
||||
slotList.set(0, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*****
|
||||
PUTS the Ingots into the Forge
|
||||
*****/
|
||||
|
||||
if(!slotList.get(0).isEmpty()) {
|
||||
if (world.getBlockState(pos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
if(slotList.get(0).getItem() instanceof ToolPart) {
|
||||
ItemStack tempStack = slotList.get(0).copy();
|
||||
tile.setSlotStack(4, tempStack);
|
||||
slotList.set(0, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
/*****
|
||||
TAKES anything out from the Forge
|
||||
*****/
|
||||
if (slotList.get(0).isEmpty()) {
|
||||
if (world.getBlockState(pos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||
if (tile.getSlotStack(i) != ItemStack.EMPTY) {
|
||||
ItemStack tempStack = tile.getSlotStack(i).copy();
|
||||
System.out.println(tempStack);
|
||||
slotList.set(0, tempStack);
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
System.out.println(slotList.get(0));
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!slotList.get(0).isEmpty() ){
|
||||
if(slotList.get(0).getItem() instanceof ToolPart) {
|
||||
ItemStack tempStack = slotList.get(0).copy();
|
||||
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
|
||||
slotList.set(0, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
/*****
|
||||
PUTS the Ingots into the Forge
|
||||
*****/
|
||||
if (!slotList.get(0).isEmpty()) {
|
||||
if (world.getBlockState(pos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
if (!(slotList.get(0).getItem() instanceof ToolPart)) {
|
||||
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||
ItemStack tempStack = slotList.get(0).copy();
|
||||
tile.setSlotStack(i, tempStack);
|
||||
slotList.set(0, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*****
|
||||
PUTS the ToolParts into the Forge
|
||||
*****/
|
||||
|
||||
if (!slotList.get(0).isEmpty()) {
|
||||
if (world.getBlockState(pos).getBlock() instanceof Forge) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
if (slotList.get(0).getItem() instanceof ToolPart) {
|
||||
ItemStack tempStack = slotList.get(0).copy();
|
||||
tile.setSlotStack(4, tempStack);
|
||||
slotList.set(0, ItemStack.EMPTY);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****
|
||||
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();
|
||||
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
|
||||
slotList.set(0, ItemStack.EMPTY);
|
||||
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.SUCCESS;
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
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.items.BaseMultiItem;
|
||||
import nmd.primal.forgecraft.items.ForgeHammer;
|
||||
import nmd.primal.forgecraft.items.SlottedTongs;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
import nmd.primal.forgecraft.tiles.TileAnvil;
|
||||
|
||||
@@ -185,8 +187,8 @@ public interface AnvilHandler {
|
||||
for (int x = 0; x < 5; x++) {
|
||||
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
|
||||
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
|
||||
AnvilHandler.doWork(pItem, counter, tile, world, pos, player);
|
||||
return true;
|
||||
return AnvilHandler.doWork(pItem, counter, tile, world, pos, player);
|
||||
//return true;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
@@ -199,8 +201,7 @@ public interface AnvilHandler {
|
||||
for (int x = 0; x < 5; x++) {
|
||||
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
|
||||
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
|
||||
doWork(pItem, counter, tile, world, pos, player);
|
||||
return true;
|
||||
return AnvilHandler.doWork(pItem, counter, tile, world, pos, player);
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
@@ -213,8 +214,7 @@ public interface AnvilHandler {
|
||||
for (int z = 0; z < 5; z++) {
|
||||
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
|
||||
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
|
||||
doWork(pItem, counter, tile, world, pos, player);
|
||||
return true;
|
||||
return AnvilHandler.doWork(pItem, counter, tile, world, pos, player);
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
@@ -227,8 +227,7 @@ public interface AnvilHandler {
|
||||
for (int z = 0; z < 5; z++) {
|
||||
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
|
||||
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
|
||||
doWork(pItem, counter, tile, world, pos, player);
|
||||
return true;
|
||||
return AnvilHandler.doWork(pItem, counter, tile, world, pos, player);
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
@@ -241,8 +240,39 @@ public interface AnvilHandler {
|
||||
|
||||
|
||||
static boolean doWork(ItemStack pItem, Integer counter, TileAnvil tile, World world, BlockPos pos, EntityPlayer player) {
|
||||
if (pItem.getItem().equals(ModItems.stonetongs)) {
|
||||
if ((pItem.getTagCompound().getInteger("type") == 6) ||
|
||||
if(!world.isRemote) {
|
||||
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") == 8) ||
|
||||
(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");
|
||||
/*if (pItem.getTagCompound().getInteger("type") == 6) {
|
||||
//System.out.println("Tongs meta = 6");
|
||||
@@ -315,7 +345,7 @@ public interface AnvilHandler {
|
||||
///System.out.println(counter);
|
||||
//System.out.println(tile.getSlotStack(counter));
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 8) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.pickaxehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
@@ -388,7 +418,7 @@ public interface AnvilHandler {
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
*/
|
||||
/*********************************
|
||||
* Clean Iron *
|
||||
*********************************/
|
||||
@@ -405,7 +435,7 @@ public interface AnvilHandler {
|
||||
///System.out.println(counter);
|
||||
//System.out.println(tile.getSlotStack(counter));
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
if (pItem.getTagCompound().getInteger("type") == 17) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.cleanironpickaxehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
@@ -478,7 +508,7 @@ public interface AnvilHandler {
|
||||
pItem.getTagCompound().setInteger("tempDamage", 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
*/
|
||||
/*********************************
|
||||
* Steel *
|
||||
*********************************/
|
||||
@@ -497,7 +527,7 @@ public interface AnvilHandler {
|
||||
//System.out.println(tile.getSlotStack(counter));
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
if (pItem.getTagCompound().getInteger("type") == 26) {
|
||||
ItemStack tempStack = new ItemStack(ModItems.steelpickaxehead, 1);
|
||||
tempStack.setTagCompound(new NBTTagCompound());
|
||||
@@ -693,9 +723,8 @@ public interface AnvilHandler {
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
static void doDrops(World world, BlockPos pos) {
|
||||
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops")) {
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
},
|
||||
"overrides": [
|
||||
{"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"}
|
||||
]
|
||||
}
|
||||
@@ -32,7 +32,27 @@
|
||||
{"predicate": {"type": 0.23},"model": "forgecraft:item/slottedtongs/slottedtongs_23"},
|
||||
{"predicate": {"type": 0.24},"model": "forgecraft:item/slottedtongs/slottedtongs_24"},
|
||||
{"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"}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user