i think ready for update

This commit is contained in:
Mohammad-Ali Minaie
2017-06-25 14:58:57 -04:00
parent 27e670e537
commit 69b25b37ff
42 changed files with 1419 additions and 461 deletions

View File

@@ -4,9 +4,9 @@ To-Dos
*** Current Feature *** *** Current Feature ***
- [ ] BlockBreaker Support for copper dust and tin dust - [x] BlockBreaker Support for copper dust and tin dust
- [x] picking up raw bronze crucible returns some other shit - [x] picking up raw bronze crucible returns some other shit
- [ ] Tool breaking should return tool head```` - [ ] Tool breaking should return tool head
*** Feature Musket *** *** Feature Musket ***
- [ ] Create powder charge item (copper, charcoal, gunpowder) - [ ] Create powder charge item (copper, charcoal, gunpowder)

View File

@@ -5,11 +5,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent; 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.parts.ToolPart;
import nmd.primal.forgecraft.items.tools.CustomAxe; import nmd.primal.forgecraft.items.tools.*;
import nmd.primal.forgecraft.items.tools.CustomHoe;
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
import nmd.primal.forgecraft.items.tools.CustomShovel;
import nmd.primal.forgecraft.util.ToolNBT; import nmd.primal.forgecraft.util.ToolNBT;
/** /**
@@ -23,13 +21,13 @@ public class CommonEvents implements ToolNBT {
if(!event.player.getEntityWorld().isRemote) { if(!event.player.getEntityWorld().isRemote) {
if (event.crafting.getItem() instanceof CustomPickaxe) { if (event.crafting.getItem() instanceof CustomPickaxe || event.crafting.getItem() instanceof BronzePickaxe) {
NBTTagCompound tempTag = new NBTTagCompound(); NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart) { if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
@@ -38,13 +36,13 @@ public class CommonEvents implements ToolNBT {
} }
} }
} }
if (event.crafting.getItem() instanceof CustomAxe) { if (event.crafting.getItem() instanceof CustomAxe || event.crafting.getItem() instanceof BronzeAxe) {
NBTTagCompound tempTag = new NBTTagCompound(); NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart) { if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
@@ -53,70 +51,64 @@ public class CommonEvents implements ToolNBT {
} }
} }
} }
if (event.crafting.getItem() instanceof CustomShovel) { if (event.crafting.getItem() instanceof CustomShovel || event.crafting.getItem() instanceof BronzeShovel) {
NBTTagCompound tempTag = new NBTTagCompound(); NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart) { if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage()); event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
//if( getDiamondLevel(event.crafting) > 0 ){
// event.crafting.getItem().setHarvestLevel("pickaxe", 3);
//}
} }
} }
} }
} }
if (event.crafting.getItem() instanceof CustomHoe) { if (event.crafting.getItem() instanceof CustomHoe || event.crafting.getItem() instanceof BronzeHoe) {
NBTTagCompound tempTag = new NBTTagCompound(); NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart) { if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage()); event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
//if( getDiamondLevel(event.crafting) > 0 ){
// event.crafting.getItem().setHarvestLevel("pickaxe", 3);
//}
} }
} }
} }
} }
if (event.crafting.getItem() instanceof ToolPart) { if (event.crafting.getItem() instanceof ToolPart || event.crafting.getItem() instanceof BronzeToolPart) {
NBTTagCompound tempTag = new NBTTagCompound(); NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof CustomAxe) { if (a.getItem() instanceof CustomAxe || a.getItem() instanceof BronzeAxe) {
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage(); Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage); event.crafting.setItemDamage(tempDamage);
} }
if (a.getItem() instanceof CustomPickaxe) { if (a.getItem() instanceof CustomPickaxe || a.getItem() instanceof BronzePickaxe) {
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage(); Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage); event.crafting.setItemDamage(tempDamage);
} }
if (a.getItem() instanceof CustomShovel) { if (a.getItem() instanceof CustomShovel || a.getItem() instanceof BronzeShovel) {
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage(); Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage); event.crafting.setItemDamage(tempDamage);
} }
if (a.getItem() instanceof CustomHoe) { if (a.getItem() instanceof CustomHoe || a.getItem() instanceof BronzeHoe) {
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());

View File

@@ -15,6 +15,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
@@ -63,7 +65,7 @@ public class BloomeryBase extends CustomContainerFacing implements ITileEntityPr
return new TileBloomery(); return new TileBloomery();
} }
@Override /*@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random) public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{ {
this.updateTick(world, pos, state, random); this.updateTick(world, pos, state, random);
@@ -72,7 +74,7 @@ public class BloomeryBase extends CustomContainerFacing implements ITileEntityPr
FireHelper.makeSmoke(world, pos, 50); FireHelper.makeSmoke(world, pos, 50);
} }
} }
} }*/
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
@@ -106,10 +108,13 @@ public class BloomeryBase extends CustomContainerFacing implements ITileEntityPr
stringRemainingTime = remainingTime.toString(); stringRemainingTime = remainingTime.toString();
} }
String display =
ITextComponent itextcomponent = new TextComponentString("Current Temp: " + stringBloomeryHeat + " Ideal Temp: " + stringIdealTemp + " Ticks Remaining: " + stringRemainingTime); "Current Temp: " + stringBloomeryHeat + '\n'
player.sendStatusMessage(itextcomponent, true); + "Ideal Temp: " + stringIdealTemp + '\n'
//System.out.println(pos); + "Ticks Remaining: " + stringRemainingTime + '\n'
+ "Fuel Remaining: " + tile.getSlotStack(0).getCount() + '\n';
ITextComponent itextcomponent = new TextComponentString(display);
player.sendStatusMessage(itextcomponent, false);
return true; return true;
} }
} }

View File

@@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
import nmd.primal.core.api.PrimalBlocks;
import nmd.primal.core.api.PrimalItems; import nmd.primal.core.api.PrimalItems;
import nmd.primal.core.common.helper.CommonUtils; import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.crafting.AnvilCrafting; import nmd.primal.forgecraft.crafting.AnvilCrafting;
@@ -25,6 +26,16 @@ public class ModCrafting {
Random rand = new Random(); Random rand = new Random();
/***CASTING BLOCK***/
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.castingblock),
" B ", "BXB", " B ", 'X', Blocks.STONE_SLAB, 'B', PrimalItems.ADOBEBRICK_DRY);
/***CASTING FORM***/
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.castingform, 1),
true, new Object[]{" S ", "S S", " S ",
('S'), "logSplit"
}));
/***Forge***/ /***Forge***/
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.forge_brick), GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.forge_brick),
"X X", "XYX", "X X", 'X', Items.BRICK, 'Y', Blocks.FURNACE); "X X", "XYX", "X X", 'X', Items.BRICK, 'Y', Blocks.FURNACE);
@@ -135,9 +146,16 @@ public class ModCrafting {
('E'), PrimalItems.EMERALD_KNAPP, ('E'), PrimalItems.EMERALD_KNAPP,
('Y'), ModBlocks.rawbronzecrucible)); ('Y'), ModBlocks.rawbronzecrucible));
/***************************************************************
* TOOL CRAFTING RECIPES
***************************************************************/
/***Pickaxe Crafting***/ /***Pickaxe Crafting***/
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzepickaxe), "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), "T", "C", "S",
('T'), new ItemStack(ModItems.pickaxehead, 1, OreDictionary.WILDCARD_VALUE), //new ItemStack( 1, OreDictionary.WILDCARD_VALUE), ('T'), new ItemStack(ModItems.pickaxehead, 1, OreDictionary.WILDCARD_VALUE), //new ItemStack( 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK, ('S'), PrimalItems.LACQUER_STICK,
@@ -156,18 +174,29 @@ public class ModCrafting {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.IRON_PICKAXE), "T", "S", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.IRON_PICKAXE), "T", "S",
('T'), ModItems.pickaxehead, ('T'), ModItems.pickaxehead,
('S'), Items.STICK)); ('S'), Items.STICK));
//TODO wootz placeholder
//placeholder wootz
/***Axe Crafting***/ /***Axe Crafting***/
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzeaxe), "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), "T", "C", "S",
('T'), new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE), ('T'), new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK, ('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral")); ('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), "T", "C", "S",
('T'), new ItemStack(ModItems.cleanironaxehead, 1, OreDictionary.WILDCARD_VALUE), ('T'), new ItemStack(ModItems.cleanironaxehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK, ('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral")); ('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelaxe), "T", "C", "S", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelaxe), "T", "C", "S",
('T'), new ItemStack(ModItems.steelaxehead,1, OreDictionary.WILDCARD_VALUE), ('T'), new ItemStack(ModItems.steelaxehead,1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK, ('S'), PrimalItems.LACQUER_STICK,
@@ -178,14 +207,21 @@ public class ModCrafting {
('S'), Items.STICK)); ('S'), Items.STICK));
/***Shovel Crafting***/ /***Shovel Crafting***/
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzeshovel), "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), "T", "C", "S",
('T'), new ItemStack(ModItems.ironshovelhead, 1, OreDictionary.WILDCARD_VALUE), ('T'), new ItemStack(ModItems.ironshovelhead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK, ('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral")); ('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironshovel), "T", "C", "S", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironshovel), "T", "C", "S",
('T'), new ItemStack(ModItems.cleanironshovelhead, 1, OreDictionary.WILDCARD_VALUE), ('T'), new ItemStack(ModItems.cleanironshovelhead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK, ('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral")); ('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelshovel), "T", "C", "S", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelshovel), "T", "C", "S",
('T'), new ItemStack(ModItems.steelshovelhead, 1, OreDictionary.WILDCARD_VALUE), ('T'), new ItemStack(ModItems.steelshovelhead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK, ('S'), PrimalItems.LACQUER_STICK,
@@ -196,14 +232,21 @@ public class ModCrafting {
('S'), Items.STICK)); ('S'), Items.STICK));
/***Hoe Crafting***/ /***Hoe Crafting***/
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzehoe), "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), "T", "C", "S",
('T'), new ItemStack(ModItems.ironhoehead, 1, OreDictionary.WILDCARD_VALUE), ('T'), new ItemStack(ModItems.ironhoehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK, ('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral")); ('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironhoe), "T", "C", "S", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cleanironhoe), "T", "C", "S",
('T'), new ItemStack(ModItems.cleanironhoehead, 1, OreDictionary.WILDCARD_VALUE), ('T'), new ItemStack(ModItems.cleanironhoehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK, ('S'), PrimalItems.LACQUER_STICK,
('C'), "cordageGeneral")); ('C'), "cordageGeneral"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelhoe), "T", "C", "S", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.steelhoe), "T", "C", "S",
('T'), new ItemStack(ModItems.steelhoehead, 1, OreDictionary.WILDCARD_VALUE), ('T'), new ItemStack(ModItems.steelhoehead, 1, OreDictionary.WILDCARD_VALUE),
('S'), PrimalItems.LACQUER_STICK, ('S'), PrimalItems.LACQUER_STICK,
@@ -215,11 +258,24 @@ public class ModCrafting {
/*************************************************************** /***************************************************************
* TEMPORARY RECIPES * TOOL DISASSEMBLY RECIPES
***************************************************************/ ***************************************************************/
//GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE), //GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE),
// " ", " X ", " ", 'X', ModItems.ironaxe); // " ", " X ", " ", 'X', ModItems.ironaxe);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzeaxehead, 1, OreDictionary.WILDCARD_VALUE),
true, "X", ('X'), new ItemStack(ModItems.bronzeaxe, 1, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzepickaxehead, 1, OreDictionary.WILDCARD_VALUE),
true, "X", ('X'), new ItemStack(ModItems.bronzepickaxe, 1, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzeshovelhead, 1, OreDictionary.WILDCARD_VALUE),
true, "X", ('X'), new ItemStack(ModItems.bronzeshovel, 1, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.bronzehoehead, 1, OreDictionary.WILDCARD_VALUE),
true, "X", ('X'), new ItemStack(ModItems.bronzehoe, 1, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE),
true, "X", ('X'), new ItemStack(ModItems.ironaxe, 1, OreDictionary.WILDCARD_VALUE))); true, "X", ('X'), new ItemStack(ModItems.ironaxe, 1, OreDictionary.WILDCARD_VALUE)));

View File

@@ -17,9 +17,4 @@ public class ModEvents {
} }
@SideOnly(Side.CLIENT)
public static void registerClientEvents() {
//MinecraftForge.EVENT_BUS.register(new ClientEvents());
}
} }

View File

@@ -18,10 +18,7 @@ import nmd.primal.forgecraft.items.*;
import nmd.primal.forgecraft.items.casting.CastingPart; import nmd.primal.forgecraft.items.casting.CastingPart;
import nmd.primal.forgecraft.items.parts.BronzeToolPart; import nmd.primal.forgecraft.items.parts.BronzeToolPart;
import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.tools.CustomAxe; import nmd.primal.forgecraft.items.tools.*;
import nmd.primal.forgecraft.items.tools.CustomHoe;
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
import nmd.primal.forgecraft.items.tools.CustomShovel;
import nmd.primal.forgecraft.items.weapons.CustomShield; import nmd.primal.forgecraft.items.weapons.CustomShield;
import nmd.primal.forgecraft.items.weapons.CustomSword; import nmd.primal.forgecraft.items.weapons.CustomSword;
@@ -80,6 +77,11 @@ public class ModItems {
public static Item bronzeshovelhead; public static Item bronzeshovelhead;
public static Item bronzehoehead; public static Item bronzehoehead;
public static Item bronzepickaxe;
public static Item bronzeaxe;
public static Item bronzeshovel;
public static Item bronzehoe;
public static Item ironpickaxe; public static Item ironpickaxe;
public static Item ironaxe; public static Item ironaxe;
public static Item ironshovel; public static Item ironshovel;
@@ -165,6 +167,11 @@ public class ModItems {
/********** /**********
TOOLS 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);
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalMaterials.TOOL_WROUGHT_IRON); ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalMaterials.TOOL_WROUGHT_IRON);
ironaxe = new CustomAxe("ironaxe", PrimalMaterials.TOOL_WROUGHT_IRON); ironaxe = new CustomAxe("ironaxe", PrimalMaterials.TOOL_WROUGHT_IRON);
ironshovel = new CustomShovel("ironshovel", PrimalMaterials.TOOL_WROUGHT_IRON); ironshovel = new CustomShovel("ironshovel", PrimalMaterials.TOOL_WROUGHT_IRON);
@@ -269,6 +276,11 @@ public class ModItems {
/********** /**********
TOOLS TOOLS
**********/ **********/
GameRegistry.register(bronzepickaxe);
GameRegistry.register(bronzeaxe);
GameRegistry.register(bronzeshovel);
GameRegistry.register(bronzehoe);
GameRegistry.register(ironpickaxe); GameRegistry.register(ironpickaxe);
GameRegistry.register(ironaxe); GameRegistry.register(ironaxe);
GameRegistry.register(ironshovel); GameRegistry.register(ironshovel);
@@ -355,6 +367,11 @@ public class ModItems {
/********** /**********
TOOLS TOOLS
**********/ **********/
registerRender(bronzepickaxe);
registerRender(bronzeaxe);
registerRender(bronzeshovel);
registerRender(bronzehoe);
registerRender(ironpickaxe); registerRender(ironpickaxe);
registerRender(ironaxe); registerRender(ironaxe);
registerRender(ironshovel); registerRender(ironshovel);

View File

@@ -1,86 +0,0 @@
package nmd.primal.forgecraft.items.tools;
import com.google.common.collect.Sets;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import java.util.Set;
/**
* Created by mminaie on 3/29/17.
*/
public abstract class BasePickaxe extends BaseTool
{
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE});
protected BasePickaxe(ForgeToolMaterial material)
{
super(1.0F, -2.8F, material, EFFECTIVE_ON);
}
/**
* Check whether this Item can harvest the given Block
*/
public boolean canHarvestBlock(IBlockState blockIn)
{
Block block = blockIn.getBlock();
if (block == Blocks.OBSIDIAN)
{
return this.toolMaterial.getHarvestLevel() == 3;
}
else if (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE)
{
if (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK)
{
if (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE)
{
if (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE)
{
if (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE)
{
if (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE)
{
Material material = blockIn.getMaterial();
return material == Material.ROCK ? true : (material == Material.IRON ? true : material == Material.ANVIL);
}
else
{
return this.toolMaterial.getHarvestLevel() >= 2;
}
}
else
{
return this.toolMaterial.getHarvestLevel() >= 1;
}
}
else
{
return this.toolMaterial.getHarvestLevel() >= 1;
}
}
else
{
return this.toolMaterial.getHarvestLevel() >= 2;
}
}
else
{
return this.toolMaterial.getHarvestLevel() >= 2;
}
}
else
{
return this.toolMaterial.getHarvestLevel() >= 2;
}
}
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();
return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
}
}

View File

@@ -1,262 +0,0 @@
package nmd.primal.forgecraft.items.tools;
import com.google.common.collect.Multimap;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Set;
/**
* Created by mminaie on 3/29/17.
*/
public abstract class BaseTool extends Item {
private final Set<Block> effectiveBlocks;
protected float efficiencyOnProperMaterial;
/** Damage versus entities. */
protected float damageVsEntity;
protected float attackSpeed;
/** The material this tool is made from. */
protected ForgeToolMaterial toolMaterial;
protected BaseTool(float attackDamageIn, float attackSpeedIn, ForgeToolMaterial materialIn, Set<Block> effectiveBlocksIn)
{
this.efficiencyOnProperMaterial = 4.0F;
this.toolMaterial = materialIn;
this.effectiveBlocks = effectiveBlocksIn;
this.maxStackSize = 1;
this.setMaxDamage(materialIn.getMaxUses());
this.efficiencyOnProperMaterial = materialIn.getEfficiencyOnProperMaterial();
this.damageVsEntity = attackDamageIn + materialIn.getDamageVsEntity();
this.attackSpeed = attackSpeedIn;
this.setCreativeTab(CreativeTabs.TOOLS);
}
protected BaseTool(ForgeToolMaterial materialIn, Set<Block> effectiveBlocksIn)
{
this(0.0F, 0.0F, materialIn, effectiveBlocksIn);
}
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
for (String type : getToolClasses(stack))
{
if (state.getBlock().isToolEffective(type, state))
return efficiencyOnProperMaterial;
}
return this.effectiveBlocks.contains(state.getBlock()) ? this.efficiencyOnProperMaterial : 1.0F;
}
public static enum ForgeToolMaterial {
IRON(2, 250, 6.0F, 2.0F, 14);
//DIAMOND(3, 1561, 8.0F, 3.0F, 10),
//GOLD(0, 32, 12.0F, 0.0F, 22);
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = WOOD/GOLD)
*/
private int harvestLevel;
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
private int maxUses;
/**
* The strength of this tool material against blocks which it is effective against.
*/
private float efficiencyOnProperMaterial;
/**
* Damage versus entities.
*/
private float damageVsEntity;
/**
* Defines the natural enchantability factor of the material.
*/
private int enchantability;
//Added by forge for custom Tool materials.
ForgeToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) {
this.harvestLevel = harvestLevel;
this.maxUses = maxUses;
this.efficiencyOnProperMaterial = efficiency;
this.damageVsEntity = damageVsEntity;
this.enchantability = enchantability;
}
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
public int getMaxUses() {
return this.maxUses;
}
public void setMaxUses(int maxUses) {
this.maxUses = maxUses;
}
/**
* The strength of this tool material against blocks which it is effective against.
*/
public float getEfficiencyOnProperMaterial() {
return this.efficiencyOnProperMaterial;
}
public void setEfficiencyOnProperMaterial(float efficiencyOnProperMaterial) {
this.efficiencyOnProperMaterial = efficiencyOnProperMaterial;
}
/**
* Returns the damage against a given entity.
*/
public float getDamageVsEntity() {
return this.damageVsEntity;
}
public void setDamageVsEntity(float damageVsEntity) {
this.damageVsEntity = damageVsEntity;
}
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
public int getHarvestLevel() {
return this.harvestLevel;
}
public void setHarvestLevel(int harvestLevel) {
this.harvestLevel = harvestLevel;
}
/**
* Return the natural enchantability factor of the material.
*/
public int getEnchantability() {
return this.enchantability;
}
public void setEnchantability(int enchantability) {
this.enchantability = enchantability;
}
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
{
stack.damageItem(2, attacker);
return true;
}
/**
* Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic.
*/
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.damageItem(1, entityLiving);
}
return true;
}
/**
* Returns True is the item is renderer in full 3D when hold.
*/
@SideOnly(Side.CLIENT)
public boolean isFull3D()
{
return true;
}
public ForgeToolMaterial getToolMaterial()
{
return this.toolMaterial;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return this.toolMaterial.getEnchantability();
}
/**
* Return the name for this tool's material.
*/
public String getToolMaterialName()
{
return this.toolMaterial.toString();
}
/**
* Return whether this item is repairable in an anvil.
*/
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
{
return false;
}
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
{
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
{
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Tool modifier", (double)this.damageVsEntity, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", (double)this.attackSpeed, 0));
}
return multimap;
}
/*===================================== FORGE START =================================*/
@javax.annotation.Nullable
private String toolClass;
@Override
public int getHarvestLevel(ItemStack stack, String toolClass, @javax.annotation.Nullable net.minecraft.entity.player.EntityPlayer player, @javax.annotation.Nullable IBlockState blockState)
{
int level = super.getHarvestLevel(stack, toolClass, player, blockState);
if (level == -1 && toolClass.equals(this.toolClass))
{
return this.toolMaterial.getHarvestLevel();
}
else
{
return level;
}
}
@Override
public Set<String> getToolClasses(ItemStack stack)
{
return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack);
}
/*===================================== FORGE END =================================*/
}

View File

@@ -0,0 +1,235 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
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.ItemAxe;
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.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 BronzeAxe(String name, Item.ToolMaterial material) {
super(material, 5, -2f);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (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.bronzeaxehead, 1));
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(!item.isEmpty()) {
if (player.getEntityWorld().isRemote) {
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();
//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 ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
return true;
}
@Override
public float getStrVsBlock(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.getStrVsBlock(stack, state);
} else {
return this.efficiencyOnProperMaterial + 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;
}
}

View File

@@ -0,0 +1,223 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
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.ItemHoe;
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.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 {
public BronzeHoe(String name, ToolMaterial material) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (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.bronzehoehead, 1));
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
//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
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
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;
}
}

View File

@@ -0,0 +1,236 @@
package nmd.primal.forgecraft.items.tools;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
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.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.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/14/17.
*/
public class BronzePickaxe extends ItemPickaxe implements ToolNBT{
public BronzePickaxe(String name, ToolMaterial material) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
//this.toolClass = "pickaxe";
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.bronzepickaxehead, 1));
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
//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();
//System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof BronzePickaxe){
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 ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
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;
}
@Override
public float getStrVsBlock(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.IRON && material != Material.ANVIL && material != Material.ROCK){
return super.getStrVsBlock(stack, state);
} else {
return this.efficiencyOnProperMaterial + 1;
}
}
}

View File

@@ -0,0 +1,232 @@
package nmd.primal.forgecraft.items.tools;
import com.google.common.collect.Sets;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
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.Blocks;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.ItemSpade;
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.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.util.ToolNBT;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 3/21/17.
*/
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});
public BronzeShovel(String name, ToolMaterial material) {
super(material);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
/***
hot . emerald . diamond . redstone . lapis
0 . 0 . 0 . 0 . 0
***/
@SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
if (item.hasTagCompound()) {
if (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.bronzeshovelhead, 1));
}
}
}
//public void onItemTooltip(ItemTooltipEvent event){
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if(player.getEntityWorld().isRemote) {
//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 BronzeShovel){
if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
}
if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), 5);
}
}
}
return false;
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
if (!worldIn.isRemote && (double)state.getBlockHardness(worldIn, pos) != 0.0D)
{
stack.getTagCompound().removeTag("ench");
//System.out.println(stack.getTagCompound());
if(getDiamondLevel(stack) > 0) {
if(ThreadLocalRandom.current().nextInt(0, getDiamondLevel(stack)) == 0) {
stack.damageItem(1, entityLiving);
}
} else stack.damageItem(1, entityLiving);
}
return true;
}
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
for (String type : getToolClasses(stack))
{
if (state.getBlock().isToolEffective(type, state))
return efficiencyOnProperMaterial;
}
return this.efficiencyOnProperMaterial + 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;
}
}

View File

@@ -298,7 +298,7 @@ public class CustomHoe extends ItemHoe implements ToolNBT {
{ {
if(!player.world.isRemote){ if(!player.world.isRemote){
World world = player.getEntityWorld(); World world = player.getEntityWorld();
System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof CustomHoe){ if(itemstack.getItem() instanceof CustomHoe){
if( getEmerald(itemstack)){ if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);

View File

@@ -304,14 +304,13 @@ public class CustomShovel extends ItemSpade implements ToolNBT {
{ {
if(!player.world.isRemote){ if(!player.world.isRemote){
World world = player.getEntityWorld(); World world = player.getEntityWorld();
System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof CustomShovel){ if(itemstack.getItem() instanceof CustomShovel){
if( getEmerald(itemstack)){ if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
} }
if( getDiamondLevel(itemstack) > 0 ){ if( getDiamondLevel(itemstack) > 0 ){
//itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack)); //itemstack.addEnchantment(Enchantment.getEnchantmentByID(34), getDiamondLevel(itemstack));
itemstack.getItem().setHarvestLevel("pickaxe", 3); itemstack.getItem().setHarvestLevel("shovel", 3);
} }
/*if( getRedstoneLevel(itemstack) > 0 ){ /*if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack)); itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));

View File

@@ -103,21 +103,38 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
private void slotZeroManager(World world){ private void slotZeroManager(World world){
if(this.getSlotStack(0) != ItemStack.EMPTY) { if(this.getSlotStack(0) != ItemStack.EMPTY) {
Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 100); Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 5);
if(decrInt == 0) { if(decrInt == 0) {
decrInt = 1; decrInt = 1;
} }
Integer size = this.getSlotStack(0).getCount();
Integer burnModifier = 0;
if(size / 16 <= 1){
burnModifier = 1;
}
if(size / 16 > 1 && size / 16 <= 2){
burnModifier = 2;
}
if(size / 16 > 2 && size / 16 <= 3){
burnModifier = 3;
}
if(size / 16 > 3 && size / 16 <= 4){
burnModifier = 4;
}
if (world.rand.nextInt(decrInt) == 0) { if (world.rand.nextInt(decrInt) == 0) {
this.decrStackSize(0, 1); if (world.rand.nextInt(burnModifier) == 0) {
this.markDirty(); System.out.println("Fuel Burn" + this.getSlotStack(0));
this.updateBlock(); this.decrStackSize(0, 1);
this.markDirty();
this.updateBlock();
}
} }
if (this.getSlotStack(0).getCount() == 1){ if (this.getSlotStack(0).getCount() == 1){
this.decrStackSize(0, 1); this.decrStackSize(0, 1);
this.markDirty(); this.markDirty();
this.updateBlock(); this.updateBlock();
} }
if(CommonUtils.randomCheck(200)) { if(CommonUtils.randomCheck(1000)) {
makeSmoke(world, pos); makeSmoke(world, pos);
} }
} }

View File

@@ -63,21 +63,38 @@ public class TileForge extends TileBaseSlot implements ITickable {
private void slotZeroManager(World world){ private void slotZeroManager(World world){
if(this.getSlotStack(0) != ItemStack.EMPTY) { if(this.getSlotStack(0) != ItemStack.EMPTY) {
Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 100); Integer decrInt = (int) Math.floor(getVanillaItemBurnTime(this.getSlotStack(0)) / 5);
if(decrInt == 0) { if(decrInt == 0) {
decrInt = 1; decrInt = 1;
} }
Integer size = this.getSlotStack(0).getCount();
Integer burnModifier = 0;
if(size / 16 <= 1){
burnModifier = 1;
}
if(size / 16 > 1 && size / 16 <= 2){
burnModifier = 2;
}
if(size / 16 > 2 && size / 16 <= 3){
burnModifier = 3;
}
if(size / 16 > 3 && size / 16 <= 4){
burnModifier = 4;
}
if (world.rand.nextInt(decrInt) == 0) { if (world.rand.nextInt(decrInt) == 0) {
this.decrStackSize(0, 1); if (world.rand.nextInt(burnModifier) == 0) {
this.markDirty(); System.out.println("Fuel Burn" + this.getSlotStack(0));
this.updateBlock(); this.decrStackSize(0, 1);
this.markDirty();
this.updateBlock();
}
} }
if (this.getSlotStack(0).getCount() == 1){ if (this.getSlotStack(0).getCount() == 1){
this.decrStackSize(0, 1); this.decrStackSize(0, 1);
this.markDirty(); this.markDirty();
this.updateBlock(); this.updateBlock();
} }
if(CommonUtils.randomCheck(200)) { if(CommonUtils.randomCheck(1000)) {
makeSmoke(world, pos); makeSmoke(world, pos);
} }
} }

View File

@@ -1,16 +1,24 @@
package nmd.primal.forgecraft.util; package nmd.primal.forgecraft.util;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import nmd.primal.core.api.PrimalBlocks;
import nmd.primal.core.api.PrimalItems; import nmd.primal.core.api.PrimalItems;
import nmd.primal.core.common.helper.PlayerHelper; import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.blocks.CustomContainerFacing; import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.tiles.TileBreaker; import nmd.primal.forgecraft.tiles.TileBreaker;
import java.util.Arrays;
import static net.minecraftforge.oredict.OreDictionary.getOreIDs;
import static nmd.primal.core.common.helper.CommonUtils.randomCheck; import static nmd.primal.core.common.helper.CommonUtils.randomCheck;
//import nmd.primal.forgecraft.CommonUtils; //import nmd.primal.forgecraft.CommonUtils;
@@ -20,56 +28,55 @@ import static nmd.primal.core.common.helper.CommonUtils.randomCheck;
*/ */
public interface BreakerHandler { public interface BreakerHandler {
default void doBreaking (World world, IBlockState state, BlockPos pos, TileBreaker tile){ default boolean hasOreName(ItemStack itemStack, String oreName)
{
int[] oreIds = OreDictionary.getOreIDs(itemStack);
for(int oreId : oreIds)
{
String oreNameEntry = OreDictionary.getOreName(oreId);
if(oreName.equals(oreNameEntry))
{
return true;
}
}
return false;
}
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.EAST) { /*
int checkid = OreDictionary.getOreID(oreDictName);
for (int id:OreDictionary.getOreIDs(stack))
if(id == checkid) return true;
return false;
*/
if(tile.getCharge() > getThreshold(world, pos.east())) { // somewhere else
if (world.getBlockState(pos.east()).getBlock() == Blocks.IRON_ORE) { //if(hasOreName(new ItemStack(Blocks.LOG), "logWood"))
world.setBlockToAir(pos.east()); // item is logWood
PlayerHelper.spawnItemOnGround(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, randomChanceReturn(9, 1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+1); default void doBreaking(World world, IBlockState state, BlockPos pos, TileBreaker tile){
for (EnumFacing face : EnumFacing.values()) {
if(world.getBlockState(pos).getValue(CustomContainerFacing.FACING) == face) {
if (tile.getCharge() > getThreshold(world, pos.offset(face))) {
Block smashBlock = world.getBlockState(pos.offset(face)).getBlock();
ItemStack smashStack = new ItemStack(smashBlock, 1);
System.out.println(smashStack.getItem());
if (hasOreName(smashStack, "oreIron")) {
world.setBlockToAir(pos.offset(face));
PlayerHelper.spawnItemOnGround(world, pos.offset(face), new ItemStack(PrimalItems.IRON_DUST, randomChanceReturn(9, 1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
}
if (hasOreName(smashStack, "oreCopper")) {
world.setBlockToAir(pos.offset(face));
PlayerHelper.spawnItemOnGround(world, pos.offset(face), new ItemStack(PrimalItems.COPPER_DUST, randomChanceReturn(9, 1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
}
} else {
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 10);
} }
} else {
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+10);
} }
tile.setCharge(0.0f);
} }
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.WEST) {
if(tile.getCharge() > getThreshold(world, pos.west())) {
if (world.getBlockState(pos.west()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.west());
PlayerHelper.spawnItemOnGround(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, randomChanceReturn(9, 1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+1);
}
} else {
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+10);
}
}
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.SOUTH) {
if(tile.getCharge() > getThreshold(world, pos.south())) {
if (world.getBlockState(pos.south()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.south());
PlayerHelper.spawnItemOnGround(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, randomChanceReturn(9, 1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+1);
}
} else {
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+10);
}
}
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.NORTH) {
if(tile.getCharge() > getThreshold(world, pos.north())) {
if (world.getBlockState(pos.north()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.north());
PlayerHelper.spawnItemOnGround(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, randomChanceReturn(9, 1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+1);
}
} else {
//tile.getSlotStack(0).damageItem(10, (EntityPlayer) null);
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+10);
}
}
tile.setCharge(0.0f);
} }
default float getThreshold(World world, BlockPos pos){ default float getThreshold(World world, BlockPos pos){

View File

@@ -1,17 +1,24 @@
itemGroup.forgecraft=ForgeCraft itemGroup.forgecraft=ForgeCraft
tile.castingform.name=Casting Form
tile.castingblock.name=Casting Block
tile.bloomery_adobe.name=Adobe Bloomery tile.bloomery_adobe.name=Adobe Bloomery
tile.bloomery_brick.name=Brick Bloomery tile.bloomery_brick.name=Brick Bloomery
tile.forge_brick.name=Brick Forge tile.forge_brick.name=Brick Forge
tile.forge_adobe.name=Adobe Forge tile.forge_adobe.name=Adobe Forge
tile.blockbreaker.name= Block Breaker tile.blockbreaker.name= Block Breaker
tile.stoneanvil.name=Stone Anvil tile.stoneanvil.name=Stone Anvil
tile.ironanvil.name=Iron Anvil tile.ironanvil.name=Iron Anvil
tile.pistonbellows.name=Wooden Piston Bellows
tile.pistonbellowsoak.name=Oak Piston Bellows
tile.pistonbellowsjungle.name=Jungle Piston Bellows
tile.pistonbellowsbirch.name=Birch Piston Bellows
tile.pistonbellowsspruce.name=Spruce Piston Bellows
tile.pistonbellowsdarkoak.name=Dark Oak Piston Bellows
tile.pistonbellowsacacia.name=Acacia Piston Bellows
tile.emptycruciblehot.name=Empty Hot Crucible tile.emptycruciblehot.name=Empty Hot Crucible
tile.emptycrucible.name=Empty Crucible tile.emptycrucible.name=Empty Crucible
@@ -19,6 +26,28 @@ tile.emptycruciblehit.name=Hot Empty Crucible
tile.emptycruciblecracked.name= Cracked Empty Crucible tile.emptycruciblecracked.name= Cracked Empty Crucible
tile.emptycruciblecrackedhot.name=Cracked Hot Empty Crucible tile.emptycruciblecrackedhot.name=Cracked Hot Empty Crucible
tile.rawbronzecrucible.name=Raw Bronze Crucible
tile.hotbronzecrucible.name=Hot Bronze Crucible
tile.hotcookedbronzecrucible.name=Finished Bronze Crucible
tile.rawbronzecrucible_emerald.name=Raw Emerald Bronze Crucible
tile.hotbronzecrucible_emerald.name=Hot Emerald Bronze Crucible
tile.hotcookedbronzecrucible_emerald.name=Finished Emerald Bronze Crucible
tile.rawbronzecrucible_diamond.name=Raw Diamond Bronze Crucible
tile.hotbronzecrucible_diamond.name=Hot Diamond Bronze Crucible
tile.hotcookedbronzecrucible_diamond.name=Finished Diamond Bronze Crucible
tile.rawbronzecrucible_lapis.name=Raw Lapis Bronze Crucible
tile.hotbronzecrucible_lapis.name=Hot Lapis Bronze Crucible
tile.hotcookedbronzecrucible_lapis.name=Finished Lapis Bronze Crucible
tile.rawbronzecrucible_redstone.name=Raw Redstone Bronze Crucible
tile.hotbronzecrucible_redstone.name=Hot Redstone Bronze Crucible
tile.hotcookedbronzecrucible_redstone.name=Finished Redstone Bronze Crucible
tile.rawironcrucible.name=Filled Iron Crucible tile.rawironcrucible.name=Filled Iron Crucible
tile.hotironcrucible.name=Hot Iron Crucible tile.hotironcrucible.name=Hot Iron Crucible
tile.hotcookedironcrucible.name=Hot Cooked Iron Crucible tile.hotcookedironcrucible.name=Hot Cooked Iron Crucible
@@ -62,19 +91,33 @@ item.softcrucible.name=Soft Crucible
item.stonetongs.name=Stone Tongs item.stonetongs.name=Stone Tongs
item.forgehammer.name=Forge Hammer item.forgehammer.name=Forge Hammer
item.cast_axe.name=Axe Cast
item.cast_gladius.name=Gladius Cast
item.cast_pickaxe.name=Pickaxe Cast
item.cast_shovel.name=Shovel Cast
item.cast_hoe.name=Hoe Cast
item.bronzegladius.name=Bronze Gladius
item.ironingothot.name=Iron Ingot Hot item.ironingothot.name=Hot Iron Ingot
item.ironchunkhot.name=Iron Chunk Hot item.ironchunkhot.name=Hot Iron Chunk
item.cleanironingothot.name=Clean Iron Ingot Hot item.ironcleaningotballhot.name=Hot Clean Iron Ingot
item.cleanironchunkhot.name=Clean Iron Chunk Hot item.ironcleanchunkhot.name=Hot Clean Iron Chunk
item.steelingothot.name=Steel Ingot Hot item.steelingotballhot.name=Hot Steel Ingot
item.steelchunkhot.name=Steel Chunk Hot item.steelchunkhot.name=Hot Steel Chunk
item.wootzingothot.name=Damascus Steel Ingot Hot item.wootzingothot.name=Hot Damascus Steel Ingot
item.wootzchunkhot.name=Damascus Steel Chunk Hot item.wootzchunkhot.name=Hot Damascus Steel Chunk
item.bronzepickaxehead.name=Bronze Pickaxe Head
item.bronzeaxehead.name=Bronze Axe Head
item.bronzeshovelhead.name=Bronze Shovel Head
item.bronzehoehead.name=Bronze Hoe Head
item.bronzepickaxe.name=Bronze Pickaxe
item.bronzeaxe.name=Bronze Axe
item.bronzeshovel.name=Bronze Shovel
item.bronzehoe.name=Bronze Hoe
item.ironpickaxehead.name=Iron Pickaxe Head item.ironpickaxehead.name=Iron Pickaxe Head
item.ironaxehead.name=Iron Axe Head item.ironaxehead.name=Iron Axe Head

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,20 @@
{
"parent": "forgecraft:item/axe",
"textures": {
"particle": "forgecraft:items/finished_bronze",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:items/finished_bronze"
},
"overrides": [
{"predicate": {"type": 0.0},"model": "forgecraft:item/axe/bronze/bronzeaxe_0"},
{"predicate": {"type": 0.1},"model": "forgecraft:item/axe/bronze/bronzeaxe_1"},
{"predicate": {"type": 0.2},"model": "forgecraft:item/axe/bronze/bronzeaxe_2"},
{"predicate": {"type": 0.3},"model": "forgecraft:item/axe/bronze/bronzeaxe_3"},
{"predicate": {"type": 0.4},"model": "forgecraft:item/axe/bronze/bronzeaxe_4"}
]
}

View File

@@ -0,0 +1,20 @@
{
"parent": "forgecraft:item/hoe",
"textures": {
"particle": "forgecraft:items/finished_bronze",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:items/finished_bronze"
},
"overrides": [
{"predicate": {"type": 0.0},"model": "forgecraft:item/hoe/bronze/bronzehoe_0"},
{"predicate": {"type": 0.1},"model": "forgecraft:item/hoe/bronze/bronzehoe_1"},
{"predicate": {"type": 0.2},"model": "forgecraft:item/hoe/bronze/bronzehoe_2"},
{"predicate": {"type": 0.3},"model": "forgecraft:item/hoe/bronze/bronzehoe_3"},
{"predicate": {"type": 0.4},"model": "forgecraft:item/hoe/bronze/bronzehoe_4"}
]
}

View File

@@ -0,0 +1,16 @@
{
"parent": "forgecraft:item/pickaxe",
"textures": {
"particle": "forgecraft:items/finished_bronze",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:items/finished_bronze"
},
"overrides": [
{"predicate": {"type": 0.0},"model": "forgecraft:item/pickaxe/bronze/bronzepickaxe_0"},
{"predicate": {"type": 0.1},"model": "forgecraft:item/pickaxe/bronze/bronzepickaxe_1"},
{"predicate": {"type": 0.2},"model": "forgecraft:item/pickaxe/bronze/bronzepickaxe_2"},
{"predicate": {"type": 0.3},"model": "forgecraft:item/pickaxe/bronze/bronzepickaxe_3"},
{"predicate": {"type": 0.4},"model": "forgecraft:item/pickaxe/bronze/bronzepickaxe_4"}
]
}

View File

@@ -0,0 +1,16 @@
{
"parent": "forgecraft:item/shovel",
"textures": {
"particle": "forgecraft:items/finished_bronze",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:items/finished_bronze"
},
"overrides": [
{"predicate": {"type": 0.0},"model": "forgecraft:item/shovel/bronze/bronzeshovel_0"},
{"predicate": {"type": 0.1},"model": "forgecraft:item/shovel/bronze/bronzeshovel_1"},
{"predicate": {"type": 0.2},"model": "forgecraft:item/shovel/bronze/bronzeshovel_2"},
{"predicate": {"type": 0.3},"model": "forgecraft:item/shovel/bronze/bronzeshovel_3"},
{"predicate": {"type": 0.4},"model": "forgecraft:item/shovel/bronze/bronzeshovel_4"}
]
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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