fixed epic dup bug and added broken item drops for tools, ur still better off not breaking ur tool
This commit is contained in:
@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx3G
|
|||||||
|
|
||||||
mod_group=nmd.primal.forgecraft
|
mod_group=nmd.primal.forgecraft
|
||||||
mod_name=ForgeCraft
|
mod_name=ForgeCraft
|
||||||
mod_version=1.2.65
|
mod_version=1.2.70
|
||||||
forge_version=13.20.1.2388
|
forge_version=13.20.1.2388
|
||||||
mcp_mappings=snapshot_20170610
|
mcp_mappings=snapshot_20170610
|
||||||
mc_version=1.11.2
|
mc_version=1.11.2
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class ModInfo {
|
|||||||
public static final String MOD_CONFIG = "primal/" + MOD_ID;
|
public static final String MOD_CONFIG = "primal/" + MOD_ID;
|
||||||
//public static final String MOD_PREFIX = MOD_ID + ":";
|
//public static final String MOD_PREFIX = MOD_ID + ":";
|
||||||
public static final String MOD_CHANNEL = MOD_ID;
|
public static final String MOD_CHANNEL = MOD_ID;
|
||||||
public static final String MOD_VERSION = "1.2.65";
|
public static final String MOD_VERSION = "1.2.70";
|
||||||
public static final String MC_VERSIONS = "[1.11.0, 1.12.0)";
|
public static final String MC_VERSIONS = "[1.11.0, 1.12.0)";
|
||||||
public static final String DEPENDENCIES = "required-after:forge@[13.20.1.2388,);" + "required-after:primal@[0.4,);";
|
public static final String DEPENDENCIES = "required-after:forge@[13.20.1.2388,);" + "required-after:primal@[0.4,);";
|
||||||
|
|
||||||
|
|||||||
@@ -169,6 +169,34 @@ public class ModCrafting {
|
|||||||
('E'), PrimalItems.EMERALD_KNAPP,
|
('E'), PrimalItems.EMERALD_KNAPP,
|
||||||
('Y'), ModBlocks.rawbronzecrucible));
|
('Y'), ModBlocks.rawbronzecrucible));
|
||||||
|
|
||||||
|
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.rawbronzecrucible, 1),
|
||||||
|
"T", "Y",
|
||||||
|
('T'), new ItemStack(ModItems.brokenbronzetool, 1),
|
||||||
|
('Y'), new ItemStack(ModBlocks.emptycrucible, 1)
|
||||||
|
));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.rawironcrucible, 1),
|
||||||
|
"T", "Y",
|
||||||
|
('T'), new ItemStack(ModItems.brokenwroughtirontool, 1),
|
||||||
|
('Y'), new ItemStack(ModBlocks.emptycrucible, 1)
|
||||||
|
));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.rawcleanironcrucible, 1),
|
||||||
|
"T", "Y",
|
||||||
|
('T'), new ItemStack(ModItems.brokencleanirontool, 1),
|
||||||
|
('Y'), new ItemStack(ModBlocks.emptycrucible, 1)
|
||||||
|
));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.rawsteelcrucible, 1),
|
||||||
|
"T", "Y",
|
||||||
|
('T'), new ItemStack(ModItems.brokensteeltool, 1),
|
||||||
|
('Y'), new ItemStack(ModBlocks.emptycrucible, 1)
|
||||||
|
));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.rawwootzcrucible, 1),
|
||||||
|
"T", "Y",
|
||||||
|
('T'), new ItemStack(ModItems.brokenwootztool, 1),
|
||||||
|
('Y'), new ItemStack(ModBlocks.emptycrucible, 1)
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
* TOOL CRAFTING RECIPES
|
* TOOL CRAFTING RECIPES
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|||||||
@@ -118,6 +118,12 @@ public class ModItems {
|
|||||||
public static Item cleanironslayer;
|
public static Item cleanironslayer;
|
||||||
public static Item steelslayer;
|
public static Item steelslayer;
|
||||||
|
|
||||||
|
public static Item brokenbronzetool;
|
||||||
|
public static Item brokenwroughtirontool;
|
||||||
|
public static Item brokencleanirontool;
|
||||||
|
public static Item brokensteeltool;
|
||||||
|
public static Item brokenwootztool;
|
||||||
|
|
||||||
public static Item wroughtironshield;
|
public static Item wroughtironshield;
|
||||||
//public static Item cleanironshield;
|
//public static Item cleanironshield;
|
||||||
//public static Item steelshield;
|
//public static Item steelshield;
|
||||||
@@ -193,25 +199,25 @@ public class ModItems {
|
|||||||
bronzeshovel = new BronzeShovel("bronzeshovel", PrimalMaterials.TOOL_BRONZE);
|
bronzeshovel = new BronzeShovel("bronzeshovel", PrimalMaterials.TOOL_BRONZE);
|
||||||
bronzehoe = new BronzeHoe("bronzehoe", PrimalMaterials.TOOL_BRONZE);
|
bronzehoe = new BronzeHoe("bronzehoe", PrimalMaterials.TOOL_BRONZE);
|
||||||
|
|
||||||
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalMaterials.TOOL_WROUGHT_IRON);
|
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalMaterials.TOOL_WROUGHT_IRON, brokenwroughtirontool);
|
||||||
ironaxe = new CustomAxe("ironaxe", PrimalMaterials.TOOL_WROUGHT_IRON);
|
ironaxe = new CustomAxe("ironaxe", PrimalMaterials.TOOL_WROUGHT_IRON, brokenwroughtirontool);
|
||||||
ironshovel = new CustomShovel("ironshovel", PrimalMaterials.TOOL_WROUGHT_IRON);
|
ironshovel = new CustomShovel("ironshovel", PrimalMaterials.TOOL_WROUGHT_IRON, brokenwroughtirontool);
|
||||||
ironhoe = new CustomHoe("ironhoe", PrimalMaterials.TOOL_WROUGHT_IRON);
|
ironhoe = new CustomHoe("ironhoe", PrimalMaterials.TOOL_WROUGHT_IRON, brokenwroughtirontool);
|
||||||
|
|
||||||
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalMaterials.TOOL_CLEAN_IRON);
|
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalMaterials.TOOL_CLEAN_IRON, brokencleanirontool);
|
||||||
cleanironaxe = new CustomAxe("cleanironaxe", PrimalMaterials.TOOL_CLEAN_IRON);
|
cleanironaxe = new CustomAxe("cleanironaxe", PrimalMaterials.TOOL_CLEAN_IRON, brokencleanirontool);
|
||||||
cleanironshovel = new CustomShovel("cleanironshovel", PrimalMaterials.TOOL_CLEAN_IRON);
|
cleanironshovel = new CustomShovel("cleanironshovel", PrimalMaterials.TOOL_CLEAN_IRON, brokencleanirontool);
|
||||||
cleanironhoe = new CustomHoe("cleanironhoe", PrimalMaterials.TOOL_CLEAN_IRON);
|
cleanironhoe = new CustomHoe("cleanironhoe", PrimalMaterials.TOOL_CLEAN_IRON, brokencleanirontool);
|
||||||
|
|
||||||
steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalMaterials.TOOL_BASIC_STEEL);
|
steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalMaterials.TOOL_BASIC_STEEL, brokensteeltool);
|
||||||
steelaxe = new CustomAxe("steelaxe", PrimalMaterials.TOOL_BASIC_STEEL);
|
steelaxe = new CustomAxe("steelaxe", PrimalMaterials.TOOL_BASIC_STEEL, brokensteeltool);
|
||||||
steelshovel = new CustomShovel("steelshovel", PrimalMaterials.TOOL_BASIC_STEEL);
|
steelshovel = new CustomShovel("steelshovel", PrimalMaterials.TOOL_BASIC_STEEL, brokensteeltool);
|
||||||
steelhoe = new CustomHoe("steelhoe", PrimalMaterials.TOOL_BASIC_STEEL);
|
steelhoe = new CustomHoe("steelhoe", PrimalMaterials.TOOL_BASIC_STEEL, brokensteeltool);
|
||||||
|
|
||||||
wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalMaterials.TOOL_WOOTZ_STEEL);
|
wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalMaterials.TOOL_WOOTZ_STEEL, brokenwootztool);
|
||||||
wootzaxe = new CustomAxe("wootzaxe", PrimalMaterials.TOOL_WOOTZ_STEEL);
|
wootzaxe = new CustomAxe("wootzaxe", PrimalMaterials.TOOL_WOOTZ_STEEL, brokenwootztool);
|
||||||
wootzshovel = new CustomShovel("wootzshovel", PrimalMaterials.TOOL_WOOTZ_STEEL);
|
wootzshovel = new CustomShovel("wootzshovel", PrimalMaterials.TOOL_WOOTZ_STEEL, brokenwootztool);
|
||||||
wootzhoe = new CustomHoe("wootzhoe", PrimalMaterials.TOOL_WOOTZ_STEEL);
|
wootzhoe = new CustomHoe("wootzhoe", PrimalMaterials.TOOL_WOOTZ_STEEL, brokenwootztool);
|
||||||
|
|
||||||
/**********
|
/**********
|
||||||
WEAPONS
|
WEAPONS
|
||||||
@@ -245,6 +251,11 @@ public class ModItems {
|
|||||||
//forgingmanual = new ItemForgingManual();
|
//forgingmanual = new ItemForgingManual();
|
||||||
//test = new ItemTest("ironsword");
|
//test = new ItemTest("ironsword");
|
||||||
|
|
||||||
|
brokenbronzetool = new BaseItem("brokenbronzetool");
|
||||||
|
brokenwroughtirontool = new BaseItem("brokenwroughtirontool");
|
||||||
|
brokencleanirontool = new BaseItem("brokencleanirontool");
|
||||||
|
brokensteeltool = new BaseItem("brokensteeltool");
|
||||||
|
brokenwootztool = new BaseItem("brokenwootztool");
|
||||||
|
|
||||||
/**********
|
/**********
|
||||||
ARMOR
|
ARMOR
|
||||||
@@ -354,6 +365,12 @@ public class ModItems {
|
|||||||
GameRegistry.register(longbow);
|
GameRegistry.register(longbow);
|
||||||
//GameRegistry.register(matchlockmusket);
|
//GameRegistry.register(matchlockmusket);
|
||||||
|
|
||||||
|
GameRegistry.register(brokenbronzetool);
|
||||||
|
GameRegistry.register(brokenwroughtirontool);
|
||||||
|
GameRegistry.register(brokencleanirontool);
|
||||||
|
GameRegistry.register(brokensteeltool);
|
||||||
|
GameRegistry.register(brokenwootztool);
|
||||||
|
|
||||||
/**********
|
/**********
|
||||||
ARMOR
|
ARMOR
|
||||||
**********/
|
**********/
|
||||||
@@ -467,6 +484,13 @@ public class ModItems {
|
|||||||
//registerRender(matchlockmusket);
|
//registerRender(matchlockmusket);
|
||||||
|
|
||||||
|
|
||||||
|
registerRender(brokenbronzetool);
|
||||||
|
registerRender(brokenwroughtirontool);
|
||||||
|
registerRender(brokencleanirontool);
|
||||||
|
registerRender(brokensteeltool);
|
||||||
|
registerRender(brokenwootztool);
|
||||||
|
|
||||||
|
|
||||||
/**********
|
/**********
|
||||||
ARMOR
|
ARMOR
|
||||||
**********/
|
**********/
|
||||||
|
|||||||
@@ -183,18 +183,41 @@ public class BronzeAxe extends ItemAxe implements ToolNBT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||||
{
|
|
||||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
|
||||||
{
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
|
stack.damageItem(1, attacker);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(ModItems.brokenbronzetool, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) attacker;
|
||||||
|
World world = attacker.getEntityWorld();
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
attacker.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||||
|
{
|
||||||
|
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
|
||||||
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
stack.getTagCompound().removeTag("ench");
|
stack.getTagCompound().removeTag("ench");
|
||||||
//System.out.println(stack.getTagCompound());
|
|
||||||
if(getDiamondLevel(stack) > 0) {
|
if(getDiamondLevel(stack) > 0) {
|
||||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||||
stack.damageItem(1, entityLiving);
|
stack.damageItem(1, entityLiving);
|
||||||
}
|
}
|
||||||
} else stack.damageItem(1, entityLiving);
|
} else stack.damageItem(1, entityLiving);
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(ModItems.brokenbronzetool, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
entityLiving.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ import net.minecraft.enchantment.Enchantment;
|
|||||||
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;
|
||||||
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.IItemPropertyGetter;
|
import net.minecraft.item.IItemPropertyGetter;
|
||||||
import net.minecraft.item.ItemHoe;
|
import net.minecraft.item.ItemHoe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
@@ -184,12 +186,48 @@ public class BronzeHoe extends ItemHoe implements ToolNBT {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||||
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
|
stack.damageItem(1, attacker);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(ModItems.brokenbronzetool, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) attacker;
|
||||||
|
World world = attacker.getEntityWorld();
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
attacker.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setBlock(ItemStack stack, EntityPlayer player, World worldIn, BlockPos pos, IBlockState state)
|
||||||
|
{
|
||||||
|
worldIn.playSound(player, pos, SoundEvents.ITEM_HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||||
|
|
||||||
|
if (!worldIn.isRemote)
|
||||||
|
{
|
||||||
|
worldIn.setBlockState(pos, state, 11);
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
|
stack.damageItem(1, player);
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(ModItems.brokenbronzetool, 1);
|
||||||
|
PlayerHelper.spawnItemOnPlayer(worldIn, player, dropStack);
|
||||||
|
player.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||||
{
|
{
|
||||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||||
{
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
stack.getTagCompound().removeTag("ench");
|
stack.getTagCompound().removeTag("ench");
|
||||||
//System.out.println(stack.getTagCompound());
|
//System.out.println(stack.getTagCompound());
|
||||||
if(getDiamondLevel(stack) > 0) {
|
if(getDiamondLevel(stack) > 0) {
|
||||||
@@ -197,6 +235,13 @@ public class BronzeHoe extends ItemHoe implements ToolNBT {
|
|||||||
stack.damageItem(1, entityLiving);
|
stack.damageItem(1, entityLiving);
|
||||||
}
|
}
|
||||||
} else stack.damageItem(1, entityLiving);
|
} else stack.damageItem(1, entityLiving);
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(ModItems.brokenbronzetool, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||||
|
PlayerHelper.spawnItemOnPlayer(worldIn, player, dropStack);
|
||||||
|
entityLiving.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -126,9 +126,6 @@ public class BronzePickaxe extends ItemPickaxe implements ToolNBT{
|
|||||||
setModifiers(item, 0);
|
setModifiers(item, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
|
|
||||||
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.bronzepickaxehead, 1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,20 +181,42 @@ public class BronzePickaxe extends ItemPickaxe implements ToolNBT{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||||
{
|
|
||||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
|
||||||
{
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
|
stack.damageItem(1, attacker);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(ModItems.brokenbronzetool, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) attacker;
|
||||||
|
World world = attacker.getEntityWorld();
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
attacker.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||||
|
{
|
||||||
|
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
|
||||||
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() > 1 ) {
|
||||||
stack.getTagCompound().removeTag("ench");
|
stack.getTagCompound().removeTag("ench");
|
||||||
//System.out.println(stack.getTagCompound());
|
if (getDiamondLevel(stack) > 0) {
|
||||||
if(getDiamondLevel(stack) > 0) {
|
if (ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
|
||||||
stack.damageItem(1, entityLiving);
|
stack.damageItem(1, entityLiving);
|
||||||
}
|
}
|
||||||
} else stack.damageItem(1, entityLiving);
|
} else stack.damageItem(1, entityLiving);
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(ModItems.brokenbronzetool, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
entityLiving.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.minecraft.entity.EntityLivingBase;
|
|||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.IItemPropertyGetter;
|
import net.minecraft.item.IItemPropertyGetter;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemSpade;
|
import net.minecraft.item.ItemSpade;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -182,12 +183,29 @@ public class BronzeShovel extends ItemSpade implements ToolNBT {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||||
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
|
stack.damageItem(1, attacker);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(ModItems.brokenbronzetool, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) attacker;
|
||||||
|
World world = attacker.getEntityWorld();
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
attacker.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||||
{
|
{
|
||||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||||
{
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
stack.getTagCompound().removeTag("ench");
|
stack.getTagCompound().removeTag("ench");
|
||||||
//System.out.println(stack.getTagCompound());
|
//System.out.println(stack.getTagCompound());
|
||||||
if(getDiamondLevel(stack) > 0) {
|
if(getDiamondLevel(stack) > 0) {
|
||||||
@@ -195,6 +213,13 @@ public class BronzeShovel extends ItemSpade implements ToolNBT {
|
|||||||
stack.damageItem(1, entityLiving);
|
stack.damageItem(1, entityLiving);
|
||||||
}
|
}
|
||||||
} else stack.damageItem(1, entityLiving);
|
} else stack.damageItem(1, entityLiving);
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(ModItems.brokenbronzetool, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||||
|
PlayerHelper.spawnItemOnPlayer(worldIn, player, dropStack);
|
||||||
|
entityLiving.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import nmd.primal.core.common.helper.PlayerHelper;
|
||||||
import nmd.primal.forgecraft.ModInfo;
|
import nmd.primal.forgecraft.ModInfo;
|
||||||
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
import nmd.primal.forgecraft.util.ToolNBT;
|
import nmd.primal.forgecraft.util.ToolNBT;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@@ -29,14 +31,16 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
*/
|
*/
|
||||||
public class CustomAxe extends ItemAxe implements ToolNBT {
|
public class CustomAxe extends ItemAxe implements ToolNBT {
|
||||||
|
|
||||||
public CustomAxe(String name, Item.ToolMaterial material) {
|
private Item damageDrop;
|
||||||
|
|
||||||
|
public CustomAxe(String name, Item.ToolMaterial material, Item damageDrop) {
|
||||||
super(material, 6, -3.1f);
|
super(material, 6, -3.1f);
|
||||||
this.setUnlocalizedName(name);
|
this.setUnlocalizedName(name);
|
||||||
this.setRegistryName(name);
|
this.setRegistryName(name);
|
||||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
this.setNoRepair();
|
this.setNoRepair();
|
||||||
|
damageDrop = damageDrop;
|
||||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -263,9 +267,6 @@ public class CustomAxe extends ItemAxe implements ToolNBT {
|
|||||||
setLapisLevel(item, 0);
|
setLapisLevel(item, 0);
|
||||||
setModifiers(item, 0);
|
setModifiers(item, 0);
|
||||||
}
|
}
|
||||||
if( this.getMaxDamage(item) - this.getDamage(item) < 5 ){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,18 +328,41 @@ public class CustomAxe extends ItemAxe implements ToolNBT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||||
{
|
|
||||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
|
||||||
{
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
|
stack.damageItem(1, attacker);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(damageDrop, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) attacker;
|
||||||
|
World world = attacker.getEntityWorld();
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
attacker.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||||
|
{
|
||||||
|
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
|
||||||
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
stack.getTagCompound().removeTag("ench");
|
stack.getTagCompound().removeTag("ench");
|
||||||
//System.out.println(stack.getTagCompound());
|
|
||||||
if(getDiamondLevel(stack) > 0) {
|
if(getDiamondLevel(stack) > 0) {
|
||||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||||
stack.damageItem(1, entityLiving);
|
stack.damageItem(1, entityLiving);
|
||||||
}
|
}
|
||||||
} else stack.damageItem(1, entityLiving);
|
} else stack.damageItem(1, entityLiving);
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(damageDrop, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
entityLiving.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -6,17 +6,21 @@ import net.minecraft.enchantment.Enchantment;
|
|||||||
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;
|
||||||
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.IItemPropertyGetter;
|
import net.minecraft.item.IItemPropertyGetter;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemHoe;
|
import net.minecraft.item.ItemHoe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import nmd.primal.core.common.helper.PlayerHelper;
|
||||||
import nmd.primal.forgecraft.ModInfo;
|
import nmd.primal.forgecraft.ModInfo;
|
||||||
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
import nmd.primal.forgecraft.util.ToolNBT;
|
import nmd.primal.forgecraft.util.ToolNBT;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@@ -28,14 +32,16 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
*/
|
*/
|
||||||
public class CustomHoe extends ItemHoe implements ToolNBT {
|
public class CustomHoe extends ItemHoe implements ToolNBT {
|
||||||
|
|
||||||
public CustomHoe(String name, Item.ToolMaterial material) {
|
private Item damageDrop;
|
||||||
|
|
||||||
|
public CustomHoe(String name, Item.ToolMaterial material, Item damageDrop) {
|
||||||
super(material);
|
super(material);
|
||||||
this.setUnlocalizedName(name);
|
this.setUnlocalizedName(name);
|
||||||
this.setRegistryName(name);
|
this.setRegistryName(name);
|
||||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
this.setNoRepair();
|
this.setNoRepair();
|
||||||
|
this.damageDrop = damageDrop;
|
||||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -320,6 +326,42 @@ public class CustomHoe extends ItemHoe implements ToolNBT {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||||
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
|
stack.damageItem(1, attacker);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(damageDrop, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) attacker;
|
||||||
|
World world = attacker.getEntityWorld();
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
attacker.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setBlock(ItemStack stack, EntityPlayer player, World worldIn, BlockPos pos, IBlockState state)
|
||||||
|
{
|
||||||
|
worldIn.playSound(player, pos, SoundEvents.ITEM_HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||||
|
|
||||||
|
if (!worldIn.isRemote)
|
||||||
|
{
|
||||||
|
worldIn.setBlockState(pos, state, 11);
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
|
stack.damageItem(1, player);
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(damageDrop, 1);
|
||||||
|
PlayerHelper.spawnItemOnPlayer(worldIn, player, dropStack);
|
||||||
|
player.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import nmd.primal.core.common.helper.PlayerHelper;
|
||||||
import nmd.primal.forgecraft.ModInfo;
|
import nmd.primal.forgecraft.ModInfo;
|
||||||
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
import nmd.primal.forgecraft.util.ToolNBT;
|
import nmd.primal.forgecraft.util.ToolNBT;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@@ -29,14 +31,16 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
*/
|
*/
|
||||||
public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
|
public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
|
||||||
|
|
||||||
public CustomPickaxe(String name, Item.ToolMaterial material) {
|
private Item damageDrop;
|
||||||
|
|
||||||
|
public CustomPickaxe(String name, Item.ToolMaterial material, Item damageDrop) {
|
||||||
super(material);
|
super(material);
|
||||||
this.setUnlocalizedName(name);
|
this.setUnlocalizedName(name);
|
||||||
this.setRegistryName(name);
|
this.setRegistryName(name);
|
||||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
this.setNoRepair();
|
this.setNoRepair();
|
||||||
|
this.damageDrop=damageDrop;
|
||||||
//this.toolClass = "pickaxe";
|
//this.toolClass = "pickaxe";
|
||||||
|
|
||||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||||
@@ -325,20 +329,42 @@ public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||||
{
|
|
||||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
|
||||||
{
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
|
stack.damageItem(1, attacker);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(damageDrop, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) attacker;
|
||||||
|
World world = attacker.getEntityWorld();
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
attacker.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||||
|
{
|
||||||
|
if (!world.isRemote && (double)state.getBlockHardness(world, pos) != 0.0D)
|
||||||
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() > 1 ) {
|
||||||
stack.getTagCompound().removeTag("ench");
|
stack.getTagCompound().removeTag("ench");
|
||||||
//System.out.println(stack.getTagCompound());
|
if (getDiamondLevel(stack) > 0) {
|
||||||
if(getDiamondLevel(stack) > 0) {
|
if (ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
||||||
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
|
|
||||||
stack.damageItem(1, entityLiving);
|
stack.damageItem(1, entityLiving);
|
||||||
}
|
}
|
||||||
} else stack.damageItem(1, entityLiving);
|
} else stack.damageItem(1, entityLiving);
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(damageDrop, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
entityLiving.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import nmd.primal.core.common.helper.PlayerHelper;
|
||||||
import nmd.primal.forgecraft.ModInfo;
|
import nmd.primal.forgecraft.ModInfo;
|
||||||
|
import nmd.primal.forgecraft.init.ModItems;
|
||||||
import nmd.primal.forgecraft.util.ToolNBT;
|
import nmd.primal.forgecraft.util.ToolNBT;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@@ -33,15 +35,16 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
public class CustomShovel extends ItemSpade implements ToolNBT {
|
public class CustomShovel extends ItemSpade implements ToolNBT {
|
||||||
|
|
||||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});
|
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});
|
||||||
|
private Item damageDrop;
|
||||||
|
|
||||||
public CustomShovel(String name, Item.ToolMaterial material) {
|
public CustomShovel(String name, Item.ToolMaterial material, Item damageDrop) {
|
||||||
super(material);
|
super(material);
|
||||||
this.setUnlocalizedName(name);
|
this.setUnlocalizedName(name);
|
||||||
this.setRegistryName(name);
|
this.setRegistryName(name);
|
||||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
this.setNoRepair();
|
this.setNoRepair();
|
||||||
|
this.damageDrop=damageDrop;
|
||||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -325,12 +328,29 @@ public class CustomShovel extends ItemSpade implements ToolNBT {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
|
||||||
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
|
stack.damageItem(1, attacker);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(damageDrop, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) attacker;
|
||||||
|
World world = attacker.getEntityWorld();
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
|
||||||
|
attacker.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
|
||||||
{
|
{
|
||||||
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
|
||||||
{
|
{
|
||||||
|
if(stack.getMaxDamage() - stack.getItemDamage() >1 ) {
|
||||||
stack.getTagCompound().removeTag("ench");
|
stack.getTagCompound().removeTag("ench");
|
||||||
//System.out.println(stack.getTagCompound());
|
//System.out.println(stack.getTagCompound());
|
||||||
if(getDiamondLevel(stack) > 0) {
|
if(getDiamondLevel(stack) > 0) {
|
||||||
@@ -338,6 +358,13 @@ public class CustomShovel extends ItemSpade implements ToolNBT {
|
|||||||
stack.damageItem(1, entityLiving);
|
stack.damageItem(1, entityLiving);
|
||||||
}
|
}
|
||||||
} else stack.damageItem(1, entityLiving);
|
} else stack.damageItem(1, entityLiving);
|
||||||
|
} else {
|
||||||
|
ItemStack dropStack = new ItemStack(damageDrop, 1);
|
||||||
|
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||||
|
PlayerHelper.spawnItemOnPlayer(worldIn, player, dropStack);
|
||||||
|
entityLiving.renderBrokenItemStack(stack);
|
||||||
|
stack.shrink(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "forgecraft:items/brokenbronzetool"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "forgecraft:items/brokencleanirontool"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "forgecraft:items/brokensteeltool"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "forgecraft:items/brokenwootztool"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "forgecraft:items/brokenwroughtirontool"
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 508 B |
Binary file not shown.
|
After Width: | Height: | Size: 445 B |
Binary file not shown.
|
After Width: | Height: | Size: 442 B |
Binary file not shown.
|
After Width: | Height: | Size: 544 B |
Binary file not shown.
|
After Width: | Height: | Size: 364 B |
@@ -2,7 +2,7 @@
|
|||||||
"modid": "forgecraft",
|
"modid": "forgecraft",
|
||||||
"name": "Kitsu's Forgecraft",
|
"name": "Kitsu's Forgecraft",
|
||||||
"description": "Forged with sweat and blood",
|
"description": "Forged with sweat and blood",
|
||||||
"version": "1.2.65",
|
"version": "1.2.70",
|
||||||
"mcversion": "1.11.2",
|
"mcversion": "1.11.2",
|
||||||
"url": "",
|
"url": "",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user