mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-20 20:22:10 +00:00
09/03/2015
This commit is contained in:
1 parent
a1b472d9ea
commit
d5ab00bdab
13 files changed
+108
-45
No files matched your search
+19
-7
@@ -6,7 +6,6 @@ import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentTextu
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.GUIScrollingBase;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.common.container.DummyContainer;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -51,8 +50,8 @@ public class GUIManual extends GUIScrollingBase {
|
||||
|
||||
for (int i = 0; i < pageList.size(); i++)
|
||||
{
|
||||
collection.addComponent(new ComponentIndexButton(20, 20 + i * 12, this, pageList.get(i))).setGroup(GR_INDEX);
|
||||
pageLength += 15;
|
||||
collection.addComponent(new ComponentIndexButton(20, 20 + i * 20, this, pageList.get(i))).setGroup(GR_INDEX);
|
||||
pageLength += 20;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +60,7 @@ public class GUIManual extends GUIScrollingBase {
|
||||
|
||||
@Override
|
||||
public void handleScrollInput(int direction) {
|
||||
scrollOffset += direction * 5;
|
||||
scrollOffset += direction * 10;
|
||||
if (scrollOffset < 0) scrollOffset = 0;
|
||||
if (scrollOffset > pageLength - ySize + 40) scrollOffset = pageLength - ySize + 40;
|
||||
if (pageLength + 40 <= ySize) scrollOffset = 0;
|
||||
@@ -93,7 +92,7 @@ public class GUIManual extends GUIScrollingBase {
|
||||
|
||||
public static void loadPages()
|
||||
{
|
||||
LogHelper.info("loading pages");
|
||||
//LogHelper.info("loading pages");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -109,6 +108,8 @@ public class GUIManual extends GUIScrollingBase {
|
||||
while (reader.hasNext())
|
||||
{
|
||||
String name;
|
||||
String nameL = null;
|
||||
int meta = 0;
|
||||
images = new ArrayList<String>();
|
||||
content = new ArrayList<String>();
|
||||
|
||||
@@ -124,6 +125,17 @@ public class GUIManual extends GUIScrollingBase {
|
||||
|
||||
//Read page images
|
||||
s = reader.nextName();
|
||||
if (s.equals("nameL"))
|
||||
{
|
||||
nameL = reader.nextString();
|
||||
s = reader.nextName();
|
||||
}
|
||||
if (s.equals("meta"))
|
||||
{
|
||||
meta = reader.nextInt();
|
||||
s = reader.nextName();
|
||||
}
|
||||
|
||||
if (s.equals("images"))
|
||||
{
|
||||
reader.beginArray();
|
||||
@@ -150,7 +162,7 @@ public class GUIManual extends GUIScrollingBase {
|
||||
|
||||
reader.endObject();
|
||||
|
||||
pageList.add(new ManualPage(name, images.toArray(new String[images.size()]), content.toArray(new String[content.size()])));
|
||||
pageList.add(new ManualPage(name, images.toArray(new String[images.size()]), content.toArray(new String[content.size()]), nameL, meta));
|
||||
}
|
||||
|
||||
reader.endArray();
|
||||
@@ -165,6 +177,6 @@ public class GUIManual extends GUIScrollingBase {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for (ManualPage p : pageList) LogHelper.info(p.getLocalizedName());
|
||||
//for (ManualPage p : pageList) LogHelper.info(p.getLocalizedName());
|
||||
}
|
||||
}
|
||||
+10
@@ -8,6 +8,8 @@ import net.minecraft.util.StatCollector;
|
||||
public class ManualPage {
|
||||
|
||||
public String name;
|
||||
public String nameL;
|
||||
public int meta;
|
||||
public String[] imageURLs;
|
||||
public String[] content;
|
||||
|
||||
@@ -18,8 +20,16 @@ public class ManualPage {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public ManualPage(String name, String[] imageURLs, String[] content, String nameL, int meta)
|
||||
{
|
||||
this(name, imageURLs, content);
|
||||
this.nameL = nameL;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public String getLocalizedName()
|
||||
{
|
||||
if (nameL != null) return nameL;
|
||||
return (name.contains("item.") || name.contains("tile.")) ? StatCollector.translateToLocal(name + ".name") : name.contains("info.") ? name.substring(name.indexOf("info.") + 5) : "Invalid Name Data";
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -183,8 +183,9 @@ public abstract class ComponentBase extends Gui {
|
||||
FontRenderer font;
|
||||
font = stack.getItem().getFontRenderer(stack);
|
||||
if (font == null) font = fontRendererObj;
|
||||
itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), stack, x, y);
|
||||
if (!count.equals("null"))itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), stack, x, y, count);
|
||||
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;
|
||||
|
||||
|
||||
+36
-14
@@ -1,12 +1,12 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.guicomponents;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 7/03/2015.
|
||||
@@ -14,15 +14,12 @@ import net.minecraft.item.ItemStack;
|
||||
public class ComponentIndexButton extends ComponentScrollingBase {
|
||||
|
||||
private ManualPage page;
|
||||
private EntityItem item;
|
||||
private ItemStack stack;
|
||||
|
||||
public ComponentIndexButton(int x, int y, GUIScrollingBase gui, ManualPage page) {
|
||||
super(x, y, gui);
|
||||
this.page = page;
|
||||
if (page.name.contains(".tile")) item = new EntityItem(Minecraft.getMinecraft().theWorld, 0, 0, 0, new ItemStack(GameData.getBlockRegistry().getObject(page.name.substring(page.name.indexOf(".") + 1).replace("draconicevolution", "DraconicEvolution"))));
|
||||
if (page.name.contains(".item")) item = new EntityItem(Minecraft.getMinecraft().theWorld, 0, 0, 0, new ItemStack(GameData.getItemRegistry().getObject(page.name.substring(page.name.indexOf(".") + 1).replace("draconicevolution", "DraconicEvolution"))));
|
||||
LogHelper.info(item + " " + GameData.getBlockRegistry().getObject("DraconicEvolution:draconiumOre") + " " + page.name.substring(page.name.indexOf(".") + 1).replace("draconicevolution", "DraconicEvolution") +
|
||||
" " + new ItemStack(GameData.getBlockRegistry().getObject(page.name.substring(page.name.indexOf(".") + 1).replace("draconicevolution", "DraconicEvolution"))));
|
||||
getStackFromName(page.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,7 +34,7 @@ public class ComponentIndexButton extends ComponentScrollingBase {
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return 16;
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,15 +42,40 @@ public class ComponentIndexButton extends ComponentScrollingBase {
|
||||
int sy = y - gui.scrollOffset;
|
||||
if (sy > 1 && sy + getHeight() < gui.getYSize())
|
||||
{
|
||||
fontRendererObj.drawString("!!!!!!!!!!! Test !!!!!!!!!! " + y/12, x, sy, 0xffffff);
|
||||
}
|
||||
if (item != null) {
|
||||
LogHelper.info("r");
|
||||
RenderManager.instance.renderEntityWithPosYaw(item, 0D, 0D, 0D, 0F, 0F);
|
||||
boolean mouseOver = isMouseOver(mouseX, mouseY);
|
||||
|
||||
fontRendererObj.drawString(page.getLocalizedName(), x + 19, sy, mouseOver ? 0xdd00ff : 0x000000);
|
||||
ResourceHandler.bindResource("textures/gui/Widgets.png");
|
||||
|
||||
|
||||
GL11.glColor4f(1f, 1f, 1f, 1f);
|
||||
if (mouseOver) {
|
||||
GL11.glColor4f(0f, 1f, 1f, 1f);
|
||||
drawTexturedModalRect(x - 2, sy - 2, 118, 0, 20, 20);
|
||||
}
|
||||
else drawTexturedModalRect(x-1, sy-1, 138, 0, 18, 18);
|
||||
|
||||
if (stack != null && stack.getItem() != null) drawItemStack(stack, x, sy, "");
|
||||
else drawItemStack(new ItemStack(Items.writable_book), x, sy, "");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
}
|
||||
|
||||
private void getStackFromName(String name)
|
||||
{
|
||||
if (name.contains("tile."))
|
||||
{
|
||||
name = name.replace("draconicevolution", "DraconicEvolution").replace("tile.", "");
|
||||
stack = new ItemStack(GameData.getBlockRegistry().getObject(name), 1, page.meta);
|
||||
}
|
||||
if (name.contains("item."))
|
||||
{
|
||||
name = name.replace("draconicevolution", "DraconicEvolution").replace("item.", "");
|
||||
stack = new ItemStack(GameData.getItemRegistry().getObject(name), 1, page.meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -15,4 +15,9 @@ public abstract class ComponentScrollingBase extends ComponentBase {
|
||||
}
|
||||
|
||||
public abstract void handleScrollInput(int direction);
|
||||
|
||||
@Override
|
||||
public boolean isMouseOver(int mouseX, int mouseY) {
|
||||
return super.isMouseOver(mouseX, mouseY + gui.scrollOffset);
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
public abstract class CommonProxy {
|
||||
public class CommonProxy {
|
||||
//private final static boolean debug = DraconicEvolution.debug;
|
||||
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
@@ -166,7 +166,7 @@ public abstract class CommonProxy {
|
||||
EntityRegistry.registerModEntity(EntityDragonHeart.class, "Dragon Heart Item", 5, DraconicEvolution.instance, 32, 5, true);
|
||||
}
|
||||
|
||||
public abstract boolean isDedicatedServer();
|
||||
public boolean isDedicatedServer() {return true;}
|
||||
|
||||
public MinecraftServer getMCServer(){
|
||||
return FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 16/01/2015.
|
||||
*/
|
||||
public class ServerProxy extends CommonProxy {
|
||||
@Override
|
||||
public boolean isDedicatedServer() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.brandon3055.draconicevolution.common.entity;
|
||||
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 9/03/2015.
|
||||
*/
|
||||
public class DragonLoader implements LoadingCallback {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void ticketsLoaded(List<ForgeChunkManager.Ticket> tickets, World world) {
|
||||
|
||||
}
|
||||
}
|
||||
+8
-2
@@ -641,13 +641,19 @@ public class EntityCustomDragon extends EntityDragon {
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource damageSource, float dmg) {
|
||||
if (damageSource.getEntity() != null && getDistanceToEntity(damageSource.getEntity()) > 100) return false;
|
||||
// if (damageSource.getEntity() != null && getDistanceToEntity(damageSource.getEntity()) > 100) {
|
||||
// LogHelper.info("cancel attack");
|
||||
// return false;
|
||||
// }
|
||||
return super.attackEntityFrom(damageSource, dmg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFromPart(EntityDragonPart p_70965_1_, DamageSource damageSource, float p_70965_3_) {
|
||||
if (damageSource.getEntity() != null && getDistanceSqToEntity(damageSource.getEntity()) > 100) return false;
|
||||
// if (damageSource.getEntity() != null && Utills.getDistanceAtoB(damageSource.getEntity().posX)getDistanceToEntity(damageSource.getEntity()) > 100) {
|
||||
// LogHelper.info("cancel attack");
|
||||
// return false;
|
||||
// }
|
||||
return super.attackEntityFromPart(p_70965_1_, damageSource, p_70965_3_);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ public final class References {
|
||||
public static final String VERSION = VersionHandler.FULL_VERSION;
|
||||
public static final String MCVERSION = VersionHandler.MCVERSION;
|
||||
public static final String CLIENTPROXYLOCATION = "com.brandon3055.draconicevolution.client.ClientProxy";
|
||||
public static final String SERVERPROXYLOCATION = "com.brandon3055.draconicevolution.common.ServerProxy";
|
||||
public static final String SERVERPROXYLOCATION = "com.brandon3055.draconicevolution.common.CommonProxy";
|
||||
public static final String GUIFACTORY = "com.brandon3055.draconicevolution.client.gui.DEGUIFactory";
|
||||
public static final String RESOURCESPREFIX = MODID.toLowerCase() + ":";
|
||||
|
||||
|
||||
+1
-1
@@ -236,7 +236,7 @@ public class TileWeatherController extends TileEntity implements IInventory {
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player)
|
||||
{
|
||||
return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.4) < 64;
|
||||
return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user