diff --git a/Change Log.txt b/Change Log.txt index a7ffb8c4..144d24d6 100644 --- a/Change Log.txt +++ b/Change Log.txt @@ -1,7 +1,9 @@ ######## 1.0.2-Snapshot 11 ######## -the upgrade modifier can now hold any item FOR DISPLAY PURPOSES ONLY (this was requested by a user) -added inertia cancellation to the draconic chestplate. --change: an active dragon heart will now immediately drop as an item if a player comes into contact with it. +-change: an active dragon heart will now immediately drop as an item if a player comes into contact with it. +-rewrote the bows from the ground up. +-the capacitors can now be upgraded. ######## 1.0.2-Snapshot 10-beta2 ######## -fixed client unable to connect to a server while wearing draconic armor. diff --git a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java index 9eed6ca6..da9d0fd3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java +++ b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java @@ -15,8 +15,6 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; -import java.util.Arrays; - @Mod(modid = References.MODID, name = References.MODNAME, version = References.VERSION, canBeDeactivated = false, guiFactory = References.GUIFACTORY, dependencies = "after:NotEnoughItems;" + "after:NotEnoughItems;" + "after:ThermalExpansion;" + @@ -50,13 +48,13 @@ public class DraconicEvolution { {if(debug) LogHelper.info("Initialization"); - event.getModMetadata().autogenerated = false; - event.getModMetadata().credits = ""; - event.getModMetadata().description = "This is a mod originally made for the Tolkiencraft mod pack"; - event.getModMetadata().authorList = Arrays.asList("brandon3055"); - event.getModMetadata().logoFile = "banner.png"; - event.getModMetadata().url = "http://www.brandon3055.com/"; - event.getModMetadata().version = References.VERSION + "-MC1.7.10"; +// event.getModMetadata().autogenerated = false; +// event.getModMetadata().credits = ""; +// event.getModMetadata().description = "This is a mod originally made for the Tolkiencraft mod pack"; +// event.getModMetadata().authorList = Arrays.asList("brandon3055"); +// event.getModMetadata().logoFile = "banner.png"; +// event.getModMetadata().url = "http://www.brandon3055.com/"; +// event.getModMetadata().version = References.VERSION + "-MC1.7.10"; proxy.preInit(event); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java index 0e398095..7acf0a71 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java @@ -208,6 +208,7 @@ public class ClientProxy extends CommonProxy { RenderingRegistry.registerEntityRenderingHandler(EntityDragonProjectile.class, new RenderDragonProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntityChaosCrystal.class, new RenderChaosCrystal()); RenderingRegistry.registerEntityRenderingHandler(EntityChaosVortex.class, new RenderEntityChaosVortex()); + RenderingRegistry.registerEntityRenderingHandler(EntityCustomArrow.class, new RenderEntityCustomArrow()); } public void registerRenderIDs (){ diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java index f50d1b55..7e4eca0c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java @@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.client.gui.componentguis; import com.brandon3055.brandonscore.client.gui.guicomponents.*; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHudConfig; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentConfigItemButton; @@ -61,6 +62,7 @@ public class GUIToolConfig extends GUIBase { ComponentCollection c = new ComponentCollection(0, 0, xSize, ySize, this).setOpenBoarders(); c.addComponent(new ComponentTexturedRect(0, -15, 198, 20, inventoryTexture)).setGroup("TEXT_TAB"); c.addComponent(new ComponentTexturedRect(0, 0, 198, 89, inventoryTexture)).setGroup("BACKGROUND"); + c.addComponent(new ComponentTexturedRect(0, 13, 0, 9, 198, 80, inventoryTexture, false)).setGroup("BACKGROUND_EXTENSION"); c.addComponent(new ComponentButton(3, 26, 20, 12, 0, this, "<=", StatCollector.translateToLocal("gui.back"))).setGroup("BUTTONS").setName("BACK_BUTTON"); c.addComponent(new ComponentButton(3, 39, 20, 12, 1, this, "Inv", StatCollector.translateToLocal("gui.de.itemInventory.txt"))).setGroup("BUTTONS").setName("INVENTORY_BUTTON"); c.addComponent(new ComponentFieldAdjuster(4, 34, null, this)).setGroup("FIELD_BUTTONS").setName("FIELD_CONFIG_BUTTON_ARRAY"); @@ -169,6 +171,7 @@ public class GUIToolConfig extends GUIBase { else if (level == 1){//list screen collection.setOnlyGroupEnabled("LIST_SCREEN"); collection.setGroupEnabled("BACKGROUND", true); + collection.setGroupEnabled("BACKGROUND_EXTENSION", true); if (editingItem != null && editingItem.getItem() instanceof IConfigurableItem && ((IConfigurableItem)editingItem.getItem()).hasProfiles()) collection.setGroupEnabled("TEXT_TAB", true); collection.setComponentEnabled("BACK_BUTTON", true); if (editingItem != null && editingItem.getItem() instanceof IInventoryTool) collection.setComponentEnabled("INVENTORY_BUTTON", true); @@ -222,18 +225,21 @@ public class GUIToolConfig extends GUIBase { } @Override - protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { - super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + super.drawGuiContainerForegroundLayer(mouseX, mouseY); if (slot > -1) editingItem = player.inventory.getStackInSlot(slot); if (slot > -1 && editingItem != null && editingItem.getUnlocalizedName().toLowerCase().contains("bow")){ BowHandler.BowProperties properties = new BowHandler.BowProperties(editingItem, player); - List list = new ArrayList(); - list.add("RF/Shot: "+properties.calculateEnergyCost()); - drawHoveringText(list, guiLeft + xSize - 8, guiTop, fontRendererObj); + if (!properties.canFire() && properties.cantFireMessage != null && !properties.cantFireMessage.equals("msg.de.outOfArrows.name")) { + fontRendererObj.drawSplitString(StatCollector.translateToLocal(properties.cantFireMessage), 0, ySize+5, xSize, 0xFF0000); + } - if (!properties.canFire() && properties.cantFireMessage != null && !properties.cantFireMessage.equals("msg.de.outOfArrows.name")) fontRendererObj.drawSplitString(StatCollector.translateToLocal(properties.cantFireMessage), guiLeft, guiTop+ySize, xSize, 0xFF0000); + List list = new ArrayList(); + list.add(StatCollector.translateToLocal("gui.de.rfPerShot.txt")+": "+ Utills.addCommas(properties.calculateEnergyCost())); + list.add(StatCollector.translateToLocal("gui.de.maxDamage.txt")+": "+properties.arrowDamage * (properties.arrowSpeed * 3)); + drawHoveringText(list, xSize - 8, 0, fontRendererObj); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java index cb1bdd3c..52c706f2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java @@ -1,13 +1,13 @@ package com.brandon3055.draconicevolution.client.handler; import com.brandon3055.brandonscore.common.utills.DataUtills.XZPair; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler; import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor; import com.brandon3055.draconicevolution.common.items.armor.WyvernArmor; +import com.brandon3055.draconicevolution.common.items.weapons.BowHandler; import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow; import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow; import com.brandon3055.draconicevolution.common.network.MountUpdatePacket; @@ -101,34 +101,19 @@ public class ClientEventHandler { public void fovUpdate(FOVUpdateEvent event){ //region Bow FOV Update - if (event.entity.getItemInUse() != null && (event.entity.getItemInUse().getItem() instanceof WyvernBow || event.entity.getItemInUse().getItem() instanceof DraconicBow)){ - float f = 1f; - int i = event.entity.getItemInUseDuration(); - float f1 = (float)i / 20.0F; + if (event.entity.getHeldItem()!= null && (event.entity.getHeldItem().getItem() instanceof WyvernBow || event.entity.getHeldItem().getItem() instanceof DraconicBow) && Minecraft.getMinecraft().gameSettings.keyBindUseItem.getIsKeyPressed()){ - float zMax = 1f; + BowHandler.BowProperties properties = new BowHandler.BowProperties(event.entity.getHeldItem(), event.entity); + event.newfov = ((6 - properties.zoomModifier) / 6) * event.fov; - if (ItemNBTHelper.getString(event.entity.getItemInUse(), "mode", "").equals("sharpshooter")){ - if (event.entity.getItemInUse().getItem() instanceof WyvernBow) zMax = 1.35f; - else if (event.entity.getItemInUse().getItem() instanceof DraconicBow) zMax = 2.5f; - bowZoom = true; - tickSet = elapsedTicks; - - - } - - -// if (f1 < zMax) -// { -// f1 *= (f1*(zMax*2)); +// if (ItemNBTHelper.getString(event.entity.getItemInUse(), "mode", "").equals("sharpshooter")){ +// if (event.entity.getItemInUse().getItem() instanceof WyvernBow) zMax = 1.35f; +// else if (event.entity.getItemInUse().getItem() instanceof DraconicBow) zMax = 2.5f; +// bowZoom = true; +// tickSet = elapsedTicks; // } -// else f1 = previousFOB; -// -// previousFOB = f1; -// -// f *= 1.0F - f1 * 0.15F; -// event.newfov = f; + } //endregion diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderEntityCustomArrow.java b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderEntityCustomArrow.java new file mode 100644 index 00000000..d0afa629 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderEntityCustomArrow.java @@ -0,0 +1,98 @@ +package com.brandon3055.draconicevolution.client.render.entity; + +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.common.entity.EntityCustomArrow; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.AdvancedModelLoader; +import net.minecraftforge.client.model.IModelCustom; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +/** + * Created by brandon3055 on 3/3/2016. + */ +public class RenderEntityCustomArrow extends Render +{ + private IModelCustom arrow = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/tools/ArrowCommon.obj")); + + public void doRender(EntityCustomArrow entityArrow, double x, double y, double z, float f1, float f2) + { + this.bindEntityTexture(entityArrow); + GL11.glPushMatrix(); + GL11.glTranslatef((float)x, (float)y, (float)z); + GL11.glRotatef(entityArrow.prevRotationYaw + (entityArrow.rotationYaw - entityArrow.prevRotationYaw) * f2 - 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(entityArrow.prevRotationPitch + (entityArrow.rotationPitch - entityArrow.prevRotationPitch) * f2, 0.0F, 0.0F, 1.0F); + + float f10 = 0.3F; + float f11 = (float)entityArrow.arrowShake - f2; + + if (f11 > 0.0F) + { + float f12 = -MathHelper.sin(f11 * 3.0F) * f11; + GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); + } + + GL11.glRotatef(90.0F, 0.0F, -1.0F, 0.0F); + GL11.glScalef(f10, f10, f10); + GL11.glEnable(GL11.GL_BLEND); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + + + //arrow.renderAll(); + if (entityArrow.bowProperties != null && entityArrow.bowProperties.energyBolt) + { + arrow.renderAll(); + + GL11.glTranslated(0, -0.025, 0); + GL11.glColor4f(1F, 1F, 1F, 0.6F); + GL11.glScaled(1.05, 1.05, 1.05); + + GL11.glColor4f(1F, 1F, 1F, 0.4F); + GL11.glScaled(1.05, 1.05, 1.05); + arrow.renderAll(); + } + else + { + arrow.renderAll(); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + + } + + + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityCustomArrow arrow) + { + return arrow.bowProperties.energyBolt ? ResourceHandler.getResource("textures/models/reactorCore.png") : ResourceHandler.getResource("textures/models/tools/ArrowCommon.png"); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity p_110775_1_) + { + return this.getEntityTexture((EntityCustomArrow)p_110775_1_); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render= 2 && (data[1] instanceof EntityPlayer)) { EntityPlayer player = (EntityPlayer) data[1]; j = (float)player.getItemInUseDuration(); if (j > 0) { - BowHandler.BowProperties properties = new BowHandler.BowProperties(item, player); + properties = new BowHandler.BowProperties(item, player); if (j > properties.getDrawTicks()) j = properties.getDrawTicks(); j /= (float) properties.getDrawTicks(); int j2 = (int) (j * 3F); @@ -75,12 +76,12 @@ public class RenderBowModel implements IItemRenderer } - if (activeModel != null) doRender(activeModel, type, j > 0 ? selection : -1); + if (activeModel != null) doRender(activeModel, type, j > 0 ? selection : -1, properties); GL11.glPopMatrix(); } - private void doRender(IModelCustom modelCustom, ItemRenderType type, int drawState){ + private void doRender(IModelCustom modelCustom, ItemRenderType type, int drawState, BowHandler.BowProperties properties){ if (type == ItemRenderType.EQUIPPED) { @@ -110,9 +111,31 @@ public class RenderBowModel implements IItemRenderer modelCustom.renderAll(); - GL11.glTranslated(0.3, 0.151, -0.2 + (drawState == 1 ? 0 : drawState == 2 ? 0.55 : drawState == 3 ? 1 : -0.7)); - GL11.glRotatef(90, 0, 0, 1); - if (drawState != -1)arrow.renderAll(); + if (drawState != -1) + { + GL11.glTranslated(0.3, 0.151, -0.2 + (drawState == 1 ? 0 : drawState == 2 ? 0.55 : drawState == 3 ? 1 : -0.7)); + GL11.glRotatef(90, 0, 0, 1); + + if (properties != null && properties.energyBolt) + { + ResourceHandler.bindResource("textures/models/reactorCore.png"); + arrow.renderAll(); + + GL11.glTranslated(0, -0.025, 0); + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(1F, 1F, 1F, 0.6F); + GL11.glScaled(1.05, 1.05, 1.05); + + GL11.glColor4f(1F, 1F, 1F, 0.4F); + GL11.glScaled(1.05, 1.05, 1.05); + arrow.renderAll(); + } + else + { + ResourceHandler.bindResource("textures/models/tools/ArrowCommon.png"); + arrow.renderAll(); + } + } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java index 5431da11..95940505 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java @@ -1182,6 +1182,215 @@ public class Particles { //GL11.glScaled(5, 10, 5); uvSphere.renderAll(); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glPopMatrix(); + ResourceHandler.bindDefaultParticles(); + tessellator.startDrawingQuads(); + } + } + + public static class ArrowParticle extends EntityFX + { + private int particleColour; + private float setScale; + + public ArrowParticle(World world, double x, double y, double z, int colour, float scale) { + super(world, x, y, z); + this.particleMaxAge = 30; + if (scale > 5) particleMaxAge = 10; + this.noClip = true; + this.particleColour = colour; + this.particleRed = this.particleGreen = this.particleBlue = 1.0f; + this.setScale = scale; + } + + @Override + public void onUpdate() { + if (particleAge >= particleMaxAge) setDead(); + + particleAlpha = (1F - (float)((double)particleAge / particleMaxAge)); + particleScale = setScale * (1F - (float)((double)particleAge / particleMaxAge)); + + particleAge ++; + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; + moveEntity(motionX, motionY, motionZ); + } + + @Override + @SideOnly(Side.CLIENT) + public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + tesselator.draw(); + ResourceHandler.bindParticles(); + tesselator.startDrawingQuads(); + tesselator.setBrightness(200); + //GL11.glDepthMask(true); + + int uIndex = 3; + int vIndex = 1; + + float minU = uIndex * 0.125F; + float maxU = (uIndex+1) * 0.125F; + float minV = vIndex * 0.125F; + float maxV = (vIndex+1) * 0.125F; + + float drawScale = 0.1F * this.particleScale; + + if (this.particleIcon != null) { + minU = this.particleIcon.getMinU(); + maxU = this.particleIcon.getMaxU(); + minV = this.particleIcon.getMinV(); + maxV = this.particleIcon.getMaxV(); + } + + float drawX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX); + float drawY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); + float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); + + //tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); + tesselator.setColorRGBA_I(particleColour, 0xFF); + + tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV); + tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV); + tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV); + tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV); + + tesselator.draw(); + ResourceHandler.bindDefaultParticles(); + tesselator.startDrawingQuads(); + + } + } + + public static class ArrowShockParticle extends EntityFX + { + public static IModelCustom uvSphere; + public double size = 0; + public double maxSize; + + public ArrowShockParticle(World world, double x, double y, double z, int maxSize) { + super(world, x, y, z, 0D, 0D, 0D); + if (uvSphere == null) uvSphere = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + this.maxSize = maxSize / 100D; + } + + @Override + public void onUpdate() { + //if (particleAge == 3) worldObj.playSound(posX, posY, posZ, "DraconicEvolution:fusionExplosion", 100F, 1F, false); + particleAge++; + size+=1.2; + if (size > maxSize * 1.2) setDead(); + + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; + } + + @Override + @SideOnly(Side.CLIENT) + public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y + + tessellator.draw(); + GL11.glPushMatrix(); + float xx = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTick - interpPosX); + float yy = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTick - interpPosY); + float zz = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTick - interpPosZ); + GL11.glTranslated((double)xx + 0.5, (double)yy + 0.5, (double)zz + 0.5); + + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F); + ResourceHandler.bindResource("textures/models/white.png"); + double s = size + partialTick * 1F; + GL11.glScaled(s, s/3, s); + + + //Leading edge + GL11.glPushMatrix(); + float a = (float)Math.max(0D, 0.3D - (size / (maxSize))); + GL11.glScaled(5, 5, 5); + //if (a > 0)uvSphere.renderAll(); + GL11.glPopMatrix(); + +// //Disk +// GL11.glPushMatrix(); +// a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); +// GL11.glColor4f(1F, 1F, 1F, a); +// GL11.glScaled(2, 0.2, 2); +// if (a > 0)uvSphere.renderAll(); +// GL11.glPopMatrix(); + + //Synced edge + GL11.glPushMatrix(); + a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); + GL11.glColor4f(1F, 0.1F, 0F, a); + if (a > 0)uvSphere.renderAll(); + GL11.glPopMatrix(); + +// GL11.glScalef(1.5F, 1.5F, 1.5F); +// +// //Inner edges +// GL11.glPushMatrix(); +// a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); +//// GL11.glColor4f(1F, 0.3F, 0F, a); +// GL11.glScaled(0.8, 0.8, 0.8); +//// if (a > 0)uvSphere.renderAll(); +// +//// GL11.glColor4f(1F, 0.3F, 0F, a); +// GL11.glScaled(0.8, 0.8, 0.8); +//// if (a > 0)uvSphere.renderAll(); +// +//// GL11.glColor4f(1F, 0.3F, 0F, a); +// GL11.glScaled(0.7, 0.7, 0.7); +//// if (a > 0)uvSphere.renderAll(); +// +//// GL11.glColor4f(1F, 0.3F, 0F, a); +// GL11.glScaled(0.6, 0.6, 0.6); +//// if (a > 0)uvSphere.renderAll(); +// +//// GL11.glColor4f(1F, 0.3F, 0F, a); +// GL11.glScaled(0.5, 0.5, 0.5); +//// if (a > 0)uvSphere.renderAll(); +// +// GL11.glPopMatrix(); + +// for (int i = 0; i < 10; i++) +// { +// GL11.glScalef(0.95F, 0.95F, 0.95F); +// GL11.glPushMatrix(); +// a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); +// GL11.glColor4f(1F, 1F, 1F, a); +// GL11.glScaled(0.8, 0.6, 0.8); +// if (a > 0)uvSphere.renderAll(); +// +// GL11.glColor4f(1F, 1F, 1F, a); +// GL11.glScaled(0.8, 0.7, 0.8); +// if (a > 0)uvSphere.renderAll(); +// +// GL11.glColor4f(1F, 1F, 1F, a); +// GL11.glScaled(0.7, 0.9, 0.7); +// if (a > 0)uvSphere.renderAll(); +// +// GL11.glColor4f(1F, 1F, 1F, a); +// GL11.glScaled(0.6, 0.9, 0.6); +// if (a > 0)uvSphere.renderAll(); +// +// GL11.glColor4f(1F, 1F, 1F, a); +// GL11.glScaled(0.5, 0.9, 0.5); +// if (a > 0)uvSphere.renderAll(); +// GL11.glPopMatrix(); +// } + + + + + + + + GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); ResourceHandler.bindDefaultParticles(); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java index 9035357d..c69a1cd8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java @@ -125,7 +125,7 @@ public class CommonProxy { DraconicEvolution.network.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 13, Side.CLIENT); DraconicEvolution.network.registerMessage(ToolModePacket.Handler.class, ToolModePacket.class, 14, Side.SERVER); DraconicEvolution.network.registerMessage(GenericParticlePacket.Handler.class, GenericParticlePacket.class, 15, Side.CLIENT); - DraconicEvolution.network.registerMessage(ShieldHitPacket.Handler.class, ShieldHitPacket.class, 15, Side.CLIENT); + DraconicEvolution.network.registerMessage(ShieldHitPacket.Handler.class, ShieldHitPacket.class, 16, Side.CLIENT); } public void registerTileEntities() { @@ -208,7 +208,7 @@ public class CommonProxy { EntityRegistry.registerModEntity(EntityChaosCrystal.class, "ChaosCrystal", 8, DraconicEvolution.instance, 256, 5, false); EntityRegistry.registerModEntity(EntityChaosBolt.class, "ChaosBolt", 9, DraconicEvolution.instance, 32, 5, true); EntityRegistry.registerModEntity(EntityChaosVortex.class, "EntityChaosEnergyVortex", 10, DraconicEvolution.instance, 512, 5, true); - EntityRegistry.registerModEntity(EntityCustomArrow.class, "CustomArrow", 11, DraconicEvolution.instance, 32, 1, true); + EntityRegistry.registerModEntity(EntityCustomArrow.class, "CustomArrow", 11, DraconicEvolution.instance, 128, 1, true); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java index eedae076..eee6824f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java @@ -79,31 +79,31 @@ public class ContainerUpgradeModifier extends ContainerDataSync @Override public ItemStack transferStackInSlot(EntityPlayer player, int i) { -// Slot slot = getSlot(i); -// -// if (slot != null && slot.getHasStack()) -// { -// ItemStack stack = slot.getStack(); -// ItemStack result = stack.copy(); -// -// if (i >= 36){ -// if (!mergeItemStack(stack, 0, 36, false)){ -// return null; -// } -// }else if (!isStackValidForInventory(stack, 0) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)){ -// return null; -// } -// -// if (stack.stackSize == 0) { -// slot.putStack(null); -// }else{ -// slot.onSlotChanged(); -// } -// -// slot.onPickupFromSlot(player, stack); -// -// return result; -// } + Slot slot = getSlot(i); + + if (slot != null && slot.getHasStack()) + { + ItemStack stack = slot.getStack(); + ItemStack result = stack.copy(); + + if (i >= 36){ + if (!mergeItemStack(stack, 0, 36, false)){ + return null; + } + }else if (!isStackValidForInventory(stack, 0) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)){ + return null; + } + + if (stack.stackSize == 0) { + slot.putStack(null); + }else{ + slot.onSlotChanged(); + } + + slot.onPickupFromSlot(player, stack); + + return result; + } return null; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java index 4950700a..d6ed12e8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java @@ -1,9 +1,11 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.client.render.particle.Particles; import com.brandon3055.draconicevolution.common.items.weapons.BowHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import com.brandon3055.draconicevolution.common.network.GenericParticlePacket; +import cpw.mods.fml.common.network.NetworkRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnchantmentHelper; @@ -15,8 +17,6 @@ import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.play.server.S2BPacketChangeGameState; import net.minecraft.util.*; @@ -35,7 +35,6 @@ public class EntityCustomArrow extends EntityArrow { private int ticksInAir; //Arrow Properties - private double damageO = 2.0D; //old public boolean ignorSpeed = false; //old public boolean explosive = false; //old public int knockbackStrength = 0; @@ -44,27 +43,30 @@ public class EntityCustomArrow extends EntityArrow { public EntityCustomArrow(World p_i1753_1_) { super(p_i1753_1_); + renderDistanceWeight = 40; } public EntityCustomArrow(World p_i1754_1_, double p_i1754_2_, double p_i1754_4_, double p_i1754_6_) { super(p_i1754_1_, p_i1754_2_, p_i1754_4_, p_i1754_6_); + renderDistanceWeight = 40; } - public EntityCustomArrow(BowHandler.BowProperties bowProperties, World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_) { + public EntityCustomArrow(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_) { super(p_i1755_1_, p_i1755_2_, p_i1755_3_, p_i1755_4_, p_i1755_5_); - this.bowProperties = bowProperties; + renderDistanceWeight = 40; } - public EntityCustomArrow(BowHandler.BowProperties bowProperties, World par1World, EntityLivingBase par2EntityLivingBase, float velocity) { + public EntityCustomArrow(World par1World, EntityLivingBase par2EntityLivingBase, float velocity) { super(par1World, par2EntityLivingBase, velocity); - this.bowProperties = bowProperties; + renderDistanceWeight = 40; } @Override protected void entityInit() { super.entityInit(); - //this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); + this.dataWatcher.addObject(17, Byte.valueOf((byte) 0)); + //this.dataWatcher.updateObject(17, Byte.valueOf((byte)(bowProperties.energyBolt ? 1 : 0))); } @Override @@ -89,53 +91,34 @@ public class EntityCustomArrow extends EntityArrow { this.ticksInGround = 0; } - @Override - @SideOnly(Side.CLIENT) - public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) - { - this.setPosition(par1, par3, par5); - this.setRotation(par7, par8); - } - - @Override - @SideOnly(Side.CLIENT) - public void setVelocity(double par1, double par3, double par5) - { - this.motionX = par1; - this.motionY = par3; - this.motionZ = par5; - - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { - float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5); - this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, f) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch; - this.prevRotationYaw = this.rotationYaw; - this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); - this.ticksInGround = 0; - } - } - @SuppressWarnings("rawtypes") @Override public void onUpdate() { - //super.onUpdate(); + //region Entity Update And motion super.onEntityUpdate(); + if (worldObj.isRemote) { + bowProperties.energyBolt = dataWatcher.getWatchableObjectByte(17) == 1; + } + else dataWatcher.updateObject(17, (byte) (bowProperties.energyBolt ? 1 : 0)); + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI); } + if (this.arrowShake > 0) { + --this.arrowShake; + } + //endregion + + //region Block Collision Detection Block block = this.worldObj.getBlock(this.blockX, this.blockY, this.blockZ); if (block.getMaterial() != Material.air) { - if (explosive) { - worldObj.createExplosion(this.shootingEntity, this.prevPosX, this.prevPosY, this.prevPosZ, 4, ConfigHandler.bowBlockDamage); - this.setDead(); - return; - } + onHitAnything(); block.setBlockBoundsBasedOnState(this.worldObj, this.blockX, this.blockY, this.blockZ); AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.blockX, this.blockY, this.blockZ); @@ -143,10 +126,7 @@ public class EntityCustomArrow extends EntityArrow { this.inGround = true; } } - - if (this.arrowShake > 0) { - --this.arrowShake; - } + //endregion if (this.inGround) { int j = this.worldObj.getBlockMetadata(this.blockX, this.blockY, this.blockZ); @@ -154,7 +134,7 @@ public class EntityCustomArrow extends EntityArrow { if (block == this.blockHit && j == this.inData) { ++this.ticksInGround; - if (this.ticksInGround == 1200) { + if (this.ticksInGround == 1200 || bowProperties.energyBolt) { //Delete the entity when it hits the ground if it is an energy bolt this.setDead(); } } else { @@ -166,6 +146,7 @@ public class EntityCustomArrow extends EntityArrow { this.ticksInAir = 0; } } else { + //region Detect Entity Hit ++this.ticksInAir; Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); @@ -175,7 +156,6 @@ public class EntityCustomArrow extends EntityArrow { if (movingobjectposition != null) { vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); - } Entity entity = null; @@ -214,54 +194,38 @@ public class EntityCustomArrow extends EntityArrow { movingobjectposition = null; } } + //endregion - float f2; + float velocity; float f4; + //region Process Entity Hit if (movingobjectposition != null) { if (movingobjectposition.entityHit != null) { - if (explosive) { - //world.createExplosion(this.shootingEntity, movingobjectposition.entityHit.posX, movingobjectposition.entityHit.posY, movingobjectposition.entityHit.posZ, 6, false); - //movingobjectposition.entityHit.hurtResistantTime = 0; - worldObj.createExplosion(this.shootingEntity, movingobjectposition.entityHit.posX, movingobjectposition.entityHit.posY, movingobjectposition.entityHit.posZ, 4, ConfigHandler.bowBlockDamage); - this.setDead(); - } - int k; - if (!ignorSpeed) { - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); - k = MathHelper.ceiling_double_int(f2 * this.damageO); + onHitAnything(); + if (isDead) return; + int actualDamage; + //Calculate Damage + velocity = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + actualDamage = MathHelper.ceiling_double_int(velocity * bowProperties.arrowDamage); - if (this.getIsCritical()) { - k += this.rand.nextInt(k / 2 + 2); - } - } else { - k = (int) this.damageO; - if (this.getIsCritical()) { - k += this.rand.nextInt(k / 2 + 2); - } - } + if (bowProperties.energyBolt) actualDamage *= 1.1F; - DamageSource damagesource = null; - - if (this.shootingEntity == null) { - damagesource = DamageSource.causeArrowDamage(this, this); - } else { - damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity); + if (this.getIsCritical()) { + actualDamage += this.rand.nextInt(actualDamage / 2 + 2); } - if (movingobjectposition.entityHit instanceof EntityEnderman) - damagesource = DamageSource.magic; if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { movingobjectposition.entityHit.setFire(5); } - movingobjectposition.entityHit.hurtResistantTime = 0; - if (movingobjectposition.entityHit instanceof EntityDragonPart && ((EntityDragonPart)movingobjectposition.entityHit).entityDragonObj instanceof EntityDragon) + if (bowProperties.energyBolt) movingobjectposition.entityHit.hurtResistantTime = 0; + if (movingobjectposition.entityHit instanceof EntityDragonPart && ((EntityDragonPart)movingobjectposition.entityHit).entityDragonObj instanceof EntityDragon && bowProperties.energyBolt) { ((EntityDragon)((EntityDragonPart)movingobjectposition.entityHit).entityDragonObj).hurtResistantTime = 0; } - if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k)) { + if (movingobjectposition.entityHit.attackEntityFrom(getDamageSource(), actualDamage)) { if (movingobjectposition.entityHit instanceof EntityLivingBase) { EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit; @@ -288,18 +252,17 @@ public class EntityCustomArrow extends EntityArrow { } this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); - - // if (!(movingobjectposition.entityHit instanceof EntityEnderman)) - //{ this.setDead(); - //} + } else { - this.motionX *= -0.10000000149011612D; - this.motionY *= -0.10000000149011612D; - this.motionZ *= -0.10000000149011612D; - this.rotationYaw += 180.0F; - this.prevRotationYaw += 180.0F; - this.ticksInAir = 0; + if (!(worldObj.isRemote && ticksInAir < 5)) { //Fix arrow wobble on fire due to client side collision with shooting entity + this.motionX *= -0.10000000149011612D; + this.motionY *= -0.10000000149011612D; + this.motionZ *= -0.10000000149011612D; + this.rotationYaw += 180.0F; + this.prevRotationYaw += 180.0F; + this.ticksInAir = 0; + } } } else { this.blockX = movingobjectposition.blockX; @@ -311,10 +274,10 @@ public class EntityCustomArrow extends EntityArrow { this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX)); this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY)); this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); - this.posX -= this.motionX / f2 * 0.05000000074505806D; - this.posY -= this.motionY / f2 * 0.05000000074505806D; - this.posZ -= this.motionZ / f2 * 0.05000000074505806D; + velocity = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.posX -= this.motionX / velocity * 0.05000000074505806D; + this.posY -= this.motionY / velocity * 0.05000000074505806D; + this.posZ -= this.motionZ / velocity * 0.05000000074505806D; this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); this.inGround = true; this.arrowShake = 7; @@ -324,20 +287,32 @@ public class EntityCustomArrow extends EntityArrow { } } } + //endregion - if (this.getIsCritical()) { + //region Motion + if (this.getIsCritical() || bowProperties.energyBolt) { for (i = 0; i < 4; ++i) { - this.worldObj.spawnParticle("crit", this.posX + this.motionX * i / 4.0D, this.posY + this.motionY * i / 4.0D, this.posZ + this.motionZ * i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ); + if (bowProperties.energyBolt) { + Particles.ArrowParticle particle = new Particles.ArrowParticle(worldObj, posX - 0.25 + rand.nextDouble() * 0.5, posY + rand.nextDouble() * 0.5, posZ - 0.25 + rand.nextDouble() * 0.5, 0xff6000, 0.2F+rand.nextFloat()*0.5f); + double mm = 0.2; + particle.motionX = (rand.nextDouble() - 0.5) * mm; + particle.motionY = (rand.nextDouble() - 0.5) * mm; + particle.motionZ = (rand.nextDouble() - 0.5) * mm; + ParticleHandler.spawnCustomParticle(particle, 64); + } + else { + this.worldObj.spawnParticle("crit", this.posX + this.motionX * i / 4.0D, this.posY + this.motionY * i / 4.0D, this.posZ + this.motionZ * i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ); + } } } this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + velocity = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + for (this.rotationPitch = (float) (Math.atan2(this.motionY, velocity) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { ; } @@ -356,7 +331,7 @@ public class EntityCustomArrow extends EntityArrow { this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; float f3 = 0.99F; - f1 = 0.05F; + f1 = bowProperties.energyBolt ? 0.025F : 0.05F; if (this.isInWater()) { for (int l = 0; l < 4; ++l) { @@ -377,120 +352,103 @@ public class EntityCustomArrow extends EntityArrow { this.motionY -= f1; this.setPosition(this.posX, this.posY, this.posZ); this.func_145775_I(); + //endregion } } @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + public void writeEntityToNBT(NBTTagCompound compound) { - par1NBTTagCompound.setShort("xTile", (short) this.blockX); - par1NBTTagCompound.setShort("yTile", (short) this.blockY); - par1NBTTagCompound.setShort("zTile", (short) this.blockZ); - par1NBTTagCompound.setShort("life", (short) this.ticksInGround); - par1NBTTagCompound.setByte("inTile", (byte) Block.getIdFromBlock(this.blockHit)); - par1NBTTagCompound.setByte("inData", (byte) this.inData); - par1NBTTagCompound.setByte("shake", (byte) this.arrowShake); - par1NBTTagCompound.setByte("inGround", (byte) (this.inGround ? 1 : 0)); - par1NBTTagCompound.setByte("pickup", (byte) this.canBePickedUp); - par1NBTTagCompound.setDouble("damageO", this.damageO); - //par1NBTTagCompound.setString("shooter", getShooter() instanceof EntityPlayer ? ((EntityPlayer) getShooter()).getCommandSenderName() : ""); + compound.setShort("xTile", (short) this.blockX); + compound.setShort("yTile", (short) this.blockY); + compound.setShort("zTile", (short) this.blockZ); + compound.setShort("life", (short) this.ticksInGround); + compound.setByte("inTile", (byte) Block.getIdFromBlock(this.blockHit)); + compound.setByte("inData", (byte) this.inData); + compound.setByte("shake", (byte) this.arrowShake); + compound.setByte("inGround", (byte) (this.inGround ? 1 : 0)); + compound.setByte("pickup", (byte) this.canBePickedUp); + if (bowProperties != null) bowProperties.writeToNBT(compound); } @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + public void readEntityFromNBT(NBTTagCompound compound) { - this.blockX = par1NBTTagCompound.getShort("xTile"); - this.blockY = par1NBTTagCompound.getShort("yTile"); - this.blockZ = par1NBTTagCompound.getShort("zTile"); - this.ticksInGround = par1NBTTagCompound.getShort("life"); - this.blockHit = Block.getBlockById(par1NBTTagCompound.getByte("inTile") & 255); - this.inData = par1NBTTagCompound.getByte("inData") & 255; - this.arrowShake = par1NBTTagCompound.getByte("shake") & 255; - this.inGround = par1NBTTagCompound.getByte("inGround") == 1; - //dataWatcher.updateObject(SHOOTER_DATAWATCHER_INDEX, par1NBTTagCompound.hasKey("shooter") ? par1NBTTagCompound.getString("shooter") : ""); + this.blockX = compound.getShort("xTile"); + this.blockY = compound.getShort("yTile"); + this.blockZ = compound.getShort("zTile"); + this.ticksInGround = compound.getShort("life"); + this.blockHit = Block.getBlockById(compound.getByte("inTile") & 255); + this.inData = compound.getByte("inData") & 255; + this.arrowShake = compound.getByte("shake") & 255; + this.inGround = compound.getByte("inGround") == 1; - if (par1NBTTagCompound.hasKey("damageO", 99)) { - this.damageO = par1NBTTagCompound.getDouble("damageO"); + if (compound.hasKey("pickup", 99)) { + this.canBePickedUp = compound.getByte("pickup"); + } else if (compound.hasKey("player", 99)) { + this.canBePickedUp = compound.getBoolean("player") ? 1 : 0; } - if (par1NBTTagCompound.hasKey("pickup", 99)) { - this.canBePickedUp = par1NBTTagCompound.getByte("pickup"); - } else if (par1NBTTagCompound.hasKey("player", 99)) { - this.canBePickedUp = par1NBTTagCompound.getBoolean("player") ? 1 : 0; - } + if (bowProperties != null) bowProperties.readFromNBT(compound); } @Override public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { - if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { - boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; +// if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { +// boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; +// +// if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) { +// flag = false; +// } +// +// if (flag) { +// this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); +// par1EntityPlayer.onItemPickup(this, 1); +// this.setDead(); +// } +// } + } - if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) { - flag = false; + public void onHitEntityLiving(EntityLivingBase entityLivingBase){ + } + + public void onHitAnything(){ + if (bowProperties.explosionPower > 0 && !worldObj.isRemote){ + worldObj.createExplosion(this, prevPosX, prevPosY, prevPosZ, bowProperties.explosionPower, true); + setDead(); + } + if (bowProperties.shockWavePower > 0 && !worldObj.isRemote){ + DraconicEvolution.network.sendToAllAround(new GenericParticlePacket(GenericParticlePacket.ARROW_SHOCK_WAVE, posX, posY, posZ, (int)(bowProperties.shockWavePower * 100)), new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 256)); + worldObj.playSoundEffect(posX, posY, posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + + double range = (double)bowProperties.shockWavePower + 5; + List list = worldObj.getEntitiesWithinAABB(Entity.class, boundingBox.expand(range, range, range)); + + float damage = 20F * bowProperties.shockWavePower; + + for (Entity e : list) { + if (e instanceof EntityLivingBase) { + Entity entity = e; + float distanceModifier = 1F - (entity.getDistanceToEntity(this) / bowProperties.shockWavePower); + + if (e instanceof EntityDragon){ + entity = ((EntityDragon)entity).dragonPartBody; + distanceModifier = 1F - (entity.getDistanceToEntity(this) / (bowProperties.shockWavePower * 4)); + } + + if (distanceModifier > 0) entity.attackEntityFrom(getDamageSource(), distanceModifier * damage); + } } - if (flag) { - this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); - par1EntityPlayer.onItemPickup(this, 1); - this.setDead(); - } + setDead(); } } - @Override - protected boolean canTriggerWalking() - { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() - { - return 0.0F; - } - - @Override - public void setDamage(double par1) - { - this.damageO = par1; - } - - @Override - public double getDamage() - { - return this.damageO; - } - - @Override - public void setKnockbackStrength(int par1) - { - this.knockbackStrength = par1; - } - - @Override - public boolean canAttackWithItem() - { - return false; - } - - @Override - public void setIsCritical(boolean par1) - { - byte b0 = this.dataWatcher.getWatchableObjectByte(16); - - if (par1) { - this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 1))); - } else { - this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -2))); + private DamageSource getDamageSource(){ + if (bowProperties.energyBolt){ + return new EntityDamageSourceIndirect("customArrowEnergy", this, shootingEntity != null ? shootingEntity : this).setProjectile().setDamageIsAbsolute(); } - } - - @Override - public boolean getIsCritical() - { - byte b0 = this.dataWatcher.getWatchableObjectByte(16); - return (b0 & 1) != 0; + else return DamageSource.causeArrowDamage(this, shootingEntity != null ? shootingEntity : this); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java index 37aeacb7..0c7b2ae4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java @@ -1,12 +1,16 @@ package com.brandon3055.draconicevolution.common.items.tools; import cofh.api.energy.IEnergyContainerItem; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.RFItemBase; +import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; +import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; @@ -20,12 +24,13 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import java.util.ArrayList; import java.util.List; /** * Created by Brandon on 24/11/2014. */ -public class DraconiumFluxCapacitor extends RFItemBase { +public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableItem { IIcon[] icons = new IIcon[2]; public DraconiumFluxCapacitor() @@ -67,17 +72,18 @@ public class DraconiumFluxCapacitor extends RFItemBase { @Override public int getCapacity(ItemStack stack){ - return stack.getItemDamage() == 0 ? 80000000 : stack.getItemDamage() == 1 ? 250000000 : 0; + int points = EnumUpgrade.RF_CAPACITY.getUpgradePoints(stack); + return stack.getItemDamage() == 0 ? 80000000 + points * 50000000 : stack.getItemDamage() == 1 ? 250000000 + points * 50000000 : 0; } @Override public int getMaxExtract(ItemStack stack){ - return stack.getItemDamage() == 0 ? 100000 : stack.getItemDamage() == 1 ? 100000000 : 0; + return stack.getItemDamage() == 0 ? 10000000 : stack.getItemDamage() == 1 ? 100000000 : 0; } @Override public int getMaxReceive(ItemStack stack){ - return stack.getItemDamage() == 0 ? 100000 : stack.getItemDamage() == 1 ? 10000000 : 0; + return stack.getItemDamage() == 0 ? 1000000 : stack.getItemDamage() == 1 ? 10000000 : 0; } @Override @@ -128,61 +134,6 @@ public class DraconiumFluxCapacitor extends RFItemBase { return stack; } -// @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(getCapacity(container.getItemDamage()) - energy, Math.min(getTransfer(container.getItemDamage()), 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(getTransfer(container.getItemDamage()), 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 getCapacity(container.getItemDamage()); -// } -// -// @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)); -// } - @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) @@ -193,21 +144,46 @@ public class DraconiumFluxCapacitor extends RFItemBase { list.add(InfoHelper.ITC()+StatCollector.translateToLocal("info.de.capacitorMode.txt")+": "+InfoHelper.HITC()+StatCollector.translateToLocal("info.de.capacitorMode"+ItemNBTHelper.getShort(stack, "Mode", (short)0)+".txt")); //InfoHelper.addLore(stack, list); } + ToolBase.holdCTRLForUpgrades(list, stack); } -// @Override -// public boolean hasCustomEntity(ItemStack stack) { -// return true; -// } -// -// @Override -// public Entity createEntity(World world, Entity location, ItemStack itemstack) { -// return new EntityPersistentItem(world, location, itemstack); -// } - - @Override public boolean hasProfiles() { return false; } + + @Override + public List getUpgrades(ItemStack itemstack) { + return new ArrayList(){{ + add(EnumUpgrade.RF_CAPACITY); + }}; + } + + + @Override + public int getUpgradeCap(ItemStack stack) { + return stack.getItemDamage() == 0 ? References.MAX_WYVERN_UPGRADES : References.MAX_DRACONIC_UPGRADES; + } + + @Override + public int getMaxTier(ItemStack stack) { + return stack.getItemDamage() == 0 ? 1 : 2; + } + + @Override + public int getMaxUpgradePoints(int upgradeIndex) { + return 50; + } + + @Override + public int getBaseUpgradePoints(int upgradeIndex) { + return 0; + } + + @Override + public List getUpgradeStats(ItemStack stack) { + List strings = new ArrayList(); + strings.add(InfoHelper.ITC()+StatCollector.translateToLocal("gui.de.RFCapacity.txt")+": "+InfoHelper.HITC()+ Utills.formatNumber(getMaxEnergyStored(stack))); + return strings; + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java index 5ab5b881..30457b8c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java @@ -3,18 +3,16 @@ package com.brandon3055.draconicevolution.common.items.weapons; import cofh.api.energy.IEnergyContainerItem; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.entity.EntityCustomArrow; -import com.brandon3055.draconicevolution.common.entity.EntityDraconicArrow; import com.brandon3055.draconicevolution.common.entity.EntityEnderArrow; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.ArrowLooseEvent; @@ -35,7 +33,6 @@ public class BowHandler { player.setItemInUse(stack, bow.getMaxItemUseDuration(stack)); } - else if (!properties.canFire() && properties.cantFireMessage != null) player.addChatComponentMessage(new ChatComponentTranslation(properties.cantFireMessage)); return stack; } @@ -48,160 +45,50 @@ public class BowHandler { public static void onPlayerStoppedUsingBow(ItemStack stack, World world, EntityPlayer player, int count){ BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, player); - if (!properties.canFire()) return; + if (!properties.canFire() || !(stack.getItem() instanceof IEnergyContainerItem)) return; int j = 72000 - count; ArrowLooseEvent event = new ArrowLooseEvent(player, stack, j); MinecraftForge.EVENT_BUS.post(event); - if (event.isCanceled()) { + + if (event.isCanceled()) + { return; } + j = event.charge; float drawArrowSpeedModifier = Math.min((float) j / (float) properties.getDrawTicks(), 1F); - if (drawArrowSpeedModifier < 0.1) return; + + if (drawArrowSpeedModifier < 0.1) + { + return; + } + float velocity = properties.arrowSpeed * drawArrowSpeedModifier * 2F; //2F is the speed of a vanilla arrow - LogHelper.info(velocity); - - EntityCustomArrow customArrow = new EntityCustomArrow(properties, world, player, velocity); - - if (properties.consumeArrow()) customArrow.canBePickedUp = 1; - else customArrow.canBePickedUp = 2; - + EntityCustomArrow customArrow = new EntityCustomArrow(world, player, velocity); + customArrow.bowProperties = properties; + if (drawArrowSpeedModifier == 1.0F) + { + customArrow.setIsCritical(true); + } + if (properties.consumeArrowAndEnergy()) + { + customArrow.canBePickedUp = 1; + } + else + { + customArrow.canBePickedUp = 2; + } if (!world.isRemote) world.spawnEntityInWorld(customArrow); world.playSoundAtEntity(player, "random.bow", 1.0F, (1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + (drawArrowSpeedModifier + (velocity / 40F)) * 0.5F)); - -// boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; -// -// if (flag || player.inventory.hasItem(Items.arrow)) { -// float f = j / pullSpeedModifier; -// f = (f * f + f * 2.0F) / 3.0F; -// -// if ((j < minRelease) || f < 0.1D) return; -// -// if (f > 1.0F) f = 1.0F; -// -// f *= speedModifier; -// -// EntityDraconicArrow entityArrow = new EntityDraconicArrow(world, player, f * 2.0F);//.setShooter(player); -// -// if (f >= 1.0F) entityArrow.setIsCritical(true); -// -// int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack); -// -// if (k > 0) // -// entityArrow.setDamage(entityArrow.getDamage() + k + 0.5D); -// -// int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack); -// -// if (l > 0) entityArrow.setKnockbackStrength(l * 2); -// -// if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0) entityArrow.setFire(200); -// -// if (ignorSpeedWhenCalculatingDamage) { -// entityArrow.ignorSpeed = true; -// entityArrow.setDamage(entityArrow.getDamage() + ignorSpeedCompensation); -// } -// if (isExplosive) { -// if ((player.inventory.hasItemStack(new ItemStack(Items.gunpowder, 4)) || player.capabilities.isCreativeMode)) { -// entityArrow.explosive = isExplosive; -// for (int i = 0; i < 4; ++i) -// player.inventory.consumeInventoryItem(Items.gunpowder); -// } else { -// if (player.worldObj.isRemote) -// player.addChatMessage(new ChatComponentTranslation("msg.bowoutofgunpowder.txt")); -// } -// } -// -// stack.damageItem(1, player); // -// world.playSoundAtEntity(player, "random.bow", 1.0F, soundPitchModifier * (1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.3F)); -// -// if (flag) entityArrow.canBePickedUp = 2; -// else { -// entityArrow.canBePickedUp = 1; -// player.inventory.consumeInventoryItem(Items.arrow); -// } -// -// if (!world.isRemote) world.spawnEntityInWorld(entityArrow); -// } } - public static void standerdShot(ItemStack stack, World world, EntityPlayer player, int count, Random itemRand, float pullSpeedModifier, float speedModifier, boolean ignorSpeedWhenCalculatingDamage, double ignorSpeedCompensation, float soundPitchModifier, boolean isExplosive, int minRelease) - { - int j = 72000 - count; - ArrowLooseEvent event = new ArrowLooseEvent(player, stack, j); - MinecraftForge.EVENT_BUS.post(event); - if (event.isCanceled()) { - return; - } - j = event.charge; - - boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; - - if (flag || player.inventory.hasItem(Items.arrow)) { - float f = j / pullSpeedModifier; - f = (f * f + f * 2.0F) / 3.0F; - - if ((j < minRelease) || f < 0.1D) - return; - - if (f > 1.0F) - f = 1.0F; - - f *= speedModifier; - - EntityDraconicArrow entityArrow = new EntityDraconicArrow(world, player, f * 2.0F);//.setShooter(player); - - if (f >= 1.0F) - entityArrow.setIsCritical(true); - - int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack); - - if (k > 0) // - entityArrow.setDamage(entityArrow.getDamage() + k + 0.5D); - - int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack); - - if (l > 0) - entityArrow.setKnockbackStrength(l * 2); - - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0) - entityArrow.setFire(200); - - if (ignorSpeedWhenCalculatingDamage) { - entityArrow.ignorSpeed = true; - entityArrow.setDamage(entityArrow.getDamage() + ignorSpeedCompensation); - } - if (isExplosive) { - if ((player.inventory.hasItemStack(new ItemStack(Items.gunpowder, 4)) || player.capabilities.isCreativeMode)) { - entityArrow.explosive = isExplosive; - for (int i = 0; i < 4; ++i) - player.inventory.consumeInventoryItem(Items.gunpowder); - } else { - if (player.worldObj.isRemote) - player.addChatMessage(new ChatComponentTranslation("msg.bowoutofgunpowder.txt")); - } - } - - stack.damageItem(1, player); // - world.playSoundAtEntity(player, "random.bow", 1.0F, soundPitchModifier * (1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.3F)); - - if (flag) - entityArrow.canBePickedUp = 2; - else { - entityArrow.canBePickedUp = 1; - player.inventory.consumeInventoryItem(Items.arrow); - } - - if (!world.isRemote) - world.spawnEntityInWorld(entityArrow); - } - } public static void enderShot(ItemStack stack, World world, EntityPlayer player, int count, Random itemRand, float pullSpeedModifier, float speedModifier, float soundPitchModifier, int minRelease) { @@ -241,14 +128,6 @@ public class BowHandler { } } - public static void rapidFire(EntityPlayer player, int count, int speed) - { - int ticks = 72000 - count; - if (ticks > speed) { - //if (!player.isSneaking()) - player.stopUsingItem(); - } - } public static class BowProperties { public ItemStack bow; @@ -281,8 +160,8 @@ public class BowHandler { double rfCost = 80; rfCost *= 1 + arrowDamage; - rfCost *= 1 + arrowSpeed; - rfCost *= 1 + explosionPower * 10; + rfCost *= (1 + arrowSpeed) * (1 + arrowSpeed) * (1 + arrowSpeed); + rfCost *= 1 + explosionPower * 20; rfCost *= 1 + shockWavePower * 10; if (energyBolt) rfCost *= 30; @@ -298,19 +177,19 @@ public class BowHandler { return false; } else if (!energyBolt && shockWavePower > 0){ - cantFireMessage = "msg.de.shockWaveForEnergyBoltsOnly.name"; + cantFireMessage = "msg.de.shockWaveForEnergyBoltsOnly.txt"; return false; } else if (energyBolt && explosionPower > 0){ - cantFireMessage = "msg.de.explosiveNotForEnergyBolts.name"; + cantFireMessage = "msg.de.explosiveNotForEnergyBolts.txt"; return false; } else if (calculateEnergyCost() > ((IEnergyContainerItem)bow.getItem()).getEnergyStored(bow)){ - cantFireMessage = "msg.de.insufficientPowerToFire.name"; + cantFireMessage = "msg.de.insufficientPowerToFire.txt"; return false; } else if (!energyBolt && !player.inventory.hasItem(Items.arrow) && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 && !player.capabilities.isCreativeMode){ - cantFireMessage = "msg.de.outOfArrows.name"; + cantFireMessage = "msg.de.outOfArrows.txt"; return false; } @@ -320,7 +199,7 @@ public class BowHandler { } private void updateValues(){ - arrowDamage = (float)IUpgradableItem.EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(bow); + arrowDamage = (float)IConfigurableItem.ProfileHelper.getFloat(bow, "BowArrowDamage", IUpgradableItem.EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(bow)); arrowSpeed = 1F + IConfigurableItem.ProfileHelper.getFloat(bow, "BowArrowSpeedModifier", 0F); explosionPower = IConfigurableItem.ProfileHelper.getFloat(bow, "BowExplosionPower", 0F); shockWavePower = IConfigurableItem.ProfileHelper.getFloat(bow, "BowShockWavePower", 0F); @@ -334,7 +213,10 @@ public class BowHandler { return Math.max(62 - (drawTimeReduction * 10), 1); } - public boolean consumeArrow(){ + public boolean consumeArrowAndEnergy(){ + + ((IEnergyContainerItem)bow.getItem()).extractEnergy(bow, calculateEnergyCost(), false); + if (!energyBolt && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 && !player.capabilities.isCreativeMode) { player.inventory.consumeInventoryItem(Items.arrow); return true; @@ -342,6 +224,20 @@ public class BowHandler { return false; } + + public void writeToNBT(NBTTagCompound compound){ + compound.setFloat("ArrowDamage", arrowDamage); + compound.setFloat("ArrowExplosive", explosionPower); + compound.setFloat("ArrowShock", shockWavePower); + compound.setBoolean("ArrowEnergy", energyBolt); + } + + public void readFromNBT(NBTTagCompound compound){ + arrowDamage = compound.getFloat("ArrowDamage"); + explosionPower = compound.getFloat("ArrowExplosive"); + shockWavePower = compound.getFloat("ArrowShock"); + energyBolt = compound.getBoolean("ArrowEnergy"); + } } } //lot, "BowArrowSpeedModifier").setMinMaxAndIncromente(0F, (float)EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F).readFromItem(stack, 0F)todo dont forget the speed needs to be "Calibrated" for the upgrade system diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java index 5e5089ce..133e08d7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.items.weapons; import cofh.api.energy.IEnergyContainerItem; +import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.brandonscore.common.utills.Utills; @@ -10,6 +11,7 @@ import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; @@ -25,6 +27,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; @@ -32,7 +35,7 @@ import net.minecraft.world.World; import java.util.ArrayList; import java.util.List; -public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableItem, IEnergyContainerItem +public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableItem, IEnergyContainerItem, IHudDisplayItem { public static final String[] bowPullIconNameArray = new String[] { "pulling_0", "pulling_1", "pulling_2" }; @SideOnly(Side.CLIENT) @@ -193,12 +196,13 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI public List getFields(ItemStack stack, int slot) {//todo balance floaty upgrade things List list = new ArrayList(); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowDamage").setMinMaxAndIncromente((float)getBaseUpgradePoints(EnumUpgrade.ARROW_DAMAGE.index), (float)EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack), 0.1F).readFromItem(stack, (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack))); list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowSpeedModifier").setMinMaxAndIncromente(0F, (float)EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowAutoFire").readFromItem(stack, false)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower").setMinMaxAndIncromente(0F, 4F, 0.1F).readFromItem(stack, 0F)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower").setMinMaxAndIncromente(0F, 4F, 0.1F).readFromItem(stack, 0F)); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower").setMinMaxAndIncromente(0F, 6F, 0.1F).readFromItem(stack, 0F)); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower").setMinMaxAndIncromente(0F, 10F, 0.1F).readFromItem(stack, 0F)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowEnergyBolt").readFromItem(stack, false)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier").setMinMaxAndIncromente(0F, 3F, 0.01F).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier").setMinMaxAndIncromente(0F, 6F, 0.01F).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); return list; } @@ -234,8 +238,8 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI public int getBaseUpgradePoints(int upgradeIndex) { if (upgradeIndex == EnumUpgrade.RF_CAPACITY.index) return 2; else if (upgradeIndex == EnumUpgrade.DRAW_SPEED.index) return 4; - else if (upgradeIndex == EnumUpgrade.ARROW_SPEED.index) return 2; - else if (upgradeIndex == EnumUpgrade.ARROW_DAMAGE.index) return 1; + else if (upgradeIndex == EnumUpgrade.ARROW_SPEED.index) return 3; + else if (upgradeIndex == EnumUpgrade.ARROW_DAMAGE.index) return 3; return 0; } @@ -245,7 +249,7 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI List list = new ArrayList(); list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.ArrowSpeed.txt") + ": " + InfoHelper.HITC() + "+"+EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack)*100+"%"); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() + properties.arrowDamage + ""); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() + EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack) + ""); list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + ": " + InfoHelper.HITC() + properties.getDrawTicks()/20D + "s"); return list; @@ -260,7 +264,7 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { int energy = ItemNBTHelper.getInteger(container, "Energy", 0); - int energyReceived = Math.min(getMaxEnergyStored(container) - energy, Math.min(References.WYVERNTRANSFER, maxReceive)); + int energyReceived = Math.min(getMaxEnergyStored(container) - energy, Math.min(References.DRACONICTRANSFER, maxReceive)); if (!simulate) { energy += energyReceived; @@ -273,7 +277,7 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { int energy = ItemNBTHelper.getInteger(container, "Energy", 0); - int energyExtracted = Math.min(energy, Math.min(References.WYVERNTRANSFER, maxExtract)); + int energyExtracted = Math.min(energy, maxExtract); if (!simulate) { energy -= energyExtracted; @@ -293,5 +297,34 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI return i * 5000000; } + @Override + public List getDisplayData(ItemStack stack) { + List list = new ArrayList(); + + if (BrandonsCore.proxy.getClientPlayer() != null && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null && BrandonsCore.proxy.getClientPlayer().getItemInUseDuration() > 2){ + EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); + BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, player); + int power = (int)Math.min(((float) player.getItemInUseDuration() / (float)properties.getDrawTicks() * 100F), 100F); + list.add(InfoHelper.ITC()+StatCollector.translateToLocal("info.de.power.txt")+": "+InfoHelper.HITC()+power+"%"); + } + else { + int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); + list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + + for (ItemConfigField field : getFields(stack, 0)) { + if ((field.datatype == References.FLOAT_ID && (Float)field.value > 0) || (field.datatype == References.BOOLEAN_ID && (Boolean)field.value)) list.add(field.getTooltipInfo()); + } + + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(getMaxEnergyStored(stack))); + + if (BrandonsCore.proxy.getClientPlayer() != null) { + BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, BrandonsCore.proxy.getClientPlayer()); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + InfoHelper.HITC() + Utills.addCommas(properties.calculateEnergyCost())); + if (!properties.canFire() && properties.cantFireMessage != null) list.add(EnumChatFormatting.DARK_RED+StatCollector.translateToLocal(properties.cantFireMessage)); + } + } + return list; + } + //endregion } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java index ae245982..22364b47 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java @@ -252,6 +252,7 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem, II @Override public int getMaxUpgradePoints(int upgradeIndex) { if (upgradeIndex == EnumUpgrade.ATTACK_AOE.index) return 5; + else if (upgradeIndex == EnumUpgrade.ATTACK_DAMAGE.index) return 12; return 50; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java index d18c20fb..401a710e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java @@ -1,18 +1,20 @@ package com.brandon3055.draconicevolution.common.items.weapons; import cofh.api.energy.IEnergyContainerItem; +import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,6 +27,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; @@ -32,7 +35,7 @@ import net.minecraft.world.World; import java.util.ArrayList; import java.util.List; -public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableItem, IEnergyContainerItem { +public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableItem, IEnergyContainerItem, IHudDisplayItem { public static final String[] bowPullIconNameArray = new String[] { "pulling_0", "pulling_1", "pulling_2" }; @SideOnly(Side.CLIENT) @@ -94,7 +97,6 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte if (j2 < 0) j2 = 0; else if (j2 > 2) j2 = 2; - LogHelper.info(j2); return getItemIconForUseDuration(j2); } @@ -190,11 +192,12 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte public List getFields(ItemStack stack, int slot) {//todo balance floaty upgrade things List list = new ArrayList(); + list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowDamage").setMinMaxAndIncromente((float)getBaseUpgradePoints(EnumUpgrade.ARROW_DAMAGE.index), (float)EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack), 0.1F).readFromItem(stack, (float)EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack))); list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowSpeedModifier").setMinMaxAndIncromente(0F, (float)EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowAutoFire").readFromItem(stack, false)); list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower").setMinMaxAndIncromente(0F, 4F, 0.1F).readFromItem(stack, 0F)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower").setMinMaxAndIncromente(0F, 4F, 0.1F).readFromItem(stack, 0F)); - list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowEnergyBolt").readFromItem(stack, false)); + // list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower").setMinMaxAndIncromente(0F, 4F, 0.1F).readFromItem(stack, 0F)); + // list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowEnergyBolt").readFromItem(stack, false)); list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier").setMinMaxAndIncromente(0F, 3F, 0.01F).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); return list; @@ -237,17 +240,20 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte if (upgradeIndex == EnumUpgrade.RF_CAPACITY.index) return 2; else if (upgradeIndex == EnumUpgrade.DRAW_SPEED.index) return 3; else if (upgradeIndex == EnumUpgrade.ARROW_SPEED.index) return 1; - else if (upgradeIndex == EnumUpgrade.ARROW_DAMAGE.index) return 1; + else if (upgradeIndex == EnumUpgrade.ARROW_DAMAGE.index) return 2; return 0; } @Override - public List getUpgradeStats(ItemStack itemstack) { - List strings = new ArrayList(); + public List getUpgradeStats(ItemStack stack) { + BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, null); + List list = new ArrayList(); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.ArrowSpeed.txt") + ": " + InfoHelper.HITC() + "+"+EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack)*100+"%"); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() + properties.arrowDamage + ""); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + ": " + InfoHelper.HITC() + properties.getDrawTicks()/20D + "s"); - // strings.add(StatCollector.translateToLocal("gui.de.RFCapacity.txt")+": "+ Utills.formatNumber(getMaxEnergyStored(itemstack))); - - return strings; + return list; } @Override @@ -267,7 +273,7 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { int energy = ItemNBTHelper.getInteger(container, "Energy", 0); - int energyExtracted = Math.min(energy, Math.min(References.WYVERNTRANSFER, maxExtract)); + int energyExtracted = Math.min(energy, maxExtract); if (!simulate) { energy -= energyExtracted; @@ -286,6 +292,36 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte int i = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(stack); return i * 500000; } + + @Override + public List getDisplayData(ItemStack stack) { + List list = new ArrayList(); + + if (BrandonsCore.proxy.getClientPlayer() != null && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null){ + EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); + BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, player); + int power = (int)Math.min(((float) player.getItemInUseDuration() / (float)properties.getDrawTicks() * 100F), 100F); + list.add(InfoHelper.ITC()+StatCollector.translateToLocal("info.de.power.txt")+": "+InfoHelper.HITC()+power+"%"); + } + else { + int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); + list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + + for (ItemConfigField field : getFields(stack, 0)) { + if ((field.datatype == References.FLOAT_ID && (Float)field.value > 0) || (field.datatype == References.BOOLEAN_ID && (Boolean)field.value)) list.add(field.getTooltipInfo()); + } + + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(getMaxEnergyStored(stack))); + + if (BrandonsCore.proxy.getClientPlayer() != null) { + BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, BrandonsCore.proxy.getClientPlayer()); + list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + InfoHelper.HITC() + Utills.addCommas(properties.calculateEnergyCost())); + if (!properties.canFire() && properties.cantFireMessage != null) list.add(EnumChatFormatting.DARK_RED+StatCollector.translateToLocal(properties.cantFireMessage)); + } + + } + return list; + } //endregion } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java index 7c3b52a4..8ff8dff4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java @@ -15,11 +15,13 @@ public class GenericParticlePacket implements IMessage public static final byte ENERGY_BALL_KILL = 0; public static final byte CHAOS_BALL_KILL = 1; public static final byte CHAOS_IMPLOSION = 3; + public static final byte ARROW_SHOCK_WAVE = 4; - byte particleId = 0; - double posX; - double posY; - double posZ; + private byte particleId = 0; + private double posX; + private double posY; + private double posZ; + private int additionalData; public GenericParticlePacket() {} @@ -30,12 +32,24 @@ public class GenericParticlePacket implements IMessage this.posZ = posZ; } + public GenericParticlePacket(byte particleId, double posX, double posY, double posZ, int aditionalData) { + this.particleId = particleId; + this.posX = posX; + this.posY = posY; + this.posZ = posZ; + this.additionalData = aditionalData; + } + @Override public void fromBytes(ByteBuf bytes){ this.particleId = bytes.readByte(); this.posX = (double)bytes.readFloat(); this.posY = (double)bytes.readFloat(); this.posZ = (double)bytes.readFloat(); + + if (particleId == ARROW_SHOCK_WAVE) { + this.additionalData = bytes.readInt(); + } } @Override @@ -44,6 +58,10 @@ public class GenericParticlePacket implements IMessage bytes.writeFloat((float)posX); bytes.writeFloat((float)posY); bytes.writeFloat((float)posZ); + + if (particleId == ARROW_SHOCK_WAVE) { + bytes.writeInt(additionalData); + } } public static class Handler implements IMessageHandler { @@ -83,6 +101,25 @@ public class GenericParticlePacket implements IMessage ParticleHandler.spawnCustomParticle(new Particles.ChaosImplosionParticle(BrandonsCore.proxy.getClientWorld(), message.posX, message.posY, message.posZ, 200F), 512); break; } + case ARROW_SHOCK_WAVE: + { + ParticleHandler.spawnCustomParticle(new Particles.ArrowShockParticle(BrandonsCore.proxy.getClientWorld(), message.posX, message.posY, message.posZ, message.additionalData), 256); + for (int i = 0; i < 100; i++){ + Particles.ArrowParticle particle = new Particles.ArrowParticle(BrandonsCore.proxy.getClientWorld(), + message.posX - 0.25 + BrandonsCore.proxy.getClientWorld().rand.nextDouble() * 0.5, + message.posY + BrandonsCore.proxy.getClientWorld().rand.nextDouble() * 0.5, + message.posZ - 0.25 + BrandonsCore.proxy.getClientWorld().rand.nextDouble() * 0.5, + 0xff6000, + 0.2F+BrandonsCore.proxy.getClientWorld().rand.nextFloat()*10f); + + double mm = 2; + particle.motionX = (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + particle.motionY = (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + particle.motionZ = (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + ParticleHandler.spawnCustomParticle(particle, 64); + } + break; + } default: diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java index c240242f..0eeeacb2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java @@ -108,8 +108,15 @@ public class TileUpgradeModifier extends TileEntity implements ISidedInventory { @Override public boolean isUseableByPlayer(EntityPlayer player) { - return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.4) < 64; - } + if (worldObj == null) + { + return true; + } + if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) + { + return false; + } + return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.4) < 64; } @Override public void openInventory() {} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java index 81d89f00..1e4e242e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java @@ -86,7 +86,19 @@ public interface IUpgradableItem { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); } }, - ARROW_DAMAGE (6, 1, "ArrowDamage"), + ARROW_DAMAGE (6, 1, "ArrowDamage"){ + @Override + public void onRemovedFromItem(ItemStack itemStack) { + int profile = ItemNBTHelper.getInteger(itemStack, "ConfigProfile", 0); + + for (int i = 0; i < 5; i++){ + ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); + if (IConfigurableItem.ProfileHelper.getInteger(itemStack, "BowArrowDamage", 0) > getUpgradePoints(itemStack)) IConfigurableItem.ProfileHelper.setInteger(itemStack, "BowArrowDamage", getUpgradePoints(itemStack)); + } + + ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); + } + }, DRAW_SPEED (7, 2, "DrawSpeed"), ARROW_SPEED (8, 2, "ArrowSpeed"){ @Override diff --git a/src/main/resources/assets/draconicevolution/lang/en_US.lang b/src/main/resources/assets/draconicevolution/lang/en_US.lang index 5d3d12ab..935fd852 100644 --- a/src/main/resources/assets/draconicevolution/lang/en_US.lang +++ b/src/main/resources/assets/draconicevolution/lang/en_US.lang @@ -168,6 +168,10 @@ msg.de.dragonDeath.txt=§5The heart is temporarily awakened by the dragons explo msg.de.baseSafeAOW.txt=§9(§aAOE §aSafe §aMode §ais §aenabled§9) §cOperation §cCanceled §cbecause §ca §ctile §centity §cwas §cdetected msg.de.guardianAttackBlocked.txt=Your attack is blocked by the guardians crystals! msg.de.shieldDepleted.txt=Warning Critical Damage!!! +msg.de.shockWaveForEnergyBoltsOnly.txt=Shock Wave is only possible with Arrow of Draconic Fire +msg.de.explosiveNotForEnergyBolts.txt=Explosive is not possible with Arrow of Draconic Fire +msg.de.insufficientPowerToFire.txt=Insufficient Power to Fire +msg.de.outOfArrows.txt=Out of Arrows!!! //Energy Net msg.de.wrenchMode.bind.txt=Function: Bind @@ -233,8 +237,9 @@ info.de.bonusHealthDamage.txt=Mob Health info.de.press.txt=Press info.de.toOpenConfigGUI.txt=To open config GUI info.de.shiftToPause.txt=Hold shift to pause slide +info.de.power.txt=Power -info.de.bowEnchants.txt=Enchants are twice as effective on this bow +info.de.bowEnchants.txt=10x more accurate then a vanilla bow! info.de.sword.txt=Your enemy's strength makes this blade stronger! @@ -292,7 +297,7 @@ draconicevolution.achievementPage.name=Draconic Evolution achievement.draconicevolution.dust=The Start of something BIG! achievement.draconicevolution.dust.desc=Collect Draconium dust achievement.draconicevolution.ingot=Better than Diamond! -achievement.draconicevolution.ingot.desc=Refine 4 Draconium dust into 2 Draconium Ingots +achievement.draconicevolution.ingot.desc=Smelt a Draconium Dust into a Draconium Ingot achievement.draconicevolution.core=This is where it begins achievement.draconicevolution.core.desc=Craft a Draconic Core achievement.draconicevolution.core2=Not Good Enough! @@ -476,6 +481,7 @@ button.de.EffectiveOnSprint.name=Effective while sprinting button.de.GogglesOfRevealing.name=Magical Sense button.de.BowArrowSpeedModifier.name=Arrow Velocity Modifier button.de.BowAutoFire.name=Auto Fire +button.de.BowArrowDamage.name=Base Damage button.de.BowExplosionPower.name=Explosive Power button.de.BowShockWavePower.name=Shock Wave Power button.de.BowEnergyBolt.name=Arrow of Draconic Fire @@ -561,6 +567,8 @@ gui.de.hudDisplaySettings.txt=HUD Display Settings gui.de.shieldDisplaySettings.txt=Shield Display Settings gui.de.clickAndDragPurpleBoxes.txt=Click and drag the purple boxes to move the displays gui.de.profile.txt=Profile +gui.de.maxDamage.txt=Max Damage +gui.de.rfPerShot.txt=RF/Shot gui.de.RFCapacity.txt=RF Capacity gui.de.DigSpeed.txt=Dig Speed @@ -568,7 +576,7 @@ gui.de.DigAOE.txt=Dig A.O.E gui.de.DigDepth.txt=Dig Depth gui.de.AttackDamage.txt=Attack Damage gui.de.AttackAOE.txt=Attack A.O.E -gui.de.ArrowDamage.txt=Arrow Damage +gui.de.ArrowDamage.txt=Base Damage gui.de.DrawSpeed.txt=Draw Speed gui.de.ArrowSpeed.txt=Arrow Velocity gui.de.ShieldCapacity.txt=Shield Capacity diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 00000000..96010082 --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,16 @@ +[ +{ + "modid": "DraconicEvolution", + "name": "Draconic Evolution", + "description": "This is a mod that was originally made for the Tolkiencraft mod pack but it has since evolved way beyond that. This mod adds a mot of extremely expensive ant powerful end game items as well as a lot of random useful bits and peaces.", + "version": "${version}", + "mcversion": "${mcversion}", + "url": "http://www.brandon3055.com/", + "updateUrl": "", + "authorList": ["brandon3055"], + "credits": "", + "logoFile": "banner.png", + "screenshots": [], + "dependencies": [] +} +] \ No newline at end of file diff --git a/src/main/resources/mcmod.info.disabled b/src/main/resources/mcmod.info.disabled deleted file mode 100644 index 5db844d2..00000000 --- a/src/main/resources/mcmod.info.disabled +++ /dev/null @@ -1,16 +0,0 @@ -[ -{ - "modid": "tolkienaddon", - "name": "Tolkiencraft Addon", - "description": "This is a mod made for the Tolkiencraft mod pack", - "version": "0.8alpha", - "mcversion": "1.7.2", - "url": "http://dragontalk.net/node/71", - "updateUrl": "", - "credits": "Many Online tutorials", - "authorList": ["brandon3055"], - "logoFile": "TCLogo.png", - "screenshots": [TCLogo.png], - "dependencies": [] -} -]