commit current functioning code, needs assets
This commit is contained in:
@@ -10,9 +10,11 @@ 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.inventory.ItemStackHelper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
@@ -28,6 +30,7 @@ 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.crafting.CrucibleCrafting;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.items.SlottedTongs;
|
||||
import nmd.primal.forgecraft.tiles.TileBloomery;
|
||||
@@ -108,19 +111,28 @@ public class BloomeryBase extends CustomContainerFacing implements ITileEntityPr
|
||||
" Fuel Remaining: " + tileItem.getCount();
|
||||
ITextComponent itextcomponent = new TextComponentString(display);
|
||||
player.sendStatusMessage(itextcomponent, false);
|
||||
|
||||
BloomeryCrafting recipe = BloomeryCrafting.getRecipe(tile.getSlotStack(1));
|
||||
NBTTagCompound tag = tile.getSlotStack(1).getSubCompound("BlockEntityTag");
|
||||
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
||||
NonNullList<ItemStack> dropList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
||||
ItemStackHelper.loadAllItems(tag, ingList);
|
||||
ItemStackHelper.loadAllItems(tag, dropList);
|
||||
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
|
||||
if(recipe != null) {
|
||||
Integer minTemp = recipe.getHeatThreshold();
|
||||
Integer minTemp = recipe.getCookTemp();
|
||||
Integer cookCounter = tile.getCookCounter();
|
||||
Integer idealTime = recipe.getIdealTime();
|
||||
Integer idealTime = recipe.getCookTime();
|
||||
Integer remainingTime = idealTime - cookCounter;
|
||||
|
||||
String display1 =
|
||||
"Cooking: " + tileItem1.getDisplayName() +
|
||||
" Target Temp: " + minTemp.toString() +
|
||||
" Time Left: " + remainingTime.toString();
|
||||
ITextComponent itextcomponent1 = new TextComponentString(display1);
|
||||
String display2 = tileItem1.getDisplayName() + "finished.";
|
||||
ITextComponent itextcomponent1 = null;
|
||||
if (tileItem1.getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||
itextcomponent1 = new TextComponentString(display2);
|
||||
} else itextcomponent1 = new TextComponentString(display1);
|
||||
|
||||
player.sendStatusMessage(itextcomponent1, false);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -49,7 +51,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
||||
|
||||
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
|
||||
|
||||
private Ingredient crucibleIngredients;
|
||||
//private Ingredient crucibleIngredients;
|
||||
|
||||
public NBTCrucible(Material material, String registryName) {
|
||||
super(material);
|
||||
@@ -57,7 +59,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
||||
setRegistryName(registryName);
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
setHardness(3.0f);
|
||||
//crucibleIngredients.apply(new ItemStack(Blocks.IRON_ORE, 1));
|
||||
//setDefaultState(this.blockState.getBaseState().withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,7 +171,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
||||
if (stack.hasDisplayName())
|
||||
{
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
|
||||
//world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
if (tileentity instanceof TileNBTCrucible)
|
||||
{
|
||||
//((TileStorageCrate)tileentity).setCustomName(stack.getDisplayName());
|
||||
@@ -177,6 +179,45 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if( (state.getValue(PrimalAPI.States.ACTIVE) == false)) {
|
||||
i = 0;
|
||||
return i;
|
||||
}
|
||||
if ( (state.getValue(PrimalAPI.States.ACTIVE) == true)) {
|
||||
i = 14;
|
||||
return i;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
EnumFacing enumfacing;
|
||||
Boolean active;
|
||||
switch (meta & 7)
|
||||
{
|
||||
case 0:
|
||||
active = false;
|
||||
break;
|
||||
case 1:
|
||||
active = true;
|
||||
break;
|
||||
default:
|
||||
active = false;
|
||||
}
|
||||
|
||||
return this.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(active));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] {PrimalAPI.States.ACTIVE});
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
|
||||
@@ -119,7 +119,7 @@ public class ModBlocks {
|
||||
|
||||
|
||||
public static void init() {
|
||||
|
||||
//FISH_TRAP = RegistryHelper.addBlock("fish_trap", new FishTrap(), ItemFishTraps::new, "fishtrap");
|
||||
nbtCrucible = new NBTCrucible(Material.ROCK, "nbtCrucible");
|
||||
forge_brick = new Forge(Material.ROCK, "forge_brick", 5000);
|
||||
forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000);
|
||||
|
||||
@@ -32,8 +32,8 @@ public class ModCrafting{
|
||||
new ItemStack(Blocks.IRON_ORE, 1),
|
||||
new ItemStack(ModBlocks.ironball, 1),
|
||||
100,
|
||||
20,
|
||||
20);
|
||||
200,
|
||||
100);
|
||||
|
||||
/***CASTING BLOCK***/
|
||||
RecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.castingblock),
|
||||
|
||||
@@ -15,8 +15,10 @@ 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.Crucibles.NBTCrucible;
|
||||
import nmd.primal.forgecraft.items.*;
|
||||
import nmd.primal.forgecraft.items.armor.CustomHelmet;
|
||||
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible;
|
||||
import nmd.primal.forgecraft.items.casting.CastingPart;
|
||||
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
|
||||
import nmd.primal.forgecraft.items.parts.ToolPart;
|
||||
@@ -32,6 +34,7 @@ import nmd.primal.forgecraft.items.weapons.SlayerSword;
|
||||
public class ModItems {
|
||||
|
||||
//public static Item test;
|
||||
public static Item itemnbtcrucible;
|
||||
public static Item slottedtongs;
|
||||
public static Item itemcrucible;
|
||||
public static Item bellowshandle;
|
||||
@@ -144,6 +147,7 @@ public class ModItems {
|
||||
public static void init() {
|
||||
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
|
||||
//pistonbellows = new ItemBellowsHandle("pistonbellows");
|
||||
itemnbtcrucible = new ItemNBTCrucible("itemnbtcrucible", ModBlocks.nbtCrucible);
|
||||
slottedtongs = new SlottedTongs("slottedtongs");
|
||||
itemcrucible = new ItemCrucible("itemcrucible");
|
||||
bellowshandle = new BaseItem("bellowshandle");
|
||||
@@ -270,6 +274,7 @@ public class ModItems {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
ForgeRegistries.ITEMS.register(itemnbtcrucible);
|
||||
ForgeRegistries.ITEMS.register(slottedtongs);
|
||||
ForgeRegistries.ITEMS.register(itemcrucible);
|
||||
ForgeRegistries.ITEMS.register(castingmud);
|
||||
@@ -391,6 +396,7 @@ public class ModItems {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerRenders() {
|
||||
registerRender(itemnbtcrucible);
|
||||
registerRender(itemcrucible);
|
||||
registerRender(castingmud);
|
||||
registerRender(bellowshandle);
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package nmd.primal.forgecraft.items.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.interfaces.IFireProof;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/7/18.
|
||||
*/
|
||||
public class AbstractItemBlock extends ItemBlock {
|
||||
private boolean is_fire_proof;
|
||||
|
||||
public AbstractItemBlock(Block block, boolean sub_types) {
|
||||
super(block);
|
||||
this.setHasSubtypes(sub_types);
|
||||
}
|
||||
|
||||
public AbstractItemBlock(Block block) {
|
||||
this(block, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreativeTabs getCreativeTab() {
|
||||
return ModInfo.TAB_FORGECRAFT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the normal 'lifespan' of this item when it is dropped on the ground as amount EntityItem.
|
||||
* This is in ticks, standard result is 6000, or 5 mins.
|
||||
*
|
||||
* @param itemStack The current ItemStack
|
||||
* @param world The world the entity is in
|
||||
* @return The normal lifespan in ticks.
|
||||
*/
|
||||
@Override
|
||||
public int getEntityLifespan(ItemStack itemStack, World world) {
|
||||
return 6000;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package nmd.primal.forgecraft.items.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 2/7/18.
|
||||
*/
|
||||
public class ItemNBTCrucible extends AbstractItemBlock {
|
||||
public ItemNBTCrucible(String name, Block block) {
|
||||
super(block);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setRegistryName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
//TODO get the item name
|
||||
if (item.hasTagCompound()) {
|
||||
if (getStatus(item)){
|
||||
return 0.1f;
|
||||
}
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean getStatus(ItemStack stack) {
|
||||
if(!stack.isEmpty()) {
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.getSubCompound("tags") != null) {
|
||||
return stack.getSubCompound("BlockEntityTag").getBoolean("status");
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
|
||||
if(!world.isRemote) {
|
||||
System.out.println("We doin it?");
|
||||
if (!item.hasTagCompound()) {
|
||||
//item.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound tag = item.getSubCompound("BlockEntityTag");
|
||||
|
||||
//item.getTagCompound().setTag("BlockEntityTag", tags);
|
||||
System.out.println(tag);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,7 +83,9 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
||||
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
|
||||
NonNullList<ItemStack> dropList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
|
||||
NBTTagCompound tag = this.getSlotStack(1).getSubCompound("BlockEntityTag");
|
||||
//System.out.println(this.getSlotStack(1).getTagCompound());
|
||||
if(tag != null) {
|
||||
System.out.println(tag);
|
||||
ItemStackHelper.loadAllItems(tag, ingList);
|
||||
ItemStackHelper.loadAllItems(tag, dropList);
|
||||
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
|
||||
@@ -92,24 +94,21 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
||||
!this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||
cookCounter++;
|
||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("hot", true);
|
||||
System.out.println("Cooking");
|
||||
this.updateBlock();
|
||||
this.markDirty();
|
||||
}
|
||||
if (cookCounter >= recipe.getCookTime() && !this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("status", true);
|
||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setInteger("heat", this.getHeat());
|
||||
cookCounter = 0;
|
||||
//dropList.set(0, recipe.getDropsCooked());
|
||||
System.out.println("Cooked");
|
||||
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());
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
@@ -73,7 +73,9 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
||||
}
|
||||
|
||||
private void coolManager() {
|
||||
System.out.println(this.getHeat() + " " + this.getStatus() + " " + this.getDrops());
|
||||
if(this.getHot()){
|
||||
System.out.println("Still Hot");
|
||||
if(this.getHeat() > 0){
|
||||
this.setHeat( this.getHeat() - 1);
|
||||
System.out.println(this.getHeat());
|
||||
@@ -82,6 +84,7 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
||||
this.setHot(false);
|
||||
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
|
||||
this.setDrops(recipe.getDropsCooked());
|
||||
System.out.println("Ready to harvest: " + this.getDrops());
|
||||
}
|
||||
//CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user