pickaxehead model upgraded abstracted resource and NBT code for pickaxe

This commit is contained in:
Mohammad-Ali Minaie
2017-03-14 22:25:35 -04:00
parent 6505c797a0
commit bf73763bee
6 changed files with 328 additions and 80 deletions

View File

@@ -1,25 +1,7 @@
To-Dos To-Dos
{
"parent": "forgecraft:item/pickaxehead",
"textures": {
"particle": "forgecraft:items/iron_ingot",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:items/iron_ingot_emerald1_diamond1"
}
}
ironpickaxehead_1
*** Priority *** *** Priority ***
- [ ] Create all the textures for all the NBT types
- [ ] Create the axe Model - [ ] Create the axe Model
- [ ] Create the shovel model - [ ] Create the shovel model
- [ ] Create the hoe model - [ ] Create the hoe model
@@ -50,6 +32,7 @@ ironpickaxehead_1
*** Completed *** *** Completed ***
- [x] Create all the textures for all the NBT types
- [x] Check for if the pickaxe head is hot before removing from forge - [x] Check for if the pickaxe head is hot before removing from forge
- [x] fix rotation rendering for Anvil - [x] fix rotation rendering for Anvil
- [x] Fix renderings in the Anvil - [x] Fix renderings in the Anvil

View File

@@ -30,7 +30,7 @@ public class PickaxePart extends ToolPart {
public PickaxePart(String name) { public PickaxePart(String name) {
super(name); super(name);
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() /*this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
{ {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
@@ -201,11 +201,11 @@ public class PickaxePart extends ToolPart {
} }
return 0.0F; return 0.0F;
} }
}); });*/
} }
@Override /*@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) { public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) { if (!item.hasTagCompound()) {
@@ -249,8 +249,11 @@ public class PickaxePart extends ToolPart {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced) public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{ {
tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags")); tooltip.add(ChatFormatting.BLACK + "Upgrades");
//tooltip.add(ChatFormatting.RED + "Consumes sticks"); tooltip.add(ChatFormatting.DARK_GREEN + "Emerald: " + item.getSubCompound("tags").getBoolean("emerald"));
} tooltip.add(ChatFormatting.AQUA + "Diamond: " + item.getSubCompound("tags").getInteger("diamond"));
tooltip.add(ChatFormatting.RED + "Redstone: " + item.getSubCompound("tags").getInteger("redstone"));
tooltip.add(ChatFormatting.BLUE + "Lapis: " + item.getSubCompound("tags").getInteger("lapis"));
}*/
} }

View File

@@ -1,5 +1,6 @@
package nmd.primal.forgecraft.items.toolparts; package nmd.primal.forgecraft.items.toolparts;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -14,6 +15,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List;
/** /**
* Created by mminaie on 3/9/17. * Created by mminaie on 3/9/17.
@@ -26,21 +28,178 @@ public abstract class ToolPart extends Item {
this.setCreativeTab(ModInfo.TAB_FORGECRAFT); this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1); this.setMaxStackSize(1);
/*this.addPropertyOverride(new ResourceLocation("upgrade"), new IItemPropertyGetter() this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
{ {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{ {
if (entityIn == null) if (item.hasTagCompound()) {
{
return 0.0F;
} if (item.getSubCompound("tags").getBoolean("hot") == false) {
else if (item.getSubCompound("tags").getInteger("modifiers") != 0) {
{ if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
return 1.0F; (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.1F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.11F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(item.getSubCompound("tags").getInteger("diamond") == 2) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.12F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.111F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 2) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.102F;
}
// ============
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.01F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 2) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.02F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 3) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.03F;
}
//=======
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.001F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 2) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.002F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 3) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.003F;
}
//=========
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 1)) {
return 0.0001F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 2)) {
return 0.0002F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 3)) {
return 0.0003F;
}
//=======
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getSubCompound("tags").getInteger("lapis") == 1)) {
return 0.0111F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 2) &&
(item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.021F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 2) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.012F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getSubCompound("tags").getInteger("lapis") == 2)) {
return 0.0012F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 2) &&
(item.getSubCompound("tags").getInteger("lapis") == 1)) {
return 0.0021F;
}
if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 2)) {
return 0.0102F;
}
}
}
if (item.getSubCompound("tags").getBoolean("hot") == true) {
return 1.0F;
}
if (item.getSubCompound("tags").getBoolean("hot") == false) {
if (item.getSubCompound("tags").getInteger("modifiers") == 0) {
return 0.0F;
}
}
} }
return 0.0F;
} }
});*/ });
} }
@@ -51,29 +210,23 @@ public abstract class ToolPart extends Item {
return false; 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) { public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) { if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound()); item.setTagCompound(new NBTTagCompound());
//this.setDamage(item, 1000); NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setBoolean("silk_touch", false); item.getTagCompound().setTag("tags", tags);
item.getTagCompound().setInteger("durability", 50);
item.getTagCompound().setFloat("speed", 0.0F); item.getSubCompound("tags").setBoolean("hot", false);
item.getTagCompound().setFloat("fortune", 0.0F);
item.getTagCompound().setInteger("modifiers", 0); item.getSubCompound("tags").setBoolean("emerald", false);
this.setMaxDamage(item.getTagCompound().getInteger("durability")); item.getSubCompound("tags").setInteger("diamond", 0);
item.getSubCompound("tags").setInteger("redstone", 0);
item.getSubCompound("tags").setInteger("lapis", 0);
item.getSubCompound("tags").setInteger("modifiers", 0);
} }
} }
@@ -82,14 +235,41 @@ public abstract class ToolPart extends Item {
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) { public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) { if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound()); item.setTagCompound(new NBTTagCompound());
item.getTagCompound().setBoolean("silk_touch", false); NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setInteger("durability", 50);
item.getTagCompound().setFloat("speed", 0.0F); item.getTagCompound().setTag("tags", tags);
item.getTagCompound().setFloat("fortune", 0.0F);
item.getTagCompound().setInteger("modifiers", 0); item.getSubCompound("tags").setBoolean("hot", false);
this.setMaxDamage(item.getTagCompound().getInteger("durability"));
item.getSubCompound("tags").setBoolean("emerald", false);
item.getSubCompound("tags").setInteger("diamond", 0);
item.getSubCompound("tags").setInteger("redstone", 0);
item.getSubCompound("tags").setInteger("lapis", 0);
item.getSubCompound("tags").setInteger("modifiers", 0);
} }
}*/ }
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
tooltip.add(ChatFormatting.BLACK + "Upgrades");
if(item.getSubCompound("tags").getBoolean("emerald") == true){
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if(item.getSubCompound("tags").getInteger("diamond") > 0){
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + item.getSubCompound("tags").getInteger("diamond"));
}
if(item.getSubCompound("tags").getInteger("redstone") > 0){
tooltip.add(ChatFormatting.RED + "Redstone Level: " + item.getSubCompound("tags").getInteger("redstone"));
}
if(item.getSubCompound("tags").getInteger("lapis") > 0){
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + item.getSubCompound("tags").getInteger("lapis"));
}
}
} }

View File

@@ -15,7 +15,11 @@ public abstract class CustomTool extends Item {
this.setCreativeTab(ModInfo.TAB_FORGECRAFT); this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1); this.setMaxStackSize(1);
this.setNoRepair(); this.setNoRepair();
} }
@Override @Override
public boolean isRepairable() public boolean isRepairable()
{ {

View File

@@ -7,16 +7,55 @@
}, },
"elements": [ "elements": [
{ {
"__comment": "Cube2", "__comment": "Cube4",
"from": [ 7, 13, 4.5 ], "from": [ 7, 13, 4.5 ],
"to": [ 9, 14, 11.5 ], "to": [ 9, 14, 7 ],
"faces": { "faces": {
"down": { "uv": [ 7, 4.5, 9, 11.5 ], "texture": "#texture1" }, "down": { "uv": [ 7, 9, 9, 11.5 ], "texture": "#texture1" },
"up": { "uv": [ 7, 4.5, 9, 11.5 ], "texture": "#texture1" }, "up": { "uv": [ 7, 4.5, 9, 7 ], "texture": "#texture1" },
"north": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" }, "north": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"south": { "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" }, "west": { "uv": [ 4.5, 2, 7, 3 ], "texture": "#texture1" },
"east": { "uv": [ 4.5, 2, 11.5, 3 ], "texture": "#texture1" } "east": { "uv": [ 9, 2, 11.5, 3 ], "texture": "#texture1" }
}
},
{
"__comment": "Cube4",
"from": [ 7, 13, 9 ],
"to": [ 9, 14, 11.5 ],
"faces": {
"down": { "uv": [ 7, 9, 9, 11.5 ], "texture": "#texture1" },
"up": { "uv": [ 7, 4.5, 9, 7 ], "texture": "#texture1" },
"north": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"south": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"west": { "uv": [ 4.5, 2, 7, 3 ], "texture": "#texture1" },
"east": { "uv": [ 9, 2, 11.5, 3 ], "texture": "#texture1" }
}
},
{
"__comment": "Cube6",
"from": [ 7, 13, 7 ],
"to": [ 7.5, 14, 9 ],
"faces": {
"down": { "uv": [ 7, 7, 7.5, 9 ], "texture": "#texture1" },
"up": { "uv": [ 7, 7, 7.5, 9 ], "texture": "#texture1" },
"north": { "uv": [ 8.5, 2, 9, 3 ], "texture": "#texture1" },
"south": { "uv": [ 7, 2, 7.5, 3 ], "texture": "#texture1" },
"west": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"east": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" }
}
},
{
"__comment": "Cube7",
"from": [ 8.5, 13, 7 ],
"to": [ 9, 14, 9 ],
"faces": {
"down": { "uv": [ 8.5, 7, 9, 9 ], "texture": "#texture1" },
"up": { "uv": [ 8.5, 7, 9, 9 ], "texture": "#texture1" },
"north": { "uv": [ 7, 2, 7.5, 3 ], "texture": "#texture1" },
"south": { "uv": [ 8.5, 2, 9, 3 ], "texture": "#texture1" },
"west": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"east": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" }
} }
}, },
{ {

View File

@@ -1,24 +1,11 @@
{ {
"__comment": "Designed by Kitsushadow with Cubik Studio - https://cubik.studio", "__comment": "Designed by Kitsushadow with Cubik Studio - https://cubik.studio",
"textures": { "textures": {
"particle": "blocks/iron_ingot", "particle": "items/iron_ingot",
"texture": "blocks/planks_oak", "texture": "blocks/planks_oak",
"texture1": "blocks/iron_ingot" "texture1": "items/iron_ingot"
}, },
"elements": [ "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", "__comment": "Cube5",
"from": [ 7.5, 13, 11 ], "from": [ 7.5, 13, 11 ],
@@ -46,6 +33,58 @@
"west": { "uv": [ 1.5, 2.5, 5.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" } "east": { "uv": [ 10.5, 2.5, 14.5, 3 ], "texture": "#texture1" }
} }
},
{
"__comment": "Cube4",
"from": [ 7, 13, 4.5 ],
"to": [ 9, 14, 7 ],
"faces": {
"down": { "uv": [ 7, 9, 9, 11.5 ], "texture": "#texture1" },
"up": { "uv": [ 7, 4.5, 9, 7 ], "texture": "#texture1" },
"north": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"south": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"west": { "uv": [ 4.5, 2, 7, 3 ], "texture": "#texture1" },
"east": { "uv": [ 9, 2, 11.5, 3 ], "texture": "#texture1" }
}
},
{
"__comment": "Cube4",
"from": [ 7, 13, 9 ],
"to": [ 9, 14, 11.5 ],
"faces": {
"down": { "uv": [ 7, 9, 9, 11.5 ], "texture": "#texture1" },
"up": { "uv": [ 7, 4.5, 9, 7 ], "texture": "#texture1" },
"north": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"south": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"west": { "uv": [ 4.5, 2, 7, 3 ], "texture": "#texture1" },
"east": { "uv": [ 9, 2, 11.5, 3 ], "texture": "#texture1" }
}
},
{
"__comment": "Cube6",
"from": [ 7, 13, 7 ],
"to": [ 7.5, 14, 9 ],
"faces": {
"down": { "uv": [ 7, 7, 7.5, 9 ], "texture": "#texture1" },
"up": { "uv": [ 7, 7, 7.5, 9 ], "texture": "#texture1" },
"north": { "uv": [ 8.5, 2, 9, 3 ], "texture": "#texture1" },
"south": { "uv": [ 7, 2, 7.5, 3 ], "texture": "#texture1" },
"west": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"east": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" }
}
},
{
"__comment": "Cube7",
"from": [ 8.5, 13, 7 ],
"to": [ 9, 14, 9 ],
"faces": {
"down": { "uv": [ 8.5, 7, 9, 9 ], "texture": "#texture1" },
"up": { "uv": [ 8.5, 7, 9, 9 ], "texture": "#texture1" },
"north": { "uv": [ 7, 2, 7.5, 3 ], "texture": "#texture1" },
"south": { "uv": [ 8.5, 2, 9, 3 ], "texture": "#texture1" },
"west": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" },
"east": { "uv": [ 7, 2, 9, 3 ], "texture": "#texture1" }
}
} }
], ],
"display": { "display": {