diff --git a/Change Log.txt b/Change Log.txt new file mode 100644 index 00000000..cae3c9f0 --- /dev/null +++ b/Change Log.txt @@ -0,0 +1,184 @@ +######## 1.0.1-Snap Shot(?) ######## + +-fixed spawner display mob shaking when disabled +-removed energy cost for Draconic Chest flight +-added tool config gui +-safety flame can now be extinguished without breaking the block it is placed on +-removed a few leftover debug lines +-fixed teleporting between dimensions breaking NEI +-added tool hud display +-implemented hud display in all configurable tools +-implemented hud display in energy core & stabilized spawner +-added option to rearrange locations in advanced dislocator +-fixed galacticraft mob soul crash +-fixed disenchanter book crash +-fixed network channel name too long +-fixed chaos island server crash + +######## 1.0.0-BugFix(e) ######## + +-fixed crash when opening manual if the distortion flame or sun dial are disabled. + +######## 1.0.0-BugFix(d) ######## + +-fixed null pointer related to the dislocator stand renderer +-fixed null pointer when trying to use a dislocator stand that has an un-set dislocator + +######## 1.0.0-BugFix(c) ######## + +-fixed possible null pointer in event handler. + +######## 1.0.0-BugFix(b) ######## + +-fixed generator and grinder not respecting fuel container items. +-fixed crash when shooting Hardcore Ender Expansions dragon. +-fixed dislocators using fuel/durability when on a stand. +-fixed dragon heart not dropping from Hardcore Ender Expansions dragon. +-switched mob grinder to a fake player. + +######## 1.0.0-BugFix(a) ######## + +BUGFIX +-Fixed silk touch on tools crashing server. +-Fixed minor packet error. + +######## 1.0.0 ######## + +-Added Dislocator Stand. +-Re wrote the advanced charm of dislocation. + >Re designed gui. + >Can now teleport other players if they give consent (by sneaking) + >Can now scroll through the destinations by holding shift and scrolling. + >Now stores 100 destinations. +-Switched to the new IMessage network system (Fixes minor memory leak) +-Hid items that should not be shown in nei. +-Added Draconic Chest. +-Draconium ore now drops 4 - 12 dust when harvested with fortune 3 as opposed to 2 - 8. +-Re wrote a lot of the damage and effect code for armor. +-Armor now uses RF. +-Re wrote most item information code. +-Added lore to language localization. +-Added config option to disable item lore. +-Tools are now enchantable. +-Fixed knockback not working. +-Fixed staff not mining some blocks at correct speed. +-Fixed some rendering bugginess with the particle gen. +-Removed 0.9.3-beta update fix. +-Grinder now kills in a 9x9x9 area 4 blocks bellow and 4 blocks above the grinder. +-You can now shift right click the grinder to display the kill area. +-Reduced energy usage of the tools from 450RF to 80RF per block. +-Reduced energy usage of the swords from 1000RF per hit to 250RF. +-Increased charge rates 5x. +-Added Awakened Draconium. +-Added Awakened Draconium Block. +-Added Wyvern Core (Crafting component) +-Added Awakened Core (Crafting component) +-Removed Draconic Compound. +-Removed Infused Compound. +-Added Wyvern Energy Core (Crafting component) +-Added Draconic Energy Core (Crafting component) +-Added Wyvern Flux Capacitor. +-Added Draconic Flux Capacitor. +-Added Ritual of Draconic Awakening. +-Changed a lot of crafting recipes. +-Changed the energy core and energy pylon (block) texture. +-Improved bow VOF manipulation. +-Added Achievements. +-Changed stabilized spawner upgrade requirements. +-Dislocators can now also teleport player mounts. +-Increased Energy pylon max transfer to 2,147,483,647 RF/t +-Energy core now changes colour to red as it fills. +-Draconic Helm prevents mining slowdown under water. +-Draconic Chest stops mining slowdown when flying. +-If an Energy Pylon is within range of multiple cores the core it is connected to can be toggled. +-Tools and armor now retain their energy when upgraded to draconic +-Added a recipe to create dirt from sand rotten flesh and plant matter + +######## 0.9.5-beta ######## + +Added safety matches. +Recipe Handler now uses the ore dictionary. +Added charged versions of all the tools to the creative menu. +Added Ender Comets. +Added Chaos Islands (WIP) +Added Chaos Guardian (OP Enderdragon) +Adjusted the ender arrow range. +Added Admin spawn egg (a spawn egg that can be set to any custom entity) +Ender arrow damage is now based on the distance travelled (100 blocks is fatal without fall protection of some sort) +Draconic helm clears negative potion effects. +Added Draconic Evolution info guide (An in game information gui similar to those used by other mods) +Added Diss-Enchanter. +Added Pigmen Blood Rage. +Moved camouflage slot in advanced player detector gui. +Advanced player detector now shows that block it is camouflaged as in its mouse over text (e.g. WAILA) +Placed items are now solid. +All mobs killed by the mob grinder now drop loot and player only loot. + +######## 0.9.4-beta ######## + +Fixed Armor Crash +All tool and armor item entities are now Persistent and can not be killed except if they fall out of the world +All items in the game can be placed in the world using the “Place Item” key (default P) +Added ender arrow +Improved Draconic Helm night vision effect (effect now stops immediately when you enter a lit area) +Fixed Mob grinder crash +Update Fix is now disabled by default +Fixed Buggy gui’s for grinder and generator + +######## 0.9.32-beta (Bug Fix) ######## + +Updated Cofh energy API + +######## 0.9.31-beta (Bug Fix) ######## + +Fixed Crash when killing mobs by hand + +######## 0.9.3-beta######## + +Added Energy Core Multiblock Structure +Added Energy Core +Added Energy Pylon +Updated Naming system (READ THE RELEASE NOTES!) +Added Draconium Block + +######## 0.9.2-beta ######## + +Implemented cofh energy API +Added Energy Infuser +All tools now require RF +Added Draconic armor +Added Wyvern armor +Added Stabilized mob spawner +Added Mob Soul +Mob Grinder can run on RF + +######## 0.9.1-beta ######## + +Distortion Flame is only collectable via Draconic pick or staff +Added config option to disable the Distortion Flame +Added Player Detector and Advanced Player Detector +Fixed Advanced charm of dislocation server crash +Draconium ore can no longer be destroyed by the Enderdragon +Weapons now work on the Enderdragon +Fixed Draconic Hoe use animation +Draconic Hoe now checks “isReplacable” +Reduced the teleport sound effect volume +Fixed Mining AOE bugginess +Added AOE to the Draconic Axe +Charm of Dislocation no longer works on boss mobs +Added config option to disable block damage the Draconic Bows explosive mode + +######## 0.9.0-beta ######## + +First Public release +Changed name from Tolkien Addon to Draconic Evolution +Added config file and option to disable the sun dial +Started the process of updating textures and texture names +Renamed the Translocator to Charm of Dislocation +Added the Enhanced Charm of Dislocation +Added the Mob Grinder +Added the Potentiometer +Added the Rain sensor +Optimized the leave code used by the Draconic axe to reduce lag +Renamed the Xray Block to Distortion flame +The Distortion flame can be collected using Wyvern Draconic or other pick with a mining level of 4 diff --git a/build.gradle b/build.gradle index 551e0b2b..efb594ef 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ repositories { apply plugin: 'forge' -version = "1.7.10-v1.0.1-snapshot_0" //Version System A.B.CD A=Minecraft version (increments with each new minecraft version) B=Major mod change (Will break saves) C=Release Number (Increments with each public release) D=Bugfix version (a-z) +version = "1.7.10-v1.0.1-snapshot_3" //Version System A.B.CD A=Minecraft version (increments with each new minecraft version) B=Major mod change (Will break saves) C=Release Number (Increments with each public release) D=Bugfix version (a-z) group= "com.brandon3055.draconicevolution" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Draconic-Evolution" diff --git a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java index 99e059fc..6e571bf7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java +++ b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java @@ -27,10 +27,10 @@ public class DraconicEvolution { // TODO Update Licence and add change log to gi public static CreativeTabs tabToolsWeapons = new DETab(CreativeTabs.getNextID(), References.MODID, "toolsAndWeapons", 0); public static CreativeTabs tabBlocksItems = new DETab(CreativeTabs.getNextID(), References.MODID, "blocksAndItems", 1); - public static final String networkChannelName = "DraconicEvolution"; + public static final String networkChannelName = "DEvolutionNC"; public static SimpleNetworkWrapper network; - public static boolean debug = true;//todo + public static boolean debug = false;//todo public static Enchantment reaperEnchant; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/guicomponents/ComponentConfigItemButton.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/guicomponents/ComponentConfigItemButton.java index 42f5cde2..b164ff98 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/guicomponents/ComponentConfigItemButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/guicomponents/ComponentConfigItemButton.java @@ -27,7 +27,7 @@ public class ComponentConfigItemButton extends ComponentBase { super(x, y); this.slot = slot; this.inventory = player.inventory; - if (inventory.getStackInSlot(slot) != null && ((inventory.getStackInSlot(slot).getItem() instanceof IConfigurableItem && !((IConfigurableItem) inventory.getStackInSlot(slot).getItem()).getFields(inventory.getStackInSlot(slot), slot).isEmpty()) || inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool)) hasValidItem = true;//todo && instanceof IConfigurableItem + if (inventory.getStackInSlot(slot) != null && ((inventory.getStackInSlot(slot).getItem() instanceof IConfigurableItem && !((IConfigurableItem) inventory.getStackInSlot(slot).getItem()).getFields(inventory.getStackInSlot(slot), slot).isEmpty()) || inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool)) hasValidItem = true; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java index bd562a0c..c9721b74 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java @@ -7,14 +7,13 @@ import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.passive.EntityPig; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; public class RenderMobSoul implements IItemRenderer { private Minecraft mc; - private Entity randomEntity = new EntityPig(Minecraft.getMinecraft().theWorld); + private Entity randomEntity = null; private String[] randomEntitys = new String[] {"Pig", "Sheep", "Enderman", "Zombie", "Creeper", "Cow", "Chicken", "Ozelot", "Witch", "Wolf", "MushroomCow", "Squid", "EntityHorse", "Spider", "Skeleton", "Blaze", "Bat", "Villager", "Silverfish"}; public RenderMobSoul() { @@ -35,9 +34,9 @@ public class RenderMobSoul implements IItemRenderer { @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { Entity mob = EntityList.createEntityByName(ItemNBTHelper.getString(item, "Name", "Pig"), mc.theWorld); + randomEntity = EntityList.createEntityByName(randomEntitys[(int)((Minecraft.getSystemTime() / 1000) % 18)], mc.theWorld); if (ItemNBTHelper.getString(item, "Name", "Pig").equals("Any")) mob = randomEntity; if (mob instanceof EntitySkeleton) ((EntitySkeleton)mob).setSkeletonType(ItemNBTHelper.getInteger(item, "SkeletonType", 0)); - randomEntity = EntityList.createEntityByName(randomEntitys[(int)((mc.getSystemTime() / 1000) % 18)], mc.theWorld); if (mob == null) { LogHelper.error("Invalid Mob Name:" + ItemNBTHelper.getString(item, "Name", "Pig")); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java index 0226d09c..03ad2f2d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java @@ -6,10 +6,14 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; +import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; +import net.minecraft.world.World; import java.util.List; @@ -30,10 +34,11 @@ public class DraconicAxe extends MiningTool implements IInventoryTool {//todo ax public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE).setMinMaxAndIncromente(0, 3, 1).readFromItem(stack, 0).setModifier("AOE")); - list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.TREE_MODE).readFromItem(stack, true)); + list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.TREE_MODE).readFromItem(stack, false)); return list; } + @Override public String getInventoryName() { return StatCollector.translateToLocal("info.de.toolInventoryEnch.txt"); @@ -49,39 +54,19 @@ public class DraconicAxe extends MiningTool implements IInventoryTool {//todo ax return enchant.type == EnumEnchantmentType.digger; } + @Override + public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) { + if (ItemNBTHelper.getBoolean(stack, References.TREE_MODE, false) && isTree(player.worldObj, x, y, z)) { + trimLeavs(x, y, z, player, player.worldObj, stack); + for (int i = 0; i < 9; i++) player.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(player.worldObj.getBlock(x, y, z)) + (player.worldObj.getBlockMetadata(x, y, z) << 12)); + chopTree(x, y, z, player, player.worldObj, stack); + return false; + } -// -// @Override -// public boolean isItemTool(ItemStack p_77616_1_) { -// return true; -// } -// -// @SideOnly(Side.CLIENT) -// @SuppressWarnings("unchecked") -// @Override -// public void getSubItems(Item item, CreativeTabs tab, List list) { -// list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); -// list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); -// } -// -// @Override -// public String getUnlocalizedName(){ -// -// return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); -// } -// -// @Override -// public String getUnlocalizedName(final ItemStack itemStack){ -// return getUnlocalizedName(); -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public void registerIcons(final IIconRegister iconRegister) { -// this.itemIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_axe"); -// } -// -// @Override + return super.onBlockStartBreak(stack, x, y, z, player); + } + + // @Override // public boolean onBlockStartBreak(ItemStack stack, int X, int Y, int Z, EntityPlayer player) { // World world = player.worldObj; // boolean tree = isTree(world, X, Y, Z); @@ -108,82 +93,77 @@ public class DraconicAxe extends MiningTool implements IInventoryTool {//todo ax // return true; // } // -// private boolean isTree(World world, int X, int Y, int Z) { -// final Block wood = world.getBlock(X, Y, Z); -// if (wood == null || !wood.isWood(world, X, Y, Z)) { -// return false; -// } else { -// int top = Y; -// for (int y = Y; y <= Y + 50; y++) { -// if (!world.getBlock(X, y, Z).isWood(world, X, y, Z) && !world.getBlock(X, y, Z).isLeaves(world, X, y, Z)) { -// top += y; -// break; -// } -// } -// -// int leaves = 0; -// for (int xPos = X - 1; xPos <= X + 1; xPos++) { -// for (int yPos = Y; yPos <= top; yPos++) { -// for (int zPos = Z - 1; zPos <= Z + 1; zPos++) { -// if (world.getBlock(xPos, yPos, zPos).isLeaves(world, xPos, yPos, zPos)) leaves++; -// } -// } -// } -// if (leaves >= 3) return true; -// } -// -// return false; -// } -// -// void chopTree(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) { -// for (int xPos = X - 1; xPos <= X + 1; xPos++) { -// for (int yPos = Y; yPos <= Y + 1; yPos++) { -// for (int zPos = Z - 1; zPos <= Z + 1; zPos++) { -// Block block = world.getBlock(xPos, yPos, zPos); -// int meta = world.getBlockMetadata(xPos, yPos, zPos); -// if (block.isWood(world, xPos, yPos, zPos)) { -// world.setBlockToAir(xPos, yPos, zPos); -// if (!player.capabilities.isCreativeMode) { -// if (block.removedByPlayer(world, player, xPos, yPos, zPos, false)) { -// block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, meta); -// } -// block.harvestBlock(world, player, xPos, yPos, zPos, meta); -// block.onBlockHarvested(world, xPos, yPos, zPos, meta, player); -// onBlockDestroyed(stack, world, block, xPos, yPos, zPos, player); -// } -// chopTree(xPos, yPos, zPos, player, world, stack); -// }//else -// //trimLeavs(xPos, yPos, zPos, player, world, stack); -// } -// } -// } -// } -// -// @SuppressWarnings("all") -// void trimLeavs(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) { -// scedualUpdates(X, Y, Z, player, world, stack); -// } -// -// @SuppressWarnings("all") -// void scedualUpdates(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) { -// for (int xPos = X - 15; xPos <= X + 15; xPos++) { -// for (int yPos = Y; yPos <= Y + 50; yPos++) { -// for (int zPos = Z - 15; zPos <= Z + 15; zPos++) { -// Block block = world.getBlock(xPos, yPos, zPos); -// if (block.isLeaves(world, xPos, yPos, zPos)) { -// world.scheduleBlockUpdate(xPos, yPos, zPos, block, 2 + world.rand.nextInt(10)); -// } -// } -// } -// } -// } -// -// @Override -// public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int x, int y, int z, int side, float par8, float par9, float par10) { -// //System.out.println(x + " " + y + " " + z); -// return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, x, y, z, side, par8, par9, par10); -// } -// + private boolean isTree(World world, int X, int Y, int Z) { + final Block wood = world.getBlock(X, Y, Z); + if (wood == null || !wood.isWood(world, X, Y, Z)) { + return false; + } else { + int top = Y; + for (int y = Y; y <= Y + 50; y++) { + if (!world.getBlock(X, y, Z).isWood(world, X, y, Z) && !world.getBlock(X, y, Z).isLeaves(world, X, y, Z)) { + top += y; + break; + } + } + + int leaves = 0; + for (int xPos = X - 1; xPos <= X + 1; xPos++) { + for (int yPos = Y; yPos <= top; yPos++) { + for (int zPos = Z - 1; zPos <= Z + 1; zPos++) { + if (world.getBlock(xPos, yPos, zPos).isLeaves(world, xPos, yPos, zPos)) leaves++; + } + } + } + if (leaves >= 3) return true; + } + + return false; + } + + void chopTree(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) { + for (int xPos = X - 1; xPos <= X + 1; xPos++) { + for (int yPos = Y; yPos <= Y + 1; yPos++) { + for (int zPos = Z - 1; zPos <= Z + 1; zPos++) { + Block block = world.getBlock(xPos, yPos, zPos); + int meta = world.getBlockMetadata(xPos, yPos, zPos); + if (block.isWood(world, xPos, yPos, zPos)) { + world.setBlockToAir(xPos, yPos, zPos); + if (!player.capabilities.isCreativeMode) { + if (block.removedByPlayer(world, player, xPos, yPos, zPos, false)) { + block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, meta); + } + block.harvestBlock(world, player, xPos, yPos, zPos, meta); + block.onBlockHarvested(world, xPos, yPos, zPos, meta, player); + onBlockDestroyed(stack, world, block, xPos, yPos, zPos, player); + } + chopTree(xPos, yPos, zPos, player, world, stack); + }//else + //trimLeavs(xPos, yPos, zPos, player, world, stack); + } + } + } + } + + @SuppressWarnings("all") + void trimLeavs(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) { + scedualUpdates(X, Y, Z, player, world, stack); + } + + @SuppressWarnings("all") + void scedualUpdates(int X, int Y, int Z, EntityPlayer player, World world, ItemStack stack) { + for (int xPos = X - 15; xPos <= X + 15; xPos++) { + for (int yPos = Y; yPos <= Y + 50; yPos++) { + for (int zPos = Z - 15; zPos <= Z + 15; zPos++) { + Block block = world.getBlock(xPos, yPos, zPos); + if (block.isLeaves(world, xPos, yPos, zPos)) { + world.scheduleBlockUpdate(xPos, yPos, zPos, block, 2 + world.rand.nextInt(10)); + } + } + } + } + } + + // @SuppressWarnings({"rawtypes", "unchecked"}) // @Override // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { @@ -196,82 +176,5 @@ public class DraconicAxe extends MiningTool implements IInventoryTool {//todo ax // // }else list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe1.txt")); // } -// -// @Override -// public EnumRarity getRarity(ItemStack stack) { -// return EnumRarity.rare; -// } -// -// @Override -// public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { -// -// if (container.stackTagCompound == null) { -// container.stackTagCompound = new NBTTagCompound(); -// } -// int energy = container.stackTagCompound.getInteger("Energy"); -// int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); -// -// if (!simulate) { -// energy += energyReceived; -// container.stackTagCompound.setInteger("Energy", energy); -// } -// return energyReceived; -// } -// -// @Override -// public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { -// -// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { -// return 0; -// } -// int energy = container.stackTagCompound.getInteger("Energy"); -// int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); -// -// if (!simulate) { -// energy -= energyExtracted; -// container.stackTagCompound.setInteger("Energy", energy); -// } -// return energyExtracted; -// } -// -// @Override -// public int getEnergyStored(ItemStack container) { -// if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { -// return 0; -// } -// return container.stackTagCompound.getInteger("Energy"); -// } -// -// @Override -// public int getMaxEnergyStored(ItemStack container) { -// return capacity; -// } -// -// @Override -// public boolean showDurabilityBar(ItemStack stack) { -// return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); -// } -// -// @Override -// public double getDurabilityForDisplay(ItemStack stack) { -// return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); -// } -// -// @Override -// public float getDigSpeed(ItemStack stack, Block block, int meta) { -// if ((stack.getItem() instanceof IEnergyContainerItem) && ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= References.ENERGYPERBLOCK) -// return super.getDigSpeed(stack, block, meta); -// else -// return 1F; -// } -// -// @Override -// public boolean hasCustomEntity(ItemStack stack) { -// return true; -// } -// -// @Override -// public Entity createEntity(World world, Entity location, ItemStack itemstack) { -// return new EntityPersistentItem(world, location, itemstack); -// } + } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java index a796cb13..40f382d0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java @@ -2,13 +2,17 @@ package com.brandon3055.draconicevolution.common.items.tools; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool; +import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; @@ -61,27 +65,11 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo return enchant.type == EnumEnchantmentType.digger || enchant.type == EnumEnchantmentType.weapon; } - -// @SuppressWarnings({"unchecked"}) -// @Override -// public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { -// int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; -// boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false); -// if (InfoHelper.holdShiftForDetails(list)){ -// InfoHelper.addEnergyInfo(stack, list); -// -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + size + "x" + size); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt")); -// list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt")); -// -// InfoHelper.addLore(stack, list); -// } -// } -// -// @Override -// public EnumRarity getRarity(ItemStack stack) { -// return EnumRarity.epic; -// } + @Override + public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { + //todo Make this awesome + ToolHandler.AOEAttack(player, entity, stack, 25, ItemNBTHelper.getInteger(stack, References.ATTACK_AOE, 0)); + ToolHandler.damageEntityBasedOnHealth(entity, player, 0.5F); + return true; + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java index af87333b..9a4a7894 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utills.DataUtills; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.utills.LogHelper; @@ -61,7 +62,7 @@ public abstract class MiningTool extends ToolBase {//todo add custom information int radius = ItemNBTHelper.getInteger(stack, References.DIG_AOE, 0); int depth = ItemNBTHelper.getInteger(stack, References.DIG_DEPTH, 1) - 1; - return getEnergyStored(stack) >= energyPerOperation && (radius > 0 || depth > 0) ? breakAOEBlocks(stack, x, y, z, radius, depth, player) : super.onBlockStartBreak(stack, x, y, z, player); + return getEnergyStored(stack) >= energyPerOperation && (radius > 0) ? breakAOEBlocks(stack, x, y, z, radius, depth, player) : super.onBlockStartBreak(stack, x, y, z, player); } @Override @@ -73,13 +74,13 @@ public abstract class MiningTool extends ToolBase {//todo add custom information List fields = getFields(stack, player.inventory.currentItem); for (ItemConfigField field : fields) { - if (!world.isRemote && field.name.equals(References.DIG_AOE)) - { + if (field.name.equals(References.DIG_AOE)) { int aoe = (Integer) field.value; aoe++; - if (aoe > (Integer)field.max) aoe = (Integer) field.min; + if (aoe > (Integer) field.max) aoe = (Integer) field.min; field.value = aoe; - field.sendChanges(); + //field.sendChanges(); + DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name); } } } @@ -87,11 +88,11 @@ public abstract class MiningTool extends ToolBase {//todo add custom information return super.onItemRightClick(stack, world, player); } - //todo Hud, Hud Config, shift right click, attack, axe, hoe + //todo attack, hoe, textures //This method is basses on tinkerers construct public boolean breakAOEBlocks(ItemStack stack, int x, int y, int z, int breakRadius, int breakDepth, EntityPlayer player) { - Map blockMap = getObliterationList(stack); + Map blockMap = ItemNBTHelper.getBoolean(stack, References.OBLITERATE, false) ? getObliterationList(stack) : new HashMap(); Block block = player.worldObj.getBlock(x,y,z); int meta = player.worldObj.getBlockMetadata(x,y,z); boolean effective = false; @@ -196,6 +197,9 @@ public abstract class MiningTool extends ToolBase {//todo add custom information if (!world.isRemote) { ((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); } + + if ((blockMap.containsKey(block) && blockMap.get(block) == meta)) extractEnergy(stack, energyPerOperation, false); + if (breakSound) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); return; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java index 2dd5a81f..13bb1791 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java @@ -127,8 +127,8 @@ public class RFItemBase extends ItemDE implements IEnergyContainerItem, IConfigu @Override public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - for (ItemConfigField field : getFields(stack, 0)) list.add(field.getLocalizedName() + ": " + field.getFormatedValue()); - if (capacity > 0) list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity)); + for (ItemConfigField field : getFields(stack, 0)) list.add(field.getTooltipInfo());//list.add(field.getLocalizedName() + ": " + field.getFormatedValue()); + if (capacity > 0) list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity)); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java index c8b805cc..8901cbf1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.keybinding.KeyBindings; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.InfoHelper; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; @@ -12,9 +13,11 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.ForgeHooks; +import org.lwjgl.input.Keyboard; import java.util.HashSet; import java.util.List; @@ -129,7 +132,6 @@ public class ToolBase extends RFItemBase { @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean extended) { boolean show = InfoHelper.holdShiftForDetails(list); - //if (show) InfoHelper.addEnergyInfo(stack, list); if (show){ List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); @@ -141,5 +143,13 @@ public class ToolBase extends RFItemBase { @SideOnly(Side.CLIENT) public void addAditionalInformation(ItemStack stack, EntityPlayer player, List list, boolean extended) { + list.add("Press " + Keyboard.getKeyName(KeyBindings.toolConfig.getKeyCode()) + " to open config gui"); + } + + @Override + public EnumRarity getRarity(ItemStack stack) { + if (stack.getUnlocalizedName().contains(":wyvern")) return EnumRarity.rare; + if (stack.getUnlocalizedName().contains(":draconic")) return EnumRarity.epic; + return EnumRarity.uncommon; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java index d298657c..cb7c7705 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java @@ -172,6 +172,7 @@ public class ToolHandler { entity.attackEntityFrom(DamageSource.causePlayerDamage(player), (entHealth) * dmg); } } + ((EntityLivingBase) entity).attackTime = 0; } else if (entity instanceof EntityDragonPart) { if (!world.isRemote) { if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) { @@ -233,13 +234,18 @@ public class ToolHandler { World world = player.worldObj; AxisAlignedBB box = AxisAlignedBB.getBoundingBox(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range).expand(1.0D, 1.0D, 1.0D); List list = world.getEntitiesWithinAABBExcludingEntity(player, box); - for (Object entityObject : list) { - if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) { + if (range == 0){ + if (stack == null || !(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERATTACK) { if (!player.capabilities.isCreativeMode) return; } else { if (!player.capabilities.isCreativeMode) ((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERATTACK, false); } + entity.attackEntityFrom(DamageSource.causePlayerDamage(player), dmg + sharp); + return; + } + + for (Object entityObject : list) { if (entityObject instanceof EntityLivingBase) { ((Entity) entityObject).attackEntityFrom(DamageSource.causePlayerDamage(player), dmg + sharp); @@ -266,6 +272,7 @@ public class ToolHandler { entityLivingBase.motionY = 0.4000000059604645D; } } + entityLivingBase.attackTime = 0; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java index cdf139eb..924d7f87 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java @@ -3,7 +3,7 @@ package com.brandon3055.draconicevolution.common.lib; public final class References { public static final String MODID = "DraconicEvolution"; public static final String MODNAME = "Draconic Evolution"; - public static final String VERSION = "1.0.1-snapshot_0"; + public static final String VERSION = "1.0.1-snapshot_3"; public static final String MCVERSION = "1.7.10"; public static final String CLIENTPROXYLOCATION = "com.brandon3055.draconicevolution.client.ClientProxy"; public static final String SERVERPROXYLOCATION = "com.brandon3055.draconicevolution.common.ServerProxy"; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java index 23a182c3..0a811b66 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java @@ -117,14 +117,14 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { if (!player.capabilities.isCreativeMode) player.addExperienceLevel(-dissenchantCost); if (items[0] != null && ItemNBTHelper.getInteger(items[0], "RepairCost", 0) > 0)ItemNBTHelper.setInteger(items[0], "RepairCost", ItemNBTHelper.getInteger(items[0], "RepairCost", 0) - Math.min(2, ItemNBTHelper.getInteger(items[0], "RepairCost", 0))); if (!player.capabilities.isCreativeMode) decrStackSize(1, 1); - int maxDamage = items[0].getMaxDamage(); + int maxDamage = items[0] != null ? items[0].getMaxDamage() : 0; float damageF = (40f - bookPower)/100f; int damage = (int)(damageF*(float)maxDamage); - int damageResult = items[0].getItemDamage() + damage; + int damageResult = items[0] != null ? items[0].getItemDamage() + damage : 0; if (!player.capabilities.isCreativeMode && damageResult > maxDamage && maxDamage > 0) { setInventorySlotContents(0, null); - }else if (!player.capabilities.isCreativeMode && maxDamage > 0){ + }else if (!player.capabilities.isCreativeMode && maxDamage > 0 && items[0] != null){ items[0].setItemDamage(damageResult); } onInventoryChanged(); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java index 66113911..713434be 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java @@ -8,10 +8,5 @@ import java.util.List; * Created by Brandon on 29/12/2014. */ public interface IConfigurableItem { -//todo -// String[] getNames(ItemStack stack); -// -// int getDataType(String name); - List getFields(ItemStack stack, int slot); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java index 55d78273..c55378ca 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java @@ -7,6 +7,6 @@ import java.util.List; /** * Created by Brandon on 26/01/2015. */ -public interface IHudDisplayItem {//todo create and implement block version +public interface IHudDisplayItem { List getDisplayData(ItemStack stack); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java index a81d0311..f58a4fc8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java @@ -145,7 +145,11 @@ public class WorldGenEnderIsland extends WorldGenerator { private void generateObelisk(World world, int x1, int y1, int z1, boolean outer, Random rand) { if (!outer) { world.setBlock(x1, y1 + 20, z1, Blocks.bedrock, 0, 2); - if (!world.isRemote) world.spawnEntityInWorld(new EntityEnderCrystal(world, x1 + 0.5, y1 + 21, z1 + 0.5)); + if (!world.isRemote) { + EntityEnderCrystal crystal = new EntityEnderCrystal(world); + crystal.setPosition(x1 + 0.5, y1 + 21, z1 + 0.5); + world.spawnEntityInWorld(crystal); + } for (int y = y1; y < y1 + 20; y++) { world.setBlock(x1, y, z1, Blocks.obsidian, 0, 2); world.setBlock(x1 + 1, y, z1, Blocks.obsidian, 0, 2); @@ -159,7 +163,11 @@ public class WorldGenEnderIsland extends WorldGenerator { } } else { world.setBlock(x1, y1 + 40, z1, Blocks.bedrock, 0, 2); - if (!world.isRemote) world.spawnEntityInWorld(new EntityEnderCrystal(world, x1 + 0.5, y1 + 41, z1 + 0.5)); + if (!world.isRemote) { + EntityEnderCrystal crystal = new EntityEnderCrystal(world); + crystal.setPosition(x1 + 0.5, y1 + 41, z1 + 0.5); + world.spawnEntityInWorld(crystal); + } int diff = 0; for (int y = y1 + 20; y < y1 + 40; y++) { diff++;