diff --git a/Change Log.txt b/Change Log.txt index f26b4d3b..415b41f5 100644 --- a/Change Log.txt +++ b/Change Log.txt @@ -1,10 +1,23 @@ ######## 1.0.1-Snap Shot(?) ######## -reduced default particle view range to 64 blocks. +-fixed up and down arrows in advanced dislocator GUI. +-fixed chaos guardian not spawning a portal on servers. +-re added the ability to change mining aoe of the tools with shift right click. +-fixed item config gui crash (needs server testing to confirm). +-optimized draconium chest packet handling. +-added config option to disable ore generation. +-blocked cheaty method of killing the dragon on servers by going out of its update range. +-added config option to disable the HUD info. +-added Energy Relay [WIP] +-added Advanced Energy Relay [WIP] +-added Energy Transceiver [WIP] +-added Advanced Energy Transceiver [WIP] +-added Crystal Wrench [WIP] ######## 1.0.1-Snap Shot(3) ######## --fixed spawner display mob shaking when disabled +-fixed spawner display mob shaking when disabled. -removed energy cost for Draconic Chest flight. -added tool config gui. -safety flame can now be extinguished without breaking the block it is placed on. diff --git a/VERSION.json b/VERSION.json new file mode 100644 index 00000000..62b6a83b --- /dev/null +++ b/VERSION.json @@ -0,0 +1,6 @@ +{ + "Version":"1.0.1" + "Snapshot":4 + "MCVersion":"1.0.1-snapshot_4" + "ReleaseNote":"This is a release note!" +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index efb594ef..0ca1a5cc 100644 --- a/build.gradle +++ b/build.gradle @@ -75,3 +75,5 @@ processResources exclude 'mcmod.info' } } + +sourceSets { main { output.resourcesDir = output.classesDir } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 662430a8..a9bbffb5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -#Tue May 06 21:57:37 CEST 2014 +#Fri Feb 20 03:02:45 EST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java index 1ebe051b..80bb78dc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java +++ b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java @@ -30,7 +30,7 @@ public class DraconicEvolution { // TODO Update Licence and add change log to gi public static final String networkChannelName = "DEvolutionNC"; public static SimpleNetworkWrapper network; - public static boolean debug = true;//todo + public static boolean debug = false;//todo public static Enchantment reaperEnchant; @@ -54,13 +54,6 @@ public class DraconicEvolution { // TODO Update Licence and add change log to gi proxy.preInit(event); - /* - public static Achievement ultimatePower; - ultimatePower = new Achievement("achievment.ultimatePower", "Ultimate Power!!!", 1, -2, ModItems.draconicDestructionStaff, null).registerStat(); - AchievementPage draconicEvolution = new AchievementPage("Draconic Evolution", ultimatePower); - AchievementPage.registerAchievementPage(draconicEvolution); - */ - } @Mod.EventHandler diff --git a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java index 33e1639c..c050b456 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java @@ -12,7 +12,7 @@ import com.brandon3055.draconicevolution.client.render.entity.RenderDragonHeart; import com.brandon3055.draconicevolution.client.render.item.RenderBow; import com.brandon3055.draconicevolution.client.render.item.RenderMobSoul; import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam; -import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyRing; +import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; import com.brandon3055.draconicevolution.client.render.tile.*; import com.brandon3055.draconicevolution.common.CommonProxy; import com.brandon3055.draconicevolution.common.ModBlocks; @@ -188,16 +188,16 @@ public class ClientProxy extends CommonProxy { } @Override - public ParticleEnergyRing energyRing(World worldObj, double x, double y, double z, int powerFlow, boolean advanced, ParticleEnergyRing oldBeam, boolean render) { + public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced, ParticleEnergyField oldBeam, boolean render) { if (!worldObj.isRemote) return null; - ParticleEnergyRing beam = oldBeam; + ParticleEnergyField beam = oldBeam; boolean inRange = ParticleHandler.isInRange(x, y, z, 50); if (beam == null || beam.isDead) { if (inRange) { - beam = new ParticleEnergyRing(worldObj, x, y, z, 8, powerFlow, advanced); + beam = new ParticleEnergyField(worldObj, x, y, z, 8, type, advanced); FMLClientHandler.instance().getClient().effectRenderer.addEffect(beam); } @@ -209,7 +209,7 @@ public class ClientProxy extends CommonProxy { } else { - beam.update(powerFlow, render); + beam.update(render); } return beam; } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java index b02095fb..1aee3b04 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java @@ -34,7 +34,7 @@ public class HudHandler { @SubscribeEvent @SideOnly(Side.CLIENT) public void drawHUD(RenderGameOverlayEvent.Post event) { - if (event.type == RenderGameOverlayEvent.ElementType.ALL) { + if (ConfigHandler.enableHudDisplay && event.type == RenderGameOverlayEvent.ElementType.ALL) { if (hudList == null) return; Minecraft mc = Minecraft.getMinecraft(); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/ConfigGUI.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/ConfigGUI.java index cd2e0b86..c11f8412 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/ConfigGUI.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/ConfigGUI.java @@ -16,4 +16,6 @@ public class ConfigGUI extends GuiConfig { configElements.addAll(new ConfigElement(ConfigHandler.config.getCategory("spawner")).getChildElements()); configElements.addAll(new ConfigElement(ConfigHandler.config.getCategory("long range dislocator")).getChildElements()); } + + } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUITeleporter.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUITeleporter.java index d910469d..9a033e8a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUITeleporter.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/GUITeleporter.java @@ -303,7 +303,7 @@ public class GUITeleporter extends GuiScreen @SuppressWarnings("unchecked") @Override - public void initGui(){ + public void initGui(){//todo Localization buttonList.clear(); int posX = (this.width - xSize) / 2; int posY = (this.height - ySize) / 2; @@ -314,13 +314,13 @@ public class GUITeleporter extends GuiScreen buttonList.add(new GuiButtonAHeight(1, posX + 112, posY + 58, 66, 12, "Set Here")); buttonList.add(new GuiButtonAHeight(2, posX + 112, posY + 71, 66, 12, "Remove")); - buttonList.add(new GuiButtonAHeight(3, posX + 112, posY + 99, 33, 12, "▲ ▲ ▲")); + buttonList.add(new GuiButtonAHeight(3, posX + 112, posY + 99, 33, 12, "UP")); buttonList.add(new GuiButtonAHeight(4, posX + 112, posY + 112, 66, 12, "Add New")); buttonList.add(new GuiButtonAHeight(5, posX + 112, posY + 125, 66, 12, "Add Fuel")); buttonList.add(new GuiButtonAHeight(6, posX+xSize-63, posY-15, 60, 15, "Cancel")); - buttonList.add(new GuiButtonAHeight(7, posX + 112 + 34, posY + 99, 33, 12, "▼ ▼ ▼")); + buttonList.add(new GuiButtonAHeight(7, posX + 112 + 34, posY + 99, 33, 12, "DOWN")); ((GuiButton) buttonList.get(6)).visible = false; textBeingEdited = new GuiTextField(fontRendererObj, posX+3, posY-14, xSize-67, 12); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/componentguis/GUIToolConfig.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/componentguis/GUIToolConfig.java index 93669087..4bef2a75 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/componentguis/GUIToolConfig.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/componentguis/GUIToolConfig.java @@ -7,6 +7,7 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import com.brandon3055.draconicevolution.common.utills.LogHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; @@ -74,6 +75,18 @@ public class GUIToolConfig extends GUIBase { setLevel(0); } + public void updateItemButtons() + { + LogHelper.info("Update Buttons"); + for (ComponentBase component : collection.getComponents()) + { + if (component instanceof ComponentConfigItemButton) + { + ((ComponentConfigItemButton) component).refreshState(); + } + } + } + @Override protected void mouseClicked(int x, int y, int button) { super.mouseClicked(x, y, button); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/componentguis/GUIToolInventory.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/componentguis/GUIToolInventory.java index e9cce3ef..b56c60ff 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/componentguis/GUIToolInventory.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/componentguis/GUIToolInventory.java @@ -53,6 +53,7 @@ public class GUIToolInventory extends GUIBase { public void buttonClicked(int id) { super.buttonClicked(id); if (guiToolConfig == null) guiToolConfig = new GUIToolConfig(player, container); + guiToolConfig.updateItemButtons(); Minecraft.getMinecraft().displayGuiScreen(guiToolConfig); guiToolConfig.setLevel(1); container.setSlotsActive(false); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/guicomponents/ComponentConfigItemButton.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/guicomponents/ComponentConfigItemButton.java index b164ff98..328e4b3c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/guicomponents/ComponentConfigItemButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/guicomponents/ComponentConfigItemButton.java @@ -27,7 +27,12 @@ public class ComponentConfigItemButton extends ComponentBase { super(x, y); this.slot = slot; this.inventory = player.inventory; - if (inventory.getStackInSlot(slot) != null && ((inventory.getStackInSlot(slot).getItem() instanceof IConfigurableItem && !((IConfigurableItem) inventory.getStackInSlot(slot).getItem()).getFields(inventory.getStackInSlot(slot), slot).isEmpty()) || inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool)) hasValidItem = true; + refreshState(); + } + + public void refreshState() + { + hasValidItem = (inventory.getStackInSlot(slot) != null && ((inventory.getStackInSlot(slot).getItem() instanceof IConfigurableItem && !((IConfigurableItem) inventory.getStackInSlot(slot).getItem()).getFields(inventory.getStackInSlot(slot), slot).isEmpty()) || inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool)); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelTeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelTeleporterStand.java index e048df7c..bdaf3002 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelTeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelTeleporterStand.java @@ -59,7 +59,7 @@ public class ModelTeleporterStand extends ModelBase { } public void render() { - final float scale = 1F / 16F; + final float scale = 1F / 16; plate.render(scale); holders.render(scale); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderDraconiumChest.java index 5f85027b..36a3ce4f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderDraconiumChest.java @@ -1,7 +1,7 @@ package com.brandon3055.draconicevolution.client.render.block; -import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; +import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import net.minecraft.client.model.ModelChest; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java index 8f3b8379..75840660 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java @@ -140,7 +140,7 @@ public class ParticleEnergyBeam extends EntityFX { if (!renderParticle) return; tessellator.draw(); GL11.glPushMatrix(); - GL11.glPushAttrib(GL11.GL_ATTRIB_STACK_DEPTH); + //GL11.glPushAttrib(GL11.GL_ATTRIB_STACK_DEPTH); float var9 = 1.0F; float slide = (float) getPlayer().ticksExisted; float size = (float) flow / 100f * 2f; //0.7F; @@ -148,7 +148,7 @@ public class ParticleEnergyBeam extends EntityFX { else Minecraft.getMinecraft().renderEngine.bindTexture(beamTextureBasic); GL11.glTexParameterf(3553, 10242, 10497.0F); GL11.glTexParameterf(3553, 10243, 10497.0F); - GL11.glDisable(2884); + GL11.glDisable(GL11.GL_CULL_FACE); float var11 = slide + partialTick; float var12 = -var11 * 0.2F - (float) MathHelper.floor_float(-var11 * 0.1F); GL11.glBlendFunc(770, 1); @@ -165,7 +165,7 @@ public class ParticleEnergyBeam extends EntityFX { double var44 = -0.15D * (double)size; double var17 = 0.15D * (double)size; - + GL11.glTranslated(0.03, 0, 0); for(int t = 0; t < 2; ++t) { double var29 = (double)(this.length * var9); double var31 = 0D; @@ -190,6 +190,7 @@ public class ParticleEnergyBeam extends EntityFX { var17 = 0.15D * (double)1; //GL11.glColor4f(1f, 1f, 1f, 1f); + //GL11.glTranslated(0.1, 0, 0); for(int t = 0; t < 2; ++t) { double var29 = (double)(this.length * var9); double var31 = 0D; @@ -210,10 +211,10 @@ public class ParticleEnergyBeam extends EntityFX { } - GL11.glDepthMask(true); + //GL11.glDepthMask(true); GL11.glBlendFunc(770, 771); - GL11.glEnable(2884); - GL11.glPopAttrib(); + GL11.glEnable(GL11.GL_CULL_FACE); + // GL11.glPopAttrib(); GL11.glPopMatrix(); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyField.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyField.java new file mode 100644 index 00000000..e80aa424 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyField.java @@ -0,0 +1,132 @@ +package com.brandon3055.draconicevolution.client.render.particle; + +import com.brandon3055.draconicevolution.client.handler.ResourceHelper; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; + +/** + * Created by Brandon on 9/02/2015. + */ +public class ParticleEnergyField extends EntityFX {//todo Fancy Animated Particle? Maby? + /** + * Particle Type 0 = Energy Ring, 1 = single particle + */ + private int type; + private boolean advanced; + private boolean renderParticle = true; + + public ParticleEnergyField(World world, double x, double y, double z, int maxAge, int type, boolean advanced) { + super(world, x, y, z, 0.0D, 0.0D, 0.0D); + this.particleRed = 1F; + this.particleGreen = 1F; + this.particleBlue = 1F; + this.noClip = true; + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.particleMaxAge = maxAge; + this.type = type; + this.advanced = advanced; + this.setSize(1F, 1F); + } + + public void update(boolean render) + { + for (this.renderParticle = render; this.particleMaxAge - this.particleAge < 4; ++this.particleMaxAge) {} + } + + @Override + public void onUpdate() { + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + } + + + @Override + public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { + if (!renderParticle) return; + tessellator.draw(); + GL11.glPushMatrix(); + //GL11.glPushAttrib(GL11.GL_ATTRIB_STACK_DEPTH); + GL11.glDepthMask(false); + ResourceHelper.bindParticles(); + + float minU = 0.0F + 0.125F * (advanced ? 4 : 3); + float maxU = 0.0F + 0.125F * (advanced ? 5 : 4);//minU + 0.124F; + float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; + float maxV = 0.123F;//minV + 0.124F; + float drawScale = 0.2f; + + 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) partialTick - interpPosX); + float drawY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTick - interpPosY); + float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTick - interpPosZ); + + + if (type == 0) + { + tessellator.startDrawingQuads(); + tessellator.setBrightness(200); + tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1f); + + double pCount = Minecraft.getMinecraft().gameSettings.fancyGraphics ? 35 : 15; + for (int i = 0; i < pCount; i++) + { + double rot = i / pCount * (3.141 * 2D) + particleAge / 3D;//1D;//i / 10D; + double offset = 0.4; + double ox = Math.sin(rot) * offset; + double oz = Math.cos(rot) * offset; + + float drawXX = drawX + (float) ox; + float drawZZ = drawZ + (float) oz; + + tessellator.addVertexWithUV((double) (drawXX - rotX * drawScale - rotYZ * drawScale), (double) (drawY - rotXZ * drawScale), (double) (drawZZ - rotZ * drawScale - rotXY * drawScale), (double) maxU, (double) maxV); + tessellator.addVertexWithUV((double) (drawXX - rotX * drawScale + rotYZ * drawScale), (double) (drawY + rotXZ * drawScale), (double) (drawZZ - rotZ * drawScale + rotXY * drawScale), (double) maxU, (double) minV); + tessellator.addVertexWithUV((double) (drawXX + rotX * drawScale + rotYZ * drawScale), (double) (drawY + rotXZ * drawScale), (double) (drawZZ + rotZ * drawScale + rotXY * drawScale), (double) minU, (double) minV); + tessellator.addVertexWithUV((double) (drawXX + rotX * drawScale - rotYZ * drawScale), (double) (drawY - rotXZ * drawScale), (double) (drawZZ + rotZ * drawScale - rotXY * drawScale), (double) minU, (double) maxV); + } + + tessellator.draw(); + } + else + { + + tessellator.startDrawingQuads(); + tessellator.setBrightness(200); + tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1f); + + tessellator.addVertexWithUV((double) (drawX - rotX * drawScale - rotYZ * drawScale), (double) (drawY - rotXZ * drawScale), (double) (drawZ - rotZ * drawScale - rotXY * drawScale), (double) maxU, (double) maxV); + tessellator.addVertexWithUV((double) (drawX - rotX * drawScale + rotYZ * drawScale), (double) (drawY + rotXZ * drawScale), (double) (drawZ - rotZ * drawScale + rotXY * drawScale), (double) maxU, (double) minV); + tessellator.addVertexWithUV((double) (drawX + rotX * drawScale + rotYZ * drawScale), (double) (drawY + rotXZ * drawScale), (double) (drawZ + rotZ * drawScale + rotXY * drawScale), (double) minU, (double) minV); + tessellator.addVertexWithUV((double) (drawX + rotX * drawScale - rotYZ * drawScale), (double) (drawY - rotXZ * drawScale), (double) (drawZ + rotZ * drawScale - rotXY * drawScale), (double) minU, (double) maxV); + + tessellator.draw(); + } + + +// GL11.glDepthMask(true); + //GL11.glPopAttrib(); + GL11.glPopMatrix(); + + ResourceHelper.bindDefaultParticles(); + tessellator.startDrawingQuads(); + } +} \ No newline at end of file diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyRing.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyRing.java deleted file mode 100644 index bde9f691..00000000 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyRing.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.brandon3055.draconicevolution.client.render.particle; - -import com.brandon3055.draconicevolution.client.handler.ResourceHelper; -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.world.World; -import org.lwjgl.opengl.GL11; - -/** - * Created by Brandon on 9/02/2015. - */ -public class ParticleEnergyRing extends EntityFX { - /** - * Power flow integer Ranges from 0 to 100 - */ - private int flow; - private boolean advanced; - private boolean renderParticle = true; - - public ParticleEnergyRing(World world, double x, double y, double z, int maxAge, int flow, boolean advanced) { - super(world, x, y, z, 0.0D, 0.0D, 0.0D); - this.particleRed = 1F; - this.particleGreen = 1F; - this.particleBlue = 1F; - this.noClip = true; - this.motionX = 0.0D; - this.motionY = 0.0D; - this.motionZ = 0.0D; - this.particleMaxAge = maxAge; - this.flow = flow; - this.advanced = advanced; - this.setSize(1F, 1F); - } - - public void update(int flow, boolean render) - { - this.renderParticle = render; - for (this.flow = 100; this.particleMaxAge - this.particleAge < 4; ++this.particleMaxAge) {} - } - - @Override - public void onUpdate() { - - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - - - if (this.particleAge++ >= this.particleMaxAge) - { - this.setDead(); - } - } - - - @Override - public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { - if (!renderParticle) return; - tessellator.draw(); - GL11.glPushMatrix(); - //GL11.glPushAttrib(GL11.GL_ATTRIB_STACK_DEPTH); - GL11.glDepthMask(false); - ResourceHelper.bindParticles(); - - float minU = 0.0F + 0.125F * (advanced ? 4 : 3); - float maxU = 0.0F + 0.125F * (advanced ? 5 : 4);//minU + 0.124F; - float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; - float maxV = 0.1245F;//minV + 0.124F; - float drawScale = 0.2f; - - 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) partialTick - interpPosX); - float drawY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTick - interpPosY); - float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTick - interpPosZ); - - - tessellator.startDrawingQuads(); - tessellator.setBrightness(200); - tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1f); - double pCount = Minecraft.getMinecraft().gameSettings.fancyGraphics ? 35 : 15; - for (int i = 0; i < pCount; i++) - { - double rot = i / pCount * (3.141 * 2D) + particleAge / 3D;//1D;//i / 10D; - double offset = 0.4; - double ox = Math.sin(rot) * offset; - double oz = Math.cos(rot) * offset; - - float drawXX = drawX + (float)ox; - float drawZZ = drawZ + (float)oz; - - tessellator.addVertexWithUV((double) (drawXX - rotX * drawScale - rotYZ * drawScale), (double) (drawY - rotXZ * drawScale), (double) (drawZZ - rotZ * drawScale - rotXY * drawScale), (double) maxU, (double) maxV); - tessellator.addVertexWithUV((double) (drawXX - rotX * drawScale + rotYZ * drawScale), (double) (drawY + rotXZ * drawScale), (double) (drawZZ - rotZ * drawScale + rotXY * drawScale), (double) maxU, (double) minV); - tessellator.addVertexWithUV((double) (drawXX + rotX * drawScale + rotYZ * drawScale), (double) (drawY + rotXZ * drawScale), (double) (drawZZ + rotZ * drawScale + rotXY * drawScale), (double) minU, (double) minV); - tessellator.addVertexWithUV((double) (drawXX + rotX * drawScale - rotYZ * drawScale), (double) (drawY - rotXZ * drawScale), (double) (drawZZ + rotZ * drawScale - rotXY * drawScale), (double) minU, (double) maxV); - - - } - tessellator.draw(); - - - GL11.glDepthMask(true); - //GL11.glPopAttrib(); - GL11.glPopMatrix(); - - ResourceHelper.bindDefaultParticles(); - tessellator.startDrawingQuads(); - } -} \ No newline at end of file diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java index 607cdb2a..3cbfa60e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java @@ -72,7 +72,8 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { modelCrystal.renderAll(); - GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glAlphaFunc(GL11.GL_GREATER, 0f); +// GL11.glDisable(GL11.GL_ALPHA_TEST); //--- Render Overlay ---// @@ -84,6 +85,7 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { //--- Post Render ---// GL11.glDisable(GL11.GL_BLEND); + RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); } @@ -151,6 +153,7 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { //--- Post Render ---// GL11.glDisable(GL11.GL_BLEND); + RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java index 9a49ba55..abc63aa1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java @@ -24,11 +24,11 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { GL11.glPushMatrix(); - + GL11.glTranslatef((float) x, (float) y, (float) z); TileEnergyInfuser tile = (TileEnergyInfuser) tileEntity; renderBlock(tile); - + GL11.glPopMatrix(); } @@ -40,19 +40,26 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer tessellator.setColorRGBA(255, 255, 255, 255); //tessellator.setBrightness(200); - tessellator.setColorOpaque_F(1f, 1f, 1f); + //tessellator.setColorOpaque_F(1f, 1f, 1f); //OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2); - +// GL11.glEnable(GL11.GL_CULL_FACE); +// GL11.glDisable(GL11.GL_ALPHA_TEST); +// GL11.glEnable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); +// GL11.glDepthMask(true); drawBase(tessellator); drawWings(tessellator, tile); renderChargingItem(tile); + GL11.glDisable(GL11.GL_ALPHA_TEST); +// GL11.glDepthMask(false); } private void drawBase(Tessellator tess){ GL11.glPushMatrix(); tess.startDrawingQuads(); - tess.setNormal(0.0F, 0.0F, 1.0F); + tess.setNormal(0F, 0F, 1.0F); double srcXMin = 0D; double srcYMin = 0D; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java index 6aea89f4..4b9c3d74 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java @@ -98,10 +98,6 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer { GL11.glPopMatrix(); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java index d76a3876..7d9dbf26 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java @@ -4,7 +4,7 @@ import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.creativetab.DETab; import com.brandon3055.draconicevolution.client.interfaces.GuiHandler; import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam; -import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyRing; +import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; import com.brandon3055.draconicevolution.common.achievements.Achievements; import com.brandon3055.draconicevolution.common.entity.*; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; @@ -177,7 +177,7 @@ public abstract class CommonProxy { return null; } - public ParticleEnergyRing energyRing(World worldObj, double x, double y, double z, int powerFlow, boolean advanced, ParticleEnergyRing oldBeam, boolean render) { + public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced, ParticleEnergyField oldBeam, boolean render) { return null; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java index c71216a9..a71daf3e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java @@ -23,8 +23,7 @@ public abstract class BlockCustomDrop extends BlockContainerDE { /**If true the tile will drop its inventory when broken*/ protected abstract boolean dropInventory(); - /**If true the tile will a custom block with custom data when broken - * use getCustomTileEntityCrop to specify the lock that should be dropped*/ + /**If true the tile will drop a custom block with custom data when broken*/ protected abstract boolean hasCustomDropps(); /**Use to specify custom drops*/ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java index 72fde10a..1703ef0b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java @@ -6,8 +6,8 @@ import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.itemblocks.DraconiumChestItemBlock; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; +import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -39,6 +39,9 @@ import static net.minecraftforge.common.util.ForgeDirection.UP; * Created by Brandon on 28/10/2014. */ public class DraconiumChest extends BlockCustomDrop { + + private static final String[] STORAGE_BLACKLIST = new String[] {"tile.thermalexpansion.strongbox", "item.thermalexpansion.satchel", "tile.draconicevolution:draconiumChest"}; + public DraconiumChest() { super(Material.iron); this.setBlockName(Strings.draconiumChestName); @@ -49,11 +52,21 @@ public class DraconiumChest extends BlockCustomDrop { ModBlocks.register(this, DraconiumChestItemBlock.class); } + + public static boolean isStackValid(ItemStack stack) + { + for (int i = 0; i < STORAGE_BLACKLIST.length; i++) + if (stack.getUnlocalizedName().contains(STORAGE_BLACKLIST[i])) return false; + return true; + } + + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float cx, float cy, float cz) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (!(tileEntity instanceof TileDraconiumChest)) return false; TileDraconiumChest te = (TileDraconiumChest) tileEntity; + if (player.isSneaking()) { te.editMode = !te.editMode; if (world.isRemote)player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_GREEN + "" + StatCollector.translateToLocal("msg.draconiumChestEditmode.txt") + EnumChatFormatting.DARK_AQUA + " " + String.valueOf(te.editMode))); @@ -255,4 +268,6 @@ public class DraconiumChest extends BlockCustomDrop { } droppes.add(stack); } + + } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java index fc42bc5a..fd1f5423 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java @@ -34,4 +34,14 @@ public class DraconiumChestItemBlock extends ItemBlockCustomData { public boolean hasCustomEntity(ItemStack stack) { return true; } + + @Override + public boolean getShareTag() { + return false; + } + + @Override + public boolean isDamageable() { + return false; + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java index a311d23c..69e0f727 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java @@ -18,7 +18,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -89,6 +91,66 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock } } + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 1 || meta == 0) return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.135F, z + 0.37F, x + 0.63F, y + 0.865F, z + 0.63F); + else if (meta == 2 || meta == 3) + { + TileEnergyTransceiver tile = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) : null; + if (tile != null) + { + switch (tile.facing) + { + case 0: + return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.59F, z + 0.37F, x + 0.63F, y + 1.0F, z + 0.63F); + case 1: + return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.0F, z + 0.37F, x + 0.63F, y + 0.41F, z + 0.63F); + case 2: + return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.37F, z + 0.59F, x + 0.63F, y + 0.63F, z + 1.0F); + case 3: + return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.37F, z + 0.0F, x + 0.63F, y + 0.63F, z + 0.41F); + case 4: + return AxisAlignedBB.getBoundingBox(x + 0.59F, y + 0.37F, z + 0.37F, x + 1.0F, y + 0.63F, z + 0.63F); + case 5: + return AxisAlignedBB.getBoundingBox(x + 0.0F, y + 0.37F, z + 0.37F, x + 0.41F, y + 0.63F, z + 0.63F); + } + } + } + + return super.getCollisionBoundingBoxFromPool(world, x, y, z); + } + + @Override + public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 1 || meta == 0) return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.135F, z + 0.37F, x + 0.63F, y + 0.865F, z + 0.63F); + else if (meta == 2 || meta == 3) + { + TileEnergyTransceiver tile = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) : null; + if (tile != null) + { + switch (tile.facing) + { + case 0: + return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.59F, z + 0.37F, x + 0.63F, y + 1.0F, z + 0.63F); + case 1: + return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.0F, z + 0.37F, x + 0.63F, y + 0.41F, z + 0.63F); + case 2: + return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.37F, z + 0.59F, x + 0.63F, y + 0.63F, z + 1.0F); + case 3: + return AxisAlignedBB.getBoundingBox(x + 0.37F, y + 0.37F, z + 0.0F, x + 0.63F, y + 0.63F, z + 0.41F); + case 4: + return AxisAlignedBB.getBoundingBox(x + 0.59F, y + 0.37F, z + 0.37F, x + 1.0F, y + 0.63F, z + 0.63F); + case 5: + return AxisAlignedBB.getBoundingBox(x + 0.0F, y + 0.37F, z + 0.37F, x + 0.41F, y + 0.63F, z + 0.63F); + } + } + } + + return super.getSelectedBoundingBoxFromPool(world, x, y, z); + } + @Override public boolean hasTileEntity(int metadata) { return true; @@ -136,7 +198,7 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock } @Override - public List getDisplayData(World world, int x, int y, int z) { + public List getDisplayData(World world, int x, int y, int z) {//todo Localization List list = new ArrayList(); IRemoteEnergyHandler tile = world.getTileEntity(x, y, z) instanceof IRemoteEnergyHandler ? (IRemoteEnergyHandler) world.getTileEntity(x, y, z) : null; if (tile != null) @@ -144,6 +206,14 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock list.add(InfoHelper.HITC()+getLocalizedName()); list.add("RF: " + tile.getEnergyStored(ForgeDirection.DOWN)); list.add("Cap: " + tile.getCapacity() + "%"); + if (tile instanceof TileEnergyTransceiver) { + String x5 = ((TileEnergyTransceiver) tile).getPowerTier() > 0 && ((TileEnergyTransceiver) tile).transferBoost ? StatCollector.translateToLocal("info.de.5xTransfer.txt") : ""; + list.add(((TileEnergyTransceiver)tile).getInput() ? StatCollector.translateToLocal("info.de.modeIn.txt") + x5 : StatCollector.translateToLocal("info.de.modeOut.txt") + x5); + } + if (tile instanceof TileRemoteEnergyBase) { + list.add(StatCollector.translateToLocal("info.de.connections.txt") + ": " + ((TileRemoteEnergyBase) tile).linkedDevices.size() + "/" + tile.getMaxConnections()); + } + if (tile instanceof TileRemoteEnergyBase) { for (LinkedEnergyDevice l : ((TileRemoteEnergyBase) tile).linkedDevices) @@ -155,4 +225,8 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock return list; } + @Override + public int damageDropped(int dmg) { + return dmg; + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java index 7bd5321a..db3c325c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java @@ -29,6 +29,7 @@ public class ContainerAdvTool extends ContainerDataSync { this.inventoryTool = inventory; this.inventoryTool.setContainer(this); this.player = invPlayer.player; + setSlotsActive(false); } public void setSlotsActive(boolean active) { @@ -56,6 +57,18 @@ public class ContainerAdvTool extends ContainerDataSync { addSlotToContainer(new SlotEnchantment(inventoryTool, inventoryTool.size + y, 173, 19 + y * 21)); } } + else + { + for (int x = 0; x < 9; x++) { + addSlotToContainer(new SlotPlayerInv(player.inventory, x, -1000 + 8 + 18 * x, -1000 + 103, inventoryItemSlot)); + } + + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 9; x++) { + addSlotToContainer(new SlotPlayerInv(player.inventory, x + y * 9 + 9, -1000 + 8 + 18 * x, -1000 + 45 + y * 18, inventoryItemSlot)); + } + } + } if (player.worldObj.isRemote) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java index 7b0e35cb..f243d35e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.container; import cofh.api.energy.IEnergyContainerItem; +import com.brandon3055.draconicevolution.common.blocks.DraconiumChest; import com.brandon3055.draconicevolution.common.inventory.InventoryCraftingChest; import com.brandon3055.draconicevolution.common.inventory.InventoryCraftingChestResult; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; @@ -54,7 +55,7 @@ public class ContainerDraconiumChest extends Container { { for (int chestCol = 0; chestCol < 26; chestCol++) { - addSlotToContainer(new Slot(tile, chestCol + (chestRow * 26), 8 + chestCol * 18, 15 + chestRow * 18)); + addSlotToContainer(new SlotDChest(tile, chestCol + (chestRow * 26), 8 + chestCol * 18, 15 + chestRow * 18)); } } @@ -88,7 +89,7 @@ public class ContainerDraconiumChest extends Container { { for (int gridRow = 0; gridRow < 3; ++gridRow) { - addSlotToContainer(new Slot(craftMatrix, gridRow + (gridCol * 3), xOffset + (gridRow * 18), yOffset + (gridCol * 18))); + addSlotToContainer(new SlotDChest(craftMatrix, gridRow + (gridCol * 3), xOffset + (gridRow * 18), yOffset + (gridCol * 18))); } } } @@ -242,4 +243,20 @@ public class ContainerDraconiumChest extends Container { return 1; } } + + public class SlotDChest extends Slot { + + + public SlotDChest(IInventory inventory, int id, int x, int y) { + super(inventory, id, x, y); + + } + + @Override + public boolean isItemValid(ItemStack stack) + { + return DraconiumChest.isStackValid(stack); + } + + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java index 97b52a66..2216f98b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java @@ -48,8 +48,7 @@ public class EntityCustomDragon extends EntityDragon { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(health); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(health); this.attackDamage = attack; - //LogHelper.info(attackDamage); - this.addPotionEffect(new PotionEffect(10, 600, 10, false));; + this.addPotionEffect(new PotionEffect(10, 600, 10, false)); } @Override @@ -298,6 +297,7 @@ public class EntityCustomDragon extends EntityDragon { @Override protected void onDeathUpdate() { + if (deathTicks == 0 && !isUber) { for (int ix = -150; ix < 150; ix++) { @@ -597,6 +597,9 @@ public class EntityCustomDragon extends EntityDragon { super.writeToNBT(compound); compound.setFloat("AttackDamage", attackDamage); compound.setBoolean("IsUber", isUber); + compound.setInteger("PortalX", portalX); + compound.setInteger("PortalY", portalY); + compound.setInteger("PortalZ", portalZ); } @Override @@ -605,6 +608,9 @@ public class EntityCustomDragon extends EntityDragon { attackDamage = compound.getFloat("AttackDamage"); isUber = compound.getBoolean("IsUber"); this.dataWatcher.updateObject(12, isUber ? (byte)1: (byte)0); + portalX = compound.getInteger("PortalX"); + portalY = compound.getInteger("PortalY"); + portalZ = compound.getInteger("PortalZ"); } @Override @@ -625,4 +631,16 @@ public class EntityCustomDragon extends EntityDragon { public boolean getIsUber(){ return isUber; } + + @Override + public boolean attackEntityFrom(DamageSource damageSource, float dmg) { + if (damageSource.getEntity() != null && getDistanceToEntity(damageSource.getEntity()) > 100) return false; + return super.attackEntityFrom(damageSource, dmg); + } + + @Override + public boolean attackEntityFromPart(EntityDragonPart p_70965_1_, DamageSource damageSource, float p_70965_3_) { + if (damageSource.getEntity() != null && getDistanceSqToEntity(damageSource.getEntity()) > 100) return false; + return super.attackEntityFromPart(p_70965_1_, damageSource, p_70965_3_); + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java index 4860b58d..0c457eb5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java @@ -18,7 +18,6 @@ public class ConfigHandler { public static int cometRarity; public static int hudX; public static int hudY; - public static String[] obliterationList; public static boolean generateEnderComets; public static boolean generateChaosIslands; public static boolean pigmenBloodRage; @@ -26,6 +25,10 @@ public class ConfigHandler { public static boolean showUnlocalizedNames; public static boolean disableLore; public static boolean invertDPDSB; + public static boolean disableOreSpawnEnd; + public static boolean disableOreSpawnOverworld; + public static boolean disableOreSpawnNether; + public static boolean enableHudDisplay; //spawner public static String[] spawnerList; @@ -46,7 +49,6 @@ public class ConfigHandler { private static String[] defaultSpawnerList = new String[] {"ExampleMob1", "ExampleMob2", "ExampleMob3 (these examples can be deleted)"}; - private static String[] defaultObliterationList = new String[] {"tile.stonebrick", "tile.gravel", "tile.dirt", "tile.stone", "tile.dirt", "tile.sandStone", "tile.sand", "tile.grass", "tile.hellrock"}; public static void init(File confFile) { if (config == null) { @@ -64,7 +66,6 @@ public class ConfigHandler { disableXrayBlock = config.get(Configuration.CATEGORY_GENERAL, "Disable Xray Block", 0, "Disable Distortion Flame 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0); teleporterUsesPerPearl = config.get(Configuration.CATEGORY_GENERAL, "Teleporter Uses PerPearl", 1, "Charm of Dislocation uses per Ender pearl").getInt(1); bowBlockDamage = config.get(Configuration.CATEGORY_GENERAL, "Bow Block Damage", true, "Dose Draconic bow explosion damage blocks").getBoolean(true); - obliterationList = config.getStringList("Oblit Mode List", Configuration.CATEGORY_GENERAL, defaultObliterationList, "List of block (unlocalized)names that will be destroyed by tools in obliteration mode. To find the unlocalized name of a block see the \"Show Unlocalized Names\" config option"); showUnlocalizedNames = config.get(Configuration.CATEGORY_GENERAL, "Show Unlocalized Names", false, "If set to true the unlocalized name of every block and item will be displayed in its tool tip").getBoolean(false); soulDropChance = config.get(Configuration.CATEGORY_GENERAL, "soulDropChance", 1000, "Mobs have a 1 in this number chance to drop a soul", 1, Integer.MAX_VALUE).getInt(1000); passiveSoulDropChance = config.get(Configuration.CATEGORY_GENERAL, "passiveSoulDropChance", 800, "Passive (Animals) Mobs have a 1 in this number chance to drop a soul", 1, Integer.MAX_VALUE).getInt(800); @@ -76,7 +77,10 @@ public class ConfigHandler { invertDPDSB = config.get(Configuration.CATEGORY_GENERAL, "InvertDPDSB", false, "Invert Dislocator Pedestal display name shift behavior").getBoolean(false); hudX = config.get(Configuration.CATEGORY_GENERAL, "Hud Display X pos", 7).getInt(7); hudY = config.get(Configuration.CATEGORY_GENERAL, "Hud Display Y pos", 874).getInt(874); - + disableOreSpawnEnd = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (End)", false, "Set to true to prevent draconium ore from spawning in the end").getBoolean(false); + disableOreSpawnNether = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (Nether)", false, "Set to true to prevent draconium ore from spawning in the nether").getBoolean(false); + disableOreSpawnOverworld = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (Overworld)", false, "Set to true to prevent draconium ore from spawning in the overworld").getBoolean(false); + enableHudDisplay = config.get(Configuration.CATEGORY_GENERAL, "Enable HUD info", true, "Set to false to disable the HUD info for tools and blocks").getBoolean(true); //Spawner spawnerListType = config.get("spawner", "listType", false, "Sets weather the spawner list is a white list or a black list (true = white list false = black list)").getBoolean(false); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java index 3e5043c5..d5e69844 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java @@ -4,17 +4,30 @@ import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.items.ItemDE; import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; +import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utills.UpdateChecker; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import java.util.ArrayList; import java.util.List; /** * Created by Brandon on 23/08/2014. */ -public class Wrench extends ItemDE { +public class Wrench extends ItemDE implements IHudDisplayItem{ + + public static final String BIND_MODE = "bind"; + public static final String UNBIND_MODE = "unBind"; + public static final String CLEAR_BINDINGS = "unBindAll"; + public static final String MODE_SWITCH = "modeSwitch"; public Wrench() { @@ -24,10 +37,66 @@ public class Wrench extends ItemDE { ModItems.register(this); } + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + + new UpdateChecker(); + + if (player.isSneaking()) cycleMode(stack, world, player); + else if (ItemNBTHelper.getCompound(stack).hasKey("LinkData") && ItemNBTHelper.getCompound(stack).getCompoundTag("LinkData").getBoolean("Bound")) ItemNBTHelper.getCompound(stack).getCompoundTag("LinkData").setBoolean("Bound", false); + return super.onItemRightClick(stack, world, player); + } + + static final String[] modes = new String[] {BIND_MODE, UNBIND_MODE, CLEAR_BINDINGS, MODE_SWITCH}; + + private static void cycleMode(ItemStack stack, World world, EntityPlayer player) + { + String currentMode = ItemNBTHelper.getString(stack, "Mode", "bind"); + int mode = 0; + for (String s : modes) + { + if (s.equals(currentMode)) + { + if (mode + 1 >= modes.length) currentMode = modes[0]; + else currentMode = modes[mode + 1]; + break; + } + mode++; + } + ItemNBTHelper.setString(stack, "Mode", currentMode); + if (world.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.wrenchMode." + currentMode + ".txt")); + } + @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { - //list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.safetyMatch.txt")); + public void addInformation(ItemStack stack, EntityPlayer p_77624_2_, List list, boolean bool) { + list.add(StatCollector.translateToLocal("msg.de.wrenchMode." + ItemNBTHelper.getString(stack, "Mode", "bind") + ".txt")); + NBTTagCompound linkDat = null; + if (stack.hasTagCompound() && stack.getTagCompound().hasKey("LinkData")) linkDat = stack.getTagCompound().getCompoundTag("LinkData"); + if (linkDat != null && linkDat.getBoolean("Bound")) + { + list.add(StatCollector.translateToLocal("msg.de.boundTo.txt") + ": [X:" + linkDat.getInteger("XCoord") + ", Y:" + linkDat.getInteger("YCoord") + ", Z:" + linkDat.getInteger("ZCoord") + "]"); + list.add(StatCollector.translateToLocal("msg.de.rightClickUnbind.txt")); + } + } + + @Override + public List getDisplayData(ItemStack stack) { + List list = new ArrayList(); + list.add(StatCollector.translateToLocal("msg.de.wrenchMode." + ItemNBTHelper.getString(stack, "Mode", "bind") + ".txt")); + NBTTagCompound linkDat = null; + if (stack.hasTagCompound() && stack.getTagCompound().hasKey("LinkData")) linkDat = stack.getTagCompound().getCompoundTag("LinkData"); + if (linkDat != null && linkDat.getBoolean("Bound")) + { + list.add(StatCollector.translateToLocal("msg.de.boundTo.txt") + ": [X:" + linkDat.getInteger("XCoord") + ", Y:" + linkDat.getInteger("YCoord") + ", Z:" + linkDat.getInteger("ZCoord") + "]"); + list.add(StatCollector.translateToLocal("msg.de.rightClickUnbind.txt")); + } + return list; + } + + public static String getMode(ItemStack stack) + { + return ItemNBTHelper.getString(stack, "Mode", "bind"); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java index 00481422..ca7ae16a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java @@ -3,8 +3,8 @@ package com.brandon3055.draconicevolution.common.lib; public final class References { public static final String MODID = "DraconicEvolution"; public static final String MODNAME = "Draconic Evolution"; - public static final String VERSION = "1.0.1-snapshot_3"; - public static final String MCVERSION = "1.7.10"; + public static final String VERSION = VersionHandler.FULL_VERSION; + public static final String MCVERSION = VersionHandler.MCVERSION; public static final String CLIENTPROXYLOCATION = "com.brandon3055.draconicevolution.client.ClientProxy"; public static final String SERVERPROXYLOCATION = "com.brandon3055.draconicevolution.common.ServerProxy"; public static final String GUIFACTORY = "com.brandon3055.draconicevolution.client.interfaces.DEGUIFactory"; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java new file mode 100644 index 00000000..7c053d69 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java @@ -0,0 +1,13 @@ +package com.brandon3055.draconicevolution.common.lib; + +/** + * Created by Brandon on 24/02/2015. + */ +public class VersionHandler +{ + public static final String VERSION = "1.0.1"; + public static final int SNAPSHOT = 4; + public static final String MCVERSION = "1.7.10"; + + public static final String FULL_VERSION = VERSION + (SNAPSHOT > 0 ? "-snapshot_" + SNAPSHOT: ""); +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java index 6cbd0547..5f14a5d9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java @@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.common.tileentities; import cofh.api.energy.IEnergyContainerItem; import cofh.api.energy.IEnergyHandler; import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.DraconiumChest; import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest; import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry; import com.brandon3055.draconicevolution.common.utills.EnergyStorage; @@ -13,6 +14,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; @@ -297,9 +299,21 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg @Override public Packet getDescriptionPacket() { - NBTTagCompound tagCompound = new NBTTagCompound(); - this.writeToNBT(tagCompound); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound); + NBTTagCompound compound = new NBTTagCompound(); + compound.setByte("facing", (byte) facing); + compound.setInteger("Red", red); + compound.setInteger("Green", green); + compound.setInteger("Blue", blue); + compound.setBoolean("Edit", editMode); + compound.setByte("AutoFeed", (byte) smeltingAutoFeed); + if (customName != null && customName.length() > 0)compound.setString("CustomName", customName); + energy.writeToNBT(compound); + super.writeToNBT(compound); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, compound); +// NBTTagCompound tagCompound = new NBTTagCompound(); +// this.writeToNBT(tagCompound); +// return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound); } @Override @@ -400,7 +414,7 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; + return DraconiumChest.isStackValid(itemstack); } @Override @@ -465,28 +479,31 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg @Override public void writeDataToItem(NBTTagCompound compound, ItemStack stack) { - NBTTagCompound[] tag = new NBTTagCompound[items.length]; + + NBTTagList tagList = new NBTTagList(); for (int i = 0; i < items.length; i++) { - tag[i] = new NBTTagCompound(); - - if (items[i] != null) { - tag[i] = items[i].writeToNBT(tag[i]); + if (items[i] != null) + { + NBTTagCompound tag = new NBTTagCompound(); + tag.setShort("IS", (short)i); + items[i].writeToNBT(tag); + tagList.appendTag(tag); } - - compound.setTag("Item" + i, tag[i]); } for (int i = 0; i < itemsCrafting.length; i++) { - tag[i] = new NBTTagCompound(); - - if (itemsCrafting[i] != null) { - tag[i] = itemsCrafting[i].writeToNBT(tag[i]); + if (itemsCrafting[i] != null) + { + NBTTagCompound tag = new NBTTagCompound(); + tag.setShort("CS", (short)i); + itemsCrafting[i].writeToNBT(tag); + tagList.appendTag(tag); } - - compound.setTag("CraftingItem" + i, tag[i]); } + compound.setTag("Inventory", tagList); + compound.setInteger("Red", red); compound.setInteger("Green", green); compound.setInteger("Blue", blue); @@ -498,16 +515,22 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg @Override public void readDataFromItem(NBTTagCompound compound, ItemStack stack) { - NBTTagCompound[] tag = new NBTTagCompound[items.length]; - for (int i = 0; i < items.length; i++) { - tag[i] = compound.getCompoundTag("Item" + i); - items[i] = ItemStack.loadItemStackFromNBT(tag[i]); - } - - for (int i = 0; i < itemsCrafting.length; i++) { - tag[i] = compound.getCompoundTag("CraftingItem" + i); - itemsCrafting[i] = ItemStack.loadItemStackFromNBT(tag[i]); + if (compound.hasKey("Inventory")) + { + NBTTagList tagList = compound.getTagList("Inventory", 10); + for (int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound tag = tagList.getCompoundTagAt(i); + if (tag.hasKey("IS")) + { + items[tag.getShort("IS")] = ItemStack.loadItemStackFromNBT(tag); + } + else if (tag.hasKey("CS")) + { + itemsCrafting[tag.getShort("CS")] = ItemStack.loadItemStackFromNBT(tag); + } + } } red = compound.getInteger("Red"); @@ -518,6 +541,61 @@ public class TileDraconiumChest extends TileEntity implements IInventory, IEnerg energy.readFromNBT(compound); } +// @Override +// public void writeDataToItem(NBTTagCompound compound, ItemStack stack) { +// NBTTagCompound[] tag = new NBTTagCompound[items.length]; +// +// for (int i = 0; i < items.length; i++) { +// tag[i] = new NBTTagCompound(); +// +// if (items[i] != null) { +// tag[i] = items[i].writeToNBT(tag[i]); +// } +// +// compound.setTag("Item" + i, tag[i]); +// } +// +// for (int i = 0; i < itemsCrafting.length; i++) { +// tag[i] = new NBTTagCompound(); +// +// if (itemsCrafting[i] != null) { +// tag[i] = itemsCrafting[i].writeToNBT(tag[i]); +// } +// +// compound.setTag("CraftingItem" + i, tag[i]); +// } +// +// compound.setInteger("Red", red); +// compound.setInteger("Green", green); +// compound.setInteger("Blue", blue); +// compound.setBoolean("Edit", editMode); +// compound.setByte("AutoFeed", (byte) smeltingAutoFeed); +// if (hasCustomInventoryName()) stack.setStackDisplayName(customName); +// energy.writeToNBT(compound); +// } + +// @Override +// public void readDataFromItem(NBTTagCompound compound, ItemStack stack) { +// NBTTagCompound[] tag = new NBTTagCompound[items.length]; +// +// for (int i = 0; i < items.length; i++) { +// tag[i] = compound.getCompoundTag("Item" + i); +// items[i] = ItemStack.loadItemStackFromNBT(tag[i]); +// } +// +// for (int i = 0; i < itemsCrafting.length; i++) { +// tag[i] = compound.getCompoundTag("CraftingItem" + i); +// itemsCrafting[i] = ItemStack.loadItemStackFromNBT(tag[i]); +// } +// +// red = compound.getInteger("Red"); +// green = compound.getInteger("Green"); +// blue = compound.getInteger("Blue"); +// editMode = compound.getBoolean("Edit"); +// smeltingAutoFeed = compound.getByte("AutoFeed"); +// energy.readFromNBT(compound); +// } + @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { return this.energy.receiveEnergy(maxReceive, simulate); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java index 7a46f125..99ce8e4a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java @@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.tileentities; import cofh.api.energy.IEnergyHandler; import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam; -import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyRing; +import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utills.Utills; @@ -26,14 +26,14 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { public float modelRotation; //Use a map for the beam to each target (Target, Beam) private ParticleEnergyBeam beam = null; - private ParticleEnergyRing ring = null; + private ParticleEnergyField ring = null; @Override public void updateEntity() { //beam = DraconicEvolution.proxy.energyBeam(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 0.5, 4.5, 0.5, 100, true, beam); - //ring = DraconicEvolution.proxy.energyRing(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, ClientEventHandler.elapsedTicks % 100, true, ring); + //ring = DraconicEvolution.proxy.energyField(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, ClientEventHandler.elapsedTicks % 100, true, ring); if (worldObj.isRemote) return; for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java index c49b70ef..a9b50009 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; import cofh.api.energy.IEnergyHandler; +import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import net.minecraft.entity.player.EntityPlayer; /** @@ -24,4 +25,8 @@ public interface IRemoteEnergyHandler extends IEnergyHandler { double getBeamY(); double getBeamZ(); + + EnergyStorage getStorage(); + + int getMaxConnections(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java index ebbdf1ca..346c1af5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java @@ -1,14 +1,14 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyRing; +import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; import net.minecraft.nbt.NBTTagCompound; /** * Created by Brandon on 10/02/2015. */ public class TileEnergyRelay extends TileRemoteEnergyBase { - private ParticleEnergyRing ring; + private ParticleEnergyField ring; public TileEnergyRelay(){} @@ -20,17 +20,17 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { @Override public int getCap() { - return 50000 + (powerTier * 450000); + return 50000 + (powerTier * 4500000); } @Override public int getRec() { - return 50000 + (powerTier * 450000); + return 50000 + (powerTier * 4500000); } @Override public int getExt() { - return 50000 + (powerTier * 450000); + return 50000 + (powerTier * 4500000); } @Override @@ -39,7 +39,7 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { if (worldObj.isRemote) { - ring = DraconicEvolution.proxy.energyRing(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 0, powerTier == 1, ring, inView > 0); + ring = DraconicEvolution.proxy.energyField(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 0, powerTier == 1, ring, inView > 0); return; } } @@ -66,7 +66,7 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { *return double between 0 to 100*/ public double getFlow(double localCap, double remoteCap) { - return Math.max(0, Math.min(100, (localCap - remoteCap) * 10D/*Flow Multiplier*/)); + return Math.max(0, Math.min(100, (localCap - remoteCap) * 100D/*Flow Multiplier*/)); } @Override @@ -83,4 +83,9 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { public double getBeamZ() { return zCoord + 0.5D; } + + @Override + public int getMaxConnections() { + return powerTier == 0 ? 10 : 20; + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java index 2c4d2429..3b119927 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java @@ -1,6 +1,14 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; +import cofh.api.energy.IEnergyHandler; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; +import com.brandon3055.draconicevolution.common.items.tools.Wrench; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; /** * Created by Brandon on 16/02/2015. @@ -8,6 +16,9 @@ import net.minecraft.nbt.NBTTagCompound; public class TileEnergyTransceiver extends TileRemoteEnergyBase{ public int facing = 0;//0=up, 1=down, 3=north, 2=south, 4=east, 5=west + private boolean input = false; + public boolean transferBoost = false; + private ParticleEnergyField particle; public TileEnergyTransceiver() {} @@ -20,8 +31,62 @@ public class TileEnergyTransceiver extends TileRemoteEnergyBase{ @Override public void updateEntity() { super.updateEntity(); + + if (!worldObj.isRemote) + { + ForgeDirection direction = ForgeDirection.getOrientation(facing).getOpposite(); + TileEntity adjacentTile = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); + if (!input && adjacentTile instanceof IEnergyHandler) + { + IEnergyHandler handler = (IEnergyHandler) adjacentTile; + storage.extractEnergy(handler.receiveEnergy(direction.getOpposite(), storage.extractEnergy(storage.getMaxExtract(), true), false), false); + if (transferBoost) + { + for (int i = 0; i < 4; i++) storage.extractEnergy(handler.receiveEnergy(direction.getOpposite(), storage.extractEnergy(storage.getMaxExtract(), true), false), false); + } + } + else if (input && adjacentTile instanceof IEnergyHandler) + { + IEnergyHandler handler = (IEnergyHandler) adjacentTile; + if (transferBoost) + { + for (int i = 0; i < 4; i++) storage.receiveEnergy(handler.extractEnergy(direction.getOpposite(), storage.receiveEnergy(storage.getMaxExtract(), true), false), false); + } + } + } + + if (worldObj.isRemote) particle = DraconicEvolution.proxy.energyField(worldObj, getBeamX(), getBeamY(), getBeamZ(), 1, powerTier == 1, particle, inView > 0); } + @Override + public boolean handleOther(EntityPlayer player, ItemStack wrench) { + String mode = Wrench.getMode(wrench); + + if (mode.equals(Wrench.MODE_SWITCH)) + { + if (powerTier == 0) + { + input = !input; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + else + { + if (!transferBoost) transferBoost = true; + else + { + input = !input; + transferBoost = false; + } + } + } + + return true; + } + + public boolean getInput() { return input; } + + public void setInput(boolean input) { this.input = input;} + @Override public double getBeamX() { return xCoord + 0.5; @@ -39,28 +104,60 @@ public class TileEnergyTransceiver extends TileRemoteEnergyBase{ @Override public int getCap() { - return 50000 + (powerTier * 450000); + return powerTier == 0 ? 50000 : 10000000; } @Override public int getRec() { - return 50000 + (powerTier * 450000); + return powerTier == 0 ? 50000 : 10000000; } @Override public int getExt() { - return 50000 + (powerTier * 450000); + return powerTier == 0 ? 50000 : 10000000; } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setInteger("Facing", facing); + compound.setBoolean("Input", input); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); facing = compound.getInteger("Facing"); + input = compound.getBoolean("Input"); + } + + @Override + public boolean canConnectEnergy(ForgeDirection from) { + return from == ForgeDirection.getOrientation(facing).getOpposite(); + } + + @Override + public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { + return from == ForgeDirection.getOrientation(facing).getOpposite() && input ? storage.receiveEnergy(maxReceive, simulate) : 0; + } + + @Override + public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { + return from == ForgeDirection.getOrientation(facing).getOpposite() && !input ? storage.extractEnergy(maxExtract, simulate) : 0; + } + + @Override + public int getEnergyStored(ForgeDirection from) { + return storage.getEnergyStored(); + } + + @Override + public int getMaxEnergyStored(ForgeDirection from) { + return storage.getMaxEnergyStored(); + } + + @Override + public int getMaxConnections() { + return powerTier == 0 ? 2 : 4; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java index e9d4329f..004aaf25 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java @@ -2,19 +2,21 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.items.tools.Wrench; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; import com.brandon3055.draconicevolution.common.utills.*; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; import net.minecraftforge.common.util.ForgeDirection; import java.util.ArrayList; @@ -23,13 +25,14 @@ import java.util.List; /** * Created by Brandon on 10/02/2015. */ -public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRemoteEnergyHandler { +public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRemoteEnergyHandler {//todo optimize (add cutoff, explore possible cach optimization) /**The tier of the relay (0-1)*/ protected int powerTier; protected EnergyStorage storage = new EnergyStorage(0); public List linkedDevices = new ArrayList(); protected int lastTickEnergy; + private int tick = 0; public byte inView = 0; @@ -48,22 +51,42 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe @Override public void updateEntity() { + tick++; + //worldObj.theProfiler.startSection("DE REB"); updateLinkedDevices(); + if (linkedDevices.size() == 0) detectAndSendChanges(-1); if (worldObj.isRemote && inView > 0) --inView; + //worldObj.theProfiler.endSection(); } //**********Distribution Logic********** private void updateLinkedDevices() { - //LogHelper.info(storage.getEnergyStored()); + boolean inView = false; +// if (worldObj.isRemote) +// { +// MovingObjectPosition mop = Minecraft.getMinecraft().thePlayer.rayTrace(5, 0); +// if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.blockX == xCoord && mop.blockY == yCoord && mop.blockZ == zCoord) inView = true;//todo remove +// } + + + if (inView)LogHelper.info("######Start#######"); + for (LinkedEnergyDevice device : linkedDevices) { if (!device.isValid(worldObj)) { - linkedDevices.remove(device); - updateLinkedDevices(); - return; + if (worldObj.getChunkFromBlockCoords(device.xCoord, device.zCoord).isChunkLoaded) + { + linkedDevices.remove(device); + updateLinkedDevices(); + return; + } + else + { + continue; + } } IRemoteEnergyHandler remoteTile = device.getEnergyTile(worldObj); @@ -81,7 +104,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe if (remoteTile instanceof TileEnergyRelay) rType = 1; else rType = 0; } - + if (inView) LogHelper.info(device.energyFlow); device.beam = DraconicEvolution.proxy.energyBeam(worldObj, getBeamX(), getBeamY(), getBeamZ(), remoteTile.getBeamX(), remoteTile.getBeamY(), remoteTile.getBeamZ(), (int)device.energyFlow, getPowerTier() == 1, device.beam, true, rType); } else @@ -91,15 +114,18 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe double difference = getCapacity() - remoteTile.getCapacity(); - int energyToEqual = (int)(((difference / 100D) * (double)remoteTile.getMaxEnergyStored(ForgeDirection.UNKNOWN)) / 2.1D); + int energyToEqual = (int)(((difference / 100D) * (double)remoteTile.getStorage().getMaxEnergyStored()) / 2.1D); - double maxFlow = Math.min(energyToEqual, Math.min(transferCap, remoteTile.getMaxEnergyStored(ForgeDirection.UNKNOWN) - remoteTile.getEnergyStored(ForgeDirection.UNKNOWN))); + double maxFlow = Math.min(energyToEqual, Math.min(transferCap, remoteTile.getStorage().getMaxEnergyStored() - remoteTile.getStorage().getEnergyStored())); device.energyFlow = getFlow(getCapacity(), remoteTile.getCapacity()); int flow = (int) ((device.energyFlow / 100D) * maxFlow); - storage.extractEnergy(remoteTile.receiveEnergy(ForgeDirection.UNKNOWN, storage.extractEnergy(flow, true), false), false); + int transfered = storage.extractEnergy(remoteTile.getStorage().receiveEnergy(storage.extractEnergy(flow, true), false), false); + + if (inView)LogHelper.info(transfered); + device.energyFlow = Math.min(((double)transfered / 10000D) * 100D, 100D); //LogHelper.info("dif:" + difference + " flow:" + getFlow(getCapacity(), remoteTile.getCapacity()) + " EtoE:" + energyToEqual + " tfrd:" + transfered + " X:" + xCoord + " lCap:" + getCapacity() + " rCap:" + remoteTile.getCapacity() + " strd:" + storage.getEnergyStored() + " T:" + type + " mxflw:" + maxFlow); @@ -107,18 +133,21 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe //if (device.energyFlow > 0)LogHelper.info(device.energyFlow + " " + transfered); //if (device.energyFlow == 0) LogHelper.info(device.getEnergyTile(worldObj));//todo clean up detectAndSendChanges(linkedDevices.indexOf(device)); + if (inView) LogHelper.info(device.energyFlow); } } + if (inView)LogHelper.info("#######END########"); } protected void detectAndSendChanges(int index) { - if (linkedDevices.get(index).energyFlow != linkedDevices.get(index).lastTickEnergyFlow) { + boolean forceSend = (tick + xCoord + yCoord + zCoord) % 100 == 0; + if (index >= 0 && (linkedDevices.get(index).energyFlow != linkedDevices.get(index).lastTickEnergyFlow || forceSend)) { sendObject(References.TWO_INTS_ID, 0, new DataUtills.TwoXInteger(index, (int)linkedDevices.get(index).energyFlow)); linkedDevices.get(index).lastTickEnergyFlow = linkedDevices.get(index).energyFlow; } - if (getEnergyStored(ForgeDirection.UNKNOWN) != lastTickEnergy) sendObject(References.INT_ID, 1, getEnergyStored(ForgeDirection.UNKNOWN)); + if (storage.getEnergyStored() != lastTickEnergy || forceSend) sendObject(References.INT_ID, 1, storage.getEnergyStored()); } @SideOnly(Side.CLIENT) @@ -134,7 +163,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe @Override public double getCapacity() { - return ((double) getEnergyStored(ForgeDirection.UNKNOWN) / (double) getMaxEnergyStored(ForgeDirection.UNKNOWN)) * 100D; + return ((double) storage.getEnergyStored() / (double) storage.getMaxEnergyStored()) * 100D; } /**Calculates the energy flow based on the local buffer @@ -149,14 +178,25 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe return powerTier; } - public void onBlockActivated(EntityPlayer player) { + public void onBlockActivated(EntityPlayer player) + { + ItemStack wrench = player.getHeldItem(); - if (player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.wrench) + if (wrench != null && wrench.getItem() == Items.stick) { - ItemStack wrench = player.getHeldItem(); - NBTTagCompound linkDat = null; - if (wrench.hasTagCompound() && wrench.getTagCompound().hasKey("LinkData")) linkDat = wrench.getTagCompound().getCompoundTag("LinkData"); + for (LinkedEnergyDevice ld : linkedDevices) + { + if (ld.beam != null) LogHelper.info(ld.beam.getFlow()); + } + } + if (wrench == null || wrench.getItem() != ModItems.wrench) return; + String mode = Wrench.getMode(wrench); + NBTTagCompound linkDat = null; + if (wrench.hasTagCompound() && wrench.getTagCompound().hasKey("LinkData")) linkDat = wrench.getTagCompound().getCompoundTag("LinkData"); + + if (mode.equals(Wrench.BIND_MODE)) + { if (linkDat != null && linkDat.hasKey("Bound") && linkDat.getBoolean("Bound")) { handleBinding(player, linkDat.getInteger("XCoord"), linkDat.getInteger("YCoord"), linkDat.getInteger("ZCoord"), true); @@ -170,34 +210,101 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe linkDat.setInteger("ZCoord", zCoord); linkDat.setBoolean("Bound", true); ItemNBTHelper.getCompound(wrench).setTag("LinkData", linkDat); - if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentText("txt.posSaved")); + if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.posSaved.txt")); } } - else { - if (!player.isSneaking())receiveEnergy(ForgeDirection.UNKNOWN, 100000, false); - else extractEnergy(ForgeDirection.UNKNOWN, 100000, false); - LogHelper.info(getEnergyStored(ForgeDirection.UNKNOWN)); + else if (mode.equals(Wrench.UNBIND_MODE)) + { + if (linkDat != null && linkDat.hasKey("Bound") && linkDat.getBoolean("Bound")) + { + for (LinkedEnergyDevice ld : linkedDevices) + { + if (ld.xCoord == linkDat.getInteger("XCoord") && ld.yCoord == linkDat.getInteger("YCoord") && ld.zCoord == linkDat.getInteger("ZCoord")) + { + + if (!(ld.getTile(worldObj) instanceof TileRemoteEnergyBase)) + { + LogHelper.error("TileRemoteEnergyBase - UNBIND - Remote tile invalid (This should be reported)"); + break; + } + + for (LinkedEnergyDevice rld : ((TileRemoteEnergyBase)ld.getTile(worldObj)).linkedDevices) + { + if (rld.xCoord == xCoord && rld.yCoord == yCoord && rld.zCoord == zCoord) + { + ((TileRemoteEnergyBase)ld.getTile(worldObj)).linkedDevices.remove(rld); + break; + } + } + + linkedDevices.remove(ld); + break; + } + } + + linkDat.setBoolean("Bound", false); + } + else + { + linkDat = new NBTTagCompound(); + linkDat.setInteger("XCoord", xCoord); + linkDat.setInteger("YCoord", yCoord); + linkDat.setInteger("ZCoord", zCoord); + linkDat.setBoolean("Bound", true); + ItemNBTHelper.getCompound(wrench).setTag("LinkData", linkDat); + if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.posSaved.txt")); + } + } + else if (mode.equals(Wrench.CLEAR_BINDINGS)) + { + for (LinkedEnergyDevice ld : linkedDevices) + { + if (!(ld.getTile(worldObj) instanceof TileRemoteEnergyBase)) + { + LogHelper.error("TileRemoteEnergyBase - UNBIND - Remote tile invalid (This should be reported)"); + break; + } + + for (LinkedEnergyDevice rld : ((TileRemoteEnergyBase)ld.getTile(worldObj)).linkedDevices) + { + if (rld.xCoord == xCoord && rld.yCoord == yCoord && rld.zCoord == zCoord) + { + ((TileRemoteEnergyBase)ld.getTile(worldObj)).linkedDevices.remove(rld); + break; + } + } + + } + + linkedDevices.clear(); + } + else + { + handleOther(player, wrench); } } @Override public boolean handleBinding(EntityPlayer player, int x, int y, int z, boolean callOther) { - int range = (powerTier + 1) * 10; + int range = (powerTier + 1) * 25; IRemoteEnergyHandler tile = worldObj.getTileEntity(x, y, z) instanceof IRemoteEnergyHandler ? (IRemoteEnergyHandler) worldObj.getTileEntity(x, y, z) : null; if (tile == null || (x == xCoord && y == yCoord && z == zCoord)) { - if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentText("txt.invalidTile")); + if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.invalidTile.txt")); return false; } else if (Utills.getDistanceAtoB(xCoord, yCoord, zCoord, x, y, z) > range) { - if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentText("txt.outOfRange")); + if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.outOfRange.txt")); + return false; + } + else if (linkedDevices.size() >= getMaxConnections()) + { + if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.maxConnections.txt")); return false; } - - if (callOther && !tile.handleBinding(player, xCoord, yCoord, zCoord, false)) { @@ -205,7 +312,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe return false; } - if (callOther && worldObj.isRemote) player.addChatComponentMessage(new ChatComponentText("txt.linked")); + if (callOther && worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.linked.txt")); for (LinkedEnergyDevice ld : linkedDevices) { @@ -218,18 +325,23 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe return true; } + public boolean handleOther(EntityPlayer player, ItemStack wrench) { return false; } + @Override + public EnergyStorage getStorage() { + return storage; + } //************************************** @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - return storage.receiveEnergy(maxReceive, simulate); + return 0; } @Override public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { - return storage.extractEnergy(maxExtract, simulate); + return 0; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java index ee980c93..79edff13 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java @@ -224,8 +224,8 @@ public class TileEnergyStorageCore extends TileObjectSync { break; case 1: if (!testForOrActivateDraconium(xCoord + 1, yCoord, zCoord, setBlocks, activate) || !testForOrActivateDraconium(xCoord - 1, yCoord, zCoord, setBlocks, activate) || !testForOrActivateDraconium(xCoord, yCoord + 1, zCoord, setBlocks, activate) || !testForOrActivateDraconium(xCoord, yCoord - 1, zCoord, setBlocks, activate) || !testForOrActivateDraconium(xCoord, yCoord, zCoord + 1, setBlocks, activate) || !testForOrActivateDraconium(xCoord, yCoord, zCoord - 1, setBlocks, activate)) return false; - if (!isAir(xCoord+1, yCoord+1, zCoord, setBlocks) || !isAir(xCoord, yCoord+1, zCoord+1, setBlocks) || !isAir(xCoord-1, yCoord+1, zCoord, setBlocks) || !isAir(xCoord, yCoord+1, zCoord-1, setBlocks) || !isAir(xCoord+1, yCoord-1, zCoord, setBlocks) || !isAir(xCoord, yCoord-1, zCoord+1, setBlocks) || !isAir(xCoord-1, yCoord-1, zCoord, setBlocks) || !isAir(xCoord, yCoord-1, zCoord-1, setBlocks) || !isAir(xCoord+1, yCoord, zCoord+1, setBlocks) || !isAir(xCoord-1, yCoord, zCoord-1, setBlocks) || !isAir(xCoord+1, yCoord, zCoord-1, setBlocks) || !isAir(xCoord-1, yCoord, zCoord+1, setBlocks)) return false; - if (!isAir(xCoord+1, yCoord+1, zCoord+1, setBlocks) || !isAir(xCoord-1, yCoord+1, zCoord-1, setBlocks) || !isAir(xCoord+1, yCoord+1, zCoord-1, setBlocks) || !isAir(xCoord-1, yCoord+1, zCoord+1, setBlocks) || !isAir(xCoord+1, yCoord-1, zCoord+1, setBlocks) || !isAir(xCoord-1, yCoord-1, zCoord-1, setBlocks) || !isAir(xCoord+1, yCoord-1, zCoord-1, setBlocks) || !isAir(xCoord-1, yCoord-1, zCoord+1, setBlocks)) return false; + if (!isReplacable(xCoord + 1, yCoord + 1, zCoord, setBlocks) || !isReplacable(xCoord, yCoord + 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord + 1, zCoord, setBlocks) || !isReplacable(xCoord, yCoord + 1, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord - 1, zCoord, setBlocks) || !isReplacable(xCoord, yCoord - 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord - 1, zCoord, setBlocks) || !isReplacable(xCoord, yCoord - 1, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord, zCoord - 1, setBlocks) || !isReplacable(xCoord - 1, yCoord, zCoord + 1, setBlocks)) return false; + if (!isReplacable(xCoord + 1, yCoord + 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord + 1, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord + 1, zCoord - 1, setBlocks) || !isReplacable(xCoord - 1, yCoord + 1, zCoord + 1, setBlocks) || !isReplacable(xCoord + 1, yCoord - 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord - 1, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord - 1, zCoord - 1, setBlocks) || !isReplacable(xCoord - 1, yCoord - 1, zCoord + 1, setBlocks)) return false; break; case 2: if (!testOrActivateRect(1, 1, 1, "draconiumBlock", setBlocks, activate)) return false; @@ -266,7 +266,7 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int z = zCoord - zDim; z <= zCoord + zDim; z++){ if (block.equals("air")){ - if (!(x == xCoord && y == yCoord && z == zCoord) && !isAir(x, y, z, set)) return false; + if (!(x == xCoord && y == yCoord && z == zCoord) && !isReplacable(x, y, z, set)) return false; } else if (block.equals("redstone")){ if (!(x == xCoord && y == yCoord && z == zCoord) && !testForOrActivateRedstone(x, y, z, set, activate)) return false; @@ -290,7 +290,7 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord-size || y == yCoord+size || z == zCoord-size || z==zCoord+size) { if (block.equals("air")) { - if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !isAir(xCoord + dist, y, z, set)) + if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !isReplacable(xCoord + dist, y, z, set)) return false; } else if (block.equals("redstone")) { if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateRedstone(xCoord + dist, y, z, set, activate)) @@ -310,7 +310,7 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord-size || y == yCoord+size || z == zCoord-size || z==zCoord+size) { if (block.equals("air")) { - if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !isAir(xCoord - dist, y, z, set)) + if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !isReplacable(xCoord - dist, y, z, set)) return false; } else if (block.equals("redstone")) { if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateRedstone(xCoord - dist, y, z, set, activate)) @@ -331,7 +331,7 @@ public class TileEnergyStorageCore extends TileObjectSync { if (x == xCoord-size || x == xCoord+size || z == zCoord-size || z == zCoord+size) { if (block.equals("air")){ - if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !isAir(x, yCoord + dist, z, set)) return false; + if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !isReplacable(x, yCoord + dist, z, set)) return false; } else if (block.equals("redstone")){ if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !testForOrActivateRedstone(x, yCoord + dist, z, set, activate)) return false; @@ -351,7 +351,7 @@ public class TileEnergyStorageCore extends TileObjectSync { if (x == xCoord-size || x == xCoord+size || z == zCoord-size || z==zCoord+size) { if (block.equals("air")){ - if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !isAir(x, yCoord - dist, z, set)) return false; + if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !isReplacable(x, yCoord - dist, z, set)) return false; } else if (block.equals("redstone")){ if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !testForOrActivateRedstone(x, yCoord - dist, z, set, activate)) return false; @@ -372,7 +372,7 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord-size || y == yCoord+size || x == xCoord-size || x == xCoord+size) { if (block.equals("air")){ - if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !isAir(x, y, zCoord + dist, set)) return false; + if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !isReplacable(x, y, zCoord + dist, set)) return false; } else if (block.equals("redstone")){ if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !testForOrActivateRedstone(x, y, zCoord + dist, set, activate)) return false; @@ -392,7 +392,7 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord-size || y == yCoord+size || x == xCoord-size || x==xCoord+size) { if (block.equals("air")){ - if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !isAir(x, y, zCoord - dist, set)) return false; + if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !isReplacable(x, y, zCoord - dist, set)) return false; } else if (block.equals("redstone")){ if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !testForOrActivateRedstone(x, y, zCoord - dist, set, activate)) return false; @@ -416,7 +416,7 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int z=zCoord-1; z<=zCoord+1;z++){ if (block.equals("air")){ - if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !isAir(xCoord + dist, y, z, set)) return false; + if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !isReplacable(xCoord + dist, y, z, set)) return false; } else if (block.equals("redstone")){ if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateRedstone(xCoord + dist, y, z, set, activate)) return false; @@ -434,7 +434,7 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int z=zCoord-1; z<=zCoord+1;z++){ if (block.equals("air")){ - if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !isAir(xCoord - dist, y, z, set)) return false; + if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !isReplacable(xCoord - dist, y, z, set)) return false; } else if (block.equals("redstone")){ if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) && !testForOrActivateRedstone(xCoord - dist, y, z, set, activate)) return false; @@ -453,7 +453,7 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int z=zCoord-1; z<=zCoord+1;z++){ if (block.equals("air")){ - if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !isAir(x, yCoord + dist, z, set)) return false; + if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !isReplacable(x, yCoord + dist, z, set)) return false; } else if (block.equals("redstone")){ if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) && !testForOrActivateRedstone(x, yCoord + dist, z, set, activate)) return false; @@ -471,7 +471,7 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int z=zCoord-1; z<=zCoord+1;z++){ if (block.equals("air")){ - if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !isAir(x, yCoord - dist, z, set)) return false; + if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !isReplacable(x, yCoord - dist, z, set)) return false; } else if (block.equals("redstone")){ if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) && !testForOrActivateRedstone(x, yCoord - dist, z, set, activate)) return false; @@ -490,7 +490,7 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int x=xCoord-1; x<=xCoord+1;x++){ if (block.equals("air")){ - if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !isAir(x, y, zCoord + dist, set)) return false; + if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !isReplacable(x, y, zCoord + dist, set)) return false; } else if (block.equals("redstone")){ if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) && !testForOrActivateRedstone(x, y, zCoord + dist, set, activate)) return false; @@ -508,7 +508,7 @@ public class TileEnergyStorageCore extends TileObjectSync { for (int x=xCoord-1; x<=xCoord+1;x++){ if (block.equals("air")){ - if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !isAir(x, y, zCoord - dist, set)) return false; + if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !isReplacable(x, y, zCoord - dist, set)) return false; } else if (block.equals("redstone")){ if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) && !testForOrActivateRedstone(x, y, zCoord - dist, set, activate)) return false; @@ -574,12 +574,12 @@ public class TileEnergyStorageCore extends TileObjectSync { return false; } - private boolean isAir(int x, int y, int z, boolean set){ + private boolean isReplacable(int x, int y, int z, boolean set){ if (set){ worldObj.setBlock(x, y, z, Blocks.air); return true; }else - return worldObj.getBlock(x, y, z) == Blocks.air; + return worldObj.getBlock(x, y, z).isReplaceable(worldObj, x, y, z); } public boolean isOnline(){ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java new file mode 100644 index 00000000..4d396cea --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java @@ -0,0 +1,43 @@ +package com.brandon3055.draconicevolution.common.utills; + +/** + * Created by Brandon on 24/02/2015. + */ +public class UpdateChecker +{ + private final UpdateCheckThread thread; + + public UpdateChecker() + { + thread = new UpdateCheckThread(); + thread.start(); + } + + + + public class UpdateCheckThread extends Thread + { + private String version; + private int snapshot; + private String note; + private boolean checkComplete = false; + private boolean checkFaild = false; + + @Override + public void run() { + LogHelper.info("Thread Run"); + try + { + LogHelper.info("Thread going to sleep"); + Thread.sleep(4000L); + LogHelper.info("Thread resuming"); + } + catch (InterruptedException e) + { + checkFaild = true; + e.printStackTrace(); + } + } + } + +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java index 3eccdeed..cc9f4890 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java @@ -31,7 +31,7 @@ public class DraconicWorldGenerator implements IWorldGenerator { } public void generateSurface(Random random, int x, int z, World world) {// minVainSise, maxVainSize, spawnChance(Def2), minY, maxY - addOreSpawn(ModBlocks.draconiumOre, world, random, x, z, 3, 4, 2, 2, 8); + if (!ConfigHandler.disableOreSpawnOverworld) addOreSpawn(ModBlocks.draconiumOre, world, random, x, z, 3, 4, 2, 2, 8); } public void generateEnd(Random random, int x, int z, World world) { @@ -42,11 +42,11 @@ public class DraconicWorldGenerator implements IWorldGenerator { int cX = x/16; int cZ = z/16; if (ConfigHandler.generateChaosIslands && Math.sqrt(x*x + z*z) > 9000 && cX%625 == 0 && cZ%625 == 0) new WorldGenEnderIsland().generate(world, random, x1, 100 , z1); - addOreSpawn(ModBlocks.draconiumOre, world, random, x, z, 4, 5, 10, 1, 70); + if (!ConfigHandler.disableOreSpawnEnd) addOreSpawn(ModBlocks.draconiumOre, world, random, x, z, 4, 5, 10, 1, 70); } public void generateNether(final Random random, final int chunkX, final int chunkZ, final World world) { - addOreSpawn(ModBlocks.draconiumOre, world, random, chunkX, chunkZ, 3, 4, 5, 1, 125); + if (!ConfigHandler.disableOreSpawnNether) addOreSpawn(ModBlocks.draconiumOre, world, random, chunkX, chunkZ, 3, 4, 5, 1, 125); } /**Generate Ore * Block to generate diff --git a/src/main/resources/assets/draconicevolution/lang/en_US.lang b/src/main/resources/assets/draconicevolution/lang/en_US.lang index 99b0130f..3973a43a 100644 --- a/src/main/resources/assets/draconicevolution/lang/en_US.lang +++ b/src/main/resources/assets/draconicevolution/lang/en_US.lang @@ -75,6 +75,18 @@ tile.draconicevolution:draconiumChest.description=Using your draconic knowledge tile.draconicevolution:draconicBlock.name=Awakened Draconium Block tile.draconicevolution:draconicBlock.description=You have been studying the interactions of Draconium with various materials and have come to realize that this is only an inert state. You have discovered a method to bring out the true power of Draconium using a complex ritual involving a dragon heart. (See the dragon heart page for details) +tile.draconicevolution:energyCrystal0.name=Energy Relay [WIP] +tile.draconicevolution:energyCrystal0.description= + +tile.draconicevolution:energyCrystal1.name=Advanced Energy Relay [WIP] +tile.draconicevolution:energyCrystal1.description= + +tile.draconicevolution:energyCrystal2.name=Energy Transceiver [WIP] +tile.draconicevolution:energyCrystal2.description= + +tile.draconicevolution:energyCrystal3.name=Advanced Energy Transceiver [WIP] +tile.draconicevolution:energyCrystal3.description= + //Item Information ---------------------------------------------------------------------------------------------------------------------------------------- item.draconicevolution:awakenedCore.name=Awakened Core @@ -205,6 +217,10 @@ item.draconicevolution:creativeStructureSpawnerEnderIsland.name=Spawn Ender Isla item.draconicevolution:infoTablet.name=Draconic Evolution Information Tablet +item.draconicevolution:wrench.name=Crystal Wrench [WIP] +item.draconicevolution:wrench.description= + + //Item Groups ---------------------------------------------------------------------------------------------------------------------------------------- itemGroup.toolsAndWeapons=Draconic Evolution Tools & Weapons itemGroup.blocksAndItems=Draconic Evolution Blocks & Items @@ -262,6 +278,20 @@ msg.draconiumChestEditL4.txt=Right click with paper to copy the colour to other msg.draconiumChestEdit2.txt=Please use a single peace of paper msg.de.dragonDeath.txt=§5The heart is temporarily awakened by the dragons explosive §5death +//Energy Net +msg.de.wrenchMode.bind.txt=Function: Bind +msg.de.wrenchMode.unBind.txt=Function: Un-Bind +msg.de.wrenchMode.unBindAll.txt=Function: Un-Bind All +msg.de.wrenchMode.modeSwitch.txt=Function: Mode Change +msg.de.rightClickUnbind.txt=Right click air to un-bind +msg.de.boundTo.txt=Bound To +msg.de.posSaved.txt=Position Saved +msg.de.invalidTile.txt=Target Invalid +msg.de.outOfRange.txt=Target out of range +msg.de.maxConnections.txt=Connection limit reached +msg.de.linked.txt=Devices Linked + + //Tool Tips ---------------------------------------------------------------------------------------------------------------------------------------- info.teleporterInfUnset1.txt=Unbound info.teleporterInfUnset2.txt=Shift right click to bind your current @@ -321,6 +351,13 @@ info.de.hudDisplayConfigTxt3.txt=################### info.de.hudDisplayConfigInfo1.txt=Click and drag HUD info.de.hudDisplayConfigInfo2.txt=to change location +//Energy Net +info.de.modeIn.txt=Mode: Input +info.de.modeOut.txt=Mode: Output +info.de.5xTransfer.txt= (5x Transfer) +info.de.connections.txt=Connections + + enchantment.draconicevolution.reaperEnchant=Reaper //Achievements ---------------------------------------------------------------------------------------------------------------------------------------- diff --git a/src/main/resources/assets/draconicevolution/textures/particle/particles.png b/src/main/resources/assets/draconicevolution/textures/particle/particles.png index 76626c3f..8368455e 100644 Binary files a/src/main/resources/assets/draconicevolution/textures/particle/particles.png and b/src/main/resources/assets/draconicevolution/textures/particle/particles.png differ diff --git a/src/main/resources/assets/draconicevolution/textures/particle/particles.png.mcmeta b/src/main/resources/assets/draconicevolution/textures/particle/particles.png.mcmeta new file mode 100644 index 00000000..b920dcd2 --- /dev/null +++ b/src/main/resources/assets/draconicevolution/textures/particle/particles.png.mcmeta @@ -0,0 +1 @@ +{ "texture": { "blur": true }} \ No newline at end of file