figured out process for adding and removing enchants need to clean up the section

This commit is contained in:
Mohammad-Ali Minaie
2017-03-15 23:13:12 -04:00
parent 5e6c6de3b6
commit 40a36461f5
9 changed files with 384 additions and 155 deletions

View File

@@ -2,7 +2,7 @@ To-Dos
*** Priority *** *** Priority ***
- [ ] Create a Harvest Drops event - [ ] Create a Harvest Drops event
- [ ] Create getter and setter for itemNBT
- [ ] Create the axe Model - [ ] Create the axe Model
- [ ] Create the shovel model - [ ] Create the shovel model
- [ ] Create the hoe model - [ ] Create the hoe model
@@ -10,7 +10,7 @@ To-Dos
- [ ] Create Crafting Block for Tools and Weapons - [ ] Create Crafting Block for Tools and Weapons
- [ ] Create PickAxe Tool which ingests NBT - [ ] Create PickAxe Tool which ingests NBT
- [ ] Copy Heat Handler for Forge to Bloomery
*** Backlog *** *** Backlog ***
- [ ] Create a method which adds the types of NBT upgrades and creates a unique float instead of using magic numbers - [ ] Create a method which adds the types of NBT upgrades and creates a unique float instead of using magic numbers
@@ -18,8 +18,6 @@ To-Dos
- [ ] Finish Toolhead Recipes - [ ] Finish Toolhead Recipes
- [ ] WeaponHead recipes - [ ] WeaponHead recipes
- [ ] Stone Anvil Bounding Box
- [ ] Casting Table - [ ] Casting Table
- [ ] Block - [ ] Block
- [ ] Gui - [ ] Gui
@@ -33,6 +31,7 @@ To-Dos
*** Completed *** *** Completed ***
- [x] Create getter and setter for itemNBT
- [x] Create all the textures for all the NBT types - [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

View File

@@ -0,0 +1,41 @@
package nmd.primal.forgecraft;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
import java.util.List;
/**
* Created by mminaie on 3/15/17.
*/
public class ClientEvents {
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority= EventPriority.LOWEST, receiveCanceled=true)
public void toolTipOverride(ItemTooltipEvent event) {
Entity entity = event.getEntity();
if (entity instanceof EntityPlayer)
{
ItemStack held_stack = ((EntityPlayer) entity).getActiveItemStack();
if(held_stack.getItem() instanceof CustomPickaxe){
event.getToolTip().clear();
if(entity.getEntityWorld().isRemote) {
event.setCanceled(true);
}
}
}
}
}

View File

@@ -0,0 +1,78 @@
package nmd.primal.forgecraft;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import nmd.primal.core.api.PrimalBlocks;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.core.api.PrimalRegistries;
import nmd.primal.core.common.init.ModConfig;
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
/**
* Created by mminaie on 3/15/17.
*/
public class CommonEvents {
/*******************************************************************************
* Block Harvesting
* leaf stick drops, plant fiber drops, extra flint and rock drops, stone harvesting
*/
@SubscribeEvent(priority= EventPriority.LOWEST, receiveCanceled=true)
public void onBlockHarvest(BlockEvent.HarvestDropsEvent event)
{
World world = event.getWorld();
EntityPlayer player = event.getHarvester();
if (!world.isRemote && player!=null) //&& !event.isSilkTouching()
{
BlockPos pos = event.getPos();
IBlockState state = event.getState();
Block block = state.getBlock();
Material material = state.getBlock().getMaterial(state);
ItemStack event_stack = new ItemStack(block, 1, block.getMetaFromState(state));
ItemStack held_stack = player.getHeldItemMainhand();
//System.out.println(event.getDrops());
System.out.println(event.getFortuneLevel());
if(held_stack.getItem() instanceof CustomPickaxe){
if(((CustomPickaxe) held_stack.getItem()).getLapisLevel(held_stack) > 0){
//held_stack.addEnchantment(Enchantment.getEnchantmentByID(35), ((CustomPickaxe) held_stack.getItem()).getLapisLevel(held_stack));
}
if( ((CustomPickaxe) held_stack.getItem()).getEmerald(held_stack) == true) {
}
}
if (!event.isSilkTouching()) {
// ***************************************************************************** //
// Extra Rock/Flint Drop
// ***************************************************************************** //
}
}
}
}

View File

@@ -9,6 +9,7 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import nmd.primal.forgecraft.init.ModEvents;
import nmd.primal.forgecraft.compat.ModDictionary; import nmd.primal.forgecraft.compat.ModDictionary;
import nmd.primal.forgecraft.gui.GuiHandler; import nmd.primal.forgecraft.gui.GuiHandler;
import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModBlocks;
@@ -49,6 +50,9 @@ public class ForgeCraft
ModItems.register(); ModItems.register();
ModTiles.registerTileEntities(); ModTiles.registerTileEntities();
ModEvents.registerCommonEvents();
ModEvents.registerClientEvents();
// ModItems.registerRenders(); // ModItems.registerRenders();
proxy.preInit(); proxy.preInit();
} }

View File

@@ -0,0 +1,28 @@
package nmd.primal.forgecraft.init;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.PrimalCore;
import nmd.primal.core.common.init.ModConfig;
import nmd.primal.forgecraft.ClientEvents;
import nmd.primal.forgecraft.CommonEvents;
/**
* Created by mminaie on 3/15/17.
*/
public class ModEvents {
public static void registerCommonEvents()
{
MinecraftForge.EVENT_BUS.register(new CommonEvents());
}
@SideOnly(Side.CLIENT)
public static void registerClientEvents() {
//MinecraftForge.EVENT_BUS.register(new ClientEvents());
}
}

View File

@@ -44,163 +44,162 @@ public class ToolPart extends Item {
{ {
if (item.hasTagCompound()) { if (item.hasTagCompound()) {
if (getHot(item) == false) {
if (item.getSubCompound("tags").getBoolean("hot") == false) { if (getModifiers(item) != 0) {
if (item.getSubCompound("tags").getInteger("modifiers") != 0) { if ( (getEmerald(item) == true) &&
if ((item.getSubCompound("tags").getBoolean("emerald") == true) && (getDiamondLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) && (getRedstoneLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) && (getLapisLevel(item) == 0)) {
(item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.1F; return 0.1F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == true) && if ( (getEmerald(item) == true) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) && (getDiamondLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) && (getRedstoneLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.11F; return 0.11F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == true) && if ( (getEmerald(item) == true) &&
(item.getSubCompound("tags").getInteger("diamond") == 2) && (getDiamondLevel(item) == 2) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) && (getRedstoneLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.12F; return 0.12F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == true) && if ( (getEmerald(item) == true) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) && (getDiamondLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 1) && (getRedstoneLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.111F; return 0.111F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == true) && if ( (getEmerald(item) == true) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) && (getDiamondLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 2) && (getRedstoneLevel(item) == 2) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.102F; return 0.102F;
} }
// ============ // ============
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) && (getDiamondLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) && (getRedstoneLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.01F; return 0.01F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 2) && (getDiamondLevel(item) == 2) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) && (getRedstoneLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.02F; return 0.02F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 3) && (getDiamondLevel(item) == 3) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) && (getRedstoneLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.03F; return 0.03F;
} }
//======= //=======
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) && (getDiamondLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 1) && (getRedstoneLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.001F; return 0.001F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) && (getDiamondLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 2) && (getRedstoneLevel(item) == 2) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.002F; return 0.002F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) && (getDiamondLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 3) && (getRedstoneLevel(item) == 3) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.003F; return 0.003F;
} }
//========= //=========
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) && (getDiamondLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) && (getRedstoneLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 1)) { (getLapisLevel(item) == 1)) {
return 0.0001F; return 0.0001F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) && (getDiamondLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) && (getRedstoneLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 2)) { (getLapisLevel(item) == 2)) {
return 0.0002F; return 0.0002F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) && (getDiamondLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) && (getRedstoneLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 3)) { (getLapisLevel(item) == 3)) {
return 0.0003F; return 0.0003F;
} }
//======= //=======
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) && (getDiamondLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 1) && (getRedstoneLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("lapis") == 1)) { (getLapisLevel(item) == 1)) {
return 0.0111F; return 0.0111F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 2) && (getDiamondLevel(item) == 2) &&
(item.getSubCompound("tags").getInteger("redstone") == 1) && (getRedstoneLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.021F; return 0.021F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) && (getDiamondLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 2) && (getRedstoneLevel(item) == 2) &&
(item.getSubCompound("tags").getInteger("lapis") == 0)) { (getLapisLevel(item) == 0)) {
return 0.012F; return 0.012F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) && (getDiamondLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 1) && (getRedstoneLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("lapis") == 2)) { (getLapisLevel(item) == 2)) {
return 0.0012F; return 0.0012F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 0) && (getDiamondLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("redstone") == 2) && (getRedstoneLevel(item) == 2) &&
(item.getSubCompound("tags").getInteger("lapis") == 1)) { (getLapisLevel(item) == 1)) {
return 0.0021F; return 0.0021F;
} }
if ((item.getSubCompound("tags").getBoolean("emerald") == false) && if ( (getEmerald(item) == false) &&
(item.getSubCompound("tags").getInteger("diamond") == 1) && (getDiamondLevel(item) == 1) &&
(item.getSubCompound("tags").getInteger("redstone") == 0) && (getRedstoneLevel(item) == 0) &&
(item.getSubCompound("tags").getInteger("lapis") == 2)) { (getLapisLevel(item) == 2) ) {
return 0.0102F; return 0.0102F;
} }
} }
} }
if (item.getSubCompound("tags").getBoolean("hot") == true) { if (getHot(item) == true) {
return 1.0F; return 1.0F;
} }
if (item.getSubCompound("tags").getBoolean("hot") == false) { if (getHot(item) == false) {
if (item.getSubCompound("tags").getInteger("modifiers") == 0) { if (item.getSubCompound("tags").getInteger("modifiers") == 0) {
return 0.0F; return 0.0F;
} }
@@ -212,6 +211,53 @@ public class ToolPart extends Item {
} }
public boolean getHot(ItemStack stack){
return stack.getSubCompound("tags").getBoolean("hot");
}
public void setHot(ItemStack stack, Boolean bool){
stack.getSubCompound("tags").setBoolean("hot", bool);
}
public int getModifiers(ItemStack stack) {
return stack.getSubCompound("tags").getInteger("modifiers");
}
public void setModifiers(ItemStack stack, Integer mods){
stack.getSubCompound("tags").setInteger("modifiers", mods);
}
public boolean getEmerald(ItemStack stack){
return stack.getSubCompound("tags").getBoolean("emerald");
}
public void setEmerald(ItemStack stack, Boolean bool){
stack.getSubCompound("keys").setBoolean("emerald", bool);
}
public int getDiamondLevel(ItemStack stack) {
return stack.getSubCompound("tags").getInteger("diamond");
}
public void setDiamondLevel(ItemStack stack, Integer level){
stack.getSubCompound("tags").setInteger("diamond", level);
}
public int getRedstoneLevel(ItemStack stack) {
return stack.getSubCompound("tags").getInteger("redstone");
}
public void setRedstoneLevel(ItemStack stack, Integer level){
stack.getSubCompound("tags").setInteger("redstone", level);
}
public int getLapisLevel(ItemStack stack) {
return stack.getSubCompound("tags").getInteger("lapis");
}
public void setLapisLevel(ItemStack stack, Integer level){
stack.getSubCompound("tags").setInteger("lapis", level);
}
public NBTTagCompound getTags(ItemStack stack){
return stack.getSubCompound("tags");
}
public static boolean isHidden() public static boolean isHidden()
@@ -269,23 +315,23 @@ public class ToolPart extends Item {
if(item.hasTagCompound()) { if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades"); tooltip.add(ChatFormatting.GRAY + "Upgrades");
if (item.getSubCompound("tags").getBoolean("emerald") == true) { if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald"); tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
} }
if (item.getSubCompound("tags").getInteger("diamond") > 0) { if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + item.getSubCompound("tags").getInteger("diamond")); tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
} }
if (item.getSubCompound("tags").getInteger("redstone") > 0) { if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + item.getSubCompound("tags").getInteger("redstone")); tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item));
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item));
} }
if (item.getSubCompound("tags").getInteger("lapis") > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + item.getSubCompound("tags").getInteger("lapis"));
} }
} }
} }
}
} }

View File

@@ -17,6 +17,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -221,31 +222,23 @@ public class CustomPickaxe extends ItemPickaxe{
}); });
} }
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{ public boolean getHot(ItemStack stack){
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D) return stack.getSubCompound("tags").getBoolean("hot");
{
stack.damageItem(1, entityLiving);
if(stack.getSubCompound("tags").getInteger("lapis") > 0){
state.getBlock().quantityDroppedWithBonus(stack.getSubCompound("tags").getInteger("lapis"), world.rand);
} }
public boolean getEmerald(ItemStack stack){
return stack.getSubCompound("tags").getBoolean("emerald");
} }
public int getDiamondLevel(ItemStack stack) {
return true; return stack.getSubCompound("tags").getInteger("diamond");
}
public int getRedstoneLevel(ItemStack stack) {
return stack.getSubCompound("tags").getInteger("redstone");
}
public int getLapisLevel(ItemStack stack) {
return stack.getSubCompound("tags").getInteger("lapis");
} }
public static boolean isHidden() public static boolean isHidden()
{ {
@@ -266,11 +259,10 @@ public class CustomPickaxe extends ItemPickaxe{
item.getSubCompound("tags").setBoolean("emerald", false); item.getSubCompound("tags").setBoolean("emerald", false);
item.getSubCompound("tags").setInteger("diamond", 0); item.getSubCompound("tags").setInteger("diamond", 0);
item.getSubCompound("tags").setInteger("redstone", 0); item.getSubCompound("tags").setInteger("redstone", 0);
item.getSubCompound("tags").setInteger("lapis", 3); item.getSubCompound("tags").setInteger("lapis", 0);
item.getSubCompound("tags").setInteger("modifiers", 0); item.getSubCompound("tags").setInteger("modifiers", 0);
} }
} }
@Override @Override
@@ -289,6 +281,9 @@ public class CustomPickaxe extends ItemPickaxe{
item.getSubCompound("tags").setInteger("lapis", 3); item.getSubCompound("tags").setInteger("lapis", 3);
item.getSubCompound("tags").setInteger("modifiers", 0); item.getSubCompound("tags").setInteger("modifiers", 0);
if(!world.isRemote){
//item.addEnchantment(Enchantment.getEnchantmentByID(35), 3);
}
} }
} }
@@ -300,8 +295,6 @@ public class CustomPickaxe extends ItemPickaxe{
{ {
if(player.getEntityWorld().isRemote) { if(player.getEntityWorld().isRemote) {
if(item.hasTagCompound()) { if(item.hasTagCompound()) {
tooltip.add(ChatFormatting.GRAY + "Upgrades"); tooltip.add(ChatFormatting.GRAY + "Upgrades");
@@ -323,6 +316,44 @@ public class CustomPickaxe extends ItemPickaxe{
} }
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof CustomPickaxe){
if ( ((CustomPickaxe) itemstack.getItem()).getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), ((CustomPickaxe) itemstack.getItem()).getLapisLevel(itemstack));
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
stack.damageItem(1, entityLiving);
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override @Override
public boolean isRepairable() public boolean isRepairable()
{ {

View File

@@ -9,33 +9,33 @@
{ {
"__comment": "Cube1", "__comment": "Cube1",
"from": [ 7.5, 0, 7 ], "from": [ 7.5, 0, 7 ],
"to": [ 8.5, 13, 9 ], "to": [ 8.5, 13, 8.5 ],
"faces": { "faces": {
"down": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" }, "down": { "uv": [ 8, 7, 9, 8.5 ], "texture": "#texture" },
"up": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" }, "up": { "uv": [ 8, 7, 9, 8.5 ], "texture": "#texture" },
"north": { "uv": [ 7.5, 3, 8.5, 16 ], "texture": "#texture" }, "north": { "uv": [ 7.5, 3, 8.5, 16 ], "texture": "#texture" },
"south": { "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" }, "west": { "uv": [ 7, 3, 8.5, 16 ], "texture": "#texture" },
"east": { "uv": [ 7, 3, 9, 16 ], "texture": "#texture" } "east": { "uv": [ 7, 3, 8.5, 16 ], "texture": "#texture" }
} }
}, },
{ {
"__comment": "Cube2", "__comment": "Cube2",
"from": [ 7, 13, 4.5 ], "from": [ 7, 13, 4 ],
"to": [ 9, 14, 11.5 ], "to": [ 9, 14, 11.5 ],
"faces": { "faces": {
"down": { "uv": [ 7, 4.5, 9, 11.5 ], "texture": "#texture1" }, "down": { "uv": [ 7, 4.5, 9, 12 ], "texture": "#texture1" },
"up": { "uv": [ 7, 4.5, 9, 11.5 ], "texture": "#texture1" }, "up": { "uv": [ 7, 4.5, 9, 12 ], "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, 12, 3 ], "texture": "#texture1" },
"east": { "uv": [ 4.5, 2, 11.5, 3 ], "texture": "#texture1" } "east": { "uv": [ 4.5, 2, 12, 3 ], "texture": "#texture1" }
} }
}, },
{ {
"__comment": "Cube3", "__comment": "Cube3",
"from": [ 7.5, 14, 7 ], "from": [ 7.5, 14, 7 ],
"to": [ 8.5, 14.5, 9 ], "to": [ 8.5, 14.5, 8.5 ],
"faces": { "faces": {
"down": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" }, "down": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
"up": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" }, "up": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
@@ -61,9 +61,9 @@
}, },
{ {
"__comment": "Cube5", "__comment": "Cube5",
"from": [ 7.5, 13, 1.5 ], "from": [ 7.5, 13, 1 ],
"to": [ 8.5, 14, 5 ], "to": [ 8.5, 14, 4.5 ],
"rotation": { "origin": [ 8.5, 13, 5 ], "axis": "x", "angle": -22.5 }, "rotation": { "origin": [ 8.5, 13, 4.5 ], "axis": "x", "angle": -22.5 },
"faces": { "faces": {
"down": { "uv": [ 7.5, 1.5, 8.5, 5.5 ], "texture": "#texture1", "rotation": 180 }, "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 }, "up": { "uv": [ 7.5, 10.5, 8.5, 14.5 ], "texture": "#texture1", "rotation": 180 },
@@ -79,7 +79,8 @@
"translation": [ 0, 6.25, 1.5 ] "translation": [ 0, 6.25, 1.5 ]
}, },
"firstperson_righthand": { "firstperson_righthand": {
"translation": [ 0, 6.25, 1.5 ] "translation": [ 0, 6.25, 1.5 ],
"scale": [ 1, 1, 0.5 ]
}, },
"gui": { "gui": {
"rotation": [ 90, 45, -90 ], "rotation": [ 90, 45, -90 ],

View File

@@ -9,33 +9,33 @@
{ {
"__comment": "Cube1", "__comment": "Cube1",
"from": [ 7.5, 0, 7 ], "from": [ 7.5, 0, 7 ],
"to": [ 8.5, 13, 9 ], "to": [ 8.5, 13, 8.5 ],
"faces": { "faces": {
"down": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" }, "down": { "uv": [ 8, 7, 9, 8.5 ], "texture": "#texture" },
"up": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" }, "up": { "uv": [ 8, 7, 9, 8.5 ], "texture": "#texture" },
"north": { "uv": [ 7.5, 3, 8.5, 16 ], "texture": "#texture" }, "north": { "uv": [ 7.5, 3, 8.5, 16 ], "texture": "#texture" },
"south": { "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" }, "west": { "uv": [ 7, 3, 8.5, 16 ], "texture": "#texture" },
"east": { "uv": [ 7, 3, 9, 16 ], "texture": "#texture" } "east": { "uv": [ 7, 3, 8.5, 16 ], "texture": "#texture" }
} }
}, },
{ {
"__comment": "Cube2", "__comment": "Cube2",
"from": [ 7, 13, 4.5 ], "from": [ 7, 13, 4 ],
"to": [ 9, 14, 11.5 ], "to": [ 9, 14, 11.5 ],
"faces": { "faces": {
"down": { "uv": [ 7, 4.5, 9, 11.5 ], "texture": "#texture1" }, "down": { "uv": [ 7, 4.5, 9, 12 ], "texture": "#texture1" },
"up": { "uv": [ 7, 4.5, 9, 11.5 ], "texture": "#texture1" }, "up": { "uv": [ 7, 4.5, 9, 12 ], "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, 12, 3 ], "texture": "#texture1" },
"east": { "uv": [ 4.5, 2, 11.5, 3 ], "texture": "#texture1" } "east": { "uv": [ 4.5, 2, 12, 3 ], "texture": "#texture1" }
} }
}, },
{ {
"__comment": "Cube3", "__comment": "Cube3",
"from": [ 7.5, 14, 7 ], "from": [ 7.5, 14, 7 ],
"to": [ 8.5, 14.5, 9 ], "to": [ 8.5, 14.5, 8.5 ],
"faces": { "faces": {
"down": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" }, "down": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
"up": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" }, "up": { "uv": [ 7.5, 7, 8.5, 9 ], "texture": "#texture" },
@@ -61,9 +61,9 @@
}, },
{ {
"__comment": "Cube5", "__comment": "Cube5",
"from": [ 7.5, 13, 1.5 ], "from": [ 7.5, 13, 1 ],
"to": [ 8.5, 14, 5 ], "to": [ 8.5, 14, 4.5 ],
"rotation": { "origin": [ 8.5, 13, 5 ], "axis": "x", "angle": -22.5 }, "rotation": { "origin": [ 8.5, 13, 4.5 ], "axis": "x", "angle": -22.5 },
"faces": { "faces": {
"down": { "uv": [ 7.5, 1.5, 8.5, 5.5 ], "texture": "#texture1", "rotation": 180 }, "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 }, "up": { "uv": [ 7.5, 10.5, 8.5, 14.5 ], "texture": "#texture1", "rotation": 180 },
@@ -79,7 +79,8 @@
"translation": [ 0, 6.25, 1.5 ] "translation": [ 0, 6.25, 1.5 ]
}, },
"firstperson_righthand": { "firstperson_righthand": {
"translation": [ 0, 6.25, 1.5 ] "translation": [ 0, 6.25, 1.5 ],
"scale": [ 1, 1, 0.5 ]
}, },
"gui": { "gui": {
"rotation": [ 90, 45, -90 ], "rotation": [ 90, 45, -90 ],