create model for modifying tool parts, rendering multiple textures for only one item based off NBT

This commit is contained in:
Mohammad-Ali Minaie
2017-03-11 01:20:01 -05:00
parent b1f9aa0f8a
commit f7eda0ac55
15 changed files with 770 additions and 171 deletions

View File

@@ -61,7 +61,7 @@ public class CommonUtils {
}
public static void spawnItemEntityFromWorld(World world, BlockPos pos, ItemStack stack){
EntityItem entityitem = new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), stack); // player.posY - 1.0D
EntityItem entityitem = new EntityItem(world, pos.getX(), pos.getY() + 1, pos.getZ(), stack); // player.posY - 1.0D
world.spawnEntity(entityitem);
}

View File

@@ -7,6 +7,8 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
@@ -78,13 +80,15 @@ public class Anvil extends CustomContainerFacing {
// Crafting Anvil Recipes
// ***************************************************************************** //
if((pItem.getItem().equals(PrimalItems.STONE_GALLAGHER)) || (pItem.getItem() == ModItems.forgehammer)){
Integer[] tempArray = new Integer[25];
String [] tempArray = new String[25];
for(int i=0; i < 25 ; i++){
if(!tile.getSlotStack(i).isEmpty()){
tempArray[i] = 1;
} else tempArray[i] = 0;
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
//System.out.println(i + " || " + tempArray[i] + " || " + tile.getSlotStack(i).getItem());
}
AnvilCrafting recipe = AnvilCrafting.getRecipe(tempArray);
if(recipe != null) {
if(pItem.getItem().equals(PrimalItems.STONE_GALLAGHER)) {
pItem.damageItem(15, player);
@@ -105,181 +109,270 @@ public class Anvil extends CustomContainerFacing {
// ***************************************************************************** //
// Adding and Removing Inventory
// Adding and Removing Inventory With Tongs
// ***************************************************************************** //
if(pItem.getItem().equals(ModItems.stonetongs)){
if( (pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0) ) {
if( (pItem.getItem() != PrimalItems.STONE_GALLAGHER) || (pItem.getItem() != ModItems.forgehammer) ) {
if(state.getValue(FACING) == EnumFacing.NORTH) {
int counter = 0;
for(int z=0; z<5; z++){
for(int x=0; x<5; x++){
if(hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)){
if(hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
if(!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) {
if(tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)){
pItem.getTagCompound().setInteger("type", 6);
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if(tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)){
pItem.getTagCompound().setInteger("type", 7);
tile.setSlotStack(counter, ItemStack.EMPTY);
System.out.println(counter);
return true;
if (state.getValue(FACING) == EnumFacing.NORTH) {
int counter = 0;
for (int z = 0; z < 5; z++) {
for (int x = 0; x < 5; x++) {
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
if (pItem.getItem().equals(ModItems.stonetongs)) {
if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) {
if (!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) {
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)) {
pItem.getTagCompound().setInteger("type", 6);
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)) {
pItem.getTagCompound().setInteger("type", 7);
tile.setSlotStack(counter, ItemStack.EMPTY);
//System.out.println(counter);
return true;
}
}
}
}
if(tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 6) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
pItem.getTagCompound().setInteger("type", 0);
return true;
}
if (pItem.getTagCompound().getInteger("type") == 7) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
pItem.getTagCompound().setInteger("type", 0);
System.out.println(counter);
return true;
if (tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 6) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
pItem.getTagCompound().setInteger("type", 0);
return true;
}
if (pItem.getTagCompound().getInteger("type") == 7) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
pItem.getTagCompound().setInteger("type", 0);
//System.out.println(counter);
return true;
}
}
}
}
if (pItem.equals(ItemStack.EMPTY)) {
if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) {
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
}
if (pItem.getItem().equals(Items.DIAMOND)) {
if (tile.getSlotStack(counter).isEmpty()) {
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage()));
pItem.shrink(1);
return true;
}
}
}
counter++;
}
counter++;
}
}
if(state.getValue(FACING) == EnumFacing.SOUTH) {
int counter = 0;
for(int z=0; z<5; z++){
for(int x=0; x<5; x++){
if(hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)){
if(hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
if(!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) {
if(tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)){
pItem.getTagCompound().setInteger("type", 6);
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if(tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)){
pItem.getTagCompound().setInteger("type", 7);
tile.setSlotStack(counter, ItemStack.EMPTY);
System.out.println(counter);
return true;
}
}
}
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
int counter = 0;
for (int z = 0; z < 5; z++) {
for (int x = 0; x < 5; x++) {
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
if(tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 6) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
pItem.getTagCompound().setInteger("type", 0);
return true;
if (pItem.getItem().equals(ModItems.stonetongs)) {
if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) {
if (!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) {
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)) {
pItem.getTagCompound().setInteger("type", 6);
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)) {
pItem.getTagCompound().setInteger("type", 7);
tile.setSlotStack(counter, ItemStack.EMPTY);
//System.out.println(counter);
return true;
}
}
}
if (pItem.getTagCompound().getInteger("type") == 7) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
pItem.getTagCompound().setInteger("type", 0);
System.out.println(counter);
return true;
if (tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 6) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
pItem.getTagCompound().setInteger("type", 0);
return true;
}
if (pItem.getTagCompound().getInteger("type") == 7) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
pItem.getTagCompound().setInteger("type", 0);
//System.out.println(counter);
return true;
}
}
}
}
if (pItem.equals(ItemStack.EMPTY)) {
if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) {
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
}
if (pItem.getItem().equals(Items.DIAMOND)) {
if (tile.getSlotStack(counter).isEmpty()) {
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage()));
pItem.shrink(1);
return true;
}
}
}
counter++;
}
counter++;
}
}
if(state.getValue(FACING) == EnumFacing.WEST) {
int counter = 0;
for(int x=0; x<5; x++){
for(int z=0; z<5; z++){
if(hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)){
if(hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
if(!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) {
if(tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)){
pItem.getTagCompound().setInteger("type", 6);
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if(tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)){
pItem.getTagCompound().setInteger("type", 7);
tile.setSlotStack(counter, ItemStack.EMPTY);
System.out.println(counter);
return true;
}
}
}
}
if (state.getValue(FACING) == EnumFacing.WEST) {
int counter = 0;
for (int x = 0; x < 5; x++) {
for (int z = 0; z < 5; z++) {
if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) {
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
if(tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 6) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
pItem.getTagCompound().setInteger("type", 0);
return true;
if (pItem.getItem().equals(ModItems.stonetongs)) {
if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) {
if (!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) {
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)) {
pItem.getTagCompound().setInteger("type", 6);
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)) {
pItem.getTagCompound().setInteger("type", 7);
tile.setSlotStack(counter, ItemStack.EMPTY);
//System.out.println(counter);
return true;
}
}
}
if (pItem.getTagCompound().getInteger("type") == 7) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
pItem.getTagCompound().setInteger("type", 0);
System.out.println(counter);
return true;
if (tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 6) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
pItem.getTagCompound().setInteger("type", 0);
return true;
}
if (pItem.getTagCompound().getInteger("type") == 7) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
pItem.getTagCompound().setInteger("type", 0);
//System.out.println(counter);
return true;
}
}
}
}
if (pItem.equals(ItemStack.EMPTY)) {
if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) {
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
}
if (pItem.getItem().equals(Items.DIAMOND)) {
if (tile.getSlotStack(counter).isEmpty()) {
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage()));
pItem.shrink(1);
return true;
}
}
}
counter++;
}
counter++;
}
}
if(state.getValue(FACING) == EnumFacing.EAST) {
int counter = 0;
for(int x=0; x<5; x++){
for(int z=0; z<5; z++){
if(hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)){
if(hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
if(!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) {
if(tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)){
pItem.getTagCompound().setInteger("type", 6);
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if(tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)){
pItem.getTagCompound().setInteger("type", 7);
tile.setSlotStack(counter, ItemStack.EMPTY);
System.out.println(counter);
return true;
}
}
}
}
if (state.getValue(FACING) == EnumFacing.EAST) {
int counter = 0;
for (int x = 0; x < 5; x++) {
for (int z = 0; z < 5; z++) {
if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) {
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
if(tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 6) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
pItem.getTagCompound().setInteger("type", 0);
return true;
if (pItem.getItem().equals(ModItems.stonetongs)) {
if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) {
if (!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) {
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)) {
pItem.getTagCompound().setInteger("type", 6);
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if (tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)) {
pItem.getTagCompound().setInteger("type", 7);
tile.setSlotStack(counter, ItemStack.EMPTY);
//System.out.println(counter);
return true;
}
}
}
if (pItem.getTagCompound().getInteger("type") == 7) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
pItem.getTagCompound().setInteger("type", 0);
System.out.println(counter);
return true;
if (tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 6) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
pItem.getTagCompound().setInteger("type", 0);
return true;
}
if (pItem.getTagCompound().getInteger("type") == 7) {
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
pItem.getTagCompound().setInteger("type", 0);
//System.out.println(counter);
return true;
}
}
}
}
if (pItem.equals(ItemStack.EMPTY)) {
if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) {
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
}
if (pItem.getItem().equals(Items.DIAMOND)) {
if (tile.getSlotStack(counter).isEmpty()) {
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage()));
pItem.shrink(1);
return true;
}
}
}
counter++;
}
counter++;
}
}
}
}
return false;
}
}

View File

@@ -2,6 +2,7 @@ package nmd.primal.forgecraft.crafting;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
@@ -21,15 +22,19 @@ public class AnvilCrafting {
private static ArrayList<AnvilCrafting> anvilRecipes = new ArrayList<>();
private Integer[] input = new Integer[25];
//private Integer[] input = new Integer[25];
private static ItemStack slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9, slot10, slot11, slot12, slot13, slot14, slot15, slot16, slot17, slot18, slot19, slot20, slot21, slot22, slot23, slot24;
private String[] input = new String[25];
private static ItemStack [] slots = {slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9, slot10, slot11, slot12, slot13, slot14, slot15, slot16, slot17, slot18, slot19, slot20, slot21, slot22, slot23, slot24};
//private ItemStack inputItem;
//private static Item slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9, slot10, slot11, slot12, slot13, slot14, slot15, slot16, slot17, slot18, slot19, slot20, slot21, slot22, slot23, slot24;
//private static Item[] input = {slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9, slot10, slot11, slot12, slot13, slot14, slot15, slot16, slot17, slot18, slot19, slot20, slot21, slot22, slot23, slot24};
private ItemStack output;
public AnvilCrafting(Integer[] input, ItemStack output){
public AnvilCrafting(String[] input, ItemStack output){
this.input = input;
this.output = output;
@@ -40,21 +45,22 @@ public class AnvilCrafting {
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(Integer[] input, ItemStack output)
public static void addRecipe(String[] input, ItemStack output)
{
anvilRecipes.add(new AnvilCrafting(input, output));
}
public static boolean isRecipe(Integer[] array)
public static boolean isRecipe(String[] array)
{
for(AnvilCrafting recipe : anvilRecipes) {
if (Arrays.equals(array, recipe.input))
return true;
}
return false;
}
public static AnvilCrafting getRecipe(Integer[] array)
public static AnvilCrafting getRecipe(String[] array)
{
for(AnvilCrafting recipe : anvilRecipes) {
if (Arrays.equals(array, recipe.input))
@@ -63,6 +69,8 @@ public class AnvilCrafting {
return null;
}
public String[] getInput() {return this.input;}
public ItemStack getOutput() {return this.output;}
}

View File

@@ -6,6 +6,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.registry.GameRegistry;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.core.common.crafting.ToolRecipe;
@@ -16,6 +17,9 @@ import nmd.primal.forgecraft.crafting.AnvilCrafting;
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by kitsu on 11/30/2016.
*/
@@ -23,6 +27,8 @@ public class ModCrafting {
public static void register() {
Random rand = new Random();
/***Forge***/
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.firebox),
"X X", "XYX", "X X", 'X', Items.BRICK, 'Y', Blocks.FURNACE);
@@ -50,9 +56,22 @@ public class ModCrafting {
"X X", "YSY", 'X', Blocks.STONE, 'S', Items.STRING, 'Y', Items.STICK);
/***Iron Crucible***/
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.rawironcrucible, 1),
ItemStack iron0 = new ItemStack(ModBlocks.rawironcrucible, 1);
//iron0.getTagCompound().setBoolean("mod", false);
///iron0.getTagCompound().setInteger("speed", 0);
//iron0.getTagCompound().setInteger("fortune", 0);
//iron0.getTagCompound().setInteger("durability", 0);
//iron0.getTagCompound().setBoolean("silk", false);
//Regular Iron Ore
GameRegistry.addShapedRecipe(iron0,
" X ", " Y ", 'X', Blocks.IRON_ORE, 'Y', ModBlocks.emptycrucible);
//Iron Ore speed +1
/***Bloomery Crafting***/
//Makes the Empty Crucible
@@ -154,26 +173,61 @@ public class ModCrafting {
// ANVILING
// ***************************************************************************** //
String empty = ItemStack.EMPTY.getItem().getRegistryName().toString();
String hotChunk = ModItems.ironchunkhot.getRegistryName().toString();
String diamond = Items.DIAMOND.getRegistryName().toString();
String emerald = Items.EMERALD.getRegistryName().toString();
/*
Empty = 0
hotChunk = 1
diamond = 2
*/
//Makes a ForgeHammer
AnvilCrafting.addRecipe(
new Integer[] {
0,1,1,1,0,
0,1,1,0,0,
0,0,1,0,0,
0,0,1,0,0,
0,0,1,0,0 },
new String [] {
empty,hotChunk,hotChunk,hotChunk,empty,
empty,hotChunk,hotChunk,empty,empty,
empty,empty,hotChunk,empty,empty,
empty,empty,hotChunk,empty,empty,
empty,empty,hotChunk,empty,empty },
new ItemStack(ModItems.forgehammer, 1)
);
//Makes flaked diamond
AnvilCrafting.addRecipe(
new String[] {
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,diamond,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty },
new ItemStack(PrimalItems.DIAMOND_KNAPP, 1)
);
//Makes flaked emerald
AnvilCrafting.addRecipe(
new String[] {
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,emerald,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty },
new ItemStack(PrimalItems.EMERALD_KNAPP, 1)
);
//Makes a Pickaxe Head
AnvilCrafting.addRecipe(
new Integer[] { 0,0,0,0,0,
0,1,1,1,0,
1,0,0,0,1,
0,0,0,0,0,
0,0,0,0,0 },
new ItemStack(Blocks.OBSIDIAN, 1)
new String[] {
empty,empty,empty,empty,empty,
empty,hotChunk,hotChunk,hotChunk,empty,
hotChunk,empty,empty,empty,hotChunk,
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty },
new ItemStack(Blocks.OBSIDIAN, 1)
);
}
}

View File

@@ -24,6 +24,7 @@ import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.IngotBall;
import nmd.primal.forgecraft.items.*;
import nmd.primal.forgecraft.items.blocks.ItemBlockIngotBall;
import nmd.primal.forgecraft.items.toolparts.PickaxePart;
/**
* Created by kitsu on 11/26/2016.
@@ -37,6 +38,9 @@ public class ModItems {
public static Item stonetongs;
public static Item ironingotballhot;
public static Item ironchunkhot;
public static Item pickaxehead;
//public static Item forgingmanual;
public static void init() {
@@ -44,8 +48,13 @@ public class ModItems {
pistonbellows = new ItemBellowsHandle();
softcrucible = new ItemSoftCrucible();
stonetongs = new ItemStoneTongs("stonetongs");
pickaxehead = new PickaxePart("ironpickaxehead");
//ironingotballcool = new BaseMultiItem("ironingotcool") {};
test = new ItemTest();
//test = new ItemTest();
ironingotballhot = new BaseMultiItem("ironingothot") {
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if(!world.isRemote) {
@@ -88,7 +97,10 @@ public class ModItems {
GameRegistry.register(forgehammer);
GameRegistry.register(ironingotballhot);
GameRegistry.register(ironchunkhot);
GameRegistry.register(test);
//GameRegistry.register(test);
GameRegistry.register(pickaxehead);
//GameRegistry.register(forgingmanual);
}
@@ -99,7 +111,8 @@ public class ModItems {
registerRender(forgehammer);
registerRender(ironingotballhot);
registerRender(ironchunkhot);
registerRender(test);
//registerRender(test);
registerRender(pickaxehead);
//registerRender(forgingmanual);
}

View File

@@ -0,0 +1,231 @@
package nmd.primal.forgecraft.items.toolparts;
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 javax.annotation.Nullable;
/**
* Created by mminaie on 3/11/17.
*/
public class PickaxePart extends ToolPart {
/***
Hot . Emerald . Diamond . Redstone . lapis
***/
public PickaxePart(String name) {
super(name);
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
{
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (item.getTagCompound().getBoolean("hot") == true) {
return 1.0F;
}
if (item.getTagCompound().getBoolean("hot") == false) {
if (item.getTagCompound().getInteger("modifiers") == 0) {
return 0.0F;
}
}
if (item.getTagCompound().getBoolean("hot") == false) {
if (item.getTagCompound().getInteger("modifiers") != 0) {
if ((item.getTagCompound().getBoolean("emerald") == true) &&
(item.getTagCompound().getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.1F;
}
if ((item.getTagCompound().getBoolean("emerald") == true) &&
(item.getTagCompound().getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.11F;
}
if ((item.getTagCompound().getBoolean("emerald") == true) &&
(item.getTagCompound().getInteger("diamond") == 2) &&
(item.getTagCompound().getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.12F;
}
if ((item.getTagCompound().getBoolean("emerald") == true) &&
(item.getTagCompound().getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.111F;
}
if ((item.getTagCompound().getBoolean("emerald") == true) &&
(item.getTagCompound().getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 2) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.102F;
}
// ============
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.01F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 2) &&
(item.getTagCompound().getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.02F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 3) &&
(item.getTagCompound().getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.03F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.001F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 2) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.002F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 3) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.003F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 1)) {
return 0.0001F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 2)) {
return 0.0002F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 3)) {
return 0.0003F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 1)) {
return 0.0111F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 2) &&
(item.getTagCompound().getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.021F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 2) &&
(item.getTagCompound().getInteger("lapis") == 0)) {
return 0.012F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 2)) {
return 0.012F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 2)) {
return 0.0012F;
}
if ((item.getTagCompound().getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 2)) {
return 0.0102F;
}
}
}
}
return 0.0F;
}
});
}
@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
item.getTagCompound().setBoolean("hot", false);
item.getTagCompound().setBoolean("emerald", false);
item.getTagCompound().setInteger("diamond", 0);
item.getTagCompound().setInteger("redstone", 0);
item.getTagCompound().setInteger("lapis", 0);
item.getTagCompound().setInteger("modifiers", 0);
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
item.getTagCompound().setBoolean("hot", false);
item.getTagCompound().setBoolean("emerald", false);
item.getTagCompound().setInteger("diamond", 0);
item.getTagCompound().setInteger("redstone", 0);
item.getTagCompound().setInteger("lapis", 0);
item.getTagCompound().setInteger("modifiers", 0);
}
}
}

View File

@@ -1,13 +1,20 @@
package nmd.primal.forgecraft.items.toolparts;
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.Item;
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.forgecraft.ModInfo;
import javax.annotation.Nullable;
/**
* Created by mminaie on 3/9/17.
*/
@@ -18,14 +25,43 @@ public abstract class ToolPart extends Item {
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
/*this.addPropertyOverride(new ResourceLocation("upgrade"), new IItemPropertyGetter()
{
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (entityIn == null)
{
return 0.0F;
}
else
{
return 1.0F;
}
}
});*/
}
public static boolean isHidden()
{
return false;
}
@Override
/*
item.setTagCompound(new NBTTagCompound());
item.getTagCompound().setBoolean("silk_touch", false);
item.getTagCompound().setInteger("durability", 50);
item.getTagCompound().setFloat("speed", 0.0F);
item.getTagCompound().setFloat("fortune", 0.0F);
item.getTagCompound().setInteger("modifiers", 0);
this.setMaxDamage(item.getTagCompound().getInteger("durability"));
*/
/*@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) {
@@ -34,8 +70,8 @@ public abstract class ToolPart extends Item {
item.getTagCompound().setBoolean("silk_touch", false);
item.getTagCompound().setInteger("durability", 50);
item.getTagCompound().setFloat("speed", 1.0F);
item.getTagCompound().setFloat("fortune", 1.0F);
item.getTagCompound().setFloat("speed", 0.0F);
item.getTagCompound().setFloat("fortune", 0.0F);
item.getTagCompound().setInteger("modifiers", 0);
this.setMaxDamage(item.getTagCompound().getInteger("durability"));
}
@@ -48,12 +84,12 @@ public abstract class ToolPart extends Item {
item.setTagCompound(new NBTTagCompound());
item.getTagCompound().setBoolean("silk_touch", false);
item.getTagCompound().setInteger("durability", 50);
item.getTagCompound().setFloat("speed", 1.0F);
item.getTagCompound().setFloat("fortune", 1.0F);
item.getTagCompound().setFloat("speed", 0.0F);
item.getTagCompound().setFloat("fortune", 0.0F);
item.getTagCompound().setInteger("modifiers", 0);
this.setMaxDamage(item.getTagCompound().getInteger("durability"));
}
}
}*/
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

View File

@@ -0,0 +1,14 @@
{
"parent": "item/generated",
"textures": {
"layer0": "forgecraft:items/ironpickaxehead"
},
"overrides": [
{
"predicate": {
"type": 0.0
},
"model": "forgecraft:item/pickaxehead"
}
]
}

View File

@@ -0,0 +1,51 @@
{
"__comment": "Designed by Kitsushadow with Cubik Studio - https://cubik.studio",
"textures": {
"particle": "forgecraft:blocks/iron_ingot",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:blocks/iron_ingot"
},
"elements": [
{
"__comment": "Cube2",
"from": [ 7, 13, 4.5 ],
"to": [ 9, 14, 11.5 ],
"faces": {
"down": { "uv": [ 7, 4.5, 9, 11.5 ], "texture": "#texture1" },
"up": { "uv": [ 7, 4.5, 9, 11.5 ], "texture": "#texture1" },
"north": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"south": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"west": { "uv": [ 4.5, 2, 11.5, 3 ], "texture": "#texture1" },
"east": { "uv": [ 4.5, 2, 11.5, 3 ], "texture": "#texture1" }
}
},
{
"__comment": "Cube5",
"from": [ 7.5, 13, 11 ],
"to": [ 8.5, 14, 14.5 ],
"rotation": { "origin": [ 7.5, 13, 11 ], "axis": "x", "angle": 22.5 },
"faces": {
"down": { "uv": [ 7.5, 1.5, 8.5, 5.5 ], "texture": "#texture1" },
"up": { "uv": [ 7.5, 10.5, 8.5, 14.5 ], "texture": "#texture1" },
"north": { "uv": [ 7.5, 2.5, 8.5, 3 ], "texture": "#texture1" },
"south": { "uv": [ 7.5, 2.5, 8.5, 3 ], "texture": "#texture1" },
"west": { "uv": [ 10.5, 2.5, 14.5, 3 ], "texture": "#texture1" },
"east": { "uv": [ 1.5, 2.5, 5.5, 3 ], "texture": "#texture1" }
}
},
{
"__comment": "Cube5",
"from": [ 7.5, 13, 1.5 ],
"to": [ 8.5, 14, 5 ],
"rotation": { "origin": [ 8.5, 13, 5 ], "axis": "x", "angle": -22.5 },
"faces": {
"down": { "uv": [ 7.5, 1.5, 8.5, 5.5 ], "texture": "#texture1", "rotation": 180 },
"up": { "uv": [ 7.5, 10.5, 8.5, 14.5 ], "texture": "#texture1", "rotation": 180 },
"north": { "uv": [ 7.5, 2.5, 8.5, 3 ], "texture": "#texture1" },
"south": { "uv": [ 7.5, 2.5, 8.5, 3 ], "texture": "#texture1" },
"west": { "uv": [ 1.5, 2.5, 5.5, 3 ], "texture": "#texture1" },
"east": { "uv": [ 10.5, 2.5, 14.5, 3 ], "texture": "#texture1" }
}
}
]
}