look at to-do

This commit is contained in:
Mohammad-Ali Minaie
2017-03-15 00:42:48 -04:00
parent bf73763bee
commit 5e6c6de3b6
10 changed files with 888 additions and 249 deletions

View File

@@ -1,7 +1,8 @@
To-Dos
*** Priority ***
- [ ] Create a Harvest Drops event
- [ ] Create getter and setter for itemNBT
- [ ] Create the axe Model
- [ ] Create the shovel model
- [ ] Create the hoe model

View File

@@ -1,5 +1,6 @@
package nmd.primal.forgecraft.init;
import javafx.scene.paint.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelBakery;
@@ -25,6 +26,8 @@ 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;
import nmd.primal.forgecraft.items.toolparts.ToolPart;
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
/**
* Created by kitsu on 11/26/2016.
@@ -41,6 +44,9 @@ public class ModItems {
public static Item pickaxehead;
public static Item ironpickaxe;
//public static Item forgingmanual;
public static void init() {
@@ -48,13 +54,17 @@ public class ModItems {
pistonbellows = new ItemBellowsHandle();
softcrucible = new ItemSoftCrucible();
stonetongs = new ItemStoneTongs("stonetongs");
pickaxehead = new ToolPart("ironpickaxehead");
pickaxehead = new PickaxePart("ironpickaxehead");
ironpickaxe = new CustomPickaxe("ironpickaxe", Item.ToolMaterial.IRON);
//ironingotballcool = new BaseMultiItem("ironingotcool") {};
//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) {
@@ -100,6 +110,7 @@ public class ModItems {
//GameRegistry.register(test);
GameRegistry.register(pickaxehead);
GameRegistry.register(ironpickaxe);
//GameRegistry.register(forgingmanual);
}
@@ -113,6 +124,8 @@ public class ModItems {
registerRender(ironchunkhot);
//registerRender(test);
registerRender(pickaxehead);
registerRender(ironpickaxe);
//registerRender(forgingmanual);
}

View File

@@ -20,240 +20,10 @@ import java.util.List;
*/
public class PickaxePart extends ToolPart {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
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.getSubCompound("tags").getBoolean("hot") == false) {
if (item.getSubCompound("tags").getInteger("modifiers") != 0) {
if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(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;
}
});*/
}
/*@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
item.getSubCompound("tags").setBoolean("hot", false);
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
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
item.getSubCompound("tags").setBoolean("hot", false);
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");
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,6 +1,7 @@
package nmd.primal.forgecraft.items.toolparts;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.enchantment.EnchantmentDigging;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -20,7 +21,7 @@ import java.util.List;
/**
* Created by mminaie on 3/9/17.
*/
public abstract class ToolPart extends Item {
public class ToolPart extends Item {
public ToolPart(String name) {
this.setUnlocalizedName(name);
@@ -30,6 +31,14 @@ public abstract class ToolPart extends Item {
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
{
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
@@ -248,25 +257,32 @@ public abstract class ToolPart extends Item {
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){
if(player.getEntityWorld().isRemote) {
if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades");
if (item.getSubCompound("tags").getBoolean("emerald") == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if(item.getSubCompound("tags").getInteger("diamond") > 0){
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){
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){
if (item.getSubCompound("tags").getInteger("lapis") > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + item.getSubCompound("tags").getInteger("lapis"));
}
}
}
}

View File

@@ -0,0 +1,337 @@
package nmd.primal.forgecraft.items.tools;
import com.google.common.collect.Sets;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentDigging;
import net.minecraft.enchantment.EnchantmentUntouching;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
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;
import java.util.List;
import java.util.Set;
/**
* Created by mminaie on 3/14/17.
*/
public class CustomPickaxe extends ItemPickaxe{
public CustomPickaxe(String name, Item.ToolMaterial material) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (item.hasTagCompound()) {
/*if (item.getSubCompound("tags").getBoolean("hot") == false) {
if (item.getSubCompound("tags").getInteger("modifiers") != 0) {
if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(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;
}
});
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
{
stack.damageItem(1, entityLiving);
if(stack.getSubCompound("tags").getInteger("lapis") > 0){
state.getBlock().quantityDroppedWithBonus(stack.getSubCompound("tags").getInteger("lapis"), world.rand);
}
}
return true;
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
item.getSubCompound("tags").setBoolean("hot", false);
item.getSubCompound("tags").setBoolean("emerald", false);
item.getSubCompound("tags").setInteger("diamond", 0);
item.getSubCompound("tags").setInteger("redstone", 0);
item.getSubCompound("tags").setInteger("lapis", 3);
item.getSubCompound("tags").setInteger("modifiers", 0);
}
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
item.getSubCompound("tags").setBoolean("hot", false);
item.getSubCompound("tags").setBoolean("emerald", false);
item.getSubCompound("tags").setInteger("diamond", 0);
item.getSubCompound("tags").setInteger("redstone", 0);
item.getSubCompound("tags").setInteger("lapis", 3);
item.getSubCompound("tags").setInteger("modifiers", 0);
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "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"));
}
}
}
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
}

View File

@@ -1,21 +1,290 @@
package nmd.primal.forgecraft.items.tools;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import com.mojang.realmsclient.gui.ChatFormatting;
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.*;
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;
import java.util.List;
import java.util.Set;
/**
* Created by mminaie on 3/9/17.
*/
public abstract class CustomTool extends Item {
public abstract class CustomTool extends ItemTool {
public CustomTool(String name) {
public Item.ToolMaterial material;
private String toolClass;
private final float attackDamage;
public CustomTool(String name, Item.ToolMaterial material, float attack_damage, float attack_speed, Set<Block> effective_on) {
super(attack_damage, attack_speed, material, effective_on);
this.attackDamage = 2.0F + material.getDamageVsEntity();
this.material = material;
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
{
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (item.getSubCompound("tags").getBoolean("hot") == false) {
if (item.getSubCompound("tags").getInteger("modifiers") != 0) {
if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(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;
}
});
}
public static boolean isHidden()
{
return false;
}
@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
item.getSubCompound("tags").setBoolean("hot", false);
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
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
item.getTagCompound().setTag("tags", tags);
item.getSubCompound("tags").setBoolean("hot", false);
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)
{
if(player.getEntityWorld().isRemote) {
tooltip.add(ChatFormatting.GRAY + "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

@@ -0,0 +1,33 @@
{
"parent": "forgecraft:item/pickaxe",
"textures": {
"particle": "forgecraft:items/iron_ingot",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:items/iron_ingot"
},
"overrides": [
{"predicate": {"type": 0.0},"model": "forgecraft:item/ironpickaxe_0"},
{"predicate": {"type": 0.0001},"model": "forgecraft:item/ironpickaxehead_13"},
{"predicate": {"type": 0.0002},"model": "forgecraft:item/ironpickaxehead_14"},
{"predicate": {"type": 0.0003},"model": "forgecraft:item/ironpickaxehead_15"},
{"predicate": {"type": 0.001},"model": "forgecraft:item/ironpickaxehead_10"},
{"predicate": {"type": 0.0012},"model": "forgecraft:item/ironpickaxehead_19"},
{"predicate": {"type": 0.002},"model": "forgecraft:item/ironpickaxehead_11"},
{"predicate": {"type": 0.0021},"model": "forgecraft:item/ironpickaxehead_20"},
{"predicate": {"type": 0.003},"model": "forgecraft:item/ironpickaxehead_12"},
{"predicate": {"type": 0.01},"model": "forgecraft:item/ironpickaxehead_7"},
{"predicate": {"type": 0.0102},"model": "forgecraft:item/ironpickaxehead_21"},
{"predicate": {"type": 0.0111},"model": "forgecraft:item/ironpickaxehead_16"},
{"predicate": {"type": 0.012},"model": "forgecraft:item/ironpickaxehead_18"},
{"predicate": {"type": 0.02},"model": "forgecraft:item/ironpickaxehead_8"},
{"predicate": {"type": 0.021},"model": "forgecraft:item/ironpickaxehead_17"},
{"predicate": {"type": 0.03},"model": "forgecraft:item/ironpickaxehead_9"},
{"predicate": {"type": 0.1},"model": "forgecraft:item/ironpickaxehead_2"},
{"predicate": {"type": 0.102},"model": "forgecraft:item/ironpickaxehead_6"},
{"predicate": {"type": 0.11},"model": "forgecraft:item/ironpickaxehead_3"},
{"predicate": {"type": 0.111},"model": "forgecraft:item/ironpickaxehead_5"},
{"predicate": {"type": 0.12},"model": "forgecraft:item/ironpickaxehead_4"},
{"predicate": {"type": 1.0},"model": "forgecraft:item/ironpickaxehead_1"}
]
}

View File

@@ -0,0 +1,8 @@
{
"parent": "forgecraft:item/pickaxe",
"textures": {
"particle": "forgecraft:items/iron_ingot",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:items/iron_ingot"
}
}

View File

@@ -0,0 +1,96 @@
{
"__comment": "Designed by Kitsushadow with Cubik Studio - https://cubik.studio",
"textures": {
"particle": "forgecraft:items/iron_ingot",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:items/iron_ingot"
},
"elements": [
{
"__comment": "Cube1",
"from": [ 7.5, 0, 7 ],
"to": [ 8.5, 13, 9 ],
"faces": {
"down": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
"up": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
"north": { "uv": [ 7.5, 3, 8.5, 16 ], "texture": "#texture" },
"south": { "uv": [ 7.5, 3, 8.5, 16 ], "texture": "#texture" },
"west": { "uv": [ 7, 3, 9, 16 ], "texture": "#texture" },
"east": { "uv": [ 7, 3, 9, 16 ], "texture": "#texture" }
}
},
{
"__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": "Cube3",
"from": [ 7.5, 14, 7 ],
"to": [ 8.5, 14.5, 9 ],
"faces": {
"down": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
"up": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
"north": { "uv": [ 7.5, 1.5, 8.5, 2 ], "texture": "#texture" },
"south": { "uv": [ 7.5, 1.5, 8.5, 2 ], "texture": "#texture" },
"west": { "uv": [ 7, 1.5, 9, 2 ], "texture": "#texture" },
"east": { "uv": [ 7, 1.5, 9, 2 ], "texture": "#texture" }
}
},
{
"__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" }
}
}
],
"display": {
"thirdperson_righthand": {
"translation": [ 0, 6.25, 1.5 ]
},
"firstperson_righthand": {
"translation": [ 0, 6.25, 1.5 ]
},
"gui": {
"rotation": [ 90, 45, -90 ],
"translation": [ -0.75, -0.75, 0 ]
},
"ground": {
"rotation": [ 0, 0, 90 ],
"translation": [ 0, -3, 0 ]
},
"fixed": {
"rotation": [ 0, 90, 0 ]
}
}
}

View File

@@ -0,0 +1,96 @@
{
"__comment": "Designed by Kitsushadow with Cubik Studio - https://cubik.studio",
"textures": {
"particle": "items/iron_ingot",
"texture": "blocks/planks_oak",
"texture1": "items/iron_ingot"
},
"elements": [
{
"__comment": "Cube1",
"from": [ 7.5, 0, 7 ],
"to": [ 8.5, 13, 9 ],
"faces": {
"down": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
"up": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
"north": { "uv": [ 7.5, 3, 8.5, 16 ], "texture": "#texture" },
"south": { "uv": [ 7.5, 3, 8.5, 16 ], "texture": "#texture" },
"west": { "uv": [ 7, 3, 9, 16 ], "texture": "#texture" },
"east": { "uv": [ 7, 3, 9, 16 ], "texture": "#texture" }
}
},
{
"__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": "Cube3",
"from": [ 7.5, 14, 7 ],
"to": [ 8.5, 14.5, 9 ],
"faces": {
"down": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
"up": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
"north": { "uv": [ 7.5, 1.5, 8.5, 2 ], "texture": "#texture" },
"south": { "uv": [ 7.5, 1.5, 8.5, 2 ], "texture": "#texture" },
"west": { "uv": [ 7, 1.5, 9, 2 ], "texture": "#texture" },
"east": { "uv": [ 7, 1.5, 9, 2 ], "texture": "#texture" }
}
},
{
"__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" }
}
}
],
"display": {
"thirdperson_righthand": {
"translation": [ 0, 6.25, 1.5 ]
},
"firstperson_righthand": {
"translation": [ 0, 6.25, 1.5 ]
},
"gui": {
"rotation": [ 90, 45, -90 ],
"translation": [ -0.75, -0.75, 0 ]
},
"ground": {
"rotation": [ 0, 0, 90 ],
"translation": [ 0, -3, 0 ]
},
"fixed": {
"rotation": [ 0, 90, 0 ]
}
}
}