mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-28 07:35:46 +00:00
- AuraPylon finish
- AuraResearchPage finish
This commit is contained in:
1 parent
09e436fefe
commit
28dee0fff0
23 files changed
+834
-22
No files matched your search
@@ -15,6 +15,7 @@ import makeo.gadomancy.client.renderers.block.BlockExtendedNodeJarRenderer;
|
||||
import makeo.gadomancy.client.renderers.block.RenderBlockStoneMachine;
|
||||
import makeo.gadomancy.client.renderers.block.RenderBlockTransparent;
|
||||
import makeo.gadomancy.client.renderers.entity.RenderAdditionalGolemBase;
|
||||
import makeo.gadomancy.client.renderers.entity.RenderEntityItem;
|
||||
import makeo.gadomancy.client.renderers.item.ItemCreativeNodeRenderer;
|
||||
import makeo.gadomancy.client.renderers.item.ItemExNodeRenderer;
|
||||
import makeo.gadomancy.client.renderers.item.ItemJarExtendedNodeRenderer;
|
||||
@@ -26,11 +27,13 @@ import makeo.gadomancy.client.renderers.item.ItemRenderTileEntityMulti;
|
||||
import makeo.gadomancy.client.renderers.tile.*;
|
||||
import makeo.gadomancy.common.CommonProxy;
|
||||
import makeo.gadomancy.common.blocks.tiles.*;
|
||||
import makeo.gadomancy.common.entities.EntityAuraCore;
|
||||
import makeo.gadomancy.common.entities.EntityPermNoClipItem;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
@@ -145,6 +148,7 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemCreativeNode, new ItemCreativeNodeRenderer());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityPermNoClipItem.class, new RenderSpecialItem());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityAuraCore.class, new RenderEntityItem());
|
||||
|
||||
//Blocks
|
||||
RegisteredBlocks.rendererTransparentBlock = registerBlockRenderer(new RenderBlockTransparent());
|
||||
|
||||
@@ -5,6 +5,7 @@ import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
@@ -20,7 +21,7 @@ public class ClientHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientTick(TickEvent.ClientTickEvent event) {
|
||||
if(event.phase.equals(TickEvent.Phase.END)) {
|
||||
if(event.phase.equals(TickEvent.Phase.END) && !Minecraft.getMinecraft().isGamePaused()) {
|
||||
FamiliarHandlerClient.playerTickEvent();
|
||||
ticks++;
|
||||
|
||||
|
||||
@@ -1,30 +1,44 @@
|
||||
package makeo.gadomancy.client.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import makeo.gadomancy.client.gui.GuiResearchRecipeAuraEffects;
|
||||
import makeo.gadomancy.client.util.ExtendedTypeDisplayManager;
|
||||
import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
import makeo.gadomancy.client.util.MultiTickEffectDispatcher;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.aura.ResearchPageAuraAspects;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.BlockCoordinates;
|
||||
import thaumcraft.api.IArchitect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import thaumcraft.client.gui.GuiResearchRecipe;
|
||||
import thaumcraft.client.lib.REHWandHandler;
|
||||
import thaumcraft.common.items.relics.ItemThaumometer;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
@@ -85,6 +99,17 @@ public class RenderEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void guiOpen(GuiOpenEvent event) {
|
||||
if(event.gui != null && event.gui instanceof GuiResearchRecipe) {
|
||||
GuiResearchRecipe gui = (GuiResearchRecipe) event.gui;
|
||||
ResearchItem research = new Injector(gui).getField("research");
|
||||
if(research.key.equals(Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS") && !(gui instanceof GuiResearchRecipeAuraEffects)) {
|
||||
event.gui = GuiResearchRecipeAuraEffects.create(gui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void worldRenderEvent(RenderWorldLastEvent event) {
|
||||
ExtendedTypeDisplayManager.notifyRenderTick();
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
package makeo.gadomancy.client.gui;
|
||||
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.aura.AuraResearchManager;
|
||||
import makeo.gadomancy.common.aura.ResearchPageAuraAspects;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.client.gui.GuiResearchRecipe;
|
||||
import thaumcraft.client.lib.TCFontRenderer;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
|
||||
import thaumcraft.common.lib.utils.InventoryUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by HellFirePvP @ 30.11.2015 12:24
|
||||
*/
|
||||
public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe {
|
||||
|
||||
private HashMap<String, ArrayList<ItemStack>> itemMap = new HashMap<String, ArrayList<ItemStack>>();
|
||||
|
||||
public GuiResearchRecipeAuraEffects(ResearchItem research, int page, double x, double y) {
|
||||
super(research, page, x, y);
|
||||
|
||||
Injector inj = new Injector(this, GuiResearchRecipe.class);
|
||||
|
||||
ResearchPage[] additionalPages = ResearchPageAuraAspects.createAllAuraPagesFor(Minecraft.getMinecraft().thePlayer);
|
||||
ResearchPage[] pages = inj.getField("pages");
|
||||
ResearchPage[] newPages = new ResearchPage[pages.length + additionalPages.length];
|
||||
System.arraycopy(pages, 0, newPages, 0, pages.length);
|
||||
System.arraycopy(additionalPages, 0, newPages, pages.length, additionalPages.length);
|
||||
inj.setField("pages", newPages);
|
||||
inj.setField("maxPages", newPages.length);
|
||||
|
||||
List<String> list = Thaumcraft.proxy.getScannedObjects().get(Minecraft.getMinecraft().thePlayer.getCommandSenderName());
|
||||
if ((list != null) && (list.size() > 0)) {
|
||||
for (String s : list) {
|
||||
try {
|
||||
String s2 = s.substring(1);
|
||||
ItemStack is = getFromCache(Integer.parseInt(s2));
|
||||
if (is != null) {
|
||||
AspectList tags = ThaumcraftCraftingManager.getObjectTags(is);
|
||||
tags = ThaumcraftCraftingManager.getBonusTags(is, tags);
|
||||
if ((tags != null) && (tags.size() > 0)) {
|
||||
for (Aspect a : tags.getAspects()) {
|
||||
ArrayList<ItemStack> items = itemMap.get(a.getTag());
|
||||
if (items == null) {
|
||||
items = new ArrayList<ItemStack>();
|
||||
}
|
||||
ItemStack is2 = is.copy();
|
||||
is2.stackSize = tags.getAmount(a);
|
||||
items.add(is2);
|
||||
itemMap.put(a.getTag(), items);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static GuiResearchRecipeAuraEffects create(GuiResearchRecipe oldGui) {
|
||||
Injector inj = new Injector(oldGui);
|
||||
ResearchItem ri = inj.getField("research");
|
||||
double guiX = inj.getField("guiMapX");
|
||||
double guiY = inj.getField("guiMapY");
|
||||
int page = inj.getField("page");
|
||||
return new GuiResearchRecipeAuraEffects(ri, page, guiX, guiY);
|
||||
}
|
||||
|
||||
String tex1 = "textures/gui/gui_researchbook.png";
|
||||
|
||||
@Override
|
||||
protected void genResearchBackground(int par1, int par2, float par3) {
|
||||
int sw = (this.width - this.paneWidth) / 2;
|
||||
int sh = (this.height - this.paneHeight) / 2;
|
||||
|
||||
float var10 = (this.width - this.paneWidth * 1.3F) / 2.0F;
|
||||
float var11 = (this.height - this.paneHeight * 1.3F) / 2.0F;
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
UtilsFX.bindTexture(this.tex1);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(var10, var11, 0.0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glScalef(1.3F, 1.3F, 1.0F);
|
||||
drawTexturedModalRect(0, 0, 0, 0, this.paneWidth, this.paneHeight);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
Injector inj = new Injector(this, GuiResearchRecipe.class);
|
||||
|
||||
ArrayList<List> reference = inj.getField("reference");
|
||||
inj.setField("tooltip", null);
|
||||
ResearchPage[] pages = inj.getField("pages");
|
||||
int page = inj.getField("page");
|
||||
int maxPages = inj.getField("maxPages");
|
||||
|
||||
reference.clear();
|
||||
int current = 0;
|
||||
for (int a = 0; a < pages.length; a++) {
|
||||
if (((current == page) || (current == page + 1)) && (current < maxPages)) {
|
||||
ResearchPage rPage = pages[a];
|
||||
if (rPage instanceof ResearchPageAuraAspects) {
|
||||
drawAuraAspectPagePre(rPage, current % 2, sw, sh, par1, par2, page);
|
||||
} else if(rPage != null) {
|
||||
try {
|
||||
Method m = Injector.getMethod("drawPage", GuiResearchRecipe.class, ResearchPage.class, int.class, int.class, int.class, int.class, int.class);
|
||||
m.setAccessible(true);
|
||||
m.invoke(this, pages[a], current % 2, sw, sh, par1, par2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
current++;
|
||||
if (current > page + 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
UtilsFX.bindTexture(this.tex1);
|
||||
float bob = MathHelper.sin(this.mc.thePlayer.ticksExisted / 3.0F) * 0.2F + 0.1F;
|
||||
if (!history.isEmpty()) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
drawTexturedModalRectScaled(sw + 118, sh + 189, 38, 202, 20, 12, bob);
|
||||
}
|
||||
if (page > 0) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
drawTexturedModalRectScaled(sw - 16, sh + 190, 0, 184, 12, 8, bob);
|
||||
}
|
||||
if (page < maxPages - 2) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
drawTexturedModalRectScaled(sw + 262, sh + 190, 12, 184, 12, 8, bob);
|
||||
}
|
||||
|
||||
inj.setField("reference", reference);
|
||||
}
|
||||
|
||||
private void drawAuraAspectPagePre(ResearchPage page, int side, int x, int y, int mx, int my, int thisPage) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
String researchName = Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS"; //We know the name of that research.
|
||||
researchName = StatCollector.translateToLocal(researchName);
|
||||
if ((thisPage == 0) && (side == 0)) {
|
||||
drawTexturedModalRect(x + 4, y - 13, 24, 184, 96, 4);
|
||||
drawTexturedModalRect(x + 4, y + 4, 24, 184, 96, 4);
|
||||
int offset = this.fontRendererObj.getStringWidth(researchName);
|
||||
if (offset <= 130) {
|
||||
this.fontRendererObj.drawString(researchName, x + 52 - offset / 2, y - 6, 3158064);
|
||||
} else {
|
||||
float vv = 130.0F / offset;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x + 52 - offset / 2 * vv, y - 6.0F * vv, 0.0F);
|
||||
GL11.glScalef(vv, vv, vv);
|
||||
this.fontRendererObj.drawString(researchName, 0, 0, 3158064);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
y += 25;
|
||||
}
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
drawAuraPage(side, x - 8, y - 8, mx, my, page.aspects);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private void drawAuraPage(int side, int x, int y, int mx, int my, AspectList aspects) {
|
||||
if ((aspects != null) && (aspects.size() > 0)) {
|
||||
TCFontRenderer fr = new Injector(this, GuiResearchRecipe.class).getField("fr");
|
||||
GL11.glPushMatrix();
|
||||
int start = side * 152;
|
||||
int count = 0;
|
||||
for (Aspect aspect : aspects.getAspectsSorted()) {
|
||||
if (aspect.getImage() != null) {
|
||||
GL11.glPushMatrix();
|
||||
int tx = x + start;
|
||||
int ty = y + count * 50;
|
||||
if ((mx >= tx) && (my >= ty) && (mx < tx + 40) && (my < ty + 40)) {
|
||||
UtilsFX.bindTexture("textures/aspects/_back.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glTranslated(x + start - 5, y + count * 50 - 5, 0.0D);
|
||||
GL11.glScaled(2.5D, 2.5D, 0.0D);
|
||||
UtilsFX.drawTexturedQuadFull(0, 0, this.zLevel);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glScalef(2.0F, 2.0F, 2.0F);
|
||||
UtilsFX.drawTag((x + start) / 2, (y + count * 50) / 2, aspect, aspects.getAmount(aspect), 0, this.zLevel);
|
||||
GL11.glPopMatrix();
|
||||
String text = aspect.getName();
|
||||
int offset = fr.getStringWidth(text) / 2;
|
||||
fr.drawString(text, x + start + 16 - offset, y + 33 + count * 50, 5263440);
|
||||
|
||||
List<String> lines = AuraResearchManager.getLines(aspect.getTag());
|
||||
|
||||
int drawX = x + start + 48 + 36;
|
||||
int drawY = y + 12 + count * 50;
|
||||
int lineSpace = 8;
|
||||
int yOffset = drawY - (((lines.size() - 1) * lineSpace) / 2);
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
String txt = lines.get(i);
|
||||
int width = fr.getStringWidth(txt);
|
||||
int actDrawX = drawX - (width / 2);
|
||||
int actDrawY = yOffset + (i * lineSpace);
|
||||
fr.drawString(txt, actDrawX, actDrawY, 0x444444);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
count = 0;
|
||||
for (Aspect aspect : aspects.getAspectsSorted()) {
|
||||
int tx = x + start;
|
||||
int ty = y + count * 50;
|
||||
if ((mx >= tx) && (my >= ty) && (mx < tx + 40) && (my < ty + 40)) {
|
||||
ArrayList<ItemStack> items = itemMap.get(aspect.getTag());
|
||||
if ((items != null) && (items.size() > 0)) {
|
||||
int xcount = 0;
|
||||
int ycount = 0;
|
||||
for (ItemStack item : items) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
itemRenderer.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, InventoryUtils.cycleItemStack(item), mx + 8 + xcount * 17, 17 * ycount + (my - (4 + items.size() / 8 * 8)));
|
||||
itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, InventoryUtils.cycleItemStack(item), mx + 8 + xcount * 17, 17 * ycount + (my - (4 + items.size() / 8 * 8)));
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glPopMatrix();
|
||||
xcount++;
|
||||
if (xcount >= 8) {
|
||||
xcount = 0;
|
||||
ycount++;
|
||||
}
|
||||
}
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package makeo.gadomancy.client.renderers.entity;
|
||||
|
||||
import makeo.gadomancy.common.entities.EntityAuraCore;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by HellFirePvP @ 29.11.2015 19:13
|
||||
*/
|
||||
public class RenderEntityItem extends Render {
|
||||
|
||||
private RenderItem ri;
|
||||
|
||||
public RenderEntityItem() {
|
||||
ri = new RenderItem();
|
||||
ri.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float parf1, float parf2) {
|
||||
if(!(entity instanceof EntityAuraCore)) return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return AbstractClientPlayer.locationStevePng;
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
Aspect a = ((TileAuraPylonTop) tile).getAspect();
|
||||
if(a != null) {
|
||||
int col = a.getColor();
|
||||
col |= (0x44 << 24);
|
||||
col |= (0x55 << 24);
|
||||
Color c = new Color(col, true);
|
||||
Random rand = tile.getWorldObj().rand;
|
||||
addNewOrbitalPoint(((TileAuraPylonTop) tile).orbital, rand, c);
|
||||
|
||||
Reference in new issue
Block a user