mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-20 20:22:10 +00:00
1.0.2-snapshot 6
This commit is contained in:
1 parent
a1f94155fb
commit
d1cdf6f6d9
71 files changed
+42431
-1076
No files matched your search
@@ -21,7 +21,7 @@ import java.util.Arrays;
|
||||
"after:NotEnoughItems;" +
|
||||
"after:ThermalExpansion;" +
|
||||
"after:ThermalFoundation;" +
|
||||
"required-after:BrandonsCore@[1.0.0.8,);")
|
||||
"required-after:BrandonsCore@[1.0.0.9,);")
|
||||
public class DraconicEvolution {
|
||||
|
||||
@Mod.Instance(References.MODID)
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.client;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler;
|
||||
import com.brandon3055.draconicevolution.client.handler.HudHandler;
|
||||
import com.brandon3055.draconicevolution.client.handler.ParticleHandler;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.client.handler.*;
|
||||
import com.brandon3055.draconicevolution.client.keybinding.KeyBindings;
|
||||
import com.brandon3055.draconicevolution.client.keybinding.KeyInputHandler;
|
||||
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
|
||||
@@ -60,6 +57,7 @@ public class ClientProxy extends CommonProxy {
|
||||
super.preInit(event);
|
||||
|
||||
ResourceHandler.init(event);
|
||||
ContributorHandler.init();
|
||||
|
||||
// downloadLocation = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + "/mods/derspack";
|
||||
// downloadLocation = downloadLocation.replaceAll("\\\\", "/");
|
||||
@@ -154,15 +152,20 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicBoots, new RenderArmor(ModItems.draconicBoots));
|
||||
}
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicSword, new RenderTool("models/tools/DraconicSword.obj", "textures/models/tools/DraconicSword.png", (IRenderTweak)ModItems.draconicSword));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernPickaxe, new RenderTool("models/tools/Pickaxe.obj", "textures/models/tools/Pickaxe.png", (IRenderTweak)ModItems.wyvernPickaxe));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicPickaxe, new RenderTool("models/tools/DraconicPickaxe.obj", "textures/models/tools/DraconicPickaxe.png", (IRenderTweak)ModItems.draconicPickaxe));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicAxe, new RenderTool("models/tools/DraconicLumberAxe.obj", "textures/models/tools/DraconicLumberAxe.png", (IRenderTweak)ModItems.draconicAxe));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernShovel, new RenderTool("models/tools/Shovel.obj", "textures/models/tools/Shovel.png", (IRenderTweak)ModItems.wyvernShovel));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicShovel, new RenderTool("models/tools/DraconicShovel.obj", "textures/models/tools/DraconicShovel.png", (IRenderTweak)ModItems.draconicShovel));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernSword, new RenderTool("models/tools/Sword.obj", "textures/models/tools/Sword.png", (IRenderTweak)ModItems.wyvernSword));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicDestructionStaff, new RenderTool("models/tools/DraconicStaffOfPower.obj", "textures/models/tools/DraconicStaffOfPower.png", (IRenderTweak)ModItems.draconicDestructionStaff));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicHoe, new RenderTool("models/tools/DraconicHoe.obj", "textures/models/tools/DraconicHoe.png", (IRenderTweak)ModItems.draconicHoe));
|
||||
if (!ConfigHandler.useOldD2DToolTextures)
|
||||
{
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicSword, new RenderTool("models/tools/DraconicSword.obj", "textures/models/tools/DraconicSword.png", (IRenderTweak) ModItems.draconicSword));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernPickaxe, new RenderTool("models/tools/Pickaxe.obj", "textures/models/tools/Pickaxe.png", (IRenderTweak) ModItems.wyvernPickaxe));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicPickaxe, new RenderTool("models/tools/DraconicPickaxe.obj", "textures/models/tools/DraconicPickaxe.png", (IRenderTweak) ModItems.draconicPickaxe));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicAxe, new RenderTool("models/tools/DraconicLumberAxe.obj", "textures/models/tools/DraconicLumberAxe.png", (IRenderTweak) ModItems.draconicAxe));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernShovel, new RenderTool("models/tools/Shovel.obj", "textures/models/tools/Shovel.png", (IRenderTweak) ModItems.wyvernShovel));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicShovel, new RenderTool("models/tools/DraconicShovel.obj", "textures/models/tools/DraconicShovel.png", (IRenderTweak) ModItems.draconicShovel));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernSword, new RenderTool("models/tools/Sword.obj", "textures/models/tools/Sword.png", (IRenderTweak) ModItems.wyvernSword));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicDestructionStaff, new RenderTool("models/tools/DraconicStaffOfPower.obj", "textures/models/tools/DraconicStaffOfPower.png", (IRenderTweak) ModItems.draconicDestructionStaff));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicHoe, new RenderTool("models/tools/DraconicHoe.obj", "textures/models/tools/DraconicHoe.png", (IRenderTweak) ModItems.draconicHoe));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBowModel(true));
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBowModel(false));
|
||||
}
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen());
|
||||
|
||||
+169
-21
@@ -1,5 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.componentguis;
|
||||
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
|
||||
import com.brandon3055.brandonscore.client.utills.ClientUtills;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.*;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
@@ -9,6 +11,10 @@ import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiConfirmOpenLink;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@@ -22,15 +28,17 @@ import java.util.List;
|
||||
/**
|
||||
* Created by Brandon on 6/03/2015.
|
||||
*/
|
||||
public class GUIManual extends GUIScrollingBase {
|
||||
public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback {
|
||||
|
||||
private static List<ManualPage> pageList = new ArrayList<ManualPage>();
|
||||
public static List<String> imageURLs = new ArrayList<String>();
|
||||
private static ManualPage currentPage = null;
|
||||
private int previousScale = -1;
|
||||
private int worldUpdateIn = -1;
|
||||
|
||||
|
||||
public GUIManual() {
|
||||
super(new DummyContainer(), 255, 325);
|
||||
|
||||
if (currentPage != null)
|
||||
{
|
||||
collection.addComponent(new ComponentManualPage(0, 0, this, currentPage)).setGroup(GR_PAGE);
|
||||
@@ -38,18 +46,61 @@ public class GUIManual extends GUIScrollingBase {
|
||||
collection.setOnlyGroupEnabled(GR_BACKGROUND);
|
||||
collection.setGroupEnabled(GR_PAGE, true);
|
||||
}
|
||||
|
||||
//mc.gameSettings.guiScale
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
pageList.clear();
|
||||
loadPages();//todo remove
|
||||
if (previousScale == -1) adjustGuiScale();
|
||||
}
|
||||
|
||||
private void adjustGuiScale(){
|
||||
previousScale = mc.gameSettings.guiScale;
|
||||
|
||||
if (height < ySize){
|
||||
int x = width;
|
||||
int y = height;
|
||||
|
||||
if (mc.gameSettings.guiScale == 0){
|
||||
mc.gameSettings.guiScale = 3;
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
x = scaledresolution.getScaledWidth();
|
||||
y = scaledresolution.getScaledHeight();
|
||||
}
|
||||
|
||||
if (y < ySize && mc.gameSettings.guiScale == 3){
|
||||
mc.gameSettings.guiScale = 2;
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
x = scaledresolution.getScaledWidth();
|
||||
y = scaledresolution.getScaledHeight();
|
||||
}
|
||||
|
||||
if (y < ySize && mc.gameSettings.guiScale == 2){
|
||||
mc.gameSettings.guiScale = 1;
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
x = scaledresolution.getScaledWidth();
|
||||
y = scaledresolution.getScaledHeight();
|
||||
}
|
||||
|
||||
height = y;
|
||||
width = x;
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
worldUpdateIn = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
mc.gameSettings.guiScale = previousScale;
|
||||
}
|
||||
|
||||
public static final String GR_BACKGROUND = "BACKGROUND";
|
||||
public static final String GR_INTRO = "INTRO";
|
||||
public static final String GR_SUPPORTERS = "SUPPORTERS";
|
||||
public static final String GR_CONTRIBUTORS = "CONTRIBUTORS";
|
||||
public static final String GR_INDEX = "INDEX";
|
||||
public static final String GR_PAGE = "PAGE";
|
||||
|
||||
@@ -63,16 +114,19 @@ loadPages();//todo remove
|
||||
collection.addComponent(new ComponentTexturedRect(7, 100, 0, 0, 255, 255, ResourceHandler.getResource("textures/gui/images/debanner.png"), true)).setGroup(GR_INTRO).setName("BANNER");
|
||||
|
||||
collection.addComponent(new ComponentButton(75, 260, 100, 20, 0, this, StatCollector.translateToLocal("info.de.manual.indexButton.txt"), StatCollector.translateToLocal("info.de.manual.indexButtonTip.txt"))).setGroup(GR_INTRO);
|
||||
//TODO Localize
|
||||
collection.addComponent(new ComponentButton(75, 285, 100, 20, 2, this, StatCollector.translateToLocal("info.de.manual.contributors.txt"), StatCollector.translateToLocal("info.de.manual.contributorsButtonInfo.txt"))).setGroup(GR_INTRO);
|
||||
collection.addComponent(new ComponentButton(75, 285, 100, 20, 2, this, StatCollector.translateToLocal("info.de.manual.contributorsButton.txt"), StatCollector.translateToLocal("info.de.manual.contributorsButtonInfo.txt"))).setGroup(GR_INTRO);
|
||||
collection.addComponent(new ComponentContributorsPage(0, 0, this)).setGroup(GR_CONTRIBUTORS).setName("CONTRIBUTORS");
|
||||
|
||||
collection.addComponent(new ComponentTextureButton(140, 290, 0, 0, 100, 30, 10, this, "", "", ResourceHandler.getResource("textures/gui/patreon.png")).forceFullRender()).setGroup(GR_CONTRIBUTORS);
|
||||
|
||||
for (int i = 0; i < pageList.size(); i++)
|
||||
{
|
||||
collection.addComponent(new ComponentIndexButton(20, 20 + i * 20, this, pageList.get(i))).setGroup(GR_INDEX);
|
||||
collection.addComponent(new ComponentIndexButton(20, 20 + i * 20, this, pageList.get(i))).setGroup(GR_INDEX).setName("INDEX_BUTTON_"+i);
|
||||
pageLength += 20;
|
||||
}
|
||||
|
||||
scrollLimit = pageLength - 285;
|
||||
|
||||
collection.setOnlyGroupEnabled(GR_BACKGROUND);
|
||||
collection.setGroupEnabled(GR_INTRO, true);
|
||||
return collection;
|
||||
@@ -80,11 +134,27 @@ loadPages();//todo remove
|
||||
|
||||
@Override
|
||||
public void handleScrollInput(int direction) {
|
||||
if (currentPage != null) return;
|
||||
scrollOffset += direction * (InfoHelper.isShiftKeyDown() ? 30 : 10);
|
||||
if (scrollOffset < 0) scrollOffset = 0;
|
||||
if (scrollOffset > pageLength - ySize + 40) scrollOffset = pageLength - ySize + 40;
|
||||
if (pageLength + 40 <= ySize) scrollOffset = 0;
|
||||
if (collection.getComponent("INDEX_BUTTON_0") != null && collection.getComponent("INDEX_BUTTON_0").isEnabled()) {
|
||||
|
||||
if (currentPage != null) return;
|
||||
scrollOffset += direction * (InfoHelper.isShiftKeyDown() ? 30 : 10);
|
||||
if (scrollOffset < 0) scrollOffset = 0;
|
||||
if (scrollOffset > pageLength - ySize + 40) scrollOffset = pageLength - ySize + 40;
|
||||
if (pageLength + 40 <= ySize) scrollOffset = 0;
|
||||
|
||||
barPosition = (int)(((double)scrollOffset/scrollLimit) * 247D);
|
||||
}
|
||||
else if (collection.getComponent("CONTRIBUTORS") != null && collection.getComponent("CONTRIBUTORS").isEnabled()) {
|
||||
ComponentContributorsPage page = (ComponentContributorsPage)collection.getComponent("CONTRIBUTORS");
|
||||
barPosition = (int)(((double)page.scrollOffset/page.scrollLimit) * 247D);
|
||||
}
|
||||
else if (collection.getComponent("OPEN_PAGE") != null && collection.getComponent("OPEN_PAGE").isEnabled()) {
|
||||
ComponentManualPage page = (ComponentManualPage)collection.getComponent("CONTRIBUTORS");
|
||||
barPosition = (int)(((double)page.scrollOffset/page.scrollLimit) * 247D);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,18 +163,47 @@ loadPages();//todo remove
|
||||
int posX = (this.width - xSize) / 2;
|
||||
int posY = (this.height - ySize) / 2;
|
||||
if (collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled()) fontRendererObj.drawSplitString(StatCollector.translateToLocal("info.de.manual.introTxt.txt"), posX + 20, posY + 190, 150, 0x000000);
|
||||
// if (collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled()) {
|
||||
// GL11.glPushMatrix();
|
||||
// GL11.glScalef(0.8F, 0.8F, 0.8F);
|
||||
// fontRendererObj.drawSplitString("I am still in the process of adding documentation to this manual. There is also some fine tuning that i still need to do.", posX + 110, posY + 380, 280, 0xFF0000);
|
||||
// GL11.glPopMatrix();
|
||||
// }
|
||||
|
||||
if (collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled()) return;
|
||||
ResourceHandler.bindResource("textures/gui/Widgets.png");
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 118, 20, 17, 17);
|
||||
|
||||
if (mouseX-posX >= 0 && mouseX-posX <= 17 && mouseY-posY >= 0 && mouseY-posY <= 17){
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add(EnumChatFormatting.GREEN+StatCollector.translateToLocal("info.de.manual.nav1.txt"));
|
||||
list.add("");
|
||||
list.add("-"+StatCollector.translateToLocal("info.de.manual.nav2.txt"));
|
||||
list.add("-"+StatCollector.translateToLocal("info.de.manual.nav3.txt"));
|
||||
drawHoveringText(list, posX+8, posY+32, fontRendererObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
|
||||
disableScrollBar = collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled();
|
||||
|
||||
if (!scrollPressed && collection.getComponent("INDEX_BUTTON_0") != null && collection.getComponent("INDEX_BUTTON_0").isEnabled()) {
|
||||
barPosition = (int)(((double)scrollOffset/scrollLimit) * 247D);
|
||||
}
|
||||
else if (!scrollPressed && collection.getComponent("CONTRIBUTORS") != null && collection.getComponent("CONTRIBUTORS").isEnabled()) {
|
||||
ComponentContributorsPage page = (ComponentContributorsPage)collection.getComponent("CONTRIBUTORS");
|
||||
barPosition = (int)(((double)page.scrollOffset/page.scrollLimit) * 247D);
|
||||
}
|
||||
else if (collection.getComponent("OPEN_PAGE") != null && collection.getComponent("OPEN_PAGE").isEnabled()) {
|
||||
ComponentManualPage page = (ComponentManualPage)collection.getComponent("CONTRIBUTORS");
|
||||
barPosition = (int)(((double)page.scrollOffset/page.scrollLimit) * 247D);
|
||||
}
|
||||
|
||||
if (worldUpdateIn > -1) worldUpdateIn--;
|
||||
if (worldUpdateIn == 0) collection.setWorldAndResolution(mc, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
@@ -119,6 +218,23 @@ loadPages();//todo remove
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
if (disableScrollBar) return;
|
||||
|
||||
|
||||
|
||||
ResourceHandler.bindResource("textures/gui/manualBottom.png");
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(guiLeft - 16, guiTop + 10, 0, 146, 15, 100);
|
||||
drawTexturedModalRect(guiLeft - 16, guiTop + ySize - 110, 0, 156, 15, 100);
|
||||
drawTexturedModalRect(guiLeft - 16, guiTop + 110, 0, 156, 15, 90);
|
||||
drawTexturedModalRect(guiLeft - 16, guiTop + 140, 0, 156, 15, 90);
|
||||
|
||||
drawTexturedModalRect(guiLeft-15, guiTop+20 + barPosition, 15, 218, 13, 38);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonClicked(int id, int button) {
|
||||
super.buttonClicked(id, button);
|
||||
@@ -134,6 +250,16 @@ loadPages();//todo remove
|
||||
collection.setGroupEnabled(GR_INDEX, true);
|
||||
collection.schedulRemoval(GR_PAGE);
|
||||
}
|
||||
else if (id == 2)
|
||||
{
|
||||
currentPage = null;
|
||||
collection.setOnlyGroupEnabled(GR_BACKGROUND);
|
||||
collection.setGroupEnabled(GR_CONTRIBUTORS, true);
|
||||
collection.schedulRemoval(GR_PAGE);
|
||||
}
|
||||
else if (id == 10){
|
||||
mc.displayGuiScreen(new GuiConfirmOpenLink(this, "https://www.patreon.com/brandon3055", 0, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -263,7 +389,7 @@ loadPages();//todo remove
|
||||
{
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
currentPage = ((ComponentIndexButton) c).getPage();
|
||||
collection.addComponent(new ComponentManualPage(0, 0, this, currentPage)).setGroup(GR_PAGE);
|
||||
collection.addComponent(new ComponentManualPage(0, 0, this, currentPage)).setGroup(GR_PAGE).setName("OPEN_PAGE");
|
||||
collection.addComponent(new ComponentButton(102, 314, 50, 12, 1, this, StatCollector.translateToLocal("button.de.back.txt"))).setGroup(GR_PAGE);
|
||||
collection.setOnlyGroupEnabled(GR_BACKGROUND);
|
||||
collection.setGroupEnabled(GR_PAGE, true);
|
||||
@@ -272,10 +398,32 @@ loadPages();//todo remove
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void barMoved(double position) {
|
||||
if (collection.getComponent("INDEX_BUTTON_0") != null &&collection.getComponent("INDEX_BUTTON_0").isEnabled()) scrollOffset = (int)(position * scrollLimit);
|
||||
else if (collection.getComponent("CONTRIBUTORS") != null && collection.getComponent("CONTRIBUTORS").isEnabled()) {
|
||||
ComponentContributorsPage page = (ComponentContributorsPage)collection.getComponent("CONTRIBUTORS");
|
||||
if (page.scrollLimit < 0) return;
|
||||
page.scrollOffset = (int) (position * page.scrollLimit);
|
||||
}
|
||||
else if (collection.getComponent("OPEN_PAGE") != null && collection.getComponent("OPEN_PAGE").isEnabled()) {
|
||||
ComponentManualPage page = (ComponentManualPage)collection.getComponent("CONTRIBUTORS");
|
||||
if (page.scrollLimit < 0) return;
|
||||
page.scrollOffset = (int) (position * page.scrollLimit);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isValidPage(String name)
|
||||
{
|
||||
if (name.contains("info.")) return true;
|
||||
else if (!ConfigHandler.disabledNamesList.contains(name)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean confirmed, int id) {
|
||||
if (confirmed) ClientUtills.openLink("https://www.patreon.com/brandon3055");
|
||||
mc.displayGuiScreen(this);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.componentguis;
|
||||
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
|
||||
import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.*;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerReactor;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.componentguis;
|
||||
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.*;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.componentguis;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.*;
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
-236
@@ -1,236 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 25/12/2014.
|
||||
* This gui system is based on open blocks gui system
|
||||
*/
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ComponentBase extends Gui {
|
||||
|
||||
protected static RenderItem itemRender = new RenderItem();
|
||||
protected int x;
|
||||
protected int y;
|
||||
protected boolean enabled = true;
|
||||
public static Minecraft mc;
|
||||
public FontRenderer fontRendererObj;
|
||||
private String group = "";
|
||||
/** The width of the screen object. */
|
||||
public int width;
|
||||
/** The height of the screen object. */
|
||||
public int height;
|
||||
public String name;
|
||||
|
||||
public ComponentBase(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
mc = Minecraft.getMinecraft();
|
||||
fontRendererObj = mc.fontRenderer;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public ComponentBase setGroup(String group) {
|
||||
this.group = group;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ComponentBase setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public abstract int getWidth();
|
||||
|
||||
public abstract int getHeight();
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public boolean isMouseOver(int mouseX, int mouseY) {
|
||||
return mouseX >= x && mouseX < x + getWidth() && mouseY >= y && mouseY < y + getHeight();
|
||||
}
|
||||
|
||||
public abstract void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY);
|
||||
|
||||
public abstract void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY);
|
||||
|
||||
public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {}
|
||||
|
||||
protected void drawHoveringText(List list, int x, int y, FontRenderer font)
|
||||
{
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
// RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
int k = 0;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String s = (String)iterator.next();
|
||||
int l = font.getStringWidth(s);
|
||||
|
||||
if (l > k)
|
||||
{
|
||||
k = l;
|
||||
}
|
||||
}
|
||||
|
||||
int adjX = x + 12;
|
||||
int adjY = y - 12;
|
||||
int i1 = 8;
|
||||
|
||||
if (list.size() > 1)
|
||||
{
|
||||
i1 += 2 + (list.size() - 1) * 10;
|
||||
}
|
||||
|
||||
if (adjX + k > width)
|
||||
{
|
||||
adjX -= 28 + k;
|
||||
}
|
||||
|
||||
if (adjY + i1 + 6 > height)
|
||||
{
|
||||
adjY = height - i1 - 6;
|
||||
}
|
||||
|
||||
this.zLevel = 300.0F;
|
||||
itemRender.zLevel = 300.0F;
|
||||
int j1 = -267386864;
|
||||
this.drawGradientRect(adjX - 3, adjY - 4, adjX + k + 3, adjY - 3, j1, j1);
|
||||
this.drawGradientRect(adjX - 3, adjY + i1 + 3, adjX + k + 3, adjY + i1 + 4, j1, j1);
|
||||
this.drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY + i1 + 3, j1, j1);
|
||||
this.drawGradientRect(adjX - 4, adjY - 3, adjX - 3, adjY + i1 + 3, j1, j1);
|
||||
this.drawGradientRect(adjX + k + 3, adjY - 3, adjX + k + 4, adjY + i1 + 3, j1, j1);
|
||||
int k1 = 1347420415;
|
||||
int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
|
||||
this.drawGradientRect(adjX - 3, adjY - 3 + 1, adjX - 3 + 1, adjY + i1 + 3 - 1, k1, l1);
|
||||
this.drawGradientRect(adjX + k + 2, adjY - 3 + 1, adjX + k + 3, adjY + i1 + 3 - 1, k1, l1);
|
||||
this.drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY - 3 + 1, k1, k1);
|
||||
this.drawGradientRect(adjX - 3, adjY + i1 + 2, adjX + k + 3, adjY + i1 + 3, l1, l1);
|
||||
|
||||
for (int i2 = 0; i2 < list.size(); ++i2)
|
||||
{
|
||||
String s1 = (String)list.get(i2);
|
||||
font.drawStringWithShadow(s1, adjX, adjY, -1);
|
||||
|
||||
if (i2 == 0)
|
||||
{
|
||||
adjY += 2;
|
||||
}
|
||||
|
||||
adjY += 10;
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
itemRender.zLevel = 0.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
// RenderHelper.enableStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawItemStack(ItemStack stack, int x, int y, String count)
|
||||
{
|
||||
if (stack == null) return;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
|
||||
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||
this.zLevel = 200.0F;
|
||||
itemRender.zLevel = 200.0F;
|
||||
FontRenderer font;
|
||||
font = stack.getItem().getFontRenderer(stack);
|
||||
if (font == null) font = fontRendererObj;
|
||||
itemRender.renderItemAndEffectIntoGUI(font, mc.getTextureManager(), stack, x, y);
|
||||
//itemRender.renderEffect(mc.getTextureManager(), x, y);
|
||||
if (!count.equals("null"))itemRender.renderItemOverlayIntoGUI(font, mc.getTextureManager(), stack, x, y, count);
|
||||
this.zLevel = 0.0F;
|
||||
itemRender.zLevel = 0.0F;
|
||||
|
||||
//GL11.glEnable(GL11.GL_LIGHTING);
|
||||
//GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected void renderToolTip(ItemStack stack, int x, int y)
|
||||
{
|
||||
List list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
for (int k = 0; k < list.size(); ++k)
|
||||
{
|
||||
if (k == 0)
|
||||
{
|
||||
list.set(k, stack.getRarity().rarityColor + (String)list.get(k));
|
||||
}
|
||||
else
|
||||
{
|
||||
list.set(k, EnumChatFormatting.GRAY + (String)list.get(k));
|
||||
}
|
||||
}
|
||||
|
||||
FontRenderer font = stack.getItem().getFontRenderer(stack);
|
||||
drawHoveringText(list, x, y, (font == null ? fontRendererObj : font));
|
||||
}
|
||||
|
||||
public void mouseClicked(int x, int y, int button){
|
||||
}
|
||||
|
||||
public void setWorldAndResolution(Minecraft mc, int width, int height)
|
||||
{
|
||||
|
||||
this.mc = mc;
|
||||
this.fontRendererObj = mc.fontRenderer;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
/**Translate To Local*/
|
||||
public String ttl(String unlocalizedName){return StatCollector.translateToLocal(unlocalizedName);}
|
||||
|
||||
public void updateScreen(){}
|
||||
}
|
||||
-110
@@ -1,110 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 1/01/2015.
|
||||
*/
|
||||
public class ComponentButton extends ComponentBase {
|
||||
private static final ResourceLocation widgets = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png");
|
||||
protected static final ResourceLocation buttonTextures = new ResourceLocation("textures/gui/widgets.png");
|
||||
|
||||
|
||||
public int buttonId;
|
||||
public GUIBase gui;
|
||||
public int xSize;
|
||||
public int ySize;
|
||||
public int packedFGColour;
|
||||
public String displayString;
|
||||
public String hoverText;
|
||||
|
||||
public ComponentButton(int x, int y, int xSize, int ySize, int id, GUIBase gui, String displayString) {
|
||||
super(x, y);
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
this.buttonId = id;
|
||||
this.gui = gui;
|
||||
this.displayString = displayString;
|
||||
}
|
||||
|
||||
public ComponentButton(int x, int y, int xSize, int ySize, int id, GUIBase gui, String displayString, String hoverText) {
|
||||
this(x, y, xSize, ySize, id, gui, displayString);
|
||||
this.hoverText = hoverText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return xSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return ySize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
//FontRenderer fontrenderer = minecraft.fontRenderer;
|
||||
minecraft.getTextureManager().bindTexture(buttonTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int k = isMouseOver(mouseX, mouseY) ? 2 : 1;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
this.drawTexturedModalRect(this.x, this.y, 0, 46 + k * 20, this.xSize / 2, this.ySize);
|
||||
this.drawTexturedModalRect(this.x + this.xSize / 2, this.y, 200 - this.xSize / 2, 46 + k * 20, this.xSize / 2, this.ySize);
|
||||
if (this.ySize < 20){
|
||||
|
||||
this.drawTexturedModalRect(x, y+3, 0, (46 + k * 20)+20-ySize+3, xSize / 2, ySize-3);
|
||||
this.drawTexturedModalRect(x + xSize / 2, y+3, 200 - xSize / 2, (46 + k * 20)+20-ySize+3, xSize / 2, ySize-3);
|
||||
}
|
||||
//this.mouseDragged(minecraft, mouseX, mouseY);
|
||||
int l = 14737632;
|
||||
|
||||
if (packedFGColour != 0)
|
||||
{
|
||||
l = packedFGColour;
|
||||
}
|
||||
else if (!this.enabled)
|
||||
{
|
||||
l = 10526880;
|
||||
}
|
||||
else if (isMouseOver(mouseX, mouseY))
|
||||
{
|
||||
l = 16777120;
|
||||
}
|
||||
this.drawCenteredString(fontRendererObj, this.displayString, this.x + this.xSize / 2, this.y + (this.ySize - 8) / 2, l);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
if (isMouseOver(mouseX, mouseY) && hoverText != null){
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add(hoverText);
|
||||
drawHoveringText(list, mouseX + offsetX, mouseY + offsetY + 10, fontRendererObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int x, int y, int button) {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
gui.buttonClicked(buttonId, button);
|
||||
}
|
||||
}
|
||||
-156
@@ -1,156 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 28/12/2014.
|
||||
*/
|
||||
public class ComponentCollection extends ComponentBase {
|
||||
|
||||
protected List<ComponentBase> components = new ArrayList<ComponentBase>();
|
||||
protected int xSize;
|
||||
protected int ySize;
|
||||
protected List<String> deadGroups = new ArrayList<String>();
|
||||
protected GUIBase gui;
|
||||
|
||||
|
||||
public ComponentCollection(int x, int y, int xSize, int ySize, GUIBase gui) {
|
||||
super(x, y);
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return xSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return ySize;
|
||||
}
|
||||
|
||||
|
||||
public ComponentBase addComponent(ComponentBase component) {
|
||||
components.add(component);
|
||||
component.setWorldAndResolution(Minecraft.getMinecraft(), width, height);
|
||||
return component;
|
||||
}
|
||||
|
||||
private boolean isComponentEnabled(ComponentBase component) {
|
||||
return component != null && component.isEnabled();
|
||||
}
|
||||
|
||||
private boolean isComponentCapturingMouse(ComponentBase component, int mouseX, int mouseY) {
|
||||
return isComponentEnabled(component) && component.isMouseOver(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
for (ComponentBase component : components)
|
||||
if (isComponentEnabled(component)) {
|
||||
component.renderBackground(minecraft, offsetX + this.x, offsetY + this.y, mouseX - this.x, mouseY - this.y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
for (ComponentBase component : components)
|
||||
if (isComponentEnabled(component)) {
|
||||
component.renderForground(minecraft, offsetX + this.x, offsetY + this.y, mouseX - this.x, mouseY - this.y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
for (ComponentBase component : components)
|
||||
if (isComponentEnabled(component)) {
|
||||
component.renderFinal(minecraft, offsetX + this.x, offsetY + this.y, mouseX - this.x, mouseY - this.y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int x, int y, int button) {
|
||||
for (ComponentBase component : components){
|
||||
if (!gui.buttonPressed && component.isEnabled() && component.isMouseOver(x, y)) {
|
||||
component.mouseClicked(x, y, button);
|
||||
}
|
||||
}
|
||||
//removeScheduled();
|
||||
}
|
||||
|
||||
public List<ComponentBase> getComponents() { return components; }
|
||||
|
||||
public ComponentBase getComponent(String name){
|
||||
for (ComponentBase component : components){
|
||||
if (component.name != null && component.name.equals(name)) return component;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setGroupEnabled(String group, boolean enabled){
|
||||
for (ComponentBase component : components){
|
||||
if (component.getGroup().equals(group)) {
|
||||
component.setEnabled(enabled);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnlyGroupEnabled(String group){
|
||||
for (ComponentBase component : components){
|
||||
if (component.getGroup().equals(group)) {
|
||||
component.setEnabled(enabled);
|
||||
}else{
|
||||
component.setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setComponentEnabled(String name, boolean enabled){
|
||||
for (ComponentBase component : components){
|
||||
if (component.name != null && component.name.equals(name)) {
|
||||
component.setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeGroup(String group){
|
||||
List<ComponentBase> list = new ArrayList<ComponentBase>();
|
||||
for (ComponentBase component : components){
|
||||
if (component.getGroup().equals(group)) list.add(component);
|
||||
}
|
||||
components.removeAll(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWorldAndResolution(Minecraft mc, int width, int height) {
|
||||
super.setWorldAndResolution(mc, width, height);
|
||||
for (ComponentBase component : components){
|
||||
component.setWorldAndResolution(mc, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeScheduled(){
|
||||
if (!deadGroups.isEmpty()){
|
||||
for (String s : deadGroups) removeGroup(s);
|
||||
deadGroups.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void schedulRemoval(String group){
|
||||
deadGroups.add(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
for (ComponentBase component : components){
|
||||
component.updateScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
|
||||
+198
@@ -0,0 +1,198 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase;
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase;
|
||||
import com.brandon3055.brandonscore.client.utills.ClientUtills;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.client.handler.ContributorHandler;
|
||||
import com.brandon3055.draconicevolution.client.handler.ContributorHandler.Contributor;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.gui.GuiConfirmOpenLink;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.util.StringUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 5/11/2015.
|
||||
*/
|
||||
public class ComponentContributorsPage extends ComponentScrollingBase implements GuiYesNoCallback {
|
||||
|
||||
public int scrollOffset = 0;
|
||||
public int pageLength = 0;
|
||||
public int scrollLimit = 0;
|
||||
|
||||
public ComponentContributorsPage(int x, int y, GUIScrollingBase gui) {
|
||||
super(x, y, gui);
|
||||
pageLength = 55;
|
||||
pageLength += ContributorHandler.contributors.size() * 30;
|
||||
scrollLimit = pageLength - 325;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleScrollInput(int direction) {
|
||||
// page.scrollOffset += direction * 10;
|
||||
scrollOffset += direction * (InfoHelper.isShiftKeyDown() ? 30 : 10);
|
||||
if (scrollOffset < 0) scrollOffset = 0;
|
||||
if (scrollOffset > pageLength - getHeight()) scrollOffset = pageLength - getHeight();
|
||||
if (pageLength <= getHeight()) scrollOffset = 0;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return gui.getXSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return gui.getYSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
int yOffset = -scrollOffset;
|
||||
|
||||
yOffset += 20;
|
||||
|
||||
if (yOffset > 0) {
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("info.de.manual.contributors.txt"), getWidth()/2, yOffset, 0x00FFFF);
|
||||
}
|
||||
|
||||
yOffset += 10;
|
||||
|
||||
boolean patreonButtonHighlighted = mouseX >= 140 && mouseY >= 290;
|
||||
|
||||
for (Contributor contributor : ContributorHandler.contributors){
|
||||
yOffset += 30;
|
||||
|
||||
if (!(yOffset > 25 && yOffset < 324)) continue;
|
||||
|
||||
if (mouseX > 15 && mouseX < 245 && mouseY < yOffset+5 && mouseY > yOffset - 25 && !patreonButtonHighlighted){
|
||||
ResourceHandler.bindResource("textures/gui/manualTop.png");
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(0F, 0F, 0F, 0.4F);
|
||||
drawTexturedModalRect(15, yOffset - 26, 20, 20, 226, 30);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(30, yOffset, 0);
|
||||
GL11.glScaled(100, 100, 100);
|
||||
renderPlayer(contributor.ign);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
fontRendererObj.drawStringWithShadow(EnumChatFormatting.GOLD + contributor.name, 50, yOffset-15, 0x000000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
int yOffset = -scrollOffset + 30;
|
||||
|
||||
boolean patreonButtonHighlighted = mouseX >= 140 && mouseY >= 290;
|
||||
|
||||
for (Contributor contributor : ContributorHandler.contributors){
|
||||
yOffset += 30;
|
||||
|
||||
if (!(yOffset > 20 && yOffset < 330)) continue;
|
||||
|
||||
if (mouseX > 15 && mouseX < 245 && mouseY < yOffset+5 && mouseY > yOffset - 25 && !patreonButtonHighlighted){
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add(EnumChatFormatting.GOLD+contributor.contribution);
|
||||
|
||||
if (!StringUtils.isNullOrEmpty(contributor.details))
|
||||
{
|
||||
list.add("");
|
||||
List l = fontRendererObj.listFormattedStringToWidth(contributor.details, 247);
|
||||
for (Object o : l) list.add(EnumChatFormatting.DARK_PURPLE + (String) o);
|
||||
}
|
||||
|
||||
if (!contributor.name.equals(contributor.ign)){
|
||||
list.add("");
|
||||
list.add(EnumChatFormatting.BLUE+"IGN: "+EnumChatFormatting.GOLD+contributor.ign);
|
||||
}
|
||||
|
||||
if (!StringUtils.isNullOrEmpty(contributor.website))
|
||||
{
|
||||
list.add("");
|
||||
list.add("Website: "+EnumChatFormatting.BLUE+contributor.website);
|
||||
list.add(EnumChatFormatting.GRAY+StatCollector.translateToLocal("info.de.manual.clickToGoToSite.txt"));
|
||||
}
|
||||
|
||||
drawHoveringText(list, offsetX - 7, offsetY + yOffset + 20, fontRendererObj);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ContributorHandler.successfulLoad) fontRendererObj.drawString("[Error] Failed to download contributors list", offsetX+20, offsetY+40, 0xFF0000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
|
||||
}
|
||||
|
||||
private String lastClickURL = "";
|
||||
@Override
|
||||
public void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
int yOffset = -scrollOffset + 30;
|
||||
|
||||
boolean patreonButtonHighlighted = x >= 140 && y >= 290;
|
||||
|
||||
for (Contributor contributor : ContributorHandler.contributors){
|
||||
yOffset += 30;
|
||||
|
||||
if (!(yOffset > 20 && yOffset < 330) || patreonButtonHighlighted) continue;
|
||||
|
||||
if (x > 15 && x < 245 && y < yOffset+5 && y > yOffset - 25 && !StringUtils.isNullOrEmpty(contributor.website)){
|
||||
lastClickURL = contributor.website;
|
||||
mc.displayGuiScreen(new GuiConfirmOpenLink(this, contributor.website, 0, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean confirmed, int button) {
|
||||
mc.displayGuiScreen(this.gui);
|
||||
if (confirmed) ClientUtills.openLink(lastClickURL);
|
||||
}
|
||||
|
||||
private static ModelBiped modelBiped = new ModelBiped(0.0265F);
|
||||
private static void renderPlayer(String username){
|
||||
ResourceHandler.bindTexture(getSkin(username));
|
||||
modelBiped.bipedHead.render(0.0265F);
|
||||
modelBiped.bipedHeadwear.render(0.0265F);
|
||||
}
|
||||
|
||||
private static Map<String, ResourceLocation> skinCache = new HashMap<String, ResourceLocation>();
|
||||
private static boolean skinCashInitialized = false;
|
||||
|
||||
private static ResourceLocation getSkin(String username){
|
||||
if (!skinCashInitialized){
|
||||
for (Contributor contributor : ContributorHandler.contributors)
|
||||
{
|
||||
ResourceLocation skin = AbstractClientPlayer.getLocationSkin(contributor.ign);
|
||||
AbstractClientPlayer.getDownloadImageSkin(skin, contributor.ign);
|
||||
skinCache.put(contributor.ign, skin);
|
||||
}
|
||||
skinCashInitialized = true;
|
||||
}
|
||||
|
||||
if (!skinCache.containsKey(username)) return AbstractClientPlayer.locationStevePng;
|
||||
return skinCache.get(username);
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase;
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase;
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase;
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase;
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 31/12/2014.
|
||||
*/
|
||||
public class ComponentItemRenderer extends ComponentBase {
|
||||
private static final ResourceLocation texture = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png");
|
||||
|
||||
ItemStack stack;
|
||||
public ComponentItemRenderer(int x, int y, ItemStack stack) {
|
||||
super(x, y);
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1f, 1f, 1f, 1f);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
drawTexturedModalRect(x, y, 118, 0, getWidth(), getHeight());
|
||||
drawItemStack(stack, x + 2, y + 2, "null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
if (isMouseOver(mouseX, mouseY)) {
|
||||
renderToolTip(stack, mouseX + offsetX, mouseY + offsetY);
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
-14
@@ -1,5 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase;
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase;
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.client.utill.CustomResourceLocation;
|
||||
@@ -31,6 +33,9 @@ public class ComponentManualPage extends ComponentScrollingBase {
|
||||
ItemStack stack = null;
|
||||
private int slideTick = 0;
|
||||
|
||||
public int scrollOffset = 0;
|
||||
public int scrollLimit = 0;
|
||||
|
||||
public ComponentManualPage(int x, int y, GUIScrollingBase gui, ManualPage page) {
|
||||
super(x, y, gui);
|
||||
this.page = page;
|
||||
@@ -46,15 +51,17 @@ public class ComponentManualPage extends ComponentScrollingBase {
|
||||
contentList.add(c);
|
||||
}
|
||||
pageLength += 25;
|
||||
|
||||
scrollLimit = pageLength - 325;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleScrollInput(int direction) {
|
||||
// page.scrollOffset += direction * 10;
|
||||
page.scrollOffset += direction * (InfoHelper.isShiftKeyDown() ? 30 : 10);
|
||||
if (page.scrollOffset < 0) page.scrollOffset = 0;
|
||||
if (page.scrollOffset > pageLength - getHeight()) page.scrollOffset = pageLength - getHeight();
|
||||
if (pageLength <= getHeight()) page.scrollOffset = 0;
|
||||
// scrollOffset += direction * 10;
|
||||
scrollOffset += direction * (InfoHelper.isShiftKeyDown() ? 30 : 10);
|
||||
if (scrollOffset < 0) scrollOffset = 0;
|
||||
if (scrollOffset > pageLength - getHeight()) scrollOffset = pageLength - getHeight();
|
||||
if (pageLength <= getHeight()) scrollOffset = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -214,7 +221,7 @@ public class ComponentManualPage extends ComponentScrollingBase {
|
||||
}
|
||||
else if (isTitle)
|
||||
{
|
||||
int y = yPos - page.page.scrollOffset;
|
||||
int y = yPos - page.scrollOffset;
|
||||
if (y > 310 || y < 5) return;
|
||||
page.drawCenteredString(page.fontRendererObj, content.substring(content.indexOf("title.") + 6), 128, y, 0x00ffff);
|
||||
|
||||
@@ -230,7 +237,7 @@ public class ComponentManualPage extends ComponentScrollingBase {
|
||||
{
|
||||
for (int i = 0; i < textLines.length; i++)
|
||||
{
|
||||
int y = (yPos + i * 10) - page.page.scrollOffset;
|
||||
int y = (yPos + i * 10) - page.scrollOffset;
|
||||
if (y > 310 || y < 5) continue;
|
||||
page.fontRendererObj.drawString(textLines[i], 20, y, 0x000000);
|
||||
}
|
||||
@@ -256,18 +263,18 @@ public class ComponentManualPage extends ComponentScrollingBase {
|
||||
double ySize = (double)image.getHeight() / (double)image.getWidth() * 220D;
|
||||
|
||||
double topS = 0;
|
||||
if ((yPos - page.page.scrollOffset) < 0) {
|
||||
topS = (yPos - 5 - page.page.scrollOffset);
|
||||
if ((yPos - page.scrollOffset) < 0) {
|
||||
topS = (yPos - 5 - page.scrollOffset);
|
||||
}
|
||||
double btmS = 0;
|
||||
if ((yPos - page.page.scrollOffset) + ySize > 310) {
|
||||
btmS = (yPos - 5 - page.page.scrollOffset) - 310 + ySize;
|
||||
if ((yPos - page.scrollOffset) + ySize > 310) {
|
||||
btmS = (yPos - 5 - page.scrollOffset) - 310 + ySize;
|
||||
}
|
||||
|
||||
double xmin = 17.5D ;
|
||||
double xmax = 17.5D + 220D ;
|
||||
double ymin = yPos - page.page.scrollOffset - topS;
|
||||
double ymax = yPos + ySize - page.page.scrollOffset - btmS;
|
||||
double ymin = yPos - page.scrollOffset - topS;
|
||||
double ymax = yPos + ySize - page.scrollOffset - btmS;
|
||||
|
||||
double vmin = Math.max(0D, topS / -ySize);
|
||||
double vmax = Math.min(1D, 1D - btmS / ySize);
|
||||
@@ -292,7 +299,7 @@ public class ComponentManualPage extends ComponentScrollingBase {
|
||||
ResourceHandler.bindResource("textures/gui/Widgets.png");
|
||||
GL11.glColor4f(1f, 1f, 1f, 1f);
|
||||
int posX = 70;
|
||||
int posY = yPos - page.page.scrollOffset;
|
||||
int posY = yPos - page.scrollOffset;
|
||||
|
||||
for (IRecipe recipe : recipes)
|
||||
{
|
||||
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 6/03/2015.
|
||||
*/
|
||||
public abstract class ComponentScrollingBase extends ComponentBase {
|
||||
|
||||
protected GUIScrollingBase gui;
|
||||
public int scrollOffset;
|
||||
public int componentLength;
|
||||
|
||||
public ComponentScrollingBase(int x, int y, GUIScrollingBase gui) {
|
||||
super(x, y);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public abstract void handleScrollInput(int direction);
|
||||
|
||||
@Override
|
||||
public boolean isMouseOver(int mouseX, int mouseY) {
|
||||
return super.isMouseOver(mouseX, mouseY + gui.scrollOffset);
|
||||
}
|
||||
}
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 13/01/2015.
|
||||
*/
|
||||
public class ComponentSlotBackground extends ComponentBase{
|
||||
|
||||
private static final ResourceLocation widgets = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png");
|
||||
|
||||
public ComponentSlotBackground(int x, int y) {
|
||||
super(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return 18;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return 18;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
minecraft.renderEngine.bindTexture(widgets);
|
||||
drawTexturedModalRect(x, y, 119, 1, getWidth(), getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
|
||||
}
|
||||
|
||||
public static ComponentCollection addInventorySlots(ComponentCollection c, int xOffset, int yOffset, int lockedSlot)
|
||||
{
|
||||
for (int x = 0; x < 9; x++) if (x != lockedSlot) c.addComponent(new ComponentSlotBackground(xOffset + x * 18, yOffset + 58)).setGroup("INVENTORY");
|
||||
|
||||
for (int y = 0; y < 3; y++){
|
||||
for (int x = 0; x < 9; x++) if (x + y * 9 + 9 != lockedSlot) c.addComponent(new ComponentSlotBackground(xOffset + x * 18, yOffset + y * 18)).setGroup("INVENTORY");
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 31/7/2015.
|
||||
*/
|
||||
public class ComponentTextureButton extends ComponentButton {
|
||||
public int textureXPos;
|
||||
public int textureYPos;
|
||||
private ResourceLocation texture;
|
||||
|
||||
//public ComponentTextureButton(int id, int xPos, int yPos, int textureXPos, int textureYPos, int xSise, int ySise, String text) {
|
||||
public ComponentTextureButton(int x, int y, int textureXPos, int textureYPos, int xSize, int ySize, int id, GUIBase gui, String displayString, String hoverText, ResourceLocation texture) {
|
||||
super(x, y, xSize, ySize, id, gui, displayString, hoverText);
|
||||
this.textureXPos = textureXPos;
|
||||
this.textureYPos = textureYPos;
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
//GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
minecraft.getTextureManager().bindTexture(texture);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int k = isMouseOver(mouseX, mouseY) ? 2 : 1;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
this.drawTexturedModalRect(this.x, this.y, textureXPos, textureYPos + k * ySize, this.xSize, this.ySize);
|
||||
int l = 14737632;
|
||||
|
||||
if (packedFGColour != 0)
|
||||
{
|
||||
l = packedFGColour;
|
||||
}
|
||||
else if (!this.enabled)
|
||||
{
|
||||
l = 10526880;
|
||||
}
|
||||
else if (isMouseOver(mouseX, mouseY))
|
||||
{
|
||||
l = 16777120;
|
||||
}
|
||||
this.drawCenteredString(fontRendererObj, this.displayString, this.x + this.xSize / 2, this.y + (this.ySize - 8) / 2, l);
|
||||
//GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
-69
@@ -1,69 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 29/12/2014.
|
||||
*/
|
||||
public class ComponentTexturedRect extends ComponentBase {
|
||||
private int width;
|
||||
private int height;
|
||||
private int texX = 0;
|
||||
private int texY = 0;
|
||||
private final ResourceLocation texture;
|
||||
private boolean transparent = false;
|
||||
|
||||
public ComponentTexturedRect(int x, int y, int width, int height, ResourceLocation texture) {
|
||||
super(x, y);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.texture = texture;
|
||||
}
|
||||
public ComponentTexturedRect(int x, int y, int texX, int texY, int width, int height, ResourceLocation texture, boolean transparent) {
|
||||
super(x, y);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.texture = texture;
|
||||
this.texX = texX;
|
||||
this.texY = texY;
|
||||
this.transparent = transparent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
if (transparent)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
-130
@@ -1,130 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 25/12/2014.
|
||||
* This class is copied from open blocks
|
||||
*/
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.inventory.Container;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public abstract class GUIBase extends GuiContainer {
|
||||
|
||||
protected ComponentCollection collection;
|
||||
/**used to prevent multiple buttons being pressed wen overlapping components are changed*/
|
||||
protected boolean buttonPressed = false;
|
||||
|
||||
public GUIBase(Container container, int xSize, int ySize) {
|
||||
super(container);
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
mc = Minecraft.getMinecraft();
|
||||
collection = assembleComponents();
|
||||
}
|
||||
|
||||
protected abstract ComponentCollection assembleComponents();
|
||||
|
||||
protected void addDependentComponents(){}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
if (collection.isMouseOver(x - this.guiLeft, y - this.guiTop)) {
|
||||
collection.mouseClicked(x - this.guiLeft, y - this.guiTop, button);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseMovedOrUp(int x, int y, int button) {
|
||||
super.mouseMovedOrUp(x, y, button);
|
||||
if (collection.isMouseOver(x - this.guiLeft, y - this.guiTop)) {
|
||||
//if (button >= 0) collection.mouseUp(x - this.guiLeft, y - this.guiTop, button);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(int x, int y, int button, long time) {
|
||||
super.mouseClickMove(x, y, button, time);
|
||||
//if (collection.isMouseOver(x - this.guiLeft, y - this.guiTop)) collection.mouseDrag(x - this.guiLeft, y - this.guiTop, button, time);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
super.keyTyped(par1, par2);
|
||||
//collection.keyTyped(par1, par2);
|
||||
}
|
||||
|
||||
public void preRender(float mouseX, float mouseY) {}
|
||||
|
||||
public void postRender(int mouseX, int mouseY) {}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
prepareRenderState();
|
||||
preRender(mouseX, mouseY);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(this.guiLeft, this.guiTop, 0);
|
||||
collection.renderBackground(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop);
|
||||
GL11.glPopMatrix();
|
||||
postRender(mouseX, mouseY);
|
||||
restoreRenderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
//prepareRenderState();
|
||||
GL11.glPushMatrix();
|
||||
collection.renderForground(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop);
|
||||
GL11.glPopMatrix();
|
||||
//restoreRenderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float par3) {
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
prepareRenderState();
|
||||
GL11.glPushMatrix();
|
||||
collection.renderFinal(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop);
|
||||
GL11.glPopMatrix();
|
||||
restoreRenderState();
|
||||
}
|
||||
|
||||
protected void prepareRenderState() {
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
protected void restoreRenderState() {
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWorldAndResolution(Minecraft mc, int width, int height) {
|
||||
super.setWorldAndResolution(mc, width, height);
|
||||
collection.setWorldAndResolution(mc, width, height);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
collection.removeScheduled();
|
||||
collection.updateScreen();
|
||||
buttonPressed = false;
|
||||
}
|
||||
|
||||
public void buttonClicked(int id, int button){buttonPressed = true;}
|
||||
|
||||
public int getXSize() { return xSize; }
|
||||
|
||||
public int getYSize() { return ySize; }
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 6/03/2015.
|
||||
*/
|
||||
public abstract class GUIScrollingBase extends GUIBase {
|
||||
|
||||
public int scrollOffset;
|
||||
public int pageLength;
|
||||
|
||||
public GUIScrollingBase(Container container, int xSize, int ySize) {
|
||||
super(container, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
super.handleMouseInput();
|
||||
int i = org.lwjgl.input.Mouse.getEventDWheel();
|
||||
if (i != 0) {
|
||||
handleScrollInput(i > 0 ? -1 : 1);
|
||||
|
||||
for (ComponentBase c : collection.getComponents())
|
||||
{
|
||||
if (c instanceof ComponentScrollingBase) ((ComponentScrollingBase) c).handleScrollInput(i > 0 ? -1 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void handleScrollInput(int direction);
|
||||
}
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
package com.brandon3055.draconicevolution.client.handler;
|
||||
|
||||
import com.brandon3055.brandonscore.common.handlers.FileHandler;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 5/11/2015.
|
||||
*/
|
||||
public class ContributorHandler {
|
||||
|
||||
public static List<Contributor> contributors = new ArrayList<Contributor>();
|
||||
public static boolean successfulLoad = false;
|
||||
private static DLThread thread;
|
||||
|
||||
public static void init(){
|
||||
|
||||
thread = new DLThread();
|
||||
thread.start();
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new ContributorHandler());
|
||||
}
|
||||
|
||||
private static void readFile(){
|
||||
File cFile = new File(FileHandler.configFolder, "/draconicevolution/contributors.json");
|
||||
|
||||
if (!cFile.exists()){
|
||||
LogHelper.error("Could not find contributors file");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
JsonReader reader = new JsonReader(new FileReader(cFile));
|
||||
reader.setLenient(true);
|
||||
|
||||
reader.beginArray();
|
||||
|
||||
while (reader.hasNext())
|
||||
{
|
||||
reader.beginObject();
|
||||
|
||||
Contributor contributor = new Contributor();
|
||||
|
||||
while (reader.hasNext())
|
||||
{
|
||||
String name = reader.nextName();
|
||||
|
||||
if (name.equals("name")) contributor.name = reader.nextString();
|
||||
else if (name.equals("ign")) contributor.ign = reader.nextString();
|
||||
else if (name.equals("contribution")) contributor.contribution = reader.nextString();
|
||||
else if (name.equals("details")) contributor.details = reader.nextString();
|
||||
else if (name.equals("website")) contributor.website = reader.nextString();
|
||||
else if (name.equals("contributionLevel")) contributor.contributionLevel = reader.nextInt();
|
||||
}
|
||||
|
||||
contributors.add(contributor);
|
||||
|
||||
reader.endObject();
|
||||
}
|
||||
|
||||
reader.endArray();
|
||||
|
||||
reader.close();
|
||||
cFile.delete();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void tick(TickEvent.ClientTickEvent event){
|
||||
if (thread == null) {
|
||||
FMLCommonHandler.instance().bus().unregister(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (thread.isFinished()){
|
||||
thread = null;
|
||||
readFile();
|
||||
successfulLoad = true;
|
||||
}
|
||||
else if (thread.isFailed()){
|
||||
thread = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Contributor {
|
||||
public String name;
|
||||
public String ign;
|
||||
public String contribution;
|
||||
public String details;
|
||||
public String website;
|
||||
public int contributionLevel;
|
||||
|
||||
public Contributor() {}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[Contributor: "+name+", Contribution: "+contribution+", Details: "+details+", Website: "+website+"]";
|
||||
}
|
||||
}
|
||||
|
||||
public static class DLThread extends Thread {
|
||||
|
||||
private boolean finished = false;
|
||||
private boolean failed = false;
|
||||
|
||||
public DLThread(){
|
||||
super("DE Contributors DL Thread");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
|
||||
try
|
||||
{
|
||||
URL url = new URL("http://www.brandon3055.com/json/DEContributors.json");
|
||||
File cFile = new File(FileHandler.configFolder, "/draconicevolution/contributors.json");
|
||||
|
||||
InputStream is = url.openStream();
|
||||
OutputStream os = new FileOutputStream(cFile);
|
||||
|
||||
IOUtils.copy(is, os);
|
||||
|
||||
is.close();
|
||||
os.close();
|
||||
finished = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
failed = true;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
return finished;
|
||||
}
|
||||
|
||||
public boolean isFailed() {
|
||||
return failed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,6 @@ public class ResourceHandler {
|
||||
|
||||
for (String s : imageURLs)
|
||||
{
|
||||
LogHelper.info("Checking Image: " + s);
|
||||
if (!checkExistence(s)) if (downloadImage(s)) reloadRequired = true;
|
||||
if (checkExistence(s))
|
||||
{
|
||||
|
||||
+75
-72
@@ -7,6 +7,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 25/5/2015.
|
||||
@@ -20,120 +21,122 @@ public class RenderPortal implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
tess.setColorRGBA(0, 0, 0, 256);
|
||||
switch (meta){
|
||||
case 1:
|
||||
tess.addVertexWithUV(x-0.01, y-0.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+1.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+1.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y-0.01, z+0.75, 0, 0);
|
||||
tess.addVertex(x-0.01, y-0.01, z+0.75);
|
||||
tess.addVertex(x-0.01, y+1.01, z+0.75);
|
||||
tess.addVertex(x+1.01, y+1.01, z+0.75);
|
||||
tess.addVertex(x+1.01, y-0.01, z+0.75);
|
||||
|
||||
tess.addVertexWithUV(x+1.01, y-0.01, z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+1.01, z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+1.01, z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y-0.01, z+0.25, 0, 0);
|
||||
tess.addVertex(x+1.01, y-0.01, z+0.25);
|
||||
tess.addVertex(x+1.01, y+1.01, z+0.25);
|
||||
tess.addVertex(x-0.01, y+1.01, z+0.25);
|
||||
tess.addVertex(x-0.01, y-0.01, z+0.25);
|
||||
|
||||
if (isFrame(world, x+1, y, z)){
|
||||
tess.addVertexWithUV(x+0.99, y-0.01, z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y-0.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y+1.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y+1.01, z+0.25, 0, 0);
|
||||
tess.addVertex(x+0.99, y-0.01, z+0.25);
|
||||
tess.addVertex(x+0.99, y-0.01, z+0.75);
|
||||
tess.addVertex(x+0.99, y+1.01, z+0.75);
|
||||
tess.addVertex(x+0.99, y+1.01, z+0.25);
|
||||
}
|
||||
if (isFrame(world, x-1, y, z)){
|
||||
tess.addVertexWithUV(x+0.01, y+1.01, z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y+1.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y-0.01, z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y-0.01, z+0.25, 0, 0);
|
||||
tess.addVertex(x+0.01, y+1.01, z+0.25);
|
||||
tess.addVertex(x+0.01, y+1.01, z+0.75);
|
||||
tess.addVertex(x+0.01, y-0.01, z+0.75);
|
||||
tess.addVertex(x+0.01, y-0.01, z+0.25);
|
||||
}
|
||||
if (isFrame(world, x, y-1, z)){
|
||||
tess.addVertexWithUV(x-0.01, y+0.01,z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.01,z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.01,z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.01,z+0.25, 0, 0);
|
||||
tess.addVertex(x-0.01, y+0.01,z+0.25);
|
||||
tess.addVertex(x-0.01, y+0.01,z+0.75);
|
||||
tess.addVertex(x+1.01, y+0.01,z+0.75);
|
||||
tess.addVertex(x+1.01, y+0.01,z+0.25);
|
||||
}
|
||||
if (isFrame(world, x, y+1, z)){
|
||||
tess.addVertexWithUV(x+1.01, y+0.99,z+0.25, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.99,z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.99,z+0.75, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.99,z+0.25, 0, 0);
|
||||
tess.addVertex(x+1.01, y+0.99,z+0.25);
|
||||
tess.addVertex(x+1.01, y+0.99,z+0.75);
|
||||
tess.addVertex(x-0.01, y+0.99,z+0.75);
|
||||
tess.addVertex(x-0.01, y+0.99,z+0.25);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
tess.addVertexWithUV(x+0.75, y-0.01, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y-0.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+1.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+1.01, z-0.01, 0, 0);
|
||||
tess.addVertex(x+0.75, y-0.01, z-0.01);
|
||||
tess.addVertex(x+0.75, y-0.01, z+1.01);
|
||||
tess.addVertex(x+0.75, y+1.01, z+1.01);
|
||||
tess.addVertex(x+0.75, y+1.01, z-0.01);
|
||||
|
||||
tess.addVertexWithUV(x+0.25, y+1.01, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+1.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y-0.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y-0.01, z-0.01, 0, 0);
|
||||
tess.addVertex(x+0.25, y+1.01, z-0.01);
|
||||
tess.addVertex(x+0.25, y+1.01, z+1.01);
|
||||
tess.addVertex(x+0.25, y-0.01, z+1.01);
|
||||
tess.addVertex(x+0.25, y-0.01, z-0.01);
|
||||
|
||||
if (isFrame(world, x, y, z+1)){
|
||||
tess.addVertexWithUV(x+0.25, y-0.01, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+1.01, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+1.01, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y-0.01, z+0.99, 0, 0);
|
||||
tess.addVertex(x+0.25, y-0.01, z+0.99);
|
||||
tess.addVertex(x+0.25, y+1.01, z+0.99);
|
||||
tess.addVertex(x+0.75, y+1.01, z+0.99);
|
||||
tess.addVertex(x+0.75, y-0.01, z+0.99);
|
||||
}
|
||||
if (isFrame(world, x, y, z-1)){
|
||||
tess.addVertexWithUV(x+0.75, y-0.01, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+1.01, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+1.01, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y-0.01, z+0.01, 0, 0);
|
||||
tess.addVertex(x+0.75, y-0.01, z+0.01);
|
||||
tess.addVertex(x+0.75, y+1.01, z+0.01);
|
||||
tess.addVertex(x+0.25, y+1.01, z+0.01);
|
||||
tess.addVertex(x+0.25, y-0.01, z+0.01);
|
||||
}
|
||||
if (isFrame(world, x, y-1, z)){
|
||||
tess.addVertexWithUV(x+0.25, y+0.01, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+0.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+0.01, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+0.01, z-0.01, 0, 0);
|
||||
tess.addVertex(x+0.25, y+0.01, z-0.01);
|
||||
tess.addVertex(x+0.25, y+0.01, z+1.01);
|
||||
tess.addVertex(x+0.75, y+0.01, z+1.01);
|
||||
tess.addVertex(x+0.75, y+0.01, z-0.01);
|
||||
}
|
||||
if (isFrame(world, x, y+1, z)){
|
||||
tess.addVertexWithUV(x+0.75, y+0.99, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.75, y+0.99, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+0.99, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.25, y+0.99, z-0.01, 0, 0);
|
||||
tess.addVertex(x+0.75, y+0.99, z-0.01);
|
||||
tess.addVertex(x+0.75, y+0.99, z+1.01);
|
||||
tess.addVertex(x+0.25, y+0.99, z+1.01);
|
||||
tess.addVertex(x+0.25, y+0.99, z-0.01);
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
tess.addVertexWithUV(x-0.01, y+0.25, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.25, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.25, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.25, z-0.01, 0, 0);
|
||||
tess.addVertex(x-0.01, y+0.25, z-0.01);
|
||||
tess.addVertex(x-0.01, y+0.25, z+1.01);
|
||||
tess.addVertex(x+1.01, y+0.25, z+1.01);
|
||||
tess.addVertex(x+1.01, y+0.25, z-0.01);
|
||||
|
||||
tess.addVertexWithUV(x+1.01, y+0.75, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.75, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.75, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.75, z-0.01, 0, 0);
|
||||
tess.addVertex(x+1.01, y+0.75, z-0.01);
|
||||
tess.addVertex(x+1.01, y+0.75, z+1.01);
|
||||
tess.addVertex(x-0.01, y+0.75, z+1.01);
|
||||
tess.addVertex(x-0.01, y+0.75, z-0.01);
|
||||
|
||||
if (isFrame(world, x, y, z+1)){
|
||||
tess.addVertexWithUV(x-0.01, y+0.25, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.75, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.75, z+0.99, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.25, z+0.99, 0, 0);
|
||||
tess.addVertex(x-0.01, y+0.25, z+0.99);
|
||||
tess.addVertex(x-0.01, y+0.75, z+0.99);
|
||||
tess.addVertex(x+1.01, y+0.75, z+0.99);
|
||||
tess.addVertex(x+1.01, y+0.25, z+0.99);
|
||||
}
|
||||
if (isFrame(world, x, y, z-1)){
|
||||
tess.addVertexWithUV(x+1.01, y+0.25, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+1.01, y+0.75, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.75, z+0.01, 0, 0);
|
||||
tess.addVertexWithUV(x-0.01, y+0.25, z+0.01, 0, 0);
|
||||
tess.addVertex(x+1.01, y+0.25, z+0.01);
|
||||
tess.addVertex(x+1.01, y+0.75, z+0.01);
|
||||
tess.addVertex(x-0.01, y+0.75, z+0.01);
|
||||
tess.addVertex(x-0.01, y+0.25, z+0.01);
|
||||
}
|
||||
if (isFrame(world, x+1, y, z)){
|
||||
tess.addVertexWithUV(x+0.99, y+0.25, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y+0.25, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y+0.75, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.99, y+0.75, z-0.01, 0, 0);
|
||||
tess.addVertex(x+0.99, y+0.25, z-0.01);
|
||||
tess.addVertex(x+0.99, y+0.25, z+1.01);
|
||||
tess.addVertex(x+0.99, y+0.75, z+1.01);
|
||||
tess.addVertex(x+0.99, y+0.75, z-0.01);
|
||||
}
|
||||
if (isFrame(world, x-1, y, z)){
|
||||
tess.addVertexWithUV(x+0.01, y+0.75, z-0.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y+0.75, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y+0.25, z+1.01, 0, 0);
|
||||
tess.addVertexWithUV(x+0.01, y+0.25, z-0.01, 0, 0);
|
||||
tess.addVertex(x+0.01, y+0.75, z-0.01);
|
||||
tess.addVertex(x+0.01, y+0.75, z+1.01);
|
||||
tess.addVertex(x+0.01, y+0.25, z+1.01);
|
||||
tess.addVertex(x+0.01, y+0.25, z-0.01);
|
||||
}
|
||||
}
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
package com.brandon3055.draconicevolution.client.render.item;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 29/10/2015.
|
||||
*/
|
||||
public class RenderBowModel implements IItemRenderer
|
||||
{
|
||||
private boolean draconic;
|
||||
private IModelCustom[] wyvernModels = new IModelCustom[4];
|
||||
private IModelCustom[] draconicModels = new IModelCustom[4];
|
||||
private IModelCustom arrow;
|
||||
|
||||
public RenderBowModel(boolean draconic){
|
||||
this.draconic = draconic;
|
||||
|
||||
for (int i = 0; i < 4; i++) wyvernModels[i] = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/tools/WyvernBow0"+i+".obj"));
|
||||
for (int i = 0; i < 4; i++) draconicModels[i] = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/tools/DraconicBow0"+i+".obj"));
|
||||
this.arrow = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/tools/ArrowCommon.obj"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return false;//type == ItemRenderType.ENTITY && helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
String currentMode = ItemNBTHelper.getString(item, "mode", "rapidfire");
|
||||
int j = 0;
|
||||
|
||||
if (data.length >= 2 && (data[1] instanceof EntityPlayer)) {
|
||||
EntityPlayer player = (EntityPlayer) data[1];
|
||||
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "sharpshooter";
|
||||
j = player.getItemInUseDuration();
|
||||
}
|
||||
|
||||
IModelCustom activeModel = null;
|
||||
int selection = 0;
|
||||
|
||||
if (draconic)
|
||||
{
|
||||
|
||||
if (currentMode.equals("rapidfire"))
|
||||
{
|
||||
if (j >= 4) selection = 3;
|
||||
else if (j > 2) selection = 2;
|
||||
else if (j > 0) selection = 1;
|
||||
} else if (currentMode.equals("devistation"))
|
||||
{
|
||||
if (j >= 2) selection = 3;
|
||||
else if (j > 1) selection = 2;
|
||||
else if (j > 0) selection = 1;
|
||||
} else if (currentMode.equals("sharpshooter"))
|
||||
{
|
||||
if (j >= 20) selection = 3;
|
||||
else if (j > 10) selection = 2;
|
||||
else if (j > 0) selection = 1;
|
||||
} else
|
||||
{
|
||||
if (j >= 80) selection = 3;
|
||||
else if (j > 40) selection = 2;
|
||||
else if (j > 0) selection = 1;
|
||||
}
|
||||
|
||||
activeModel = draconicModels[selection];
|
||||
ResourceHandler.bindResource("textures/models/tools/DraconicBow0" + selection + ".png");
|
||||
}else
|
||||
{
|
||||
|
||||
if (currentMode.equals("rapidfire"))
|
||||
{
|
||||
if (j >= 13) selection = 2;
|
||||
else if (j > 7) selection = 1;
|
||||
else if (j > 0) selection = 0;
|
||||
} else if (currentMode.equals("sharpshooter"))
|
||||
{
|
||||
if (j >= 30) selection = 2;
|
||||
else if (j > 15) selection = 1;
|
||||
else if (j > 0) selection = 0;
|
||||
}
|
||||
|
||||
activeModel = draconicModels[selection];
|
||||
ResourceHandler.bindResource("textures/models/tools/WyvernBow0"+selection+".png");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (activeModel != null) doRender(activeModel, type, j > 0 ? selection : -1);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void doRender(IModelCustom modelCustom, ItemRenderType type, int drawState){
|
||||
|
||||
if (type == ItemRenderType.EQUIPPED)
|
||||
{
|
||||
GL11.glScaled(0.8, 0.8, 0.8);
|
||||
GL11.glTranslated(0.7, 0, 0.2);
|
||||
GL11.glRotatef(87, 0, 0, 1);
|
||||
GL11.glRotatef(190, 1, 0, 0);
|
||||
}
|
||||
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON){
|
||||
GL11.glScaled(0.8, 0.8, 0.8);
|
||||
GL11.glTranslated(0.7, 0.7, 0.2);
|
||||
GL11.glRotatef(130, 0, 0, 1);
|
||||
GL11.glRotatef(-90, 1, 0, 0);
|
||||
}
|
||||
else if (type == IItemRenderer.ItemRenderType.INVENTORY){
|
||||
GL11.glScalef(6F, 6F, 6F);
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
GL11.glRotatef(135, 0, 1, 0);
|
||||
GL11.glTranslated(0, 0, 1.5);
|
||||
}
|
||||
else if (type == IItemRenderer.ItemRenderType.ENTITY){
|
||||
GL11.glRotatef(-34.5F, 0, 1, 0);
|
||||
GL11.glTranslated(-1.1, 0, -0.2);
|
||||
}
|
||||
|
||||
|
||||
modelCustom.renderAll();
|
||||
GL11.glTranslated(0.3, 0.151, -0.2 + (drawState == 1 ? 0 : drawState == 2 ? 0.55 : drawState == 3 ? 1 : -0.7));
|
||||
GL11.glRotatef(90, 0, 0, 1);
|
||||
if (drawState != -1)arrow.renderAll();
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -15,7 +15,7 @@ import org.lwjgl.opengl.GL11;
|
||||
/**
|
||||
* Created by Brandon on 27/07/2014.
|
||||
*/
|
||||
public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {//todo give core antygravirt
|
||||
public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {
|
||||
|
||||
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");
|
||||
|
||||
-1
@@ -107,7 +107,6 @@ public class LongRangeDislocator extends BlockDE {
|
||||
{
|
||||
if (world.getBlock(randX, i, randZ) != Blocks.air)
|
||||
{
|
||||
//LogHelper.info(world.getBlock(randX, i, randZ));
|
||||
y = i;
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class ReactorCore extends BlockDE {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
|
||||
//TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore ? (TileReactorCore) world.getTileEntity(x, y, z) : null;
|
||||
//if (tile != null) return tile.onStructureRightClicked(player);//todo What happens when you stick your hand into an active fusion reaction?
|
||||
//if (tile != null) return tile.onStructureRightClicked(player);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -7,7 +7,6 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.handler.ParticleHandler;
|
||||
import com.brandon3055.draconicevolution.client.render.particle.Particles;
|
||||
import com.brandon3055.draconicevolution.common.network.GenericParticlePacket;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -158,7 +157,7 @@ public class EntityDragonProjectile extends Entity {
|
||||
if (genericHit){
|
||||
setDead();
|
||||
Entity hit = entityHit != null ? entityHit : target;
|
||||
LogHelper.info(hit);
|
||||
if (!(hit instanceof EntityPlayer)) break;
|
||||
int r = rand.nextInt();
|
||||
if (shooter != null) new Teleporter.TeleportLocation(shooter.posX + (Math.cos(r) * 600), rand.nextInt(255), shooter.posZ + (Math.sin(r) * 600), hit.dimension).sendEntityToCoords(hit);
|
||||
else new Teleporter.TeleportLocation(posX + (Math.cos(r) * 600), rand.nextInt(255), posZ + (Math.sin(r) * 600), hit.dimension).sendEntityToCoords(hit);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.brandon3055.draconicevolution.common.items;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.handler.ContributorHandler;
|
||||
import com.brandon3055.draconicevolution.client.render.particle.Particles;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityFallingBlock;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@@ -136,16 +136,18 @@ public class Tclogo extends ItemDE {
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
LogHelper.info(ContributorHandler.contributors);
|
||||
ContributorHandler.init();
|
||||
LogHelper.info(ContributorHandler.contributors);
|
||||
|
||||
|
||||
EntityFallingBlock fallingBlock = new EntityFallingBlock(world, (int)player.posX + 0.5, (int)player.posY + 0.5, (int)player.posZ + 0.5, Blocks.obsidian, 0);
|
||||
fallingBlock.field_145812_b = 2;
|
||||
//EntityFallingBlock fallingBlock = new EntityFallingBlock(world, (int)player.posX + 0.5, (int)player.posY + 0.5, (int)player.posZ + 0.5, Blocks.obsidian, 0);
|
||||
//fallingBlock.field_145812_b = 2;
|
||||
|
||||
float motion = 0.005F;
|
||||
//fallingBlock.motionX = (rand.nextFloat()-0.5F) * motion;
|
||||
//fallingBlock.motionY = (rand.nextFloat()-0.5F) * motion;
|
||||
//fallingBlock.motionZ = (rand.nextFloat()-0.5F) * motion;
|
||||
world.spawnEntityInWorld(fallingBlock);
|
||||
//world.spawnEntityInWorld(fallingBlock);
|
||||
|
||||
|
||||
// try
|
||||
@@ -418,7 +420,8 @@ public class Tclogo extends ItemDE {
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player)
|
||||
{
|
||||
LogHelper.info(player.worldObj.getBlock(X, Y, Z).getHarvestLevel(player.worldObj.getBlockMetadata(X, Y, Z)));
|
||||
LogHelper.info(GameRegistry.findUniqueIdentifierFor(player.worldObj.getBlock(X, Y, Z)));
|
||||
|
||||
//player.worldObj.scheduleBlockUpdate(X, Y, Z, player.worldObj.getBlock(X, Y, Z), 10);
|
||||
|
||||
return false;
|
||||
|
||||
+2
-2
@@ -1,14 +1,14 @@
|
||||
package com.brandon3055.draconicevolution.common.items.weapons;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.brandon3055.draconicevolution.common.items.weapons;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -208,5 +208,6 @@ public class WyvernBow extends ItemBow implements IInventoryTool {
|
||||
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
|
||||
return new ArrayList<ItemConfigField>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,8 +114,6 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInv
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
|
||||
{
|
||||
System.out.println(par2EntityLivingBase.isEntityAlive());
|
||||
System.out.println(par3EntityLivingBase.isEntityAlive());
|
||||
return super.hitEntity(par1ItemStack, par2EntityLivingBase, par3EntityLivingBase);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package com.brandon3055.draconicevolution.common.lib;
|
||||
public class VersionHandler
|
||||
{
|
||||
public static final String VERSION = "1.0.2";
|
||||
public static final int SNAPSHOT = 5;
|
||||
public static final int SNAPSHOT = 6;
|
||||
public static final String MCVERSION = "1.7.10";
|
||||
|
||||
public static final String FULL_VERSION = VERSION + (SNAPSHOT > 0 ? "-snapshot_" + SNAPSHOT : "");
|
||||
|
||||
Reference in new issue
Block a user