merging in master

This commit is contained in:
Mohammad-Ali Minaie
2017-07-08 13:59:09 -04:00
29 changed files with 845 additions and 150 deletions

View File

@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx3G
mod_group=nmd.primal.forgecraft
mod_name=ForgeCraft
mod_version=1.2.65
mod_version=1.2.71
forge_version=13.20.1.2388
mcp_mappings=snapshot_20170610
mc_version=1.11.2

View File

@@ -1,5 +1,4 @@
#Minecraft server properties
#Tue Jul 04 21:50:19 EDT 2017
max-tick-time=60000
generator-settings=
force-gamemode=false

View File

@@ -17,7 +17,7 @@ public class ModInfo {
public static final String MOD_CONFIG = "primal/" + MOD_ID;
//public static final String MOD_PREFIX = 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.71";
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,);";

View File

@@ -169,27 +169,55 @@ public class ModCrafting {
('E'), PrimalItems.EMERALD_KNAPP,
('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
***************************************************************/
/***Pickaxe Crafting***/
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzepickaxe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzepickaxe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.bronzepickaxehead, 1, OreDictionary.WILDCARD_VALUE), //new ItemStack( 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironpickaxe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironpickaxe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.pickaxehead, 1, OreDictionary.WILDCARD_VALUE), //new ItemStack( 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironpickaxe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironpickaxe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.cleanironpickaxehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelpickaxe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelpickaxe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.steelpickaxehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
@@ -200,27 +228,22 @@ public class ModCrafting {
//TODO wootz placeholder
/***Axe Crafting***/
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzeaxe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzeaxe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.bronzeaxehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironaxe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironaxe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironaxe), "T", "C", "S",
('T'), new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironaxe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironaxe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.cleanironaxehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelaxe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelaxe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.steelaxehead,1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
@@ -230,22 +253,22 @@ public class ModCrafting {
('S'), Items.STICK));
/***Shovel Crafting***/
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzeshovel), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzeshovel, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.bronzeshovelhead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironshovel), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironshovel, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.ironshovelhead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironshovel), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironshovel, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.cleanironshovelhead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelshovel), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelshovel, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.steelshovelhead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
@@ -255,22 +278,22 @@ public class ModCrafting {
('S'), Items.STICK));
/***Hoe Crafting***/
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzehoe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzehoe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.bronzehoehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironhoe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironhoe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.ironhoehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironhoe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironhoe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.cleanironhoehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelhoe), "T", "C", "S",
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelhoe, 1, OreDictionary.WILDCARD_VALUE), "T", "C", "S",
('T'), new ItemStack(ModItems.steelhoehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral"));
@@ -462,7 +485,7 @@ public class ModCrafting {
new ItemStack(ModBlocks.hotcookedbronzecrucible, 1),
new ItemStack(ModBlocks.rawbronzecrucible, 1),
1100,
1100,
800,
600,
0.5f,
0.5f
@@ -475,10 +498,10 @@ public class ModCrafting {
new ItemStack(ModBlocks.hotbronzecrucible_diamond, 1),
new ItemStack(ModBlocks.rawbronzecrucible_diamond, 1),
800,
20,
800,
500,
0.5f,
0.0f
0.5f
);
//Makes the Finished Hot Bronze Crucible

View File

@@ -118,6 +118,12 @@ public class ModItems {
public static Item cleanironslayer;
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 cleanironshield;
//public static Item steelshield;
@@ -188,30 +194,30 @@ public class ModItems {
/**********
TOOLS
**********/
bronzepickaxe = new BronzePickaxe("bronzepickaxe", PrimalMaterials.TOOL_BRONZE);
bronzeaxe = new BronzeAxe("bronzeaxe", PrimalMaterials.TOOL_BRONZE);
bronzeshovel = new BronzeShovel("bronzeshovel", PrimalMaterials.TOOL_BRONZE);
bronzehoe = new BronzeHoe("bronzehoe", PrimalMaterials.TOOL_BRONZE);
bronzepickaxe = new BronzePickaxe("bronzepickaxe", PrimalMaterials.TOOL_BRONZE, bronzepickaxehead);
bronzeaxe = new BronzeAxe("bronzeaxe", PrimalMaterials.TOOL_BRONZE, bronzeaxehead);
bronzeshovel = new BronzeShovel("bronzeshovel", PrimalMaterials.TOOL_BRONZE, bronzeshovelhead);
bronzehoe = new BronzeHoe("bronzehoe", PrimalMaterials.TOOL_BRONZE, bronzehoehead);
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalMaterials.TOOL_WROUGHT_IRON);
ironaxe = new CustomAxe("ironaxe", PrimalMaterials.TOOL_WROUGHT_IRON);
ironshovel = new CustomShovel("ironshovel", PrimalMaterials.TOOL_WROUGHT_IRON);
ironhoe = new CustomHoe("ironhoe", PrimalMaterials.TOOL_WROUGHT_IRON);
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalMaterials.TOOL_WROUGHT_IRON, pickaxehead);
ironaxe = new CustomAxe("ironaxe", PrimalMaterials.TOOL_WROUGHT_IRON, ironaxehead);
ironshovel = new CustomShovel("ironshovel", PrimalMaterials.TOOL_WROUGHT_IRON, ironshovelhead);
ironhoe = new CustomHoe("ironhoe", PrimalMaterials.TOOL_WROUGHT_IRON, ironhoehead);
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalMaterials.TOOL_CLEAN_IRON);
cleanironaxe = new CustomAxe("cleanironaxe", PrimalMaterials.TOOL_CLEAN_IRON);
cleanironshovel = new CustomShovel("cleanironshovel", PrimalMaterials.TOOL_CLEAN_IRON);
cleanironhoe = new CustomHoe("cleanironhoe", PrimalMaterials.TOOL_CLEAN_IRON);
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalMaterials.TOOL_CLEAN_IRON, cleanironpickaxehead);
cleanironaxe = new CustomAxe("cleanironaxe", PrimalMaterials.TOOL_CLEAN_IRON, cleanironaxehead);
cleanironshovel = new CustomShovel("cleanironshovel", PrimalMaterials.TOOL_CLEAN_IRON, cleanironshovelhead);
cleanironhoe = new CustomHoe("cleanironhoe", PrimalMaterials.TOOL_CLEAN_IRON, cleanironhoehead);
steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalMaterials.TOOL_BASIC_STEEL);
steelaxe = new CustomAxe("steelaxe", PrimalMaterials.TOOL_BASIC_STEEL);
steelshovel = new CustomShovel("steelshovel", PrimalMaterials.TOOL_BASIC_STEEL);
steelhoe = new CustomHoe("steelhoe", PrimalMaterials.TOOL_BASIC_STEEL);
steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalMaterials.TOOL_BASIC_STEEL, steelpickaxehead);
steelaxe = new CustomAxe("steelaxe", PrimalMaterials.TOOL_BASIC_STEEL, steelaxehead);
steelshovel = new CustomShovel("steelshovel", PrimalMaterials.TOOL_BASIC_STEEL, steelshovelhead);
steelhoe = new CustomHoe("steelhoe", PrimalMaterials.TOOL_BASIC_STEEL, steelhoehead);
wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalMaterials.TOOL_WOOTZ_STEEL);
wootzaxe = new CustomAxe("wootzaxe", PrimalMaterials.TOOL_WOOTZ_STEEL);
wootzshovel = new CustomShovel("wootzshovel", PrimalMaterials.TOOL_WOOTZ_STEEL);
wootzhoe = new CustomHoe("wootzhoe", PrimalMaterials.TOOL_WOOTZ_STEEL);
wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzpickaxehead);
wootzaxe = new CustomAxe("wootzaxe", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzaxehead);
wootzshovel = new CustomShovel("wootzshovel", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzshovelhead);
wootzhoe = new CustomHoe("wootzhoe", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzhoehead);
/**********
WEAPONS
@@ -245,6 +251,11 @@ public class ModItems {
//forgingmanual = new ItemForgingManual();
//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
@@ -354,6 +365,12 @@ public class ModItems {
GameRegistry.register(longbow);
//GameRegistry.register(matchlockmusket);
GameRegistry.register(brokenbronzetool);
GameRegistry.register(brokenwroughtirontool);
GameRegistry.register(brokencleanirontool);
GameRegistry.register(brokensteeltool);
GameRegistry.register(brokenwootztool);
/**********
ARMOR
**********/
@@ -467,6 +484,13 @@ public class ModItems {
//registerRender(matchlockmusket);
registerRender(brokenbronzetool);
registerRender(brokenwroughtirontool);
registerRender(brokencleanirontool);
registerRender(brokensteeltool);
registerRender(brokenwootztool);
/**********
ARMOR
**********/

View File

@@ -31,14 +31,16 @@ import java.util.concurrent.ThreadLocalRandom;
*/
public class BronzeAxe extends ItemAxe implements ToolNBT {
public BronzeAxe(String name, Item.ToolMaterial material) {
Item drop;
public BronzeAxe(String name, Item.ToolMaterial material, Item damageDrop) {
super(material, 5, -2f);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
@@ -183,18 +185,54 @@ public class BronzeAxe extends ItemAxe implements ToolNBT {
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
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(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@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");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;

View File

@@ -6,11 +6,14 @@ import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -29,14 +32,16 @@ import java.util.concurrent.ThreadLocalRandom;
*/
public class BronzeHoe extends ItemHoe implements ToolNBT {
public BronzeHoe(String name, ToolMaterial material) {
Item drop;
public BronzeHoe(String name, ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
@@ -185,18 +190,78 @@ public class BronzeHoe extends ItemHoe implements ToolNBT {
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
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(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
PlayerHelper.spawnItemOnPlayer(worldIn, player, dropStack);
player.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
}
@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(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@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");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;

View File

@@ -8,6 +8,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -30,14 +31,16 @@ import java.util.concurrent.ThreadLocalRandom;
*/
public class BronzePickaxe extends ItemPickaxe implements ToolNBT{
public BronzePickaxe(String name, ToolMaterial material) {
private Item drop;
public BronzePickaxe(String name, ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
//this.toolClass = "pickaxe";
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
@@ -126,9 +129,6 @@ public class BronzePickaxe extends ItemPickaxe implements ToolNBT{
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){
PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.bronzepickaxehead, 1));
}
}
}
@@ -184,18 +184,54 @@ public class BronzePickaxe extends ItemPickaxe implements ToolNBT{
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
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(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@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");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;

View File

@@ -10,6 +10,7 @@ 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.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -34,15 +35,16 @@ import java.util.concurrent.ThreadLocalRandom;
public class BronzeShovel 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});
Item drop;
public BronzeShovel(String name, ToolMaterial material) {
public BronzeShovel(String name, ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
@@ -183,18 +185,54 @@ public class BronzeShovel extends ItemSpade implements ToolNBT {
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
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(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@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");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;

View File

@@ -17,7 +17,9 @@ 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.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
@@ -29,14 +31,16 @@ import java.util.concurrent.ThreadLocalRandom;
*/
public class CustomAxe extends ItemAxe implements ToolNBT {
public CustomAxe(String name, Item.ToolMaterial material) {
Item drop;
public CustomAxe(String name, Item.ToolMaterial material, Item damageDrop) {
super(material, 6, -3.1f);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop = damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
@@ -228,6 +232,7 @@ public class CustomAxe extends ItemAxe implements ToolNBT {
public void onCreated(ItemStack item, World world, EntityPlayer playerIn) {
if(!world.isRemote) {
item.setItemDamage(item.getMaxDamage()-5);
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
@@ -250,6 +255,7 @@ public class CustomAxe extends ItemAxe implements ToolNBT {
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
@@ -263,9 +269,6 @@ public class CustomAxe extends ItemAxe implements ToolNBT {
setLapisLevel(item, 0);
setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) < 5 ){
}
}
}
@@ -304,7 +307,6 @@ public class CustomAxe extends ItemAxe implements ToolNBT {
{
if(!player.world.isRemote){
World world = player.getEntityWorld();
//System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof CustomAxe){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
@@ -327,18 +329,54 @@ public class CustomAxe extends ItemAxe implements ToolNBT {
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
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(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@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");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;

View File

@@ -6,17 +6,21 @@ import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
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.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
@@ -28,14 +32,16 @@ import java.util.concurrent.ThreadLocalRandom;
*/
public class CustomHoe extends ItemHoe implements ToolNBT {
public CustomHoe(String name, Item.ToolMaterial material) {
private Item drop;
public CustomHoe(String name, Item.ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop = damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
@@ -321,18 +327,78 @@ public class CustomHoe extends ItemHoe implements ToolNBT {
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
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(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
PlayerHelper.spawnItemOnPlayer(worldIn, player, dropStack);
player.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
}
@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(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@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");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;

View File

@@ -17,7 +17,9 @@ 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.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
@@ -29,14 +31,16 @@ import java.util.concurrent.ThreadLocalRandom;
*/
public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
public CustomPickaxe(String name, Item.ToolMaterial material) {
private Item drop;
public CustomPickaxe(String name, Item.ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
//this.toolClass = "pickaxe";
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
@@ -325,18 +329,54 @@ public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
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(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@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");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;

View File

@@ -19,7 +19,9 @@ 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.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
@@ -33,15 +35,16 @@ import java.util.concurrent.ThreadLocalRandom;
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 Item drop;
public CustomShovel(String name, Item.ToolMaterial material) {
public CustomShovel(String name, Item.ToolMaterial material, Item damageDrop) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.drop=damageDrop;
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
@@ -326,18 +329,54 @@ public class CustomShovel extends ItemSpade implements ToolNBT {
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
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(drop, 1);
dropStack.setItemDamage(stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) attacker;
World world = attacker.getEntityWorld();
if(!world.isRemote) {
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
attacker.renderBrokenItemStack(stack);
stack.shrink(1);
return true;
}
return false;
}
}
@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");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
} else {
ItemStack dropStack = new ItemStack(drop, 1, stack.getItemDamage());
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound copyNBT;
copyNBT = stack.getSubCompound("tags").copy();
dropStack.setTagCompound(copyNBT);
EntityPlayer player = (EntityPlayer) entityLiving;
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
entityLiving.renderBrokenItemStack(stack);
stack.shrink(1);
}
}
return true;

View File

@@ -44,7 +44,7 @@ public interface BreakerHandler {
//Block smashBlock = world.getBlockState(pos.offset(face)).getBlock();
IBlockState smashState = world.getBlockState(pos.offset(face));
if(!smashState.getBlock().equals(Blocks.AIR)) {
ItemStack smashStack = new ItemStack(Item.getItemFromBlock(smashState.getBlock()), 1, smashState.getBlock().getMetaFromState(state));
ItemStack smashStack = new ItemStack(Item.getItemFromBlock(smashState.getBlock()), 1, smashState.getBlock().getMetaFromState(smashState));
if (hasOreName(smashStack, "oreIron")) {
if (tile.getCharge() > getThreshold(world, pos.offset(face))) {
world.setBlockToAir(pos.offset(face));

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "forgecraft:items/brokenbronzetool"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "forgecraft:items/brokencleanirontool"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "forgecraft:items/brokensteeltool"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "forgecraft:items/brokenwootztool"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "forgecraft:items/brokenwroughtirontool"
}
}

View File

@@ -0,0 +1,259 @@
// Date: 7/8/17 1:55:33 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package net.minecraft.src;
public class Modeltest extends ModelBase
{
//fields
ModelRenderer head;
ModelRenderer body;
ModelRenderer rightarm;
ModelRenderer leftarm;
ModelRenderer rightleg;
ModelRenderer leftleg;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape1;
ModelRenderer Shape2;
ModelRenderer Shape2;
ModelRenderer Shape2;
ModelRenderer Shape2;
ModelRenderer Shape3;
ModelRenderer Shape3;
ModelRenderer Shape4;
ModelRenderer Shape5;
ModelRenderer Shape2;
public Modeltest()
{
textureWidth = 64;
textureHeight = 64;
head = new ModelRenderer(this, 0, 0);
head.addBox(-4F, -8F, -4F, 8, 8, 8);
head.setRotationPoint(0F, 0F, 0F);
head.setTextureSize(64, 64);
head.mirror = true;
setRotation(head, 0F, 0F, 0F);
body = new ModelRenderer(this, 16, 16);
body.addBox(-4F, 0F, -2F, 8, 12, 4);
body.setRotationPoint(0F, 0F, 0F);
body.setTextureSize(64, 64);
body.mirror = true;
setRotation(body, 0F, 0F, 0F);
rightarm = new ModelRenderer(this, 40, 16);
rightarm.addBox(-3F, -2F, -2F, 4, 12, 4);
rightarm.setRotationPoint(-5F, 2F, 0F);
rightarm.setTextureSize(64, 64);
rightarm.mirror = true;
setRotation(rightarm, 0F, 0F, 0F);
leftarm = new ModelRenderer(this, 40, 16);
leftarm.addBox(-1F, -2F, -2F, 4, 12, 4);
leftarm.setRotationPoint(5F, 2F, 0F);
leftarm.setTextureSize(64, 64);
leftarm.mirror = true;
setRotation(leftarm, 0F, 0F, 0F);
rightleg = new ModelRenderer(this, 0, 16);
rightleg.addBox(-2F, 0F, -2F, 4, 12, 4);
rightleg.setRotationPoint(-2F, 12F, 0F);
rightleg.setTextureSize(64, 64);
rightleg.mirror = true;
setRotation(rightleg, 0F, 0F, 0F);
leftleg = new ModelRenderer(this, 0, 16);
leftleg.addBox(-2F, 0F, -2F, 4, 12, 4);
leftleg.setRotationPoint(2F, 12F, 0F);
leftleg.setTextureSize(64, 64);
leftleg.mirror = true;
setRotation(leftleg, 0F, 0F, 0F);
Shape1 = new ModelRenderer(this, 0, 37);
Shape1.addBox(-4.5F, -7F, -5F, 4, 7, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 1.570796F, 0F);
Shape1 = new ModelRenderer(this, 52, 37);
Shape1.addBox(-4.5F, -7F, -5F, 4, 2, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 0F, 0F);
Shape1 = new ModelRenderer(this, 52, 40);
Shape1.addBox(-2F, -7F, -5.5F, 4, 2, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 0F, 0F);
Shape1 = new ModelRenderer(this, 52, 52);
Shape1.addBox(0.5F, -7F, -5F, 4, 2, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 0F, 0F);
Shape1 = new ModelRenderer(this, 0, 37);
Shape1.addBox(0.5F, -7F, -5F, 4, 5, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 1.570796F, 0F);
Shape1 = new ModelRenderer(this, 0, 37);
Shape1.addBox(-4.5F, -7F, -5F, 4, 7, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 3.141593F, 0F);
Shape1 = new ModelRenderer(this, 5, 37);
Shape1.addBox(-2F, -7F, -5.5F, 4, 6, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 1.570796F, 0F);
Shape1 = new ModelRenderer(this, 2, 37);
Shape1.addBox(-2F, -7F, -5.5F, 4, 8, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 3.141593F, 0F);
Shape1 = new ModelRenderer(this, 5, 37);
Shape1.addBox(0.5F, -7F, -5F, 4, 7, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 3.141593F, 0F);
Shape1 = new ModelRenderer(this, 20, 37);
Shape1.addBox(-4.5F, -7F, -5F, 4, 5, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, -1.570796F, 0F);
Shape1 = new ModelRenderer(this, 25, 37);
Shape1.addBox(-2F, -7F, -5.5F, 4, 6, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, -1.570796F, 0F);
Shape1 = new ModelRenderer(this, 30, 37);
Shape1.addBox(0.5F, -7F, -5F, 4, 7, 1);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, -1.570796F, 0F);
Shape2 = new ModelRenderer(this, 10, 55);
Shape2.addBox(-2F, -11F, -2F, 4, 1, 4);
Shape2.setRotationPoint(0F, 0F, 0F);
Shape2.setTextureSize(64, 64);
Shape2.mirror = true;
setRotation(Shape2, 0F, 0F, 0F);
Shape2 = new ModelRenderer(this, 0, 46);
Shape2.addBox(-4.5F, -8F, -4.5F, 9, 1, 9);
Shape2.setRotationPoint(0F, 0F, 0F);
Shape2.setTextureSize(64, 64);
Shape2.mirror = true;
setRotation(Shape2, 0F, 0F, 0F);
Shape2 = new ModelRenderer(this, 0, 46);
Shape2.addBox(-3.5F, -10F, -3.5F, 7, 1, 7);
Shape2.setRotationPoint(0F, 0F, 0F);
Shape2.setTextureSize(64, 64);
Shape2.mirror = true;
setRotation(Shape2, 0F, 0F, 0F);
Shape2 = new ModelRenderer(this, 5, 50);
Shape2.addBox(-3F, -10.5F, -3F, 6, 1, 6);
Shape2.setRotationPoint(0F, 0F, 0F);
Shape2.setTextureSize(64, 64);
Shape2.mirror = true;
setRotation(Shape2, 0F, 0F, 0F);
Shape3 = new ModelRenderer(this, 50, 48);
Shape3.addBox(-1F, -8.5F, 3F, 2, 1, 5);
Shape3.setRotationPoint(0F, 0F, 0F);
Shape3.setTextureSize(64, 64);
Shape3.mirror = true;
setRotation(Shape3, 1.047198F, 3.141593F, 0F);
Shape3 = new ModelRenderer(this, 50, 48);
Shape3.addBox(-1F, -8.5F, 3F, 2, 1, 5);
Shape3.setRotationPoint(0F, 0F, 0F);
Shape3.setTextureSize(64, 64);
Shape3.mirror = true;
setRotation(Shape3, 1.047198F, 0F, 0F);
Shape4 = new ModelRenderer(this, 46, 51);
Shape4.addBox(-1F, -11.5F, -3.5F, 2, 1, 7);
Shape4.setRotationPoint(0F, 0F, 0F);
Shape4.setTextureSize(64, 64);
Shape4.mirror = true;
setRotation(Shape4, 0F, 0F, 0F);
Shape5 = new ModelRenderer(this, 40, 48);
Shape5.addBox(-1F, -5F, -5.5F, 2, 3, 1);
Shape5.setRotationPoint(0F, 0F, 0F);
Shape5.setTextureSize(64, 64);
Shape5.mirror = true;
setRotation(Shape5, 0F, 0F, 0F);
Shape2 = new ModelRenderer(this, 0, 45);
Shape2.addBox(-4F, -9F, -4F, 8, 1, 8);
Shape2.setRotationPoint(0F, 0F, 0F);
Shape2.setTextureSize(64, 64);
Shape2.mirror = true;
setRotation(Shape2, 0F, 0F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
head.render(f5);
body.render(f5);
rightarm.render(f5);
leftarm.render(f5);
rightleg.render(f5);
leftleg.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape1.render(f5);
Shape2.render(f5);
Shape2.render(f5);
Shape2.render(f5);
Shape2.render(f5);
Shape3.render(f5);
Shape3.render(f5);
Shape4.render(f5);
Shape5.render(f5);
Shape2.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -2,7 +2,7 @@
"modid": "forgecraft",
"name": "Kitsu's Forgecraft",
"description": "Forged with sweat and blood",
"version": "1.2.65",
"version": "1.2.71",
"mcversion": "1.11.2",
"url": "",
"updateUrl": "",

Binary file not shown.

BIN
test-helmet.tcn Normal file

Binary file not shown.