trying to pass NBT around and crashing
This commit is contained in:
@@ -1,13 +1,16 @@
|
|||||||
package nmd.primal.forgecraft.blocks.Crucibles;
|
package nmd.primal.forgecraft.blocks.Crucibles;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.inventory.ItemStackHelper;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumBlockRenderType;
|
import net.minecraft.util.EnumBlockRenderType;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@@ -18,7 +21,12 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import nmd.primal.core.api.PrimalAPI;
|
||||||
|
import nmd.primal.core.common.helper.PlayerHelper;
|
||||||
|
import nmd.primal.core.common.helper.WorldHelper;
|
||||||
import nmd.primal.forgecraft.ModInfo;
|
import nmd.primal.forgecraft.ModInfo;
|
||||||
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
|
import nmd.primal.forgecraft.items.ItemCrucible;
|
||||||
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
|
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
|
||||||
import nmd.primal.forgecraft.tiles.TileNBTCrucible;
|
import nmd.primal.forgecraft.tiles.TileNBTCrucible;
|
||||||
|
|
||||||
@@ -40,7 +48,7 @@ public class NBTCrucible extends Block implements ITileEntityProvider {
|
|||||||
setRegistryName(registryName);
|
setRegistryName(registryName);
|
||||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||||
setHardness(3.0f);
|
setHardness(3.0f);
|
||||||
crucibleIngredients.apply(new ItemStack(Blocks.IRON_ORE, 1));
|
//crucibleIngredients.apply(new ItemStack(Blocks.IRON_ORE, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -49,28 +57,86 @@ public class NBTCrucible extends Block implements ITileEntityProvider {
|
|||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
||||||
ItemStack pItem = player.inventory.getCurrentItem();
|
ItemStack pItem = player.inventory.getCurrentItem();
|
||||||
|
ItemStack pItem1 = new ItemStack(pItem.getItem(), 1);
|
||||||
|
if(pItem.isEmpty()){
|
||||||
|
if(!player.isSneaking()) {
|
||||||
|
ItemStack tempStack = new ItemStack(ModItems.itemcrucible, 1);
|
||||||
|
tempStack.setTagCompound(new NBTTagCompound());
|
||||||
|
NBTTagCompound recipe = new NBTTagCompound();
|
||||||
|
recipe.setTag("Items", recipe);
|
||||||
|
ItemStackHelper.saveAllItems(recipe, tile.ingList);
|
||||||
|
//tempStack.writeToNBT(tempNBT);
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, tempStack);
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**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();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**CLEARS THE INVENTORY**/
|
||||||
|
if(player.isSneaking()){
|
||||||
|
for(int i=0; i<tile.ingList.size(); i++){
|
||||||
|
if(!tile.ingList.get(i).isEmpty()) {
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, tile.ingList.get(i));
|
||||||
|
tile.ingList.set(i, ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tile.update();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||||
|
{
|
||||||
|
if (!world.isRemote) {
|
||||||
|
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
||||||
|
for (int i = 0; i < tile.ingList.size(); i++) {
|
||||||
|
if (!tile.ingList.get(i).isEmpty()) {
|
||||||
|
PlayerHelper.spawnItemOnGround(world, pos, tile.ingList.get(i));
|
||||||
|
tile.ingList.set(i, ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
world.removeTileEntity(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
|
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
|
||||||
{
|
{
|
||||||
|
if (!world.isRemote) {
|
||||||
|
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
||||||
|
for (int i = 0; i < tile.ingList.size(); i++) {
|
||||||
|
if (!tile.ingList.get(i).isEmpty()) {
|
||||||
|
PlayerHelper.spawnItemOnGround(world, pos, tile.ingList.get(i));
|
||||||
|
tile.ingList.set(i, ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random random)
|
public int quantityDropped(Random random)
|
||||||
{
|
{
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||||
{
|
{
|
||||||
return new TileBaseCrucible();
|
return new TileNBTCrucible();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,12 +17,19 @@ public class CrucibleCrafting {
|
|||||||
|
|
||||||
private static ArrayList<CrucibleCrafting> crucibleCrafting = new ArrayList<>();
|
private static ArrayList<CrucibleCrafting> crucibleCrafting = new ArrayList<>();
|
||||||
|
|
||||||
|
private int cookTemp;
|
||||||
|
private int cookTime;
|
||||||
|
private int coolTime;
|
||||||
|
|
||||||
private Ingredient ing0;
|
private Ingredient ing0;
|
||||||
private Ingredient ing1;
|
private Ingredient ing1;
|
||||||
private Ingredient ing2;
|
private Ingredient ing2;
|
||||||
private Ingredient ing3;
|
private Ingredient ing3;
|
||||||
private Ingredient ing4;
|
private Ingredient ing4;
|
||||||
|
|
||||||
|
private ItemStack dropsCooked;
|
||||||
|
private ItemStack dropsRaw;
|
||||||
|
|
||||||
private List<Ingredient> ingredientList = new List<Ingredient>() {
|
private List<Ingredient> ingredientList = new List<Ingredient>() {
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
@@ -140,10 +147,12 @@ public class CrucibleCrafting {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private ItemStack drops;
|
|
||||||
|
|
||||||
|
|
||||||
public CrucibleCrafting(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4, ItemStack output){
|
|
||||||
|
public CrucibleCrafting(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4,
|
||||||
|
ItemStack outputRaw, ItemStack outputCooked,
|
||||||
|
Integer temp, Integer cookTime, Integer coolTime){
|
||||||
|
|
||||||
this.ing0 = i0;
|
this.ing0 = i0;
|
||||||
this.ing1 = i1;
|
this.ing1 = i1;
|
||||||
@@ -155,12 +164,18 @@ public class CrucibleCrafting {
|
|||||||
this.ingredientList.add(2, i2);
|
this.ingredientList.add(2, i2);
|
||||||
this.ingredientList.add(3, i3);
|
this.ingredientList.add(3, i3);
|
||||||
this.ingredientList.add(4, i4);
|
this.ingredientList.add(4, i4);
|
||||||
this.drops = output;
|
this.dropsRaw = outputRaw;
|
||||||
|
this.dropsCooked = outputCooked;
|
||||||
|
this.cookTemp = temp;
|
||||||
|
this.cookTime = cookTime;
|
||||||
|
this.coolTime = coolTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addRecipe(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4, ItemStack drop)
|
public static void addRecipe(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4,
|
||||||
|
ItemStack outputRaw, ItemStack outputCooked,
|
||||||
|
Integer temp, Integer cookTime, Integer coolTime)
|
||||||
{
|
{
|
||||||
crucibleCrafting.add(new CrucibleCrafting(i0, i1, i2, i3, i4, drop));
|
crucibleCrafting.add(new CrucibleCrafting(i0, i1, i2, i3, i4, outputRaw, outputCooked, temp, cookTime, coolTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack i4){
|
public static boolean isRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack i4){
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
|
|||||||
import nmd.primal.forgecraft.blocks.*;
|
import nmd.primal.forgecraft.blocks.*;
|
||||||
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
|
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
|
||||||
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
|
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
|
||||||
|
import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible;
|
||||||
import nmd.primal.forgecraft.items.ForgeHammer;
|
import nmd.primal.forgecraft.items.ForgeHammer;
|
||||||
import nmd.primal.forgecraft.tiles.TileAnvil;
|
import nmd.primal.forgecraft.tiles.TileAnvil;
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ import nmd.primal.forgecraft.tiles.TileAnvil;
|
|||||||
*/
|
*/
|
||||||
public class ModBlocks {
|
public class ModBlocks {
|
||||||
|
|
||||||
|
public static Block nbtCrucible;
|
||||||
public static Block forge_brick;
|
public static Block forge_brick;
|
||||||
public static Block forge_adobe;
|
public static Block forge_adobe;
|
||||||
public static Block bloomery_brick;
|
public static Block bloomery_brick;
|
||||||
@@ -118,6 +120,7 @@ public class ModBlocks {
|
|||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
|
|
||||||
|
nbtCrucible = new NBTCrucible(Material.ROCK, "nbtCrucible");
|
||||||
forge_brick = new Forge(Material.ROCK, "forge_brick", 5000);
|
forge_brick = new Forge(Material.ROCK, "forge_brick", 5000);
|
||||||
forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000);
|
forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000);
|
||||||
bloomery_brick = new BloomeryBase(Material.ROCK, "bloomery_brick", 5000);
|
bloomery_brick = new BloomeryBase(Material.ROCK, "bloomery_brick", 5000);
|
||||||
@@ -419,6 +422,7 @@ public class ModBlocks {
|
|||||||
|
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
|
registerBlock(nbtCrucible);
|
||||||
registerBlock(forge_brick);
|
registerBlock(forge_brick);
|
||||||
registerBlock(forge_adobe);
|
registerBlock(forge_adobe);
|
||||||
registerBlock(bloomery_brick);
|
registerBlock(bloomery_brick);
|
||||||
@@ -509,6 +513,7 @@ public class ModBlocks {
|
|||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static void registerRenders() {
|
public static void registerRenders() {
|
||||||
|
registerRender(nbtCrucible);
|
||||||
registerRender(forge_brick);
|
registerRender(forge_brick);
|
||||||
registerRender(forge_adobe);
|
registerRender(forge_adobe);
|
||||||
registerRender(castingform);
|
registerRender(castingform);
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ public class ModCrafting{
|
|||||||
Ingredient.EMPTY,
|
Ingredient.EMPTY,
|
||||||
Ingredient.EMPTY,
|
Ingredient.EMPTY,
|
||||||
Ingredient.EMPTY,
|
Ingredient.EMPTY,
|
||||||
new ItemStack(ModBlocks.ironball, 1));
|
new ItemStack(Blocks.IRON_ORE, 1),
|
||||||
|
new ItemStack(ModBlocks.ironball, 1),
|
||||||
|
100,
|
||||||
|
20,
|
||||||
|
20);
|
||||||
|
|
||||||
/***CASTING BLOCK***/
|
/***CASTING BLOCK***/
|
||||||
RecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.castingblock),
|
RecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.castingblock),
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import nmd.primal.forgecraft.items.weapons.SlayerSword;
|
|||||||
public class ModItems {
|
public class ModItems {
|
||||||
|
|
||||||
//public static Item test;
|
//public static Item test;
|
||||||
|
public static Item itemcrucible;
|
||||||
public static Item bellowshandle;
|
public static Item bellowshandle;
|
||||||
public static Item forgehammer;
|
public static Item forgehammer;
|
||||||
public static Item softcrucible;
|
public static Item softcrucible;
|
||||||
@@ -142,6 +143,7 @@ public class ModItems {
|
|||||||
public static void init() {
|
public static void init() {
|
||||||
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
|
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
|
||||||
//pistonbellows = new ItemBellowsHandle("pistonbellows");
|
//pistonbellows = new ItemBellowsHandle("pistonbellows");
|
||||||
|
itemcrucible = new ItemCrucible("itemcrucible");
|
||||||
bellowshandle = new BaseItem("bellowshandle");
|
bellowshandle = new BaseItem("bellowshandle");
|
||||||
softcrucible = new ItemSoftCrucible("softcrucible");
|
softcrucible = new ItemSoftCrucible("softcrucible");
|
||||||
stonetongs = new ItemStoneTongs("stonetongs");
|
stonetongs = new ItemStoneTongs("stonetongs");
|
||||||
@@ -266,6 +268,7 @@ public class ModItems {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
|
ForgeRegistries.ITEMS.register(itemcrucible);
|
||||||
ForgeRegistries.ITEMS.register(castingmud);
|
ForgeRegistries.ITEMS.register(castingmud);
|
||||||
ForgeRegistries.ITEMS.register(bellowshandle);
|
ForgeRegistries.ITEMS.register(bellowshandle);
|
||||||
ForgeRegistries.ITEMS.register(softcrucible);
|
ForgeRegistries.ITEMS.register(softcrucible);
|
||||||
@@ -385,6 +388,7 @@ public class ModItems {
|
|||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static void registerRenders() {
|
public static void registerRenders() {
|
||||||
|
registerRender(itemcrucible);
|
||||||
registerRender(castingmud);
|
registerRender(castingmud);
|
||||||
registerRender(bellowshandle);
|
registerRender(bellowshandle);
|
||||||
registerRender(softcrucible);
|
registerRender(softcrucible);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class ModTiles {
|
|||||||
registerTileEntity(TileBreaker.class, "breaker");
|
registerTileEntity(TileBreaker.class, "breaker");
|
||||||
registerTileEntity(TileCastingForm.class, "castingform");
|
registerTileEntity(TileCastingForm.class, "castingform");
|
||||||
registerTileEntity(TileCastingBlock.class, "castingblock");
|
registerTileEntity(TileCastingBlock.class, "castingblock");
|
||||||
|
registerTileEntity(TileNBTCrucible.class, "nbtcrucible");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerTileEntity(Class<? extends TileEntity> tile_class, String baseName) {
|
private static void registerTileEntity(Class<? extends TileEntity> tile_class, String baseName) {
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
package nmd.primal.forgecraft.items;
|
package nmd.primal.forgecraft.items;
|
||||||
|
|
||||||
|
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.ItemStackHelper;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import nmd.primal.core.common.helper.PlayerHelper;
|
||||||
import nmd.primal.forgecraft.ModInfo;
|
import nmd.primal.forgecraft.ModInfo;
|
||||||
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -21,6 +29,33 @@ public class ItemCrucible extends Item {
|
|||||||
this.setRegistryName(unlocalizedName);
|
this.setRegistryName(unlocalizedName);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||||
|
this.setMaxStackSize(1);
|
||||||
|
this.setNoRepair();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
|
||||||
|
|
||||||
|
if(!world.isRemote) {
|
||||||
|
if (!item.hasTagCompound()) {
|
||||||
|
item.setTagCompound(new NBTTagCompound());
|
||||||
|
NBTTagCompound recipe = new NBTTagCompound();
|
||||||
|
recipe.setTag("Items", recipe);
|
||||||
|
//item.getTagCompound().setTag("recipe", recipe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||||
|
if(!world.isRemote) {
|
||||||
|
if (!item.hasTagCompound()) {
|
||||||
|
item.setTagCompound(new NBTTagCompound());
|
||||||
|
NBTTagCompound recipe = new NBTTagCompound();
|
||||||
|
recipe.setTag("Items", recipe);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -31,6 +66,11 @@ public class ItemCrucible extends Item {
|
|||||||
{
|
{
|
||||||
if (item.hasTagCompound())
|
if (item.hasTagCompound())
|
||||||
{
|
{
|
||||||
|
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
||||||
|
NBTTagCompound nbtTag = item.getSubCompound("Items");
|
||||||
|
ItemStackHelper.loadAllItems(nbtTag, ingList);
|
||||||
|
tooltip.add(ChatFormatting.BLUE + "Items:" + ingList.get(0));
|
||||||
|
|
||||||
/*tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
|
/*tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
|
||||||
if (getEmerald(item) == true) {
|
if (getEmerald(item) == true) {
|
||||||
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package nmd.primal.forgecraft.tiles;
|
package nmd.primal.forgecraft.tiles;
|
||||||
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.inventory.ItemStackHelper;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,6 +18,7 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
|||||||
private int heat;
|
private int heat;
|
||||||
private boolean hot;
|
private boolean hot;
|
||||||
private String mod0, mod1, mod2;
|
private String mod0, mod1, mod2;
|
||||||
|
public NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update () {
|
public void update () {
|
||||||
@@ -45,9 +49,8 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
|||||||
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
public NBTTagCompound readNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
super.readNBT(nbt);
|
super.readNBT(nbt);
|
||||||
this.mod0 = nbt.getString("mod0");
|
this.ingList = NonNullList.<ItemStack>withSize(this.ingList.size(), ItemStack.EMPTY);
|
||||||
this.mod1 = nbt.getString("mod1");
|
ItemStackHelper.loadAllItems(nbt, this.ingList);
|
||||||
this.mod2 = nbt.getString("mod2");
|
|
||||||
this.heat = nbt.getInteger("heat");
|
this.heat = nbt.getInteger("heat");
|
||||||
this.hot = nbt.getBoolean("hot");
|
this.hot = nbt.getBoolean("hot");
|
||||||
return nbt;
|
return nbt;
|
||||||
@@ -56,13 +59,18 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
|||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
public NBTTagCompound writeNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
|
ItemStackHelper.saveAllItems(nbt, this.ingList);
|
||||||
nbt.setInteger("heat", this.heat);
|
nbt.setInteger("heat", this.heat);
|
||||||
nbt.setString("mod0", this.mod0);
|
|
||||||
nbt.setString("mod1", this.mod1);
|
|
||||||
nbt.setString("mod2", this.mod2);
|
|
||||||
nbt.setBoolean("hot", this.hot);
|
nbt.setBoolean("hot", this.hot);
|
||||||
super.writeNBT(nbt);
|
super.writeNBT(nbt);
|
||||||
return nbt;
|
return nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
this.slotList = NonNullList.<ItemStack>withSize(this.getSlotListSize(), ItemStack.EMPTY);
|
||||||
|
ItemStackHelper.loadAllItems(nbt, this.slotList);
|
||||||
|
|
||||||
|
*/
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"forge_marker":1,
|
||||||
|
"defaults": {
|
||||||
|
"textures": {
|
||||||
|
"particle": "forgecraft:blocks/stone_slab",
|
||||||
|
"texture": "forgecraft:blocks/stone_slab"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": { "model": "forgecraft:crucibleshut" }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user