From 91317dbecae9cbcf9a1d1d6f71ebbff140334cbc Mon Sep 17 00:00:00 2001 From: brandon3055 Date: Sat, 13 Dec 2014 05:16:42 +1100 Subject: [PATCH] 13/12/2014 --- build.gradle | 2 +- .../draconicevolution/DraconicEvolution.java | 4 +- .../client/creativetab/DETab.java | 2 +- .../interfaces/manual/CraftingInfoPage.java | 2 +- .../manual/EnergyCoreTutorialPage.java | 8 +- .../client/interfaces/manual/GuiManual.java | 9 +- .../client/interfaces/manual/IntroPage.java | 6 +- .../interfaces/manual/TutorialPage.java | 52 +++--- .../tile/RenderTileEnergyStorageCore.java | 10 +- .../common/blocks/DraconicBlock.java | 2 +- .../common/blocks/multiblock/EnergyPylon.java | 13 +- .../container/ContainerEnergyInfuser.java | 4 +- .../common/handler/CraftingHandler.java | 34 +++- .../handler/MinecraftForgeEventHandler.java | 19 +++ .../common/items/Tclogo.java | 158 ++++++------------ .../items/tools/DraconiumFluxCapacitor.java | 2 +- .../common/items/tools/ToolHandler.java | 2 +- .../tileentities/TileParticleGenerator.java | 7 +- .../multiblocktiles/TileEnergyPylon.java | 67 ++++++-- .../TileEnergyStorageCore.java | 2 +- .../common/utills/ShapedOreEnergyRecipe.java | 35 ++++ .../assets/draconicevolution/lang/en_US.lang | 94 +++++------ 22 files changed, 289 insertions(+), 245 deletions(-) create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java diff --git a/build.gradle b/build.gradle index cda342cb..231fc180 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ repositories { apply plugin: 'forge' -version = "1.7.10-v1.0.0-snapshot_4" //Version System A.B.C A=Minecraft version (increments with each new minecraft version) B=Major mod change (Will break saves) C=Release Number (Increments with each public release) +version = "1.7.10-v1.0.0" //Version System A.B.C A=Minecraft version (increments with each new minecraft version) B=Major mod change (Will break saves) C=Release Number (Increments with each public release) group= "com.brandon3055.draconicevolution" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Draconic-Evolution" diff --git a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java index fbd42a2f..f99433ba 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 = "DraconicEvolution"; public static SimpleNetworkWrapper network; - public static boolean debug = true; + public static boolean debug = false;//todo public static Enchantment reaperEnchant; @@ -49,7 +49,7 @@ public class DraconicEvolution { // TODO Update Licence and add change log to gi event.getModMetadata().description = "This is a mod originally made for the Tolkiencraft mod pack"; event.getModMetadata().authorList = Arrays.asList("brandon3055"); event.getModMetadata().logoFile = "banner.png"; - event.getModMetadata().url = "http://dragontalk.net/draconic_evolution"; + event.getModMetadata().url = "http://www.tolkiencraft.com/draconic-evolution/"; event.getModMetadata().version = References.VERSION + "-MC1.7.10"; proxy.preInit(event); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java b/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java index 834a42a9..6eedbb22 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java @@ -16,7 +16,7 @@ public class DETab extends CreativeTabs { static ItemStack iconStackStaff; public static void initialize() { - iconStackStaff = ItemNBTHelper.setInteger(new ItemStack(ModItems.draconicDestructionStaff), "Energy", 100000000); + iconStackStaff = ItemNBTHelper.setInteger(new ItemStack(ModItems.draconicDestructionStaff), "Energy", 30000000); } public DETab(int id, String modid, String label, int tab) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/CraftingInfoPage.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/CraftingInfoPage.java index 62f393a3..c6633b3b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/CraftingInfoPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/CraftingInfoPage.java @@ -112,7 +112,7 @@ public class CraftingInfoPage extends TitledPage { int offset = 0; for (String s : getFormattedText(fontRendererObj)) { if (s == null) break; - if (s.substring(0,2).equals("\\%")){ + if (s.contains("\\%") && s.substring(0,2).equals("\\%")){ s = s.substring(2); offset += fontRendererObj.FONT_HEIGHT/2; } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/EnergyCoreTutorialPage.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/EnergyCoreTutorialPage.java index 232d05ed..547e2ae2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/EnergyCoreTutorialPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/EnergyCoreTutorialPage.java @@ -11,7 +11,7 @@ import java.util.List; /** * Created by Brandon on 20/09/2014. */ -public class EnergyCoreTutorialPage extends TutorialPage { +public class EnergyCoreTutorialPage extends TutorialPage { public static final ResourceLocation Energy_Core = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/T5_Energy_Core.png"); public static final ResourceLocation Stabilizer_Placement = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Stabilizer_Placement.png"); public static final ResourceLocation Core_Tiers = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Core_Tiers.png"); @@ -20,7 +20,7 @@ public class EnergyCoreTutorialPage extends TutorialPage { public static final ResourceLocation Pylon_Particles_2 = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Energy_Pylon_Particles_2.png"); public static final ResourceLocation Pylon_y_Placement = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Pylon_y_Placement.png"); - + @SuppressWarnings("unchecked") public EnergyCoreTutorialPage(String name, PageCollection collection) { super(name, collection, StatCollector.translateToLocal("manual.de.ecth.txt")); this.lastPage = 11; @@ -106,8 +106,8 @@ public class EnergyCoreTutorialPage extends TutorialPage { GL11.glScaled(imageScale, imageScale, 1D); double scaleMult = 0.21; - int yOffset = (int)((minecraft.getSystemTime()/2000 % 2)*22); - drawTexturedModalRect((int)((offsetX+49)*scaleMult), (int)((offsetY+15)*scaleMult), 180, 0+yOffset, 30, 20); + int yOffset = (int)((Minecraft.getSystemTime()/2000 % 2)*22); + drawTexturedModalRect((int)((offsetX+49)*scaleMult), (int)((offsetY+15)*scaleMult), 180, yOffset, 30, 20); GL11.glPopMatrix(); drawCenteredString(fontRendererObj, "Tier 1", offsetX+128, offsetY+107, 0xff0000); addDescription(minecraft, offsetX, offsetY+45, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage2.txt"), 4)); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/GuiManual.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/GuiManual.java index bf0ed508..d40cc81c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/GuiManual.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/GuiManual.java @@ -102,6 +102,7 @@ public class GuiManual extends GuiScreen { pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.potentiometer), "")); pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.rainSensor), "")); pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconiumBlock), "")); + pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconicBlock), "")); pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.energyStorageCore), "")); pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.energyPylon), "")); pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconiumBlock, 1, 1), "")); @@ -110,10 +111,10 @@ public class GuiManual extends GuiScreen { pageCollection.addPage(new EnergyCoreTutorialPage("TUTORIAL."+getNextPageIndex(), pageCollection).setIndexName(StatCollector.translateToLocal("manual.de.ecth.txt"))); pageCollection.addPage(new EnderResurrectionTutorialPage("TUTORIAL."+getNextPageIndex(), pageCollection).setIndexName("manual.de.roerth.txt")); - pageCollection.addPage(new DescriptionPage("INFO"+getNextPageIndex(), pageCollection, "manual.de.endercomet.description").setIndexName("manual.de.endercomet.txt")); - pageCollection.addPage(new DescriptionPage("INFO"+getNextPageIndex(), pageCollection, "manual.de.chaosisland.description").setIndexName("manual.de.enderisland.txt")); - pageCollection.addPage(new DescriptionPage("INFO"+getNextPageIndex(), pageCollection, "manual.de.placeditems.description").setIndexName("manual.de.placeditems.txt")); - pageCollection.addPage(new DescriptionPage("INFO"+getNextPageIndex(), pageCollection, "manual.de.pigmenBloodRage.description").setIndexName("manual.de.pigmenBloodRage.txt")); + pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.endercomet.description").setIndexName("manual.de.endercomet.txt")); + pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.chaosisland.description").setIndexName("manual.de.enderisland.txt")); + pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.placeditems.description").setIndexName("manual.de.placeditems.txt")); + pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.pigmenBloodRage.description").setIndexName("manual.de.pigmenBloodRage.txt")); pageCollection.addPage(new IndexPage("INDEX", pageCollection)); return pageCollection; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/IntroPage.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/IntroPage.java index a5c22eb8..64c9488b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/IntroPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/IntroPage.java @@ -36,7 +36,11 @@ public class IntroPage extends BasePage { GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(2.5F, 2.5F, 1F); - drawCenteredString(minecraft.fontRenderer, ttl("manual.de.userGuide.txt"), (int) ((offsetX + 128) / 2.5), (int) ((offsetY + 128) / 2.5), 0x00b400); + drawCenteredString(fontRendererObj, ttl("manual.de.userGuide.txt"), (int) ((offsetX + 128) / 2.5), (int) ((offsetY + 128) / 2.5), 0x00b400); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(0.5F, 0.5F, 0.5F); + fontRendererObj.drawString("This gui is a work in progress", (offsetX + 4)*2, (offsetY + 194)*2, 0x000000); GL11.glPopMatrix(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/TutorialPage.java b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/TutorialPage.java index 52aa6555..806924b5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/TutorialPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/interfaces/manual/TutorialPage.java @@ -1,5 +1,6 @@ package com.brandon3055.draconicevolution.client.interfaces.manual; +import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import net.minecraft.client.Minecraft; @@ -62,32 +63,39 @@ public class TutorialPage extends TitledPage { } @SuppressWarnings("unchecked") - public List getFormattedText(FontRenderer fr, String raw, int descriptionIndex) { + public List getFormattedText(FontRenderer fr, String rawDescription, int descriptionIndex) { if (formattedDescription[descriptionIndex] == null) { - if (Strings.isNullOrEmpty(raw)) formattedDescription[descriptionIndex] = ImmutableList.of(); - else formattedDescription[descriptionIndex] = ImmutableList.copyOf(fr.listFormattedStringToWidth(raw, 370)); - List modified = new ArrayList(); - for (int i = 0; i < formattedDescription[descriptionIndex].size(); i++){ - String line = formattedDescription[descriptionIndex].get(i); - if (!line.contains("\\n")) modified.add(line); - else { - String joinedLine = ""; - for (i=i; i < formattedDescription[descriptionIndex].size(); i++) joinedLine = joinedLine + formattedDescription[descriptionIndex].get(i); - int escape = 0; - while (!joinedLine.isEmpty() && escape < 20) { - int index = 0; - if (joinedLine.contains("\\n")) index = joinedLine.indexOf("\\n"); - else index = joinedLine.length(); - String s = joinedLine.substring(0, index); - modified.add(s); - joinedLine = joinedLine.substring(index); - joinedLine = joinedLine.replaceFirst("\\n", ""); - escape++; - } + + formattedDescription[descriptionIndex] = new ArrayList(); + + if (Strings.isNullOrEmpty(rawDescription)) { + formattedDescription[descriptionIndex] = ImmutableList.of(); + return formattedDescription[descriptionIndex]; + } + if (!rawDescription.contains("\\n")) { + formattedDescription[descriptionIndex] = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 370)); + return formattedDescription[descriptionIndex]; + } + + List segments = new ArrayList(); //Each separate string that is separated by a \n + String raw = rawDescription; + + + int escape = 0; + while (raw.contains("\\n")) { + segments.add(raw.substring(0, raw.indexOf("\\n"))); + raw = raw.substring(raw.indexOf("\\n") + 2); + if (!raw.contains("\\n")) segments.add(raw); + + escape++; + if (escape > 100) { + LogHelper.error("Bailing Out!"); break; } } - formattedDescription[descriptionIndex] = modified; + + for (String s : segments) + formattedDescription[descriptionIndex].addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370))); } return formattedDescription[descriptionIndex]; } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java index bbe9cf97..83be1277 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java @@ -15,7 +15,7 @@ import org.lwjgl.opengl.GL11; /** * Created by Brandon on 27/07/2014. */ -public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer { +public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {//todo give core antygravirt private static final ResourceLocation iner_model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_1.png"); private static final ResourceLocation outer_model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_2.png"); @@ -71,7 +71,7 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer { //float colour = (float)(Minecraft.getSystemTime()%10000) / 10000f; //double colour = Math.sin((float)Minecraft.getSystemTime() / 10000f); double colour = ((TileEnergyStorageCore) tile).getEnergyStored() / ((TileEnergyStorageCore) tile).getMaxEnergyStored(); - float brightness = (float)Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 150f); + float brightness = (float)Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 100f); colour = 1f - colour; //LogHelper.info(colour + " " + ((TileEnergyStorageCore) tile).getEnergyStored() +" "+ ((TileEnergyStorageCore) tile).getMaxEnergyStored()); @@ -80,20 +80,20 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer { GL11.glPushMatrix(); GL11.glRotatef(rotation, 0F, 1F, 0.5F); GL11.glColor4d(1F, colour * 0.3f, colour * 0.7f, 1F); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 50f + brightness, 50f + brightness); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 80f + brightness, 80f + brightness); iner_model.renderAll(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(0.8F, 0.8F, 0.8F); - GL11.glColor4f(0.5F, 1F, 1F, 1F); + GL11.glColor4d(1F, 1f, 0.2f, 1F); GL11.glRotatef(rotation, 0F, 1F, 0.5F); iner_model.renderAll(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(0.9F, 0.9F, 0.9F); - GL11.glColor4f(0F, 1F, 1F, 1F); + GL11.glColor4d(1F, 0f, 0.2f, 1F); GL11.glRotatef(rotation, 0F, 1F, 0.5F); iner_model.renderAll(); GL11.glPopMatrix(); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java index e047773d..48affa0e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java @@ -10,7 +10,7 @@ import net.minecraft.util.IIcon; /** * Created by Brandon on 21/11/2014. */ -public class DraconicBlock extends BlockDE{//todo new description +public class DraconicBlock extends BlockDE{ IIcon top; public DraconicBlock() { this.setHardness(20F); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java index 8ba9bdcd..b6547945 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java @@ -1,9 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon; @@ -14,13 +13,10 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; /** * Created by Brandon on 28/07/2014. @@ -118,12 +114,9 @@ public class EnergyPylon extends BlockDE {//todo fix sphere renderer int meta = world.getBlockMetadata(x, y, z); if (meta == 0) return false; TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; - if (player.getHeldItem() != null && player.getHeldItem().isItemEqual(new ItemStack(Items.stick)) && thisTile != null && world.isRemote) - { - LogHelper.info(thisTile.getEnergyStored(ForgeDirection.UP)); - } if (thisTile != null) { - thisTile.onActivated(); + if (!player.isSneaking()) thisTile.onActivated(); + else thisTile.nextCore(); return true; } return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java index 0335a01d..033c159e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java @@ -50,11 +50,11 @@ public class ContainerEnergyInfuser extends ContainerDataSync { ItemStack stack = slot.getStack(); ItemStack result = stack.copy(); - if (i >= 36){ + if (i >= 36){ //To player if (!mergeItemStack(stack, 0, 36, false)){ return null; } - }else if (!(stack.getItem() instanceof IEnergyContainerItem) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)){ + }else if (stack.stackSize != 1 || !(stack.getItem() instanceof IEnergyContainerItem) || !mergeItemStack(stack, 36, 37, false)){ return null; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java index e86d61f9..897ab6ca 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java @@ -4,6 +4,7 @@ import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utills.ShapedOreEnergyRecipe; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; @@ -13,6 +14,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; public class CraftingHandler { public static void init() @@ -48,20 +50,20 @@ public class CraftingHandler { //Draconic Tools - add(ModItems.draconicFluxCapacitor, "CMC", "SPS", "CSC", 'C', ModItems.draconicIngot, 'S', ModItems.draconicEnergyCore, 'M', ModItems.awakenedCore, 'P', ModItems.wyvernFluxCapacitor); + addEnergy(ModItems.draconicFluxCapacitor, "CMC", "SPS", "CSC", 'C', ModItems.draconicIngot, 'S', ModItems.draconicEnergyCore, 'M', ModItems.awakenedCore, 'P', ModItems.wyvernFluxCapacitor); //tools - add(ModItems.draconicPickaxe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernPickaxe, 'E', ModItems.draconicEnergyCore); - add(ModItems.draconicShovel, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernShovel, 'E', ModItems.draconicEnergyCore); + addEnergy(ModItems.draconicPickaxe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernPickaxe, 'E', ModItems.draconicEnergyCore); + addEnergy(ModItems.draconicShovel, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernShovel, 'E', ModItems.draconicEnergyCore); add(ModItems.draconicAxe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', Items.diamond_axe, 'E', ModItems.draconicEnergyCore); add(ModItems.draconicHoe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', Items.diamond_hoe, 'E', ModItems.draconicEnergyCore); - add(ModItems.draconicSword, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernSword, 'E', ModItems.draconicEnergyCore); + addEnergy(ModItems.draconicSword, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernSword, 'E', ModItems.draconicEnergyCore); add(ModItems.draconicBow, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernBow, 'E', ModItems.draconicEnergyCore); - add(ModItems.draconicDestructionStaff, "IAI", "PIS", "IWI", 'I', ModItems.draconicIngot, 'A', ModItems.awakenedCore, 'P', ModItems.draconicPickaxe, 'S', ModItems.draconicShovel, 'W', ModItems.draconicSword); + addEnergy(ModItems.draconicDestructionStaff, "IAI", "PIS", "IWI", 'I', ModItems.draconicIngot, 'A', ModItems.awakenedCore, 'P', ModItems.draconicPickaxe, 'S', ModItems.draconicShovel, 'W', ModItems.draconicSword); //armor - add(ModItems.draconicHelm, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernHelm, 'E', ModItems.draconicEnergyCore); - add(ModItems.draconicChest, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernChest, 'E', ModItems.draconicEnergyCore); - add(ModItems.draconicLeggs, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernLeggs, 'E', ModItems.draconicEnergyCore); - add(ModItems.draconicBoots, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernBoots, 'E', ModItems.draconicEnergyCore); + addEnergy(ModItems.draconicHelm, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernHelm, 'E', ModItems.draconicEnergyCore); + addEnergy(ModItems.draconicChest, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernChest, 'E', ModItems.draconicEnergyCore); + addEnergy(ModItems.draconicLeggs, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernLeggs, 'E', ModItems.draconicEnergyCore); + addEnergy(ModItems.draconicBoots, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernBoots, 'E', ModItems.draconicEnergyCore); @@ -103,6 +105,8 @@ public class CraftingHandler { //Other addOre(ModItems.infoTablet, "SSS", "SDS", "SSS", 'S', "stone", 'D', ModItems.draconiumDust); CraftingManager.getInstance().addShapelessRecipe(new ItemStack(ModItems.enderArrow), Items.arrow, Items.ender_pearl); + addShaplessOre(new ItemStack(Blocks.dirt), Item.getItemFromBlock(Blocks.sand), Items.rotten_flesh, "treeSapling", "treeSapling", "treeSapling"); + addShaplessOre(new ItemStack(Blocks.dirt), Item.getItemFromBlock(Blocks.sand), Items.rotten_flesh, "treeLeaves", "treeLeaves", "treeLeaves"); //Disable able @@ -128,9 +132,21 @@ public class CraftingHandler { private static void addOre(ItemStack result, Object... recipe){ GameRegistry.addRecipe(new ShapedOreRecipe(result, recipe)); } + private static void addShaplessOre(ItemStack result, Object... recipe){ + GameRegistry.addRecipe(new ShapelessOreRecipe(result, recipe)); + } + + + private static void add(Block result, Object... recipe){ add(new ItemStack(result), recipe); } private static void add(Item result, Object... recipe){ add(new ItemStack(result), recipe); } private static void add(ItemStack result, Object... recipe){ GameRegistry.addRecipe(result, recipe); } + + private static void addEnergy(Block result, Object... recipe){ addEnergy(new ItemStack(result), recipe); } + private static void addEnergy(Item result, Object... recipe){ addEnergy(new ItemStack(result), recipe); } + private static void addEnergy(ItemStack result, Object... recipe){ + GameRegistry.addRecipe(new ShapedOreEnergyRecipe(result, recipe)); + } } \ No newline at end of file diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java index 9e5a3879..51a0e15e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java @@ -17,6 +17,7 @@ import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; +import net.minecraft.block.material.Material; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; @@ -44,6 +45,7 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerUseItemEvent; import java.lang.reflect.InvocationTargetException; @@ -269,4 +271,21 @@ public class MinecraftForgeEventHandler { DraconicEvolution.network.sendToServer(new MountUpdatePacket(0)); } } + + @SubscribeEvent + public void getBreakSpeed(PlayerEvent.BreakSpeed event){ + if (event.entityPlayer != null ) + { + float newDigSpeed = event.originalSpeed; + if (event.entityPlayer.isInsideOfMaterial(Material.water)) + { + if (ArmorEffectHandler.isDraconicArmor(event.entityPlayer, 4)) newDigSpeed *= 5f; + } + if (!event.entityPlayer.onGround) + { + if (ArmorEffectHandler.isDraconicArmor(event.entityPlayer, 3)) newDigSpeed *= 5f; + } + event.newSpeed = newDigSpeed; + } + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java index 067246e0..619fd781 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java @@ -1,35 +1,17 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.ClientProxy; import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.achievements.Achievements; import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.network.MountUpdatePacket; import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.MobSpawnerBaseLogic; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; import java.util.List; public class Tclogo extends ItemDE { @@ -90,105 +72,59 @@ public class Tclogo extends ItemDE { @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - LogHelper.info(player.ridingEntity); - if (!world.isRemote)DraconicEvolution.network.sendTo(new MountUpdatePacket(player.ridingEntity.getEntityId()), (EntityPlayerMP)player); - if (1==1) return stack; -// Set set = Achievements.achievementsList.keySet(); -// for (String s : set) Achievements.triggerAchievement(player, s); + if (!player.isSneaking()) + { + player.capabilities.allowFlying = true; + //player.setPosition(player.posX, player.posY+1, player.posZ); + player.onGround = false; + player.capabilities.isFlying = true; + player.noClip = !player.noClip; - - LogHelper.info("Downloading Image"); - - try { - URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); - String fileName = url.getFile(); - String destName = ClientProxy.downloadLocation + fileName.substring(fileName.lastIndexOf("/")); - System.out.println(destName); - - InputStream is = url.openStream(); - OutputStream os = new FileOutputStream(destName); - - byte[] b = new byte[2048]; - int length; - - while ((length = is.read(b)) != -1) { - os.write(b, 0, length); - } - - is.close(); - os.close(); - }catch (IOException e){ - LogHelper.info(e); } + else{ + int xi = (int)player.posX; + int yi = (int)player.posY; + int zi = (int)player.posZ; + int rad = 100; - - - - - - if (world.isRemote) return stack; - - if (1 == 1) return stack; - - int x = (int)player.posX; - int y = (int)player.posY; - int z = (int)player.posZ; - world.setBlock(x, y, z, Blocks.mob_spawner); - TileEntity spawner = world.getTileEntity(x, y, z); - if (spawner instanceof TileEntityMobSpawner){ - MobSpawnerBaseLogic logic = ((TileEntityMobSpawner)spawner).func_145881_a(); - logic.setEntityName("Zombie"); - - EntityZombie zombie = new EntityZombie(world); - zombie.setChild(true); - zombie.setCurrentItemOrArmor(0, new ItemStack(Items.diamond_axe)); - - NBTTagCompound compound = new NBTTagCompound(); - zombie.writeEntityToNBT(compound); - - NBTTagCompound compound2 = new NBTTagCompound(); - logic.writeToNBT(compound2); - compound2.setTag("SpawnData", compound); - - logic.readFromNBT(compound2); - - LogHelper.info(compound2); - } - - - - //if (!world.isRemote)OreDoublingRegistry.getOreResult(GameRegistry.findItemStack("ThermalFoundation", "oreCopper", 1)); - - player.triggerAchievement(Achievements.getAchievement("Draconium Ore")); - //player.fallDistance = 0; - //player.motionY+=1; - //player.moveFlying(0f, 0f, 1f); - float horizontal = 0f; - float forward = 1f; - float acceleration = 1f; - - float f3 = forward * forward; - - if (f3 >= 1.0E-4F) - { - f3 = MathHelper.sqrt_float(f3); - - if (f3 < 1.0F) - { - f3 = 1.0F; + for (int x = xi-rad; x < xi+rad; x++){ + for (int y = yi-10; y < yi+30; y++){ + for (int z = zi-rad; z < zi+rad; z++){ + world.markBlockForUpdate(x, y, z); } - - f3 = acceleration / f3; - horizontal *= f3; - forward *= f3; - float f4 = MathHelper.sin(player.rotationYaw * (float)Math.PI / 180.0F); - float f5 = MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F); - float f6 = (player.rotationPitch-20) * (float) Math.PI / 180.0F; - player.motionX += (double)( - forward * f4); - player.motionY += (double)(f6*-1); - player.motionZ += (double)(forward * f5); } + } + + + world.markBlockRangeForRenderUpdate(xi-rad, yi-20, zi-rad, xi+rad, yi+20, zi+rad); + } +// +// LogHelper.info("Downloading Image"); +// +// try { +// URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); +// String fileName = url.getFile(); +// String destName = ClientProxy.downloadLocation + fileName.substring(fileName.lastIndexOf("/")); +// System.out.println(destName); +// +// InputStream is = url.openStream(); +// OutputStream os = new FileOutputStream(destName); +// +// byte[] b = new byte[2048]; +// int length; +// +// while ((length = is.read(b)) != -1) { +// os.write(b, 0, length); +// } +// +// is.close(); +// os.close(); +// }catch (IOException e){ +// LogHelper.info(e); +// } + + // player.addPotionEffect(new PotionEffect(PotionHandler.potionFlight.id, 100, 0)); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java index d3486f6c..e3f9c4dd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java @@ -185,7 +185,7 @@ public class DraconiumFluxCapacitor extends ItemDE implements IEnergyContainerIt InfoHelper.addEnergyInfo(stack, list); list.add(StatCollector.translateToLocal("info.de.changwMode.txt")); list.add(InfoHelper.ITC()+StatCollector.translateToLocal("info.de.capacitorMode.txt")+": "+InfoHelper.HITC()+StatCollector.translateToLocal("info.de.capacitorMode"+ItemNBTHelper.getShort(stack, "Mode", (short)0)+".txt")); - InfoHelper.addLore(stack, list); + //InfoHelper.addLore(stack, list); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ToolHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ToolHandler.java index c6ab4e0f..d9ca0f42 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ToolHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ToolHandler.java @@ -122,7 +122,7 @@ public class ToolHandler { if ((silk) && (block.canSilkHarvest(world, player, x, y, z, meta))) { if (block == Blocks.lit_redstone_ore) items.add(new ItemStack(Item.getItemFromBlock(Blocks.redstone_ore))); - else items.add(new ItemStack(block.getItem(world, x, y, z), 1, meta)); + else items.add(new ItemStack(block, 1, meta)); } else { items.addAll(block.getDrops(world, x, y, z, meta, fortune)); //block.dropXpOnBlockBreak(world, (int)player.posX, (int)player.posY, (int)player.posZ, block.getExpDrop(world, meta, fortune)); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java index beb2e7fd..cc54d8e7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java @@ -57,8 +57,9 @@ public class TileParticleGenerator extends TileEntity { @SideOnly(Side.CLIENT) @Override public void updateEntity() { + if (!worldObj.isRemote) return; - if (stabalizerMode && worldObj.isRemote) { + if (stabalizerMode) { rotation += 0.5F; spawnStabilizerParticle(); } @@ -70,7 +71,7 @@ public class TileParticleGenerator extends TileEntity { if (tick >= spawn_rate && active) { tick = 0; - if (worldObj.isRemote) { + Random rand = worldObj.rand; float MX = motion_x + (random_motion_x * rand.nextFloat()); @@ -91,7 +92,7 @@ public class TileParticleGenerator extends TileEntity { particle.gravity = this.gravity; ParticleHandler.spawnCustomParticle(particle); - } + } else tick++; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java index 18ef535c..f271d152 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java @@ -18,21 +18,22 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; import java.util.Random; /** * Created by Brandon on 28/07/2014. */ -public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler {//todo make it possible to select which core to to link to -//todo make core change color as it fuills - //protected EnergyStorage storage = new EnergyStorage(500000, 0, 0); +public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler { public boolean active = false; public boolean lastTickActive = false; public boolean reciveEnergy = false; //Power Flow to system public boolean lastTickReciveEnergy = false; public float modelRotation = 0; public float modelScale = 0; - private TileLocation masterLocation = new TileLocation(); + private List coreLocatios = new ArrayList(); + private int selectedCore = 0; private byte particleRate = 0; private byte lastTickParticleRate = 0; @@ -66,39 +67,57 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler {/ if (!active){ active = isValidStructure(); } - findMaster(); + findCores(); } private TileEnergyStorageCore getMaster(){ - return (worldObj.getTileEntity(masterLocation.getXCoord(), masterLocation.getYCoord(), masterLocation.getZCoord()) != null && worldObj.getTileEntity(masterLocation.getXCoord(), masterLocation.getYCoord(), masterLocation.getZCoord()) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore)worldObj.getTileEntity(masterLocation.getXCoord(), masterLocation.getYCoord(), masterLocation.getZCoord()) : null; + if (coreLocatios.isEmpty()) return null; + if (selectedCore >= coreLocatios.size()) selectedCore = coreLocatios.size() - 1; + TileLocation core = coreLocatios.get(selectedCore); + if (core == null || !(worldObj.getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()) instanceof TileEnergyStorageCore)) return null; + return (TileEnergyStorageCore) worldObj.getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()); } - private void findMaster(){ + private void findCores(){ int yMod = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 ? 3 : -3; int range = 15; + List locations = new ArrayList(); for (int x = xCoord-range; x <= xCoord+range; x++){ for (int y = yCoord+yMod-(range/4); y <= yCoord+yMod+(range/4); y++){ for (int z = zCoord-range; z <= zCoord+range; z++){ if (worldObj.getBlock(x, y, z) == ModBlocks.energyStorageCore){ - masterLocation = new TileLocation(x, y, z); - return; + locations.add(new TileLocation(x, y, z)); } } } - } + + if (locations != coreLocatios){ + coreLocatios.clear(); + coreLocatios.addAll(locations); + selectedCore = selectedCore >= coreLocatios.size() ? 0 : selectedCore; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + + public void nextCore(){ + findCores(); + selectedCore++; + if (selectedCore >= coreLocatios.size()) selectedCore = 0; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @SideOnly(Side.CLIENT) private void spawnParticles(){ Random rand = new Random(); - int x = masterLocation.getXCoord(); - int y = masterLocation.getYCoord(); - int z = masterLocation.getZCoord(); + if (getMaster() == null || !getMaster().isOnline()) return; + + int x = getMaster().xCoord; + int y = getMaster().yCoord; + int z = getMaster().zCoord; int cYCoord = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 ? yCoord+1 : yCoord-1; - TileEnergyStorageCore master = (worldObj.getTileEntity(x, y, z) != null && worldObj.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) worldObj.getTileEntity(x, y, z) : null; - if (master == null || !master.isOnline()) return; - float disMod = master.getTier()==0 ? 0.5F : master.getTier()==1 ? 1F: master.getTier()==2 ? 1F : master.getTier()==3 ? 2F : master.getTier()==4 ? 2F : master.getTier()==5 ? 3F : 4F; + + float disMod = getMaster().getTier()==0 ? 0.5F : getMaster().getTier()==1 ? 1F: getMaster().getTier()==2 ? 1F : getMaster().getTier()==3 ? 2F : getMaster().getTier()==4 ? 2F : getMaster().getTier()==5 ? 3F : 4F; double spawnX; double spawnY; double spawnZ; @@ -180,7 +199,14 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler {/ super.readFromNBT(compound); active = compound.getBoolean("Active"); reciveEnergy = compound.getBoolean("Input"); - masterLocation.readFromNBT(compound, "Master"); + int i = compound.getInteger("Cores"); + List list = new ArrayList(); + for (int j = 0; j < i; j++){ + TileLocation l = new TileLocation(); + l.readFromNBT(compound, "Core" + j); + list.add(l); + } + coreLocatios = list; particleRate = compound.getByte("ParticleRate"); } @@ -190,7 +216,12 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler {/ super.writeToNBT(compound); compound.setBoolean("Active", active); compound.setBoolean("Input", reciveEnergy); - masterLocation.writeToNBT(compound, "Master"); + int i = coreLocatios.size(); + compound.setInteger("Cores", i); + for (int j = 0; j < i; j++){ + coreLocatios.get(j).writeToNBT(compound, "Core" + j); + } + compound.setInteger("SelectedCore", selectedCore); compound.setByte("ParticleRate", particleRate); } 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 f79cdef6..a65c2747 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 @@ -38,7 +38,7 @@ public class TileEnergyStorageCore extends TileObjectSync { public void updateEntity() { if (!online) return; if (worldObj.isRemote) modelRotation += 0.5; - detectAndRendChanges(); + if (!worldObj.isRemote) detectAndRendChanges(); tick++; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java new file mode 100644 index 00000000..231d230f --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java @@ -0,0 +1,35 @@ +package com.brandon3055.draconicevolution.common.utills; + +import cofh.api.energy.IEnergyContainerItem; +import net.minecraft.block.Block; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapedOreRecipe; + +/** + * Created by Brandon on 8/12/2014. + */ +public class ShapedOreEnergyRecipe extends ShapedOreRecipe { + + public ShapedOreEnergyRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); } + public ShapedOreEnergyRecipe(Item result, Object... recipe){ this(new ItemStack(result), recipe); } + public ShapedOreEnergyRecipe(ItemStack result, Object... recipe) {super(result, recipe);} + + @Override + public ItemStack getCraftingResult(InventoryCrafting var1) { + ItemStack result = super.getCraftingResult(var1); + + int energy = 0; + for (int i = 0; i < var1.getSizeInventory(); i++) { + ItemStack stack = var1.getStackInSlot(i); + if (stack != null && stack.getItem() instanceof IEnergyContainerItem) { + energy += ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack); + } + } + + if (energy > 0 && result != null && result.getItem() instanceof IEnergyContainerItem) ItemNBTHelper.setInteger(result, "Energy", energy); + + return result; + } +} diff --git a/src/main/resources/assets/draconicevolution/lang/en_US.lang b/src/main/resources/assets/draconicevolution/lang/en_US.lang index b04bd765..ee204bcc 100644 --- a/src/main/resources/assets/draconicevolution/lang/en_US.lang +++ b/src/main/resources/assets/draconicevolution/lang/en_US.lang @@ -46,10 +46,10 @@ tile.draconicevolution:generator.name=Generator tile.draconicevolution:generator.description=This is a basic low power (around 80RF/t) generator that may come in handy if you have no other mods capable of generating RF power. tile.draconicevolution:energyStorageCore.name=Energy Core -tile.draconicevolution:energyStorageCore.description=The pinnacle of Draconic research, you have learned how to use this power to store more power than anything else invented. Using multi-block strategies you can build ever-larger storage devices. (you can find more info tn the Energy core multiblock tutorial) +tile.draconicevolution:energyStorageCore.description=Using Draconic knowledge you have discovered how to build a multi-block structure capable of storing more power then any other device ever invented with the highest tier able to store up to 2.14 trillion RF (you can find more info in the Energy core multiblock tutorial) tile.draconicevolution:energyPylon.name=Energy Pylon -tile.draconicevolution:energyPylon.description=A component of the Energy core multiblock. +tile.draconicevolution:energyPylon.description=This device is used to extract or insert energy into the energy storage multiblock. Its maximum transfer rate is 2,147,483,647 RF/t tile.draconicevolution:draconium0.name=Draconium Block tile.draconicevolution:draconium0.description=A storage block for draconium. @@ -125,16 +125,16 @@ item.draconicevolution:wyvernBow.name=Bow of the Wyvern item.draconicevolution:wyvernBow.description=Weary of ordinary tools you begin to understand ways to use Draconic energy to upgrade. Sharpshooter – Zoom in on your target and deal extreme damage with pin point accuracy. Rapid Fire – Barrage your enemies in a rain of arrows. item.draconicevolution:wyvernHelm.name=Wyvern Helm -item.draconicevolution:wyvernHelm.description=Having enjoyed the protection of diamond for so long, you realize that you can infuse it with the power of the Draconic. +item.draconicevolution:wyvernHelm.description=Stronger than diamond you can now withstand even greater blows.\n\n\nFull set gives total fire immunity item.draconicevolution:wyvernChest.name=Wyvern Chestplate -item.draconicevolution:wyvernChest.description=Having enjoyed the protection of diamond for so long, you realize that you can infuse it with the power of the Draconic. +item.draconicevolution:wyvernChest.description=Infusing the armor with Dracomiun you vastly improve its resistance.\n\n\nFull set gives total fire immunity item.draconicevolution:wyvernLeggs.name=Wyvern Leggings -item.draconicevolution:wyvernLeggs.description=Having enjoyed the protection of diamond for so long, you realize that you can infuse it with the power of the Draconic. Small speed boost when worn. +item.draconicevolution:wyvernLeggs.description=You feel even stronger and faster now\nthat you have infused diamond legs with Draconium.\n\%Armor Effects:\n\%-Speed boost\n\n\nFull set gives total fire immunity item.draconicevolution:wyvernBoots.name=Wyvern Boots -item.draconicevolution:wyvernBoots.description=Having enjoyed the protection of diamond for so long, you realize that you can infuse it with the power of the Draconic. Small jump boost when worn. +item.draconicevolution:wyvernBoots.description=You learn to improve the boots Draconium seems to have given you greater agility.\n\%Armor Effects:\n\%-Reduced fall damage\n\%-Jump boost\n\n\nFull set gives total fire immunity item.draconicevolution:draconicPickaxe.name=Draconic Pickaxe item.draconicevolution:draconicPickaxe.description=Further Draconic research has shown you ways to even greater power.. Modes: Shift-Right Click to switch modes: 1×1, 3×3, 5×5 and 7×7 Right Click to activate: Obliteration Mode – Destroys stone, cobblestone and netherrack. @@ -155,16 +155,16 @@ item.draconicevolution:draconicBow.name=Draconic Bow item.draconicevolution:draconicBow.description=Further Draconic research has shown you ways to even greater power.. Sharpshooter – Zoom in on your target and deal extreme damage with pin point accuracy. Rapid Fire – Barrage your enemies in a rain of arrows. Explosive – With gunpowder in your inventory destroy an area slightly larger than TNT with your arrows. Devastation (Creative Mode only) – Explodes an extreme area in rapid fire mode. item.draconicevolution:draconicHelm.name=Draconic Helm -item.draconicevolution:draconicHelm.description=Further Draconic research has shown you ways to even greater protection.. Night Vision active when in dark places. Full set of Draconic Armor also gives you full protection from fire! +item.draconicevolution:draconicHelm.description=No longer do you fear the night you now can see all the time regardless of what is out there.\n\%Armor Effects:\n\%-Night Vision (Activates when in darkness)\n\%-Cures negative potion effects\n\%-Bypass suffocation and drowning damage\n\%-Removes mining slowdown under water item.draconicevolution:draconicChest.name=Draconic Chestplate -item.draconicevolution:draconicChest.description=Further Draconic research has shown you ways to even greater protection.. Flight when worn. Full set of Draconic Armor also gives you full protection from fire! +item.draconicevolution:draconicChest.description=Using the heart of a dragon you are stronger and have the gift of flight.\n\%Armor Effects:\n\%-Flight\n\%-Removes mining slowdown when in the air \n\%-Fire immunity item.draconicevolution:draconicLeggs.name=Draconic Leggings -item.draconicevolution:draconicLeggs.description=Further Draconic research has shown you ways to even greater protection.. Improved speed boost. Full set of Draconic Armor also gives you full protection from fire! +item.draconicevolution:draconicLeggs.description=Even stronger armor the soul of a dragon protects you and moves you even faster Improved speed boost.\n\%Armor Effects:\n\%-Speed boost item.draconicevolution:draconicBoots.name=Draconic Boots -item.draconicevolution:draconicBoots.description=Further Draconic research has shown you ways to even greater protection.. Improved jump boost. Full set of Draconic Armor also gives you full protection from fire! +item.draconicevolution:draconicBoots.description=Stronger, faster, better than before the heart of a dragon grants you higher jumping. \n\%Armor Effects:\n\%-Fall protection\n\%-Jump boost\n\%-Up Hill Step item.draconicevolution:draconicDistructionStaff.name=Draconic Staff of Power item.draconicevolution:draconicDistructionStaff.description=After great pains you have mastered the powers of the Draconic! Mining – Shift-Right Click to switch modes: 1×1, 3×3, 5×5, 7×7 and 9×9 Mining – Right Click to activate: Obliteration Mode – Destroys all non-valuable blocks. Battle: +20 Attack – Bonus damage on mobs with health above 10 hearts (+50% of the mobs extra health) Battle: AOE – in 1×1 hits 1×1 area, 3×3 hits 5×5 area, 5×5 hits 9×9, 7×7 hits 13×13, and 9×9 hits 17×17 (bonus damage does not apply to mobs other than the one you hit directly) @@ -338,22 +338,22 @@ achievement.draconicevolution.dissenchanter=Only What I Want! achievement.draconicevolution.dissenchanter.desc=Create a disenchanter. achievement.draconicevolution.ecore=It keeps going, and going, and going achievement.draconicevolution.ecore.desc=Build the Energy Core -achievement.draconicevolution.wpick= -achievement.draconicevolution.wpick.desc= -achievement.draconicevolution.wshovel= -achievement.draconicevolution.wshovel.desc= -achievement.draconicevolution.wsword= -achievement.draconicevolution.wsword.desc= -achievement.draconicevolution.wbow= -achievement.draconicevolution.wbow.desc= -achievement.draconicevolution.whelm= -achievement.draconicevolution.whelm.desc= -achievement.draconicevolution.wchest= -achievement.draconicevolution.wchest.desc= -achievement.draconicevolution.wleggs= -achievement.draconicevolution.wleggs.desc= -achievement.draconicevolution.wboots= -achievement.draconicevolution.wboots.desc= +achievement.draconicevolution.wpick=Nothing like Diamond +achievement.draconicevolution.wpick.desc=Upgrade to a wyvern pick +achievement.draconicevolution.wshovel=Pro Digger! +achievement.draconicevolution.wshovel.desc=Craft a Wyvern shovel +achievement.draconicevolution.wsword=Better Weaponry +achievement.draconicevolution.wsword.desc=Craft a Wyvern sword +achievement.draconicevolution.wbow=Snipers at the Ready! +achievement.draconicevolution.wbow.desc=Craft the Wyvern Bow +achievement.draconicevolution.whelm=Free Breathing! +achievement.draconicevolution.whelm.desc=Craft the Wyvern Helm +achievement.draconicevolution.wchest=High Resistance +achievement.draconicevolution.wchest.desc=Craft a Wyvern Chestplate +achievement.draconicevolution.wleggs=Run like the wind +achievement.draconicevolution.wleggs.desc=Craft Wyvern leggings +achievement.draconicevolution.wboots=Feather Fall +achievement.draconicevolution.wboots.desc=Craft Wyvern boots achievement.draconicevolution.resurrection=Brimming with Antici-pation! achievement.draconicevolution.resurrection.desc=Craft the Resurrection Stone achievement.draconicevolution.dislocator2=Ender-ruler! @@ -368,25 +368,25 @@ achievement.draconicevolution.awakenedblock.desc=Create Awakened Draconium achievement.draconicevolution.core3=Expense vs. Power achievement.draconicevolution.core3.desc=Upgrade Wyvern Core to Awakened -achievement.draconicevolution.dhelm= -achievement.draconicevolution.dhelm.desc= +achievement.draconicevolution.dhelm=Gliding through water! +achievement.draconicevolution.dhelm.desc=Upgrade to the Draconic Helm achievement.draconicevolution.dChest=Fly like an eagle! achievement.draconicevolution.dChest.desc=Craft the Draconic Chest Plate -achievement.draconicevolution.dleggs= -achievement.draconicevolution.dleggs.desc= -achievement.draconicevolution.dboots= -achievement.draconicevolution.dboots.desc= +achievement.draconicevolution.dleggs=Dance like a Butterfly! +achievement.draconicevolution.dleggs.desc=Craft Draconic Leggings +achievement.draconicevolution.dboots=Higher and Higher! +achievement.draconicevolution.dboots.desc=Upgrade to Draconic Boots. achievement.draconicevolution.dpick=Mine With Authority! achievement.draconicevolution.dpick.desc=Craft a Draconic Pick -achievement.draconicevolution.dshovel= -achievement.draconicevolution.dshovel.desc= -achievement.draconicevolution.daxe= -achievement.draconicevolution.daxe.desc= -achievement.draconicevolution.dsword= -achievement.draconicevolution.dsword.desc= -achievement.draconicevolution.dbow= -achievement.draconicevolution.dbow.desc= +achievement.draconicevolution.dshovel=Moving Mountains +achievement.draconicevolution.dshovel.desc=Upgrade Wyvern Shovel +achievement.draconicevolution.daxe=One giant Chop for tree Kind! +achievement.draconicevolution.daxe.desc=Craft the Draconic Axe +achievement.draconicevolution.dsword=Sting Like a Bee! +achievement.draconicevolution.dsword.desc=Upgrade to the Draconic Sword +achievement.draconicevolution.dbow=Now you’re playing with Power! +achievement.draconicevolution.dbow.desc=Craft the Draconic Bow. achievement.draconicevolution.flux2=Phenomenal Cosmic Power! itty bitty living space. achievement.draconicevolution.flux2.desc=Craft the Draconic Flux Capacitor achievement.draconicevolution.dhoe=Kick it up a Notch! -BAM- @@ -395,12 +395,12 @@ achievement.draconicevolution.dhoe.desc=Craft the Draconic Hoe achievement.draconicevolution.dstaff=With your powers combined! achievement.draconicevolution.dstaff.desc=Create the Draconic Staff -achievement.draconicevolution.soul= -achievement.draconicevolution.soul.desc= -achievement.draconicevolution.sundial= -achievement.draconicevolution.sundial.desc= -achievement.draconicevolution.manual= -achievement.draconicevolution.manual.desc= +achievement.draconicevolution.soul=Reaper!!!! +achievement.draconicevolution.soul.desc=Acquire the soul of an unsuspecting mob. +achievement.draconicevolution.sundial=Timekeeper +achievement.draconicevolution.sundial.desc=Craft a sun dial and take control of night and day +achievement.draconicevolution.manual=Knowledge to the Max! +achievement.draconicevolution.manual.desc=Craft the Draconic Tablet //InfoHelper ---------------------------------------------------------------------------------------------------------------------------------------- info.de.charge.txt=Charge @@ -474,7 +474,7 @@ manual.de.ectdpage5.txt=Tier 4:\nRedstone x80\nDraconium x98\nCapacity = 59.3Bil manual.de.ectdpage6.txt=Tier 5:\nRedstone 133\nDraconium 150\nCapacity = 356Billion RF manual.de.ectdpage7.txt=Tier 6:\nRedstone x328\nDraconium x218\nCapacity = 2.14Trillion RF manual.de.ectdpage8a.txt=To add and remove energy from the core you need to place energy pylons within 15 blocks of the of the core. To activate a pylon place a glass block ether above or bellow it depending on weather the pylon is placed bellow or above the core e.g. if you place the pylon on the roof you would place the glass block under it. The pylon can be placed up to 6 blocks above or bellow the energy core (centre). -manual.de.ectdpage8b.txt=When the glass block is placed the pylon should immediately activate and link with a nearby Energy Core the link is indicated by white energy particles and the glass should change to the renderer shown in the image above. +manual.de.ectdpage8b.txt=When the glass block is placed the pylon should immediately activate and link with a nearby Energy Core the link is indicated by white energy particles and the glass should change to the renderer shown in the image above. You can shift right click the pylon to change which core it is linked to (if there is more then one in range) manual.de.ectdpage9a.txt=You can simply right click the energy core to check the tier and amount of energy stored. manual.de.ectdpage9b.txt=Energy is added and removed from the core using the Energy Pylons. To toggle a Pylon between input and output mode simply right click the sphere. The mode is identified by the colour of the Pylon (Blue = input, Orange = output) and the behaviour of the energy particles and the Pylon sphere manual.de.ectdpage10.txt=Energy Transfer between the pylon and the core is indicated by a stream of blue energy particles flowing between the Pylon sphere and the core. The amount of energy flowing is roughly shown by the density of the particle stream.