diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java index 1d33265e..6794f187 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java @@ -22,6 +22,7 @@ import java.util.List; public class GUIManual extends GUIScrollingBase { private static List pageList = new ArrayList(); + public static List imageURLs = new ArrayList(); public GUIManual() { super(new DummyContainer(), 0, 0); @@ -48,6 +49,16 @@ public class GUIManual extends GUIScrollingBase { collection.addComponent(new ComponentTexturedRect(0, 0, 255, 255, ResourceHandler.getResource("textures/gui/manualTop.png"))).setGroup(GR_BACKGROUND); collection.addComponent(new ComponentTexturedRect(0, 255, 255, 69, ResourceHandler.getResource("textures/gui/manualBottom.png"))).setGroup(GR_BACKGROUND); + collection.addComponent(new ComponentTexturedRect(0, 100, 0, 0, 255, 255, ResourceHandler.getResource("textures/gui/manualimages/debanner.png"), true)).setGroup(GR_INTRO); + +// ITextureObject iTextureObject = mc.getTextureManager().getTexture(ResourceHandler.getResource("textures/gui/manualBottom.png")); +// mc.getResourceManager().getResource(ResourceHandler.getResource("textures/gui/manualBottom.png")). +// LogHelper.info(iTextureObject); +// if (iTextureObject instanceof TextureMap) +// { +// LogHelper.info(((TextureMap) iTextureObject).getTextureExtry("textures/gui/manualBottom.png")); +// } + for (int i = 0; i < pageList.size(); i++) { collection.addComponent(new ComponentIndexButton(20, 20 + i * 20, this, pageList.get(i))).setGroup(GR_INDEX); @@ -99,7 +110,7 @@ public class GUIManual extends GUIScrollingBase { try { pageList.clear(); - File manualJSON = new File(ResourceHandler.getSaveFolder(), "manual.json"); + File manualJSON = new File(ResourceHandler.getConfigFolder(), "manual.json"); JsonReader reader = new JsonReader(new FileReader(manualJSON)); List images; List content; @@ -143,7 +154,9 @@ public class GUIManual extends GUIScrollingBase { reader.beginArray(); while (reader.hasNext()) { - images.add(reader.nextString()); + String url = reader.nextString(); + images.add(url); + if (!imageURLs.contains(url)) imageURLs.add(url); } reader.endArray(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java index 6345a50f..ce40e11b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java @@ -48,6 +48,7 @@ public class ComponentIndexButton extends ComponentScrollingBase { ResourceHandler.bindResource("textures/gui/Widgets.png"); + GL11.glColor4f(1f, 1f, 1f, 1f); if (mouseOver) { GL11.glColor4f(0f, 1f, 1f, 1f); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentTexturedRect.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentTexturedRect.java index e912deb8..df563dcb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentTexturedRect.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentTexturedRect.java @@ -48,11 +48,14 @@ public class ComponentTexturedRect extends ComponentBase { { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); + GL11.glScalef(1f, 0.33f, 1f); + GL11.glScalef(0.5f, 0.5f, 0.5f); } GL11.glColor4f(1f, 1f, 1f, 1f); drawTexturedModalRect(x, y, texX, texY, width, height); if (transparent) { + GL11.glScalef(2f, 2f, 2f); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/GUIBase.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/GUIBase.java index ea74344c..114cc939 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/GUIBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/GUIBase.java @@ -22,6 +22,7 @@ public abstract class GUIBase extends GuiContainer { super(container); this.xSize = xSize; this.ySize = ySize; + mc = Minecraft.getMinecraft(); collection = assembleComponents(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java index 62fc6b98..064134af 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java @@ -1,14 +1,21 @@ package com.brandon3055.draconicevolution.client.handler; +import com.brandon3055.draconicevolution.client.gui.componentguis.GUIManual; import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.google.common.collect.Lists; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EffectRenderer; +import net.minecraft.client.resources.FileResourcePack; +import net.minecraft.client.resources.FolderResourcePack; import net.minecraft.util.ResourceLocation; import java.io.File; +import java.lang.reflect.Field; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -26,10 +33,13 @@ public class ResourceHandler { //-------------------- File Handling -----------------------// public static void init(FMLPreInitializationEvent event) { - savePath = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + "/mods/draconicevolution"; + savePath = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + "/config/draconicevolution"; + GUIManual.loadPages(); + + addRSPack(); } - public static File getSaveFolder() + public static File getConfigFolder() { if (saveFolder == null) { saveFolder = new File(savePath); } if (!saveFolder.exists()) saveFolder.mkdir(); @@ -38,6 +48,43 @@ public class ResourceHandler { } + private static void downloadImages() + { + + } + + private static boolean checkExistence(String url) + { + + return true; + } + + private static void addRSPack() + { + File rspack = new File(getConfigFolder(), "/resources"); + if (!rspack.exists()) return; + List defaultResourcePacks = Lists.newArrayList(); + Field f = ReflectionHelper.findField(Minecraft.class, "defaultResourcePacks", "field_110449_ao"); + f.setAccessible(true); + try { + defaultResourcePacks = (List)f.get(Minecraft.getMinecraft()); + defaultResourcePacks.add(new FolderResourcePack(rspack)); + for (Object o : defaultResourcePacks){ + if (o instanceof FolderResourcePack) LogHelper.info(((FolderResourcePack) o).getPackName()); + if (o instanceof FileResourcePack) LogHelper.info(((FileResourcePack)o).getPackName()); + } + + f.set(Minecraft.getMinecraft(), defaultResourcePacks); + } + catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + + + + + //----------------------------------------------------------// diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utill/CustomResourceLocation.java b/src/main/java/com/brandon3055/draconicevolution/client/utill/CustomResourceLocation.java new file mode 100644 index 00000000..02b5af13 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utill/CustomResourceLocation.java @@ -0,0 +1,29 @@ +package com.brandon3055.draconicevolution.client.utill; + +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import net.minecraft.util.ResourceLocation; + +/** + * Created by Brandon on 10/03/2015. + */ +public class CustomResourceLocation extends ResourceLocation { + + private int width; + private int height; + + public CustomResourceLocation(String texturePath, int width, int height) { + super(texturePath); + this.width = width; + this.height = height; + } + + public void bind() { ResourceHandler.bindTexture(this); } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } +} 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 b6547945..1ee59bfa 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 @@ -121,4 +121,29 @@ public class EnergyPylon extends BlockDE {//todo fix sphere renderer } return false; } + + @Override + public void onPostBlockPlaced(World world, int x, int y, int z, int p_149714_5_) { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 0) { + if (world.getBlock(x, y + 1, z) == Blocks.glass) { + world.setBlockMetadataWithNotify(x, y, z, 1, 2); + world.setBlock(x, y + 1, z, ModBlocks.invisibleMultiblock, 2, 2); + } + else if (world.getBlock(x, y - 1, z) == Blocks.glass) { + world.setBlockMetadataWithNotify(x, y, z, 2, 2); + world.setBlock(x, y - 1, z, ModBlocks.invisibleMultiblock, 2, 2); + } + }else { + TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; + if (thisTile == null || (meta == 1 && !isGlass(world, x, y+1, z)) || (meta == 2 && !isGlass(world, x, y-1, z))) { + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + } + } + TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; + if (thisTile != null) { + thisTile.onActivated(); + } + if (world.getBlockMetadata(x, y, z) == 0 && world.getTileEntity(x, y, z) != null) world.removeTileEntity(x, y, z); + } } diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/Core_Tiers.png b/src/main/resources/assets/draconicevolution/textures/gui/images/Core_Tiers.png deleted file mode 100644 index bd8ca557..00000000 Binary files a/src/main/resources/assets/draconicevolution/textures/gui/images/Core_Tiers.png and /dev/null differ diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/Energy_Pylon.png b/src/main/resources/assets/draconicevolution/textures/gui/images/Energy_Pylon.png deleted file mode 100644 index 60bc7548..00000000 Binary files a/src/main/resources/assets/draconicevolution/textures/gui/images/Energy_Pylon.png and /dev/null differ diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/Energy_Pylon_Particles.png b/src/main/resources/assets/draconicevolution/textures/gui/images/Energy_Pylon_Particles.png deleted file mode 100644 index b5515420..00000000 Binary files a/src/main/resources/assets/draconicevolution/textures/gui/images/Energy_Pylon_Particles.png and /dev/null differ diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/Energy_Pylon_Particles_2.png b/src/main/resources/assets/draconicevolution/textures/gui/images/Energy_Pylon_Particles_2.png deleted file mode 100644 index 10c7c5f8..00000000 Binary files a/src/main/resources/assets/draconicevolution/textures/gui/images/Energy_Pylon_Particles_2.png and /dev/null differ diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/ManualIntro.png b/src/main/resources/assets/draconicevolution/textures/gui/images/ManualIntro.png deleted file mode 100644 index 14f6685b..00000000 Binary files a/src/main/resources/assets/draconicevolution/textures/gui/images/ManualIntro.png and /dev/null differ diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/Manual_Intro.png b/src/main/resources/assets/draconicevolution/textures/gui/images/Manual_Intro.png deleted file mode 100644 index 574a7bd1..00000000 Binary files a/src/main/resources/assets/draconicevolution/textures/gui/images/Manual_Intro.png and /dev/null differ diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/Pylon_y_Placement.png b/src/main/resources/assets/draconicevolution/textures/gui/images/Pylon_y_Placement.png deleted file mode 100644 index e1d3b44e..00000000 Binary files a/src/main/resources/assets/draconicevolution/textures/gui/images/Pylon_y_Placement.png and /dev/null differ diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/Ritual_of_ender_Resurrection.png b/src/main/resources/assets/draconicevolution/textures/gui/images/Ritual_of_ender_Resurrection.png deleted file mode 100644 index aaf54d65..00000000 Binary files a/src/main/resources/assets/draconicevolution/textures/gui/images/Ritual_of_ender_Resurrection.png and /dev/null differ diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/Stabilizer_Placement.png b/src/main/resources/assets/draconicevolution/textures/gui/images/Stabilizer_Placement.png deleted file mode 100644 index 2f97a43e..00000000 Binary files a/src/main/resources/assets/draconicevolution/textures/gui/images/Stabilizer_Placement.png and /dev/null differ diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/T5_Energy_Core.png b/src/main/resources/assets/draconicevolution/textures/gui/images/T5_Energy_Core.png deleted file mode 100644 index 6c2776e3..00000000 Binary files a/src/main/resources/assets/draconicevolution/textures/gui/images/T5_Energy_Core.png and /dev/null differ diff --git a/src/main/resources/assets/draconicevolution/textures/gui/images/debanner.png b/src/main/resources/assets/draconicevolution/textures/gui/images/debanner.png new file mode 100644 index 00000000..e8d3463d Binary files /dev/null and b/src/main/resources/assets/draconicevolution/textures/gui/images/debanner.png differ