trying to fix the forge
This commit is contained in:
@@ -6,7 +6,7 @@ org.gradle.jvmargs=-Xmx3G
|
||||
mod_group=nmd.primal.forgecraft
|
||||
mod_name=ForgeCraft
|
||||
|
||||
mod_version=1.6.06
|
||||
mod_version=1.6.07
|
||||
forge_version=14.23.4.2744
|
||||
mcp_mappings=snapshot_20171003
|
||||
mc_version=1.12.2
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ModInfo {
|
||||
//public static final String MOD_PREFIX = MOD_ID + ":";
|
||||
public static final String MOD_CHANNEL = MOD_ID;
|
||||
|
||||
public static final String MOD_VERSION = "1.6.06";
|
||||
public static final String MOD_VERSION = "1.6.07";
|
||||
public static final String MC_VERSIONS = "[1.12.0, 1.13.0)";
|
||||
public static final String DEPENDENCIES = "required-after:forge@[14.21.1.2400,);" + "required-after:primal@[0.6.69,);";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
package nmd.primal.forgecraft.blocks.ingots;
|
||||
|
||||
import net.minecraft.block.BlockDynamicLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.blocks.BlockCustomBase;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@@ -1,4 +1,4 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
package nmd.primal.forgecraft.blocks.machine;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -28,6 +28,7 @@ import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.core.common.recipes.inworld.FireSource;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
|
||||
import nmd.primal.forgecraft.items.SlottedTongs;
|
||||
import nmd.primal.forgecraft.tiles.TileBloomery;
|
||||
@@ -1,4 +1,4 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
package nmd.primal.forgecraft.blocks.machine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
@@ -21,6 +21,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.core.common.items.tools.Gallagher;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.tiles.TileBreaker;
|
||||
import nmd.primal.forgecraft.util.BreakerHandler;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
package nmd.primal.forgecraft.blocks.machine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
@@ -26,6 +26,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.CommonUtils;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.crafting.CastingCrafting;
|
||||
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
|
||||
import nmd.primal.forgecraft.init.ModBlocks;
|
||||
@@ -1,4 +1,4 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
package nmd.primal.forgecraft.blocks.machine;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -25,11 +25,16 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.core.common.helper.RecipeHelper;
|
||||
import nmd.primal.core.common.recipes.inworld.FireSource;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.BaseMultiItem;
|
||||
import nmd.primal.forgecraft.items.SlottedTongs;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
import nmd.primal.forgecraft.tiles.TileForge;
|
||||
import nmd.primal.forgecraft.util.ForgeHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
@@ -43,7 +48,7 @@ import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
|
||||
/**
|
||||
* Created by kitsu on 11/26/2016.
|
||||
*/
|
||||
public class Forge extends CustomContainerFacing implements ITileEntityProvider{
|
||||
public class Forge extends CustomContainerFacing implements ITileEntityProvider, ForgeHandler{
|
||||
|
||||
private int maxHeat;
|
||||
//public static final PropertyBool PrimalAPI.States.ACTIVE = PropertyBool.create("PrimalAPI.States.ACTIVE");
|
||||
@@ -88,137 +93,76 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider{
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
if (tile != null) {
|
||||
ItemStack pItem = player.inventory.getCurrentItem();
|
||||
TileForge tile = (TileForge) world.getTileEntity(pos);
|
||||
if (tile != null) {
|
||||
if (hand.equals(hand.MAIN_HAND)) {
|
||||
ItemStack pItem = player.inventory.getCurrentItem().copy();
|
||||
ItemStack fuelItem = tile.getSlotStack(0);
|
||||
//System.out.println(pItem.getItem().getRegistryName().toString());
|
||||
|
||||
|
||||
/***********************
|
||||
FUEL SLOT CODE
|
||||
***********************/
|
||||
if (!tile.getSlotStack(0).isEmpty()) {
|
||||
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
|
||||
ItemStack returnStack = tile.getSlotStack(0).copy();
|
||||
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
|
||||
tile.clearSlot(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(pItem.isEmpty()) {
|
||||
if(!player.isSneaking()){
|
||||
if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE) == true){
|
||||
Integer tempInt = tile.getHeat();
|
||||
String tempString = tempInt.toString();
|
||||
ITextComponent itextcomponent = new TextComponentString(tempString);
|
||||
player.sendStatusMessage(itextcomponent, true);
|
||||
//System.out.println(pos);
|
||||
if (!world.isRemote) {
|
||||
/***********************
|
||||
FUEL SLOT CODE
|
||||
***********************/
|
||||
if (!tile.getSlotStack(0).isEmpty()) {
|
||||
if (player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
|
||||
ItemStack returnStack = tile.getSlotStack(0).copy();
|
||||
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
|
||||
tile.clearSlot(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if((FireSource.useSource(world, pos, facing, player, hand, pItem, hitX, hitY, hitZ))) {
|
||||
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
|
||||
tile.setHeat(100);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
|
||||
if (!fuelItem.isEmpty()){
|
||||
if(pItem.getItem() == fuelItem.getItem()){
|
||||
if(fuelItem.getCount() < 64){
|
||||
if(fuelItem.getCount() + pItem.getCount() <= 64){
|
||||
fuelItem.grow(pItem.getCount());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
if(fuelItem.getCount() + pItem.getCount() > 64){
|
||||
pItem.setCount(64-pItem.getCount());
|
||||
fuelItem.setCount(64);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
if (pItem.isEmpty()) {
|
||||
if (!player.isSneaking()) {
|
||||
if (world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE) == true) {
|
||||
Integer tempInt = tile.getHeat();
|
||||
String tempString = tempInt.toString();
|
||||
ITextComponent itextcomponent = new TextComponentString(tempString);
|
||||
player.sendStatusMessage(itextcomponent, true);
|
||||
//System.out.println(pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(fuelItem.isEmpty()) {
|
||||
tile.setSlotStack(0, pItem);
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||
if ((FireSource.useSource(world, pos, facing, player, hand, pItem, hitX, hitY, hitZ))) {
|
||||
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
|
||||
tile.setHeat(100);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/***********************
|
||||
FORGING SLOTS CODE
|
||||
***********************/
|
||||
//REMOVE COOL INGOT
|
||||
if(facing == EnumFacing.UP ) {
|
||||
/*if (pItem.isEmpty()) {
|
||||
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||
//System.out.println(i);
|
||||
if (!tile.getSlotStack(i).isEmpty()) {
|
||||
if (Block.getBlockFromItem(tile.getSlotStack(i).getItem()) instanceof IngotBall) {
|
||||
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
if(tile.getSlotStack(i).hasTagCompound() == true){
|
||||
if (tile.getSlotStack(i).getTagCompound().getBoolean("hot") == false) {
|
||||
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
|
||||
tile.setSlotStack(i, ItemStack.EMPTY);
|
||||
if ((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
|
||||
if (!fuelItem.isEmpty()) {
|
||||
if (pItem.getItem() == fuelItem.getItem()) {
|
||||
if (fuelItem.getCount() < 64) {
|
||||
if (fuelItem.getCount() + pItem.getCount() <= 64) {
|
||||
fuelItem.grow(pItem.getCount());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
if (fuelItem.getCount() + pItem.getCount() > 64) {
|
||||
pItem.setCount(64 - pItem.getCount());
|
||||
fuelItem.setCount(64);
|
||||
tile.markDirty();
|
||||
tile.updateBlock();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
if (pItem.getItem() instanceof BaseMultiItem) {
|
||||
//System.out.println("Activating");
|
||||
for (int i = 2; i <= tile.getSlotListSize(); i++) {
|
||||
if (tile.getSlotStack(i).isEmpty()) {
|
||||
ItemStack tempItem = pItem.copy();
|
||||
tile.setSlotStack(i,tempItem);
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Needs Ore Dictionary Compat
|
||||
if (pItem.getItem().equals(new ItemStack(Items.IRON_INGOT).getItem())) {
|
||||
for (int i = 2; i < 7; i++) {
|
||||
if (tile.getSlotStack(i).isEmpty()) {
|
||||
tile.setSlotStack(i, new ItemStack(Items.IRON_INGOT, 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(pItem.getItem() instanceof ToolPart){
|
||||
if(tile.getSlotStack(4).isEmpty()){
|
||||
//System.out.println("Adding player Item to slot");
|
||||
tile.setSlotStack(4, pItem);
|
||||
//System.out.println(tile.getSlotStack(4));
|
||||
if (fuelItem.isEmpty()) {
|
||||
tile.setSlotStack(0, pItem);
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (facing == EnumFacing.UP) {
|
||||
doForgeInventoryManager(pItem, world, tile, pos, hitX, hitY, hitZ, state, player);
|
||||
}
|
||||
}
|
||||
//System.out.println(tile.getSlotStack(0));
|
||||
//System.out.println(tile.getSlotStack(1));
|
||||
//System.out.println(tile.getSlotStack(2));
|
||||
//System.out.println(tile.getSlotStack(3));
|
||||
//System.out.println(tile.getSlotStack(4));
|
||||
//System.out.println(tile.getSlotStack(5));
|
||||
//System.out.println(tile.getSlotStack(6));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -313,9 +257,8 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider{
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
if(!worldIn.isRemote) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
}
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
System.out.println(placer.getHorizontalFacing());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,4 +1,4 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
package nmd.primal.forgecraft.blocks.machine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
@@ -17,6 +17,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.init.ModSounds;
|
||||
import nmd.primal.forgecraft.tiles.TileBloomery;
|
||||
import nmd.primal.forgecraft.tiles.TileForge;
|
||||
@@ -14,6 +14,7 @@ import nmd.primal.forgecraft.blocks.Anvil.AnvilIron;
|
||||
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
|
||||
import nmd.primal.forgecraft.blocks.*;
|
||||
import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible;
|
||||
import nmd.primal.forgecraft.blocks.machine.*;
|
||||
|
||||
/**
|
||||
* Created by kitsu on 11/26/2016.
|
||||
|
||||
@@ -396,7 +396,7 @@ public class ModCrafting{
|
||||
diamondBronze.getTagCompound().setString("upgrades", "diamond");
|
||||
CrucibleCrafting.addRecipe(
|
||||
new OreIngredient("ingotBronze"),
|
||||
new OreIngredient("dustDiamond"),
|
||||
new OreIngredient("flakeDiamond"),
|
||||
Ingredient.EMPTY,
|
||||
Ingredient.EMPTY,
|
||||
Ingredient.EMPTY,
|
||||
@@ -410,7 +410,7 @@ public class ModCrafting{
|
||||
emeraldBronze.getTagCompound().setString("upgrades", "emerald");
|
||||
CrucibleCrafting.addRecipe(
|
||||
new OreIngredient("ingotBronze"),
|
||||
new OreIngredient("dustEmerald"),
|
||||
new OreIngredient("flakeEmerald"),
|
||||
Ingredient.EMPTY,
|
||||
Ingredient.EMPTY,
|
||||
Ingredient.EMPTY,
|
||||
@@ -451,7 +451,7 @@ public class ModCrafting{
|
||||
new OreIngredient("dustCopper"),
|
||||
new OreIngredient("dustCopper"),
|
||||
new OreIngredient("dustTin"),
|
||||
new OreIngredient("dustDiamond"),
|
||||
new OreIngredient("flakeDiamond"),
|
||||
new ItemStack(PrimalAPI.Items.SLAG, 1),
|
||||
diamondBronze,
|
||||
1100,
|
||||
@@ -463,7 +463,7 @@ public class ModCrafting{
|
||||
new OreIngredient("dustCopper"),
|
||||
new OreIngredient("dustCopper"),
|
||||
new OreIngredient("dustTin"),
|
||||
new OreIngredient("dustEmerald"),
|
||||
new OreIngredient("flakeEmerald"),
|
||||
new ItemStack(PrimalAPI.Items.SLAG, 1),
|
||||
emeraldBronze,
|
||||
1100,
|
||||
@@ -559,7 +559,7 @@ public class ModCrafting{
|
||||
|
||||
/***Anvil***/
|
||||
RecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.stoneanvil, 1),
|
||||
" ", " I ", " S ", 'I', ModItems.ironingotball, 'S', Blocks.STONE);
|
||||
" ", " I ", " S ", 'I', "ingotIron", 'S', Blocks.STONE);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -178,11 +178,10 @@ public class BaseMultiItem extends BaseItem {
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
//System.out.println(item.getTagCompound());
|
||||
//if (!stack.hasTagCompound()) {
|
||||
// stack.setTagCompound(new NBTTagCompound());
|
||||
// stack.getTagCompound().setBoolean("hot", false);
|
||||
//}
|
||||
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setBoolean("hot", false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ 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.blocks.machine.Forge;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
@@ -55,7 +55,8 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
SlottedTongs item = (SlottedTongs) stack.getItem();
|
||||
ItemStack slotStack = item.getSlotList().get(0);
|
||||
ItemStack slotStack = item.getSlotList().get(0).copy();
|
||||
|
||||
if (stack.getItem() instanceof SlottedTongs) {
|
||||
if (slotStack.getItem() instanceof ItemNBTCrucible) {
|
||||
/***Render Empty Crucible***/
|
||||
@@ -284,7 +285,7 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitx, float hity, float hitz)
|
||||
{
|
||||
//if(!world.isRemote){
|
||||
//if (hand.equals(player.swingingHand)) {
|
||||
if (hand.equals(player.getActiveHand())) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
@@ -319,49 +320,59 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
}
|
||||
}
|
||||
|
||||
/*****
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****
|
||||
PUTS the Ingots into the Forge
|
||||
PUTS anything 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++) {
|
||||
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||
if(tile.getSlotStack(i).isEmpty()) {
|
||||
ItemStack tempStack = slotList.get(0).copy();
|
||||
tile.setSlotStack(i, tempStack);
|
||||
slotList.set(0, ItemStack.EMPTY);
|
||||
tile.update();
|
||||
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();
|
||||
|
||||
slotList.set(0, tempStack);
|
||||
tile.setSlotStack(i, 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) {
|
||||
if(){
|
||||
ItemStack tempStack = slotList.get(0).copy();
|
||||
tile.setSlotStack(4, tempStack);
|
||||
slotList.set(0, ItemStack.EMPTY);
|
||||
@@ -369,6 +380,7 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*****
|
||||
DROPS the ToolParts into the World
|
||||
@@ -383,16 +395,6 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!slotList.get(0).isEmpty()) {
|
||||
if ((block.equals(Blocks.HOPPER))) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****
|
||||
Cools the Ingots on the Tongs
|
||||
@@ -421,17 +423,19 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
*****/
|
||||
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;
|
||||
if (!(block instanceof Forge)) {
|
||||
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.FAIL;
|
||||
}
|
||||
|
||||
public ItemStack getItem(World world, BlockPos pos, IBlockState state, Block block)
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.forgecraft.blocks.Anvil.AnvilBase;
|
||||
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
|
||||
import nmd.primal.forgecraft.blocks.IngotBall;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.BaseMultiItem;
|
||||
import nmd.primal.forgecraft.tiles.TileAnvil;
|
||||
@@ -155,14 +154,6 @@ public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (Block.getBlockFromItem(item) instanceof IngotBall) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.44D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item instanceof BaseMultiItem) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
@@ -248,14 +239,6 @@ public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (Block.getBlockFromItem(item) instanceof IngotBall) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.44D, tile.getReverseZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item instanceof BaseMultiItem) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
@@ -339,14 +322,7 @@ public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (Block.getBlockFromItem(item) instanceof IngotBall) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.44D, tile.getReverseZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (item instanceof BaseMultiItem) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
@@ -430,14 +406,6 @@ public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (Block.getBlockFromItem(item) instanceof IngotBall) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(tile.getReverseX(a), -0.44D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item instanceof BaseMultiItem) {
|
||||
GL11.glPushMatrix();
|
||||
double scale = 1.0D;
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.forgecraft.blocks.BloomeryBase;
|
||||
import nmd.primal.forgecraft.blocks.machine.BloomeryBase;
|
||||
import nmd.primal.forgecraft.tiles.TileBloomery;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.forgecraft.blocks.Breaker;
|
||||
import nmd.primal.forgecraft.blocks.machine.Breaker;
|
||||
import nmd.primal.forgecraft.tiles.TileBreaker;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.forgecraft.blocks.CastingForm;
|
||||
import nmd.primal.forgecraft.blocks.machine.CastingForm;
|
||||
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.tiles.TileCastingForm;
|
||||
|
||||
@@ -8,11 +8,17 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.forgecraft.blocks.Forge;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.forgecraft.blocks.machine.Forge;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.BaseMultiItem;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
import nmd.primal.forgecraft.tiles.TileForge;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -40,19 +46,19 @@ public class TileForgeRender extends TileEntitySpecialRenderer<TileForge>
|
||||
int bright = tile.getWorld().getCombinedLight(pos.up(), 0);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, bright % 65536, bright / 65536);
|
||||
|
||||
ItemStack stack1 = tile.getSlotStack(0);
|
||||
ItemStack stack0 = tile.getSlotStack(0);
|
||||
|
||||
boolean is_block = stack1.getItem() instanceof ItemBlock;
|
||||
boolean is_block = stack0.getItem() instanceof ItemBlock;
|
||||
float scale = is_block ? 0.1725F : 0.3F;
|
||||
double xTrans = is_block ? -1.6D : -0.45D;
|
||||
double yTrans = is_block ? -1.26D : 0.75D;
|
||||
|
||||
if (!stack1.isEmpty()) {
|
||||
int stackRotation = stack1.getCount();
|
||||
if (!stack0.isEmpty()) {
|
||||
int stackRotation = stack0.getCount();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
|
||||
renderItem.renderItem(stack0, renderItem.getItemModelMesher().getItemModel(stack0));
|
||||
GL11.glPopMatrix();
|
||||
for (int i = 0; i < Math.ceil(stackRotation / 8) + 1; i++) {
|
||||
GL11.glPushMatrix();
|
||||
@@ -60,64 +66,90 @@ public class TileForgeRender extends TileEntitySpecialRenderer<TileForge>
|
||||
GL11.glRotated(45.0F * i, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslated(xTrans, yTrans, 0.0D);
|
||||
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
|
||||
renderItem.renderItem(stack0, renderItem.getItemModelMesher().getItemModel(stack0));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 2; i < tile.getSlotListSize(); i++) {
|
||||
if (state.getValue(Forge.FACING) == EnumFacing.NORTH) {
|
||||
//float tempScale = 0.8F;
|
||||
GL11.glScalef(0.8F, 0.8F, 0.8F);
|
||||
GL11.glTranslated(-0.3F, 0.1D, -0.7D);
|
||||
int counter = 1;
|
||||
for (int i = 0; i < tile.getArraySize(); i++) {
|
||||
for (int a = 0; a < tile.getArraySize(); a++) {
|
||||
if (!tile.getSlotStack(counter).isEmpty()) {
|
||||
Item item = tile.getSlotStack(counter).getItem();
|
||||
|
||||
if (item instanceof ToolPart ) {
|
||||
GL11.glPushMatrix();
|
||||
double tempScale = 1.0D;
|
||||
GL11.glScaled(tempScale, tempScale, tempScale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.465D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (item instanceof BaseMultiItem) {
|
||||
GL11.glPushMatrix();
|
||||
double tempScale = 1.0D;
|
||||
GL11.glScaled(tempScale, tempScale, tempScale);
|
||||
GL11.glTranslated(tile.getNormalX(a), -0.0625D, tile.getNormalZ(i));
|
||||
renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
for (int i = 1; i < tile.getSlotListSize(); i++) {
|
||||
if (!tile.getSlotStack(i).isEmpty()) {
|
||||
GL11.glPushMatrix();
|
||||
float tempScale = 0.8F;
|
||||
GL11.glScalef(tempScale, tempScale, tempScale);
|
||||
GL11.glTranslated(0.0F, 0.1D, 0.0F);
|
||||
if (i == 2) {
|
||||
if (i == 1) {
|
||||
GL11.glTranslated(-0.3, -0.05D, -0.3D);
|
||||
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem() instanceof ToolPart) {
|
||||
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
if (i == 3) {
|
||||
if (i == 2) {
|
||||
GL11.glTranslated(-0.3, -0.05D, 0.3D);
|
||||
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem() instanceof ToolPart) {
|
||||
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
if (i == 4) {
|
||||
if (i == 3) {
|
||||
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
//GL11.glScalef(0.6F, 0.6F, 0.6F);
|
||||
if (tile.getSlotStack(i).getItem() == ModItems.pickaxehead) {
|
||||
if (tile.getSlotStack(i).getItem() instanceof ToolPart) {
|
||||
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem() == ModItems.ironaxehead) {
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem() == ModItems.ironshovelhead) {
|
||||
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if (tile.getSlotStack(i).getItem() == ModItems.ironhoehead) {
|
||||
GL11.glRotated(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslated(0.0, 0.025D, 0.0D);
|
||||
}
|
||||
|
||||
}
|
||||
if (i == 5) {
|
||||
if (i == 4) {
|
||||
GL11.glTranslated(0.3, -0.05D, -0.3D);
|
||||
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
if (i == 6) {
|
||||
GL11.glTranslated(0.3, -0.05D, 0.3D);
|
||||
if (tile.getSlotStack(i).getItem() == Items.IRON_INGOT) {
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
|
||||
if (tile.getSlotStack(i).getItem() instanceof ToolPart) {
|
||||
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +158,7 @@ public class TileForgeRender extends TileEntitySpecialRenderer<TileForge>
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.forgecraft.blocks.PistonBellows;
|
||||
import nmd.primal.forgecraft.blocks.machine.PistonBellows;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.tiles.TilePistonBellows;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.core.common.helper.FireHelper;
|
||||
import nmd.primal.core.common.helper.RecipeHelper;
|
||||
import nmd.primal.forgecraft.blocks.BloomeryBase;
|
||||
import nmd.primal.forgecraft.blocks.machine.BloomeryBase;
|
||||
import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible;
|
||||
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
|
||||
@@ -11,10 +11,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.core.common.helper.RecipeHelper;
|
||||
import nmd.primal.forgecraft.blocks.Forge;
|
||||
import nmd.primal.forgecraft.blocks.machine.Forge;
|
||||
import nmd.primal.forgecraft.crafting.ForgeCrafting;
|
||||
import nmd.primal.forgecraft.items.BaseMultiItem;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
import nmd.primal.forgecraft.util.ToolNBT;
|
||||
|
||||
import static nmd.primal.core.api.PrimalAPI.randomCheck;
|
||||
@@ -25,7 +23,27 @@ import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
|
||||
*/
|
||||
public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
|
||||
|
||||
private NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(7, ItemStack.EMPTY);
|
||||
private int arraySize = 2;
|
||||
private double[] normalMin = {0.0625, 0.5625};
|
||||
private double[] normalMax = {0.4375, 0.9375};
|
||||
private double[] reverseMin = {0.5625, 0.0625};
|
||||
private double[] reverseMax = {0.9375, 0.4375};
|
||||
|
||||
public int getArraySize(){return arraySize;}
|
||||
public double getNormalX(Integer x) {
|
||||
return normalMin[x];
|
||||
}
|
||||
public double getNormalZ(Integer x) {
|
||||
return normalMax[x];
|
||||
}
|
||||
public double getReverseX(Integer x) {
|
||||
return reverseMin[x];
|
||||
}
|
||||
public double getReverseZ(Integer x) {
|
||||
return reverseMax[x];
|
||||
}
|
||||
|
||||
private NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
||||
//private ItemStack[] inventory = new ItemStack [0];
|
||||
//private String customName;
|
||||
private int iteration = 0;
|
||||
@@ -174,7 +192,7 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
|
||||
|
||||
private void craftingManager() {
|
||||
|
||||
for (int i = 2; i < this.getSlotListSize(); i++) {
|
||||
for (int i = 1; i < this.getSlotListSize(); i++) {
|
||||
ItemStack stack = this.getSlotStack(i).copy();
|
||||
|
||||
ForgeCrafting recipe = ForgeCrafting.getRecipe(stack.getItem());
|
||||
@@ -183,7 +201,7 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
|
||||
if(stack.hasTagCompound()){
|
||||
stackCompound=stack.getTagCompound().copy();
|
||||
}
|
||||
if(i == 2){
|
||||
if(i == 1){
|
||||
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||
cookCounter2++;
|
||||
}
|
||||
@@ -197,7 +215,7 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
|
||||
cookCounter2 = 0;
|
||||
}
|
||||
}
|
||||
if(i == 3){
|
||||
if(i == 2){
|
||||
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||
cookCounter3++;
|
||||
}
|
||||
@@ -213,7 +231,7 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
|
||||
cookCounter3 = 0;
|
||||
}
|
||||
}
|
||||
if(i == 4){
|
||||
if(i == 3){
|
||||
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||
cookCounter4++;
|
||||
}
|
||||
@@ -227,7 +245,7 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
|
||||
cookCounter4 = 0;
|
||||
}
|
||||
}
|
||||
if(i == 5){
|
||||
if(i == 4){
|
||||
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||
cookCounter5++;
|
||||
}
|
||||
@@ -241,20 +259,6 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
|
||||
cookCounter5 = 0;
|
||||
}
|
||||
}
|
||||
if(i == 6){
|
||||
if (this.getHeat() >= recipe.getHeatThreshold()) {
|
||||
cookCounter6++;
|
||||
}
|
||||
if (this.getHeat() < recipe.getHeatThreshold() && cookCounter6 > 0) {
|
||||
cookCounter6--;
|
||||
}
|
||||
if (cookCounter6 >= recipe.getIdealTime()) {
|
||||
ItemStack outputStack = recipe.getOutput().copy();
|
||||
outputStack.setItemDamage(stack.getItemDamage());
|
||||
this.setSlotStack(i, outputStack);
|
||||
cookCounter6 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,82 +371,6 @@ public interface AnvilHandler {
|
||||
ItemStack dropStack = null;
|
||||
if (stack.getItem() instanceof BaseMultiItem) {
|
||||
BaseMultiItem item = (BaseMultiItem) stack.getItem();
|
||||
/*
|
||||
switch (item.getID()) {
|
||||
case 6:
|
||||
dropStack = new ItemStack(ModBlocks.ironball, 1);
|
||||
break;
|
||||
case 7:
|
||||
dropStack = new ItemStack(ModBlocks.ironchunk, 1);
|
||||
break;
|
||||
case 8:
|
||||
dropStack = new ItemStack(ModItems.pickaxehead, 1);
|
||||
break;
|
||||
case 9:
|
||||
dropStack = new ItemStack(ModItems.ironaxehead, 1);
|
||||
break;
|
||||
case 10:
|
||||
dropStack = new ItemStack(ModItems.ironshovelhead, 1);
|
||||
break;
|
||||
case 11:
|
||||
dropStack = new ItemStack(ModItems.ironhoehead, 1);
|
||||
break;
|
||||
case 15:
|
||||
dropStack = new ItemStack(ModBlocks.ironcleanball, 1);
|
||||
break;
|
||||
case 16:
|
||||
dropStack = new ItemStack(ModBlocks.ironcleanchunk, 1);
|
||||
break;
|
||||
case 17:
|
||||
dropStack = new ItemStack(ModItems.cleanironpickaxehead, 1);
|
||||
break;
|
||||
case 18:
|
||||
dropStack = new ItemStack(ModItems.cleanironaxehead, 1);
|
||||
break;
|
||||
case 19:
|
||||
dropStack = new ItemStack(ModItems.cleanironshovelhead, 1);
|
||||
break;
|
||||
case 20:
|
||||
dropStack = new ItemStack(ModItems.cleanironhoehead, 1);
|
||||
break;
|
||||
case 24:
|
||||
dropStack = new ItemStack(ModBlocks.steelball, 1);
|
||||
break;
|
||||
case 25:
|
||||
dropStack = new ItemStack(ModBlocks.steelchunk, 1);
|
||||
break;
|
||||
case 26:
|
||||
dropStack = new ItemStack(ModItems.steelpickaxehead, 1);
|
||||
break;
|
||||
case 27:
|
||||
dropStack = new ItemStack(ModItems.steelaxehead, 1);
|
||||
break;
|
||||
case 28:
|
||||
dropStack = new ItemStack(ModItems.steelshovelhead, 1);
|
||||
break;
|
||||
case 29:
|
||||
dropStack = new ItemStack(ModItems.steelhoehead, 1);
|
||||
break;
|
||||
case 33:
|
||||
dropStack = new ItemStack(ModBlocks.wootzball, 1);
|
||||
break;
|
||||
case 34:
|
||||
dropStack = new ItemStack(ModBlocks.wootzchunk, 1);
|
||||
break;
|
||||
case 35:
|
||||
dropStack = new ItemStack(ModItems.wootzpickaxehead, 1);
|
||||
break;
|
||||
case 36:
|
||||
dropStack = new ItemStack(ModItems.wootzaxehead, 1);
|
||||
break;
|
||||
case 37:
|
||||
dropStack = new ItemStack(ModItems.wootzshovelhead, 1);
|
||||
break;
|
||||
case 38:
|
||||
dropStack = new ItemStack(ModItems.wootzhoehead, 1);
|
||||
break;
|
||||
}*/
|
||||
|
||||
} else {
|
||||
dropStack = stack;
|
||||
}
|
||||
|
||||
184
kfc/src/main/java/nmd/primal/forgecraft/util/ForgeHandler.java
Normal file
184
kfc/src/main/java/nmd/primal/forgecraft/util/ForgeHandler.java
Normal file
@@ -0,0 +1,184 @@
|
||||
package nmd.primal.forgecraft.util;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.common.helper.RecipeHelper;
|
||||
import nmd.primal.core.common.items.tools.Gallagher;
|
||||
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.tiles.TileAnvil;
|
||||
import nmd.primal.forgecraft.tiles.TileForge;
|
||||
|
||||
import static nmd.primal.forgecraft.blocks.CustomContainerFacing.FACING;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 9/22/18.
|
||||
*/
|
||||
public interface ForgeHandler {
|
||||
|
||||
int arraySize = 2;
|
||||
double[] normalMin = {0.0625, 0.5625};
|
||||
double[] normalMax = {0.4375, 0.9375};
|
||||
double[] reverseMin = {0.5625, 0.0625};
|
||||
double[] reverseMax = {0.9375, 0.4375};
|
||||
|
||||
default int getArraySize(){return arraySize;}
|
||||
default double getNormalMin(Integer x) {
|
||||
return normalMin[x];
|
||||
}
|
||||
default double getNormalMax(Integer x) {
|
||||
return normalMax[x];
|
||||
}
|
||||
default double getReverseMin(Integer x) {
|
||||
return reverseMin[x];
|
||||
}
|
||||
default double getReverseMax(Integer x) {
|
||||
return reverseMax[x];
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Adding and Removing Inventory With Tongs
|
||||
*****************************************************************************/
|
||||
|
||||
default boolean doForgeInventoryManager(ItemStack pItem, World world, TileForge tile, BlockPos pos, float hitx, float hity, float hitz, IBlockState state, EntityPlayer player) {
|
||||
//if ((!(pItem.getItem() instanceof Gallagher)) || (!(pItem.getItem() instanceof ForgeHammer))) {
|
||||
// if (pItem.getItem() instanceof BaseMultiItem) {
|
||||
// return false;
|
||||
// }
|
||||
if (state.getValue(FACING) == EnumFacing.NORTH) {
|
||||
int counter = 0;
|
||||
for (int z = 0; z < arraySize; z++) {
|
||||
for (int x = 0; x < arraySize; x++) {
|
||||
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
|
||||
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
|
||||
return ForgeHandler.doWork(pItem, (counter + 1), tile, world, pos, player);
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.SOUTH) {
|
||||
int counter = 0;
|
||||
for (int z = 0; z < arraySize; z++) {
|
||||
for (int x = 0; x < arraySize; x++) {
|
||||
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
|
||||
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
|
||||
return ForgeHandler.doWork(pItem, (counter + 1), tile, world, pos, player);
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.WEST) {
|
||||
int counter = 0;
|
||||
for (int x = 0; x < arraySize; x++) {
|
||||
for (int z = 0; z < arraySize; z++) {
|
||||
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
|
||||
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
|
||||
return ForgeHandler.doWork(pItem, (counter + 1), tile, world, pos, player);
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.EAST) {
|
||||
int counter = 0;
|
||||
for (int x = 0; x < arraySize; x++) {
|
||||
for (int z = 0; z < arraySize; z++) {
|
||||
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
|
||||
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
|
||||
return ForgeHandler.doWork(pItem, (counter + 1), tile, world, pos, player);
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean doWork(ItemStack pItem, Integer counter, TileForge tile, World world, BlockPos pos, EntityPlayer player) {
|
||||
|
||||
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()) {
|
||||
System.out.println("Removing stuff");
|
||||
ItemStack tempStack = tile.getSlotStack(counter).copy();
|
||||
tongs.setSlotList(tempStack);
|
||||
tile.setSlotStack(counter, ItemStack.EMPTY);
|
||||
System.out.println(tongs.getSlotList().get(0));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tongStack.isEmpty()) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
System.out.println("Adding stuff");
|
||||
ItemStack tempStack = tongs.getSlotList().get(0).copy();
|
||||
tile.setSlotStack(counter, tempStack);
|
||||
tongs.setSlotList(ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem.getItem() instanceof BaseMultiItem) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
ItemStack tempItem = pItem.copy();
|
||||
tempItem.setCount(1);
|
||||
tile.setSlotStack(counter,tempItem);
|
||||
player.inventory.getCurrentItem().shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(pItem.getItem() instanceof BaseMultiItem)) {
|
||||
if (RecipeHelper.isOreName(pItem, "ingotIron")) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
tile.setSlotStack(counter, new ItemStack(Items.IRON_INGOT, 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (RecipeHelper.isOreName(pItem, "nuggetIron")) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
tile.setSlotStack(counter, new ItemStack(ModItems.wroughtironchunk, 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (RecipeHelper.isOreName(pItem, "ingotSteel")) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
tile.setSlotStack(counter, new ItemStack(ModItems.steelingotball, 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (RecipeHelper.isOreName(pItem, "nuggetSteel")) {
|
||||
if (tile.getSlotStack(counter).isEmpty()) {
|
||||
tile.setSlotStack(counter, new ItemStack(ModItems.steelchunk, 1));
|
||||
pItem.shrink(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,7 +52,7 @@
|
||||
{"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.39},"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"},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"modid": "forgecraft",
|
||||
"name": "Kitsu's Forgecraft",
|
||||
"description": "Forged with sweat and blood",
|
||||
"version": "1.6.06",
|
||||
"version": "1.6.07",
|
||||
"mcversion": "1.12.2",
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
|
||||
Reference in New Issue
Block a user