mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-20 20:22:10 +00:00
11/03/2015
This commit is contained in:
1 parent
8f387c5569
commit
c10b4e4a4d
18 files changed
+123
-4
No files matched your search
+15
-2
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
public class GUIManual extends GUIScrollingBase {
|
||||
|
||||
private static List<ManualPage> pageList = new ArrayList<ManualPage>();
|
||||
public static List<String> imageURLs = new ArrayList<String>();
|
||||
|
||||
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<String> images;
|
||||
List<String> 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();
|
||||
}
|
||||
|
||||
+1
@@ -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);
|
||||
|
||||
+3
@@ -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();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public abstract class GUIBase extends GuiContainer {
|
||||
super(container);
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
mc = Minecraft.getMinecraft();
|
||||
collection = assembleComponents();
|
||||
}
|
||||
|
||||
|
||||
+49
-2
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------//
|
||||
|
||||
|
||||
|
||||
+29
@@ -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;
|
||||
}
|
||||
}
|
||||
+25
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user