happy path achieved
This commit is contained in:
@@ -6,10 +6,12 @@ org.gradle.jvmargs=-Xmx3G
|
||||
mod_group=nmd.primal.forgecraft
|
||||
mod_name=ForgeCraft
|
||||
|
||||
mod_version=1.4.01
|
||||
forge_version=14.23.1.2566
|
||||
mod_version=1.4.04
|
||||
forge_version=14.23.1.2581
|
||||
mcp_mappings=snapshot_20171003
|
||||
mc_version=1.12.2
|
||||
|
||||
primal_version=0.6+
|
||||
jei_version=4.8+
|
||||
waila_version=1.7.0-B3
|
||||
apple_version=2.1+
|
||||
@@ -19,7 +19,7 @@ public class ModInfo {
|
||||
public static final String MOD_CHANNEL = MOD_ID;
|
||||
public static final String MOD_VERSION = "1.4.01";
|
||||
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.0,);";
|
||||
public static final String DEPENDENCIES = "required-after:forge@[14.21.1.2400,);" + "required-after:primal@[0.6,);";
|
||||
|
||||
/** Mod Structures **/
|
||||
public static final String SERVER_PROXY = "nmd.primal.forgecraft.proxy.ServerProxy";
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -27,6 +28,8 @@ import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.core.common.recipes.FireSource;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.SlottedTongs;
|
||||
import nmd.primal.forgecraft.tiles.TileBloomery;
|
||||
|
||||
import java.util.Random;
|
||||
@@ -177,6 +180,41 @@ public class BloomeryBase extends CustomContainerFacing implements ITileEntityPr
|
||||
}
|
||||
}
|
||||
|
||||
/***SLOTTED TONGS CODE TO PLACE THE ITEMS***/
|
||||
if(pItem.getItem() instanceof SlottedTongs) {
|
||||
SlottedTongs temp = (SlottedTongs) pItem.getItem();
|
||||
if (!pItem.isEmpty() && tile.isItemValidForSlot(1, temp.slotList.get(0))) {
|
||||
if (!tileItem1.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if(tileItem1.isEmpty()){
|
||||
|
||||
ItemStack place_stack = temp.slotList.get(0).copy();
|
||||
//if (tile.putStack(slot, place_stack))
|
||||
tile.setSlotStack(1, place_stack);
|
||||
temp.slotList.set(0, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/***SLOTTED TONGS CODE TO REMOVE THE ITEMS***/
|
||||
if(pItem.getItem() instanceof SlottedTongs) {
|
||||
SlottedTongs temp = (SlottedTongs) pItem.getItem();
|
||||
if (!pItem.isEmpty() && temp.slotList.get(0).isEmpty()) {
|
||||
if (tileItem1.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if(!tileItem1.isEmpty()){
|
||||
ItemStack place_stack = tileItem1.copy();
|
||||
if(temp.slotList.get(0).isEmpty()){
|
||||
temp.slotList.set(0, place_stack);
|
||||
tile.setSlotStack(1, ItemStack.EMPTY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!tile.getSlotStack(0).isEmpty()) {
|
||||
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
|
||||
ItemStack returnStack = tile.getSlotStack(0).copy();
|
||||
|
||||
@@ -34,6 +34,7 @@ import nmd.primal.core.common.tiles.machines.TileStorageCrate;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.ItemCrucible;
|
||||
import nmd.primal.forgecraft.items.SlottedTongs;
|
||||
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
|
||||
import nmd.primal.forgecraft.tiles.TileNBTCrucible;
|
||||
|
||||
@@ -73,13 +74,17 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
||||
/**SET INGREDIENT ARRAY FOR THE CRUCIBLE NOW**/
|
||||
if(!player.isSneaking()) {
|
||||
if(!pItem.isEmpty()) {
|
||||
for (int i = 0; i < tile.ingList.size(); i++) {
|
||||
if (tile.ingList.get(i).isEmpty()) {
|
||||
tile.ingList.set(i, pItem1);
|
||||
pItem.shrink(1);
|
||||
tile.update();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
if(pItem.getItem() instanceof SlottedTongs) {
|
||||
return false;
|
||||
} else {
|
||||
for (int i = 0; i < tile.ingList.size(); i++) {
|
||||
if (tile.ingList.get(i).isEmpty()) {
|
||||
tile.ingList.set(i, pItem1);
|
||||
pItem.shrink(1);
|
||||
tile.update();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import nmd.primal.forgecraft.items.weapons.SlayerSword;
|
||||
public class ModItems {
|
||||
|
||||
//public static Item test;
|
||||
public static Item slottedtongs;
|
||||
public static Item itemcrucible;
|
||||
public static Item bellowshandle;
|
||||
public static Item forgehammer;
|
||||
@@ -143,6 +144,7 @@ public class ModItems {
|
||||
public static void init() {
|
||||
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
|
||||
//pistonbellows = new ItemBellowsHandle("pistonbellows");
|
||||
slottedtongs = new SlottedTongs("slottedtongs");
|
||||
itemcrucible = new ItemCrucible("itemcrucible");
|
||||
bellowshandle = new BaseItem("bellowshandle");
|
||||
softcrucible = new ItemSoftCrucible("softcrucible");
|
||||
@@ -268,6 +270,7 @@ public class ModItems {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
ForgeRegistries.ITEMS.register(slottedtongs);
|
||||
ForgeRegistries.ITEMS.register(itemcrucible);
|
||||
ForgeRegistries.ITEMS.register(castingmud);
|
||||
ForgeRegistries.ITEMS.register(bellowshandle);
|
||||
|
||||
@@ -1,13 +1,31 @@
|
||||
package nmd.primal.forgecraft.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ItemStackHelper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.interfaces.IPickup;
|
||||
import nmd.primal.core.common.helper.NBTHelper;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.tiles.TileNBTCrucible;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 12/30/17.
|
||||
*/
|
||||
public class SlottedTongs extends Item {
|
||||
|
||||
public class SlottedTongs extends Item implements IPickup {
|
||||
|
||||
public SlottedTongs(String unlocalizedName) {
|
||||
setUnlocalizedName(unlocalizedName);
|
||||
@@ -16,4 +34,61 @@ public class SlottedTongs extends Item {
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if(!world.isRemote){
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if(slotList.get(0).isEmpty() || slotList.get(0).getItem().equals(Items.AIR) || slotList.get(0).getItem().equals(Blocks.AIR)){
|
||||
ItemStack tempStack = takeBlock(world, pos, state, face, player, block).copy();
|
||||
slotList.set(0, tempStack);
|
||||
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
if(!slotList.get(0).isEmpty() ){
|
||||
System.out.println("Current Item:" + slotList.get(0));
|
||||
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;
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
public ItemStack getItem(World world, BlockPos pos, IBlockState state, Block block)
|
||||
{
|
||||
block = world.getBlockState(pos).getBlock();
|
||||
return NBTHelper.getStackBlockNBT(world, pos, state, new ItemStack(Item.getItemFromBlock(block), 1, block.damageDropped(state)));
|
||||
}
|
||||
|
||||
public ItemStack takeBlock(World world, BlockPos pos, IBlockState state, EnumFacing face, EntityPlayer player, Block block)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
|
||||
block = world.getBlockState(pos).getBlock();
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileNBTCrucible) {
|
||||
|
||||
return this.getItem(world, pos, state, block);
|
||||
//PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, this.getItem(world, pos, state, block));
|
||||
|
||||
//world.updateComparatorOutputLevel(pos, state.getBlock());
|
||||
}
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
||||
private int heat;
|
||||
private int cookCounter;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void update () {
|
||||
World world = this.getWorld();
|
||||
@@ -80,32 +82,34 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
||||
private void slotOneManager(){
|
||||
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
||||
NBTTagCompound tag = this.getSlotStack(1).getSubCompound("BlockEntityTag");
|
||||
ItemStackHelper.loadAllItems(tag, ingList);
|
||||
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
|
||||
if(recipe != null){
|
||||
if(this.getHeat() >= recipe.getCookTemp() &&
|
||||
!this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")){
|
||||
cookCounter++;
|
||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("hot", true);
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
if(cookCounter >= recipe.getCookTime() &&
|
||||
!this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")){
|
||||
if(tag != null) {
|
||||
ItemStackHelper.loadAllItems(tag, ingList);
|
||||
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
|
||||
if (recipe != null) {
|
||||
if (this.getHeat() >= recipe.getCookTemp() &&
|
||||
!this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||
cookCounter++;
|
||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("hot", true);
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
if (cookCounter >= recipe.getCookTime() &&
|
||||
!this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||
|
||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("status", true);
|
||||
cookCounter = 0;
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("status", true);
|
||||
cookCounter = 0;
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
if (this.getSlotStack(1).isEmpty()) {
|
||||
this.cookCounter = 0;
|
||||
}
|
||||
System.out.println(recipe.getCookTemp());
|
||||
System.out.println(recipe.getCookTime());
|
||||
System.out.println(recipe.getCoolTime());
|
||||
System.out.println(recipe.getDropsCooked());
|
||||
System.out.println(recipe.getDropsRaw());
|
||||
}
|
||||
if (this.getSlotStack(1).isEmpty()){
|
||||
this.cookCounter=0;
|
||||
}
|
||||
System.out.println(recipe.getCookTemp());
|
||||
System.out.println(recipe.getCookTime());
|
||||
System.out.println(recipe.getCoolTime());
|
||||
System.out.println(recipe.getDropsCooked());
|
||||
System.out.println(recipe.getDropsRaw());
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,47 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
||||
private int heat;
|
||||
private boolean hot;
|
||||
private boolean status;
|
||||
|
||||
public Item getDrops() {
|
||||
return drops;
|
||||
}
|
||||
|
||||
public void setDrops(Item drops) {
|
||||
this.drops = drops;
|
||||
}
|
||||
|
||||
public int getHeat() {
|
||||
return heat;
|
||||
}
|
||||
|
||||
public void setHeat(int heat) {
|
||||
this.heat = heat;
|
||||
}
|
||||
|
||||
public boolean getHot() {
|
||||
return hot;
|
||||
}
|
||||
|
||||
public void setHot(boolean hot) {
|
||||
this.hot = hot;
|
||||
}
|
||||
|
||||
public boolean getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(boolean status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public NonNullList<ItemStack> getIngList() {
|
||||
return ingList;
|
||||
}
|
||||
|
||||
public void setIngList(NonNullList<ItemStack> ingList) {
|
||||
this.ingList = ingList;
|
||||
}
|
||||
|
||||
public NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"name": "Kitsu's Forgecraft",
|
||||
"description": "Forged with sweat and blood",
|
||||
"version": "1.4.01",
|
||||
"mcversion": "1.12.1",
|
||||
"mcversion": "1.12.2",
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
"authorList": ["KitsuShadow"],
|
||||
|
||||
Reference in New Issue
Block a user