diff --git a/kfc/To-Dos.md b/kfc/To-Dos.md index f6c42b93..bf5ab8cd 100644 --- a/kfc/To-Dos.md +++ b/kfc/To-Dos.md @@ -4,14 +4,21 @@ ## Current Feature - [x] Forge Light Level -- [ ] Check Forge Textures for lit -- [ ] Diamond + Redstone no texture -- [ ] Longbow Fire Speed -- [ ] Bloomery Print out -- [ ] Anvil cool down items -- [ ] Copper Tools -- [ ] Craft Tweaker Support +- [x] Check Forge Textures for lit +- [x] Forge not cooling down +- [x] Steel Chunk stop reading upgrades +- [x] Casting Form broken +- [x] Anvil cool down items +- [x] Longbow Fire Speed +- [x] More Crafting for buckets + - [ ] Config Usage +- [ ] Copper Tools +- [ ] Copper Tool Casting +- [ ] Copper Tool Assets + +- [ ] Craft Tweaker Support + - [ ] Config for lowering fortune multiplier - [ ] Hardened Leather Helmet Inventory Model @@ -27,10 +34,12 @@ - [ ] Create lock assembly item ## Backlog +- [ ] Bloomery Print out +- [ ] Random Floats for hot texture +- [ ] Diamond + Redstone no texture - [ ] Mass Ore Production - [ ] Silver/Lead Production - [ ] Sparks to forging -- [x] Move Ingot break into chunks logic out of the block and into the ForgeHammer - [ ] Add Iron Ring Recipe - [ ] Add chainmail recipe - [ ] Add Iron Shield diff --git a/kfc/src/main/java/nmd/primal/forgecraft/CommonEvents.java b/kfc/src/main/java/nmd/primal/forgecraft/CommonEvents.java index 5c747360..60836e6e 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/CommonEvents.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/CommonEvents.java @@ -8,6 +8,10 @@ import net.minecraftforge.fml.common.gameevent.PlayerEvent; import nmd.primal.forgecraft.items.parts.BronzeToolPart; import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.items.tools.*; +import nmd.primal.forgecraft.items.tools.bronze.BronzeAxe; +import nmd.primal.forgecraft.items.tools.bronze.BronzeHoe; +import nmd.primal.forgecraft.items.tools.bronze.BronzePickaxe; +import nmd.primal.forgecraft.items.tools.bronze.BronzeShovel; import nmd.primal.forgecraft.util.ToolNBT; /** diff --git a/kfc/src/main/java/nmd/primal/forgecraft/blocks/machine/CastingForm.java b/kfc/src/main/java/nmd/primal/forgecraft/blocks/machine/CastingForm.java index c8958233..4db3311e 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/blocks/machine/CastingForm.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/blocks/machine/CastingForm.java @@ -60,13 +60,12 @@ public class CastingForm extends CustomContainerFacing implements CastingFormHan TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos); ItemStack pItem = player.inventory.getCurrentItem(); - IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null); - ItemStack slotStack = inventory.getStackInSlot(0).copy(); - if(pItem.getItem() != ModItems.slottedtongs) { doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player); } if(pItem.getItem().equals(ModItems.slottedtongs)){ + IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null); + ItemStack slotStack = inventory.getStackInSlot(0).copy(); SlottedTongs tongs = (SlottedTongs) pItem.getItem(); if(slotStack.getItem().equals(Item.getItemFromBlock(ModBlocks.nbtCrucible))) { ItemStack tongsStack = slotStack.copy(); diff --git a/kfc/src/main/java/nmd/primal/forgecraft/init/ModConfig.java b/kfc/src/main/java/nmd/primal/forgecraft/init/ModConfig.java index e4eb2722..d0e85996 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/init/ModConfig.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/init/ModConfig.java @@ -6,8 +6,9 @@ import nmd.primal.forgecraft.ModInfo; @Config(modid = ModInfo.MOD_ID, name = ModInfo.MOD_CONFIG, category = "") @Config.LangKey("forgecraft.config.title") -@SuppressWarnings("unused") -public class ModConfig + + +public final class ModConfig { static { ForgeCraft.LOGGER.info("Loading Config File: " + ModInfo.MOD_CONFIG + ".cfg"); @@ -17,7 +18,7 @@ public class ModConfig * Main Config Sections */ public static Compatibility compatibility; - public static ModConfig.Features features; + public static Features features; /** * Options related to compatibility with mods and vanilla features @@ -31,10 +32,22 @@ public class ModConfig /** * Customize main features of the mod */ + + //@Config.RequiresMcRestart + //@Config.Comment({"Config to allow or dissallow Copper Tools"}) + //public static boolean ENABLE_COPPER_TOOLS = false; + public static class Features { - @Config.Comment({"Smoke is produced from various forge blocks when active"}) - public static boolean FEATURE_ENABLE_SMOKE = true; + @Config.RequiresMcRestart + @Config.Comment({"Config to allow or dissallow Copper Tools"}) + public static boolean ENABLE_COPPER_TOOLS = false; + + @Config.Comment({"Bronze Tool Lapis Bonus do not go greater than 5"}) + public static int BRONZE_LAPIS_MULTIPLIER = 5; + + @Config.Comment({"Copper Tools Emerald Upgrade"}) + public static boolean ENABLE_COPPER_EMERALD = true; @Config.RequiresMcRestart @Config.Comment({"Various forge blocks will set fire to their surroundings when active"}) @@ -44,4 +57,31 @@ public class ModConfig @Config.RangeInt(min = 0, max = 1000) public static int FEATURE_HEAT_RANGE = 0; } -} \ No newline at end of file +} + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kfc/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java b/kfc/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java index 64606673..4b239062 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java @@ -1452,6 +1452,30 @@ public class ModCrafting{ "null" ); + /*** Bucket ***/ + AnvilCrafting.addRecipe( + new ItemStack [] { + emptyAir,emptyAir,emptyAir,emptyAir,emptyAir, + emptyAir,hotCleanChunk,emptyAir,hotCleanChunk,emptyAir, + emptyAir,hotCleanChunk,emptyAir,hotCleanChunk,emptyAir, + emptyAir,emptyAir,hotCleanChunk,emptyAir,emptyAir, + emptyAir,emptyAir,emptyAir,emptyAir,emptyAir }, + new ItemStack(Items.BUCKET, 1), + "null" + ); + + /*** Bucket ***/ + AnvilCrafting.addRecipe( + new ItemStack [] { + emptyAir,emptyAir,emptyAir,emptyAir,emptyAir, + emptyAir,hotSteelChunk,emptyAir,hotSteelChunk,emptyAir, + emptyAir,hotSteelChunk,emptyAir,hotSteelChunk,emptyAir, + emptyAir,emptyAir,hotSteelChunk,emptyAir,emptyAir, + emptyAir,emptyAir,emptyAir,emptyAir,emptyAir }, + new ItemStack(Items.BUCKET, 1), + "null" + ); + /*** Primal Plate ***/ AnvilCrafting.addRecipe( new ItemStack [] { diff --git a/kfc/src/main/java/nmd/primal/forgecraft/init/ModItems.java b/kfc/src/main/java/nmd/primal/forgecraft/init/ModItems.java index 36889de9..df303880 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/init/ModItems.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/init/ModItems.java @@ -15,6 +15,10 @@ import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible; import nmd.primal.forgecraft.items.parts.BronzeToolPart; import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.items.tools.*; +import nmd.primal.forgecraft.items.tools.bronze.BronzeAxe; +import nmd.primal.forgecraft.items.tools.bronze.BronzeHoe; +import nmd.primal.forgecraft.items.tools.bronze.BronzePickaxe; +import nmd.primal.forgecraft.items.tools.bronze.BronzeShovel; import nmd.primal.forgecraft.items.weapons.CustomShield; import nmd.primal.forgecraft.items.weapons.CustomSword; import nmd.primal.forgecraft.items.weapons.Longbow; @@ -23,6 +27,7 @@ import nmd.primal.forgecraft.items.weapons.SlayerSword; /** * Created by kitsu on 11/26/2016. */ + public class ModItems { //public static Item test; @@ -47,6 +52,17 @@ public class ModItems { public static Item wootzingotball; public static Item wootzchunk; + public static Item copperpickaxehead; + public static Item copperaxehead; + public static Item coppershovelhead; + public static Item copperhoehead; + + public static Item copperpickaxe; + public static Item copperaxe; + public static Item coppershovel; + public static Item copperhoe; + + public static Item pickaxehead; public static Item ironaxehead; public static Item ironshovelhead; @@ -154,6 +170,18 @@ public class ModItems { /********** TOOL PARTS **********/ + if(ModConfig.Features.ENABLE_COPPER_TOOLS){ + copperpickaxehead; + copperaxehead; + coppershovelhead; + copperhoehead; + + copperpickaxe; + copperaxe; + coppershovel; + copperhoe; + } + bronzepickaxehead = new BronzeToolPart("bronzepickaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "pickaxe"); bronzeaxehead = new BronzeToolPart("bronzeaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "axe"); bronzeshovelhead = new BronzeToolPart("bronzeshovelhead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "shovel"); @@ -183,27 +211,27 @@ public class ModItems { TOOLS **********/ bronzepickaxe = new BronzePickaxe("bronzepickaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzepickaxehead); - bronzeaxe = new BronzeAxe("bronzeaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeaxehead); + bronzeaxe = new BronzeAxe("bronzeaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeaxehead, 5, -2.4f); bronzeshovel = new BronzeShovel("bronzeshovel", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeshovelhead); bronzehoe = new BronzeHoe("bronzehoe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzehoehead); ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, pickaxehead); - ironaxe = new CustomAxe("ironaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironaxehead); + ironaxe = new CustomAxe("ironaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironaxehead, 5, -3.6f); ironshovel = new CustomShovel("ironshovel", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironshovelhead); ironhoe = new CustomHoe("ironhoe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironhoehead); cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironpickaxehead); - cleanironaxe = new CustomAxe("cleanironaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironaxehead); + cleanironaxe = new CustomAxe("cleanironaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironaxehead, 6, -3.2f); cleanironshovel = new CustomShovel("cleanironshovel", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironshovelhead); cleanironhoe = new CustomHoe("cleanironhoe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironhoehead); steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelpickaxehead); - steelaxe = new CustomAxe("steelaxe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelaxehead); + steelaxe = new CustomAxe("steelaxe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelaxehead, 7, -2.8f); steelshovel = new CustomShovel("steelshovel", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelshovelhead); steelhoe = new CustomHoe("steelhoe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelhoehead); wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzpickaxehead); - wootzaxe = new CustomAxe("wootzaxe", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzaxehead); + wootzaxe = new CustomAxe("wootzaxe", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzaxehead, 8, -2.4f); wootzshovel = new CustomShovel("wootzshovel", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzshovelhead); wootzhoe = new CustomHoe("wootzhoe", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzhoehead); diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/BaseMultiItem.java b/kfc/src/main/java/nmd/primal/forgecraft/items/BaseMultiItem.java index c0f7667b..4a36cae9 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/BaseMultiItem.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/BaseMultiItem.java @@ -142,7 +142,7 @@ public class BaseMultiItem extends BaseItem { { if (item.hasTagCompound()) { - tooltip.add(ChatFormatting.GRAY + "Upgrades: " + item.getTagCompound().getString("upgrades")); + //tooltip.add(ChatFormatting.GRAY + "Upgrades: " + item.getTagCompound().getString("upgrades")); /* tooltip.add(ChatFormatting.GRAY + "Upgrades: " + (3 - getModifiers(item)) ); if (getEmerald(item) == true) { diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzeAxe.java b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/AbstractAxe.java similarity index 78% rename from kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzeAxe.java rename to kfc/src/main/java/nmd/primal/forgecraft/items/tools/AbstractAxe.java index 6049b45a..a5c9f73e 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzeAxe.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/AbstractAxe.java @@ -20,67 +20,25 @@ 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; import java.util.List; import java.util.concurrent.ThreadLocalRandom; -/** - * Created by mminaie on 6/25/17. - */ -public class BronzeAxe extends ItemAxe implements ToolNBT { +public abstract class AbstractAxe extends ItemAxe implements ToolNBT { Item drop; - public BronzeAxe(String name, Item.ToolMaterial material, Item damageDrop) { - super(material, 5, -2f); + public AbstractAxe(String name, Item.ToolMaterial material, Item damageDrop, Integer damage, Float speed) { + super(material, damage, speed); 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() { + this.drop = damageDrop; - /*** - - hot . emerald . diamond . redstone . lapis - 0 . 0 . 0 . 0 . 0 - - ***/ - - @SideOnly(Side.CLIENT) - public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) - { - if (item.hasTagCompound()) { - - - if (getModifiers(item) != 0) { - if (getEmerald(item)) { - return 0.1F; - } - - if (getDiamondLevel(item) == 1) { - return 0.2F; - } - - if ( getRedstoneLevel(item) == 1) { - return 0.3F; - } - - if (getLapisLevel(item) == 1) { - return 0.4F; - } - } - if (getModifiers(item) == 0) { - return 0.0F; - } - } - return 0.0F; - } - }); } public static boolean isHidden() @@ -92,6 +50,7 @@ public class BronzeAxe 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(); @@ -114,6 +73,7 @@ public class BronzeAxe 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(); @@ -127,9 +87,9 @@ public class BronzeAxe extends ItemAxe implements ToolNBT { setLapisLevel(item, 0); setModifiers(item, 0); } - //this.setDamage(item, this.getMaxDamage(item) -2); + if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenbronzetool, 1)); + PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(this.drop, 1)); ((EntityPlayer) player).inventory.deleteStack(item); } } @@ -145,7 +105,7 @@ public class BronzeAxe extends ItemAxe implements ToolNBT { { if (item.hasTagCompound()) { - tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) ); + tooltip.add(ChatFormatting.GRAY + "Upgrades added: " + (getModifiers(item)) ); if (getEmerald(item) == true) { tooltip.add(ChatFormatting.DARK_GREEN + "Emerald"); } @@ -153,38 +113,42 @@ public class BronzeAxe extends ItemAxe implements ToolNBT { tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item)); } if (getRedstoneLevel(item) > 0) { - tooltip.add(ChatFormatting.RED + "Redstone Level: " + "1" ); + tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) ); } if (getLapisLevel(item) > 0) { - tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + "5" ); + tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) ); } tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() ); } } } - +/* @Override public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) { if(!player.world.isRemote){ World world = player.getEntityWorld(); - //System.out.println(world.getBlockState(pos).getBlock()); if(itemstack.getItem() instanceof CustomAxe){ if( getEmerald(itemstack)){ itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); } - /*if( getDiamondLevel(itemstack) > 0 ){ - itemstack.getItem().setHarvestLevel("pickaxe", 3); - }*/ + if( getDiamondLevel(itemstack) > 0 ){ + itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); + //itemstack.getItem().setHarvestLevel("pickaxe", 3); + } + if( getRedstoneLevel(itemstack) > 0 ){ + itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack)); + //System.out.println(itemstack.getEnchantmentTagList()); + } if ( getLapisLevel(itemstack) > 0) { - itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5); + itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack)); } } } return false; } - +*/ @Override public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { @@ -243,7 +207,7 @@ public class BronzeAxe extends ItemAxe implements ToolNBT { if(material != Material.WOOD && material != Material.PLANTS && material != Material.VINE){ return super.getDestroySpeed(stack, state); } else { - return this.efficiency + 1; + return this.efficiency * ( (this.getRedstoneLevel(stack) * 2 )); } } diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzeHoe.java b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzeHoe.java deleted file mode 100644 index fbd89e9f..00000000 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzeHoe.java +++ /dev/null @@ -1,283 +0,0 @@ -package nmd.primal.forgecraft.items.tools; - -import com.mojang.realmsclient.gui.ChatFormatting; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.util.ITooltipFlag; -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; -import java.util.List; -import java.util.concurrent.ThreadLocalRandom; - -/** - * Created by mminaie on 3/21/17. - */ -public class BronzeHoe extends ItemHoe implements ToolNBT { - - 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() { - - /*** - - hot . emerald . diamond . redstone . lapis - 0 . 0 . 0 . 0 . 0 - - ***/ - - @SideOnly(Side.CLIENT) - public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) - { - if (item.hasTagCompound()) { - - - if (getModifiers(item) != 0) { - if (getEmerald(item)) { - return 0.1F; - } - - if (getDiamondLevel(item) == 1) { - return 0.2F; - } - - if ( getRedstoneLevel(item) == 1) { - return 0.3F; - } - - if (getLapisLevel(item) == 1) { - return 0.4F; - } - } - if (getModifiers(item) == 0) { - return 0.0F; - } - } - return 0.0F; - } - }); - } - - public static boolean isHidden() - { - return false; - } - - @Override - public void onCreated(ItemStack item, World world, EntityPlayer playerIn) { - - if(!world.isRemote) { - if (!item.hasTagCompound()) { - item.setTagCompound(new NBTTagCompound()); - NBTTagCompound tags = new NBTTagCompound(); - - item.getTagCompound().setTag("tags", tags); - - /*setHot(item, false); - - setHot(item, false); - setEmerald(item, false); - setDiamondLevel(item, 0); - setRedstoneLevel(item, 0); - setLapisLevel(item, 0); - setModifiers(item, 0);*/ - } - } - - } - - @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(); - - item.getTagCompound().setTag("tags", tags); - - setHot(item, false); - setEmerald(item, false); - setDiamondLevel(item, 0); - setRedstoneLevel(item, 0); - setLapisLevel(item, 0); - setModifiers(item, 0); - - } - if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenbronzetool, 1)); - ((EntityPlayer) player).inventory.deleteStack(item); - } - } - } - - //public void onItemTooltip(ItemTooltipEvent event){ - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack item, @Nullable World world, List tooltip, ITooltipFlag flagIn) - { - //tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() ); - if(item.hasTagCompound()) - { - tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) ); - if (getEmerald(item) == true) { - tooltip.add(ChatFormatting.DARK_GREEN + "Emerald"); - } - if (getDiamondLevel(item) > 0) { - tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item)); - } - if (getRedstoneLevel(item) > 0) { - tooltip.add(ChatFormatting.RED + "Redstone Level: " + 1 ); - } - if (getLapisLevel(item) > 0) { - tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 ); - } - tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() ); - } - } - - @Override - public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) - { - if(!player.world.isRemote){ - World world = player.getEntityWorld(); - - if(itemstack.getItem() instanceof BronzeHoe){ - if( getEmerald(itemstack)){ - itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); - } - /*if( getDiamondLevel(itemstack) > 0 ){ - itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); - itemstack.getItem().setHarvestLevel("pickaxe", 3); - }*/ - /*if( getRedstoneLevel(itemstack) > 0 ){ - itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack)); - //System.out.println(itemstack.getEnchantmentTagList()); - }*/ - if ( getLapisLevel(itemstack) > 0) { - itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5); - } - } - } - - return false; - } - - @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(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, stack.getItemDamage()); - NBTTagCompound copyNBT = stack.getTagCompound(); - 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"); - 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()); - NBTTagCompound copyNBT = stack.getTagCompound(); - dropStack.setTagCompound(copyNBT); - EntityPlayer player = (EntityPlayer) entityLiving; - PlayerHelper.spawnItemOnPlayer(world, player, dropStack); - entityLiving.renderBrokenItemStack(stack); - stack.shrink(1); - } - } - - return true; - } - - @SideOnly(Side.CLIENT) - @Override - public boolean hasEffect(ItemStack stack) - { - return false; - } - - @Override - public boolean isRepairable() - { - return false; - } - - public int getItemEnchantability(ItemStack stack) - { - return 0; - } - -} diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomAxe.java b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomAxe.java index 9b59eb7f..64354a2e 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomAxe.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomAxe.java @@ -31,18 +31,12 @@ import java.util.concurrent.ThreadLocalRandom; /** * Created by mminaie on 3/20/17. */ -public class CustomAxe extends ItemAxe implements ToolNBT { +public class CustomAxe extends AbstractAxe implements ToolNBT { 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; + public CustomAxe(String name, Item.ToolMaterial material, Item damageDrop, Integer damage, Float speed) { + super(name, material, damageDrop, damage, speed); this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() { /*** @@ -225,97 +219,6 @@ public class CustomAxe extends ItemAxe implements ToolNBT { }); } - public static boolean isHidden() - { - return false; - } - - @Override - 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(); - - item.getTagCompound().setTag("tags", tags); - - /*setHot(item, false); - - setHot(item, false); - setEmerald(item, false); - setDiamondLevel(item, 0); - setRedstoneLevel(item, 0); - setLapisLevel(item, 0); - setModifiers(item, 0);*/ - } - } - - } - - @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(); - - item.getTagCompound().setTag("tags", tags); - - setHot(item, false); - setEmerald(item, false); - setDiamondLevel(item, 0); - setRedstoneLevel(item, 0); - setLapisLevel(item, 0); - setModifiers(item, 0); - } - - if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){ - - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenwroughtirontool, 1)); - } - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokencleanirontool, 1)); - } - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokensteeltool, 1)); - } - ((EntityPlayer) player).inventory.deleteStack(item); - } - } - } - - //public void onItemTooltip(ItemTooltipEvent event){ - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack item, @Nullable World world, List tooltip, ITooltipFlag flagIn) - { - if(!item.isEmpty()) - { - if (item.hasTagCompound()) - { - tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) ); - if (getEmerald(item) == true) { - tooltip.add(ChatFormatting.DARK_GREEN + "Emerald"); - } - if (getDiamondLevel(item) > 0) { - tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item)); - } - if (getRedstoneLevel(item) > 0) { - tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) ); - } - if (getLapisLevel(item) > 0) { - tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) ); - } - tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() ); - } - } - } - @Override public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) { @@ -326,101 +229,18 @@ public class CustomAxe extends ItemAxe implements ToolNBT { itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); } if( getDiamondLevel(itemstack) > 0 ){ - //itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); - itemstack.getItem().setHarvestLevel("pickaxe", 3); + itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); + //itemstack.getItem().setHarvestLevel("pickaxe", 3); } - /*if( getRedstoneLevel(itemstack) > 0 ){ + if( getRedstoneLevel(itemstack) > 0 ){ itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack)); //System.out.println(itemstack.getEnchantmentTagList()); - }*/ + } if ( getLapisLevel(itemstack) > 0) { itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack)); } } } - 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(drop, 1, stack.getItemDamage()); - NBTTagCompound copyNBT = stack.getTagCompound(); - 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"); - 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()); - NBTTagCompound copyNBT = stack.getTagCompound(); - dropStack.setTagCompound(copyNBT); - EntityPlayer player = (EntityPlayer) entityLiving; - PlayerHelper.spawnItemOnPlayer(world, player, dropStack); - entityLiving.renderBrokenItemStack(stack); - stack.shrink(1); - } - } - - return true; - } - - @Override - public float getDestroySpeed(ItemStack stack, IBlockState state) - { - Material material = state.getMaterial(); - //return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial; - - if(material != Material.WOOD && material != Material.PLANTS && material != Material.VINE){ - return super.getDestroySpeed(stack, state); - } else { - return this.efficiency * ( (this.getRedstoneLevel(stack) * 2 ) + 1); - } - - } - - @SideOnly(Side.CLIENT) - @Override - public boolean hasEffect(ItemStack stack) - { - return false; - } - - @Override - public boolean isRepairable() - { - return false; - } - - public int getItemEnchantability(ItemStack stack) - { - return 0; - } - } diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomHoe.java b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomHoe.java index 965eaa49..33b6a053 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomHoe.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomHoe.java @@ -270,16 +270,7 @@ public class CustomHoe extends ItemHoe implements ToolNBT { } if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){ - - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenwroughtirontool, 1)); - } - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokencleanirontool, 1)); - } - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokensteeltool, 1)); - } + PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(this.drop, 1)); ((EntityPlayer) player).inventory.deleteStack(item); } @@ -322,14 +313,14 @@ public class CustomHoe extends ItemHoe implements ToolNBT { if( getEmerald(itemstack)){ itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); } - /*if( getDiamondLevel(itemstack) > 0 ){ + if( getDiamondLevel(itemstack) > 0 ){ itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); - itemstack.getItem().setHarvestLevel("pickaxe", 3); - }*/ - /*if( getRedstoneLevel(itemstack) > 0 ){ + //itemstack.getItem().setHarvestLevel("pickaxe", 3); + } + if( getRedstoneLevel(itemstack) > 0 ){ itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack)); //System.out.println(itemstack.getEnchantmentTagList()); - }*/ + } if ( getLapisLevel(itemstack) > 0) { itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack)); } diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomPickaxe.java b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomPickaxe.java index 3c4c16cd..239fa0ba 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomPickaxe.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomPickaxe.java @@ -272,18 +272,8 @@ public class CustomPickaxe extends ItemPickaxe implements ToolNBT{ } - //this.setDamage(item, this.getMaxDamage(item) -2); if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){ - - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenwroughtirontool, 1)); - } - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokencleanirontool, 1)); - } - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokensteeltool, 1)); - } + PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(this.drop, 1)); ((EntityPlayer) player).inventory.deleteStack(item); } @@ -327,13 +317,13 @@ public class CustomPickaxe extends ItemPickaxe implements ToolNBT{ itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); } if( getDiamondLevel(itemstack) > 0 ){ - //itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); + itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); itemstack.getItem().setHarvestLevel("pickaxe", 3); } - /*if( getRedstoneLevel(itemstack) > 0 ){ + if( getRedstoneLevel(itemstack) > 0 ){ itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack)); //System.out.println(itemstack.getEnchantmentTagList()); - }*/ + } if ( getLapisLevel(itemstack) > 0) { itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack)); } diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomShovel.java b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomShovel.java index c38d9516..7e71ec28 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomShovel.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/CustomShovel.java @@ -272,21 +272,10 @@ public class CustomShovel extends ItemSpade implements ToolNBT { } - if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){ - - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenwroughtirontool, 1)); - } - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokencleanirontool, 1)); - } - if(this.toolMaterial == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokensteeltool, 1)); - } + PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(this.drop, 1)); ((EntityPlayer) player).inventory.deleteStack(item); } - } } @@ -326,13 +315,13 @@ public class CustomShovel extends ItemSpade implements ToolNBT { itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); } if( getDiamondLevel(itemstack) > 0 ){ - //itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); - itemstack.getItem().setHarvestLevel("shovel", 3); + itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); + //itemstack.getItem().setHarvestLevel("shovel", 3); } - /*if( getRedstoneLevel(itemstack) > 0 ){ + if( getRedstoneLevel(itemstack) > 0 ){ itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack)); //System.out.println(itemstack.getEnchantmentTagList()); - }*/ + } if ( getLapisLevel(itemstack) > 0) { itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack)); } diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzeAxe.java b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzeAxe.java new file mode 100644 index 00000000..87bc1cfe --- /dev/null +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzeAxe.java @@ -0,0 +1,113 @@ +package nmd.primal.forgecraft.items.tools.bronze; + +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.enchantment.Enchantment; +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.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import nmd.primal.core.common.helper.PlayerHelper; +import nmd.primal.forgecraft.init.ModConfig; +import nmd.primal.forgecraft.items.tools.AbstractAxe; +import nmd.primal.forgecraft.util.ToolNBT; + +import javax.annotation.Nullable; +import java.util.concurrent.ThreadLocalRandom; + +/** + * Created by mminaie on 6/25/17. + */ +public class BronzeAxe extends AbstractAxe implements ToolNBT { + + Item drop; + + public BronzeAxe(String name, Item.ToolMaterial material, Item damageDrop, Integer damage, Float speed) { + super(name, material, damageDrop, damage, speed); + + this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() { + + /*** + + hot . emerald . diamond . redstone . lapis + 0 . 0 . 0 . 0 . 0 + + ***/ + + @SideOnly(Side.CLIENT) + public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) + { + + if (item.hasTagCompound()) { + + if (getModifiers(item) != 0) { + if (getEmerald(item)) { + return 0.1F; + } + + if (getDiamondLevel(item) == 1) { + return 0.2F; + } + + if ( getRedstoneLevel(item) == 1) { + return 0.3F; + } + + if (getLapisLevel(item) == 1) { + return 0.4F; + } + } + if (getModifiers(item) == 0) { + return 0.0F; + } + } + return 0.0F; + } + }); + } + + + @Override + public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) + { + if(!player.world.isRemote){ + World world = player.getEntityWorld(); + //System.out.println(world.getBlockState(pos).getBlock()); + if(itemstack.getItem() instanceof BronzeAxe){ + if( getEmerald(itemstack)){ + itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); + } + /*if( getDiamondLevel(itemstack) > 0 ){ + itemstack.getItem().setHarvestLevel("pickaxe", 3); + }*/ + if ( getLapisLevel(itemstack) > 0) { + itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), ModConfig.Features.BRONZE_LAPIS_MULTIPLIER); + } + } + } + + return false; + } + + @Override + public float getDestroySpeed(ItemStack stack, IBlockState state) + { + Material material = state.getMaterial(); + //return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial; + + if(material != Material.WOOD && material != Material.PLANTS && material != Material.VINE){ + return super.getDestroySpeed(stack, state); + } else { + return this.efficiency + 1; + } + + } + +} diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzeHoe.java b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzeHoe.java new file mode 100644 index 00000000..c94f6379 --- /dev/null +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzeHoe.java @@ -0,0 +1,115 @@ +package nmd.primal.forgecraft.items.tools.bronze; + +import com.mojang.realmsclient.gui.ChatFormatting; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.util.ITooltipFlag; +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.ModConfig; +import nmd.primal.forgecraft.items.tools.CustomHoe; +import nmd.primal.forgecraft.util.ToolNBT; + +import javax.annotation.Nullable; +import java.util.List; +import java.util.concurrent.ThreadLocalRandom; + +/** + * Created by mminaie on 3/21/17. + */ +public class BronzeHoe extends AbstractHoe implements ToolNBT { + + Item drop; + + public BronzeHoe(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() { + + /*** + + hot . emerald . diamond . redstone . lapis + 0 . 0 . 0 . 0 . 0 + + ***/ + + @SideOnly(Side.CLIENT) + public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) + { + if (item.hasTagCompound()) { + + + if (getModifiers(item) != 0) { + if (getEmerald(item)) { + return 0.1F; + } + + if (getDiamondLevel(item) == 1) { + return 0.2F; + } + + if ( getRedstoneLevel(item) == 1) { + return 0.3F; + } + + if (getLapisLevel(item) == 1) { + return 0.4F; + } + } + if (getModifiers(item) == 0) { + return 0.0F; + } + } + return 0.0F; + } + }); + } + + @Override + public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) + { + if(!player.world.isRemote){ + World world = player.getEntityWorld(); + + if(itemstack.getItem() instanceof BronzeHoe){ + if( getEmerald(itemstack)){ + itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); + } + /*if( getDiamondLevel(itemstack) > 0 ){ + itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); + itemstack.getItem().setHarvestLevel("pickaxe", 3); + }*/ + /*if( getRedstoneLevel(itemstack) > 0 ){ + itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack)); + //System.out.println(itemstack.getEnchantmentTagList()); + } + if ( getLapisLevel(itemstack) > 0) { + itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), ModConfig.Features.BRONZE_LAPIS_MULTIPLIER); + }*/ + } + } + + return false; + } + +} diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzePickaxe.java b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzePickaxe.java similarity index 87% rename from kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzePickaxe.java rename to kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzePickaxe.java index 615ef331..700a118b 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzePickaxe.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzePickaxe.java @@ -1,4 +1,4 @@ -package nmd.primal.forgecraft.items.tools; +package nmd.primal.forgecraft.items.tools.bronze; import com.mojang.realmsclient.gui.ChatFormatting; import net.minecraft.block.material.Material; @@ -20,7 +20,7 @@ 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.init.ModConfig; import nmd.primal.forgecraft.util.ToolNBT; import javax.annotation.Nullable; @@ -131,7 +131,7 @@ public class BronzePickaxe extends ItemPickaxe implements ToolNBT{ } if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenbronzetool, 1)); + PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(this.drop, 1)); ((EntityPlayer) player).inventory.deleteStack(item); } } @@ -139,27 +139,30 @@ public class BronzePickaxe extends ItemPickaxe implements ToolNBT{ //public void onItemTooltip(ItemTooltipEvent event){ - @Override + @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack item, @Nullable World world, List tooltip, ITooltipFlag flagIn) { - //tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() ); - if(item.hasTagCompound()) + if(!item.isEmpty()) { - tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) ); - if (getEmerald(item) == true) { - tooltip.add(ChatFormatting.DARK_GREEN + "Emerald"); + if (item.hasTagCompound()) + { + tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) ); + if (getEmerald(item) == true) { + tooltip.add(ChatFormatting.DARK_GREEN + "Emerald"); + } + if (getDiamondLevel(item) > 0) { + tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item)); + } + if (getRedstoneLevel(item) > 0) { + tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) ); + } + if (getLapisLevel(item) > 0) { + int lapisOutput = Integer.valueOf(ModConfig.Features.BRONZE_LAPIS_MULTIPLIER) ; + tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + Integer.toString(lapisOutput*1)); + } + tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() ); } - if (getDiamondLevel(item) > 0) { - tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item)); - } - if (getRedstoneLevel(item) > 0) { - tooltip.add(ChatFormatting.RED + "Redstone Level: " + 1 ); - } - if (getLapisLevel(item) > 0) { - tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 ); - } - tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() ); } } @@ -178,7 +181,7 @@ public class BronzePickaxe extends ItemPickaxe implements ToolNBT{ itemstack.getItem().setHarvestLevel("pickaxe", 3); }*/ if ( getLapisLevel(itemstack) > 0) { - itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5); + itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), ModConfig.Features.BRONZE_LAPIS_MULTIPLIER); } } } diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzeShovel.java b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzeShovel.java similarity index 87% rename from kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzeShovel.java rename to kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzeShovel.java index a8d16f74..2ef6518e 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/tools/BronzeShovel.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/tools/bronze/BronzeShovel.java @@ -1,4 +1,4 @@ -package nmd.primal.forgecraft.items.tools; +package nmd.primal.forgecraft.items.tools.bronze; import com.google.common.collect.Sets; import com.mojang.realmsclient.gui.ChatFormatting; @@ -22,7 +22,7 @@ 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.init.ModConfig; import nmd.primal.forgecraft.util.ToolNBT; import javax.annotation.Nullable; @@ -133,7 +133,7 @@ Item drop; } if( this.getMaxDamage(item) - this.getDamage(item) <= 1 ){ - PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(ModItems.brokenbronzetool, 1)); + PlayerHelper.spawnItemOnPlayer(world, (EntityPlayer) player, new ItemStack(this.drop, 1)); ((EntityPlayer) player).inventory.deleteStack(item); } } @@ -145,23 +145,25 @@ Item drop; @SideOnly(Side.CLIENT) public void addInformation(ItemStack item, @Nullable World world, List tooltip, ITooltipFlag flagIn) { - //tooltip.add(ChatFormatting.GRAY + "Damage: " + item.getItemDamage() ); - if(item.hasTagCompound()) + if(!item.isEmpty()) { - tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) ); - if (getEmerald(item) == true) { - tooltip.add(ChatFormatting.DARK_GREEN + "Emerald"); + if (item.hasTagCompound()) + { + tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (1 - getModifiers(item)) ); + if (getEmerald(item) == true) { + tooltip.add(ChatFormatting.DARK_GREEN + "Emerald"); + } + if (getDiamondLevel(item) > 0) { + tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item)); + } + if (getRedstoneLevel(item) > 0) { + tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) ); + } + if (getLapisLevel(item) > 0) { + tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + Integer.toString(ModConfig.Features.BRONZE_LAPIS_MULTIPLIER)); + } + tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() ); } - if (getDiamondLevel(item) > 0) { - tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item)); - } - if (getRedstoneLevel(item) > 0) { - tooltip.add(ChatFormatting.RED + "Redstone Level: " + 1 ); - } - if (getLapisLevel(item) > 0) { - tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + 5 ); - } - tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() ); } } @@ -176,7 +178,7 @@ Item drop; itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); } if ( getLapisLevel(itemstack) > 0) { - itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5); + itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), ModConfig.Features.BRONZE_LAPIS_MULTIPLIER); } } } diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/weapons/Longbow.java b/kfc/src/main/java/nmd/primal/forgecraft/items/weapons/Longbow.java index ad9587b7..a2032bbf 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/weapons/Longbow.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/weapons/Longbow.java @@ -179,13 +179,15 @@ public class Longbow extends BaseItem { public static float getArrowVelocity(int charge) { - float f = (float)charge / 5.0F; - f = (f * f + f * 2.0F); + float f = (float)charge / 120; if (f > 1.0F) { f = 1.0F; } + if(f < 0.1){ + f =0.1f; + } return f; } diff --git a/kfc/src/main/java/nmd/primal/forgecraft/tiles/TileAnvil.java b/kfc/src/main/java/nmd/primal/forgecraft/tiles/TileAnvil.java index 50e9bbba..a6bb93f7 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/tiles/TileAnvil.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/tiles/TileAnvil.java @@ -5,6 +5,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ITickable; import net.minecraft.util.NonNullList; import net.minecraft.world.World; +import nmd.primal.core.api.PrimalAPI; +import nmd.primal.forgecraft.items.BaseMultiItem; +import nmd.primal.forgecraft.items.parts.ToolPart; /** * Created by mminaie on 3/4/17. @@ -44,39 +47,27 @@ public class TileAnvil extends TileBaseSlot implements ITickable { if (!world.isRemote) { IBlockState state = world.getBlockState(this.pos); - - /*** - Cooling Code - */ - /*if ( ThreadLocalRandom.current().nextInt(0,10000) == 0 ) { + if(PrimalAPI.randomCheck(1800)){ for(int i=0; i=301){ + iteration =0; + } craftingManager(); } - if(this.iteration == 299){ - this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos); - } + + } } @@ -144,7 +140,7 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{ if(h > 0) { this.setHeat(h - 25); } - if(h < 10 ){ + if(h < 50 ){ world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, false), 2); } } diff --git a/kfc/testbuild.txt b/kfc/testbuild.txt deleted file mode 100644 index 2be6d3f3..00000000 --- a/kfc/testbuild.txt +++ /dev/null @@ -1,77 +0,0 @@ -buildscript { - repositories { - jcenter() - maven { url = "http://files.minecraftforge.net/maven" } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' - } -} -apply plugin: 'net.minecraftforge.gradle.forge' -//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. - - -version = "1.0" -group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = "modid" - -sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. -compileJava { - sourceCompatibility = targetCompatibility = '1.8' -} - -minecraft { - version = "1.12-14.21.0.2368" - runDir = "run" - - // the mappings can be changed at any time, and must be in the following format. - // snapshot_YYYYMMDD snapshot are built nightly. - // stable_# stables are built at the discretion of the MCP team. - // Use non-default mappings at your own risk. they may not always work. - // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "snapshot_20170624" - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. -} - -dependencies { - // you may put jars on which you depend on in ./libs - // or you may define them like so.. - //compile "some.group:artifact:version:classifier" - //compile "some.group:artifact:version" - - // real examples - //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. - //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, - // except that these dependencies get remapped to your current MCP mappings - //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' - //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // for more info... - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html - -} - -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - - // copy everything else except the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -}