mirror of
https://github.com/GTNewHorizons/Hardcore-Ender-Expansion.git
synced 2026-10-26 14:24:03 +00:00
Made End Portal in Compendium 2D
Goodbye 3D depth magic OpenGL bollocks, welcome custom 2D parallax. This should also improve the performance massively.
This commit is contained in:
1 parent
9b58a1123c
commit
855fc9fe83
7 files changed
+67
-49
No files matched your search
@@ -93,7 +93,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
@Mod(modid = "HardcoreEnderExpansion", name = "Hardcore Ender Expansion", version = "", useMetadata = true, guiFactory = "chylex.hee.gui.ModGuiFactory")
|
||||
@Mod(modid = "HardcoreEnderExpansion", name = "Hardcore Ender Expansion", version = "", useMetadata = true, guiFactory = "chylex.hee.gui.core.ModGuiFactory")
|
||||
public class HardcoreEnderExpansion{
|
||||
@Instance("HardcoreEnderExpansion")
|
||||
public static HardcoreEnderExpansion instance;
|
||||
|
||||
@@ -25,18 +25,25 @@ public class GuiEnderCompendium extends GuiScreen implements ITooltipRenderer{
|
||||
private final GuiEndPortalRenderer portalRenderer;
|
||||
|
||||
private List<AnimatedFloat> animationList = new ArrayList<>();
|
||||
private AnimatedFloat offsetX, offsetY;
|
||||
private float prevOffsetX, prevOffsetY;
|
||||
private AnimatedFloat offsetX, offsetY, portalScale;
|
||||
private float prevOffsetX, prevOffsetY, prevPortalScale;
|
||||
|
||||
public GuiEnderCompendium(){
|
||||
this.portalRenderer = new GuiEndPortalRenderer(this,guiWidth,guiHeight,guiTopOffset);
|
||||
|
||||
animationList.add(offsetX = new AnimatedFloat(Easing.CUBIC));
|
||||
animationList.add(offsetY = new AnimatedFloat(Easing.CUBIC));
|
||||
animationList.add(portalScale = new AnimatedFloat(Easing.LINEAR));
|
||||
|
||||
portalScale.startAnimation(1.5F,1F,2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen(){
|
||||
prevOffsetX = offsetX.value();
|
||||
prevOffsetY = offsetY.value();
|
||||
prevPortalScale = portalScale.value();
|
||||
|
||||
for(AnimatedFloat animation:animationList)animation.update(0.05F);
|
||||
}
|
||||
|
||||
@@ -50,7 +57,7 @@ public class GuiEnderCompendium extends GuiScreen implements ITooltipRenderer{
|
||||
GL11.glDepthFunc(GL11.GL_GEQUAL);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0F,0F,-200F);
|
||||
portalRenderer.draw(prevOffsetX+(offsetX.value()-prevOffsetX)*partialTickTime,prevOffsetY+(offsetY.value()-prevOffsetY)*partialTickTime,1F);
|
||||
portalRenderer.draw(prevOffsetX+(offsetX.value()-prevOffsetX)*partialTickTime+mouseX,prevOffsetY+(offsetY.value()-prevOffsetY)*partialTickTime+mouseY,prevPortalScale+(portalScale.value()-prevPortalScale)*partialTickTime);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
renderScreen(mouseX,mouseY,partialTickTime);
|
||||
|
||||
@@ -31,12 +31,12 @@ public final class AnimatedFloat{
|
||||
public void update(float timeAdd){
|
||||
if (!isAnimating)return;
|
||||
|
||||
if ((time += timeAdd) > 1F){
|
||||
if ((time += (timeAdd/duration)) > 1F){
|
||||
time = 1F;
|
||||
isAnimating = false;
|
||||
}
|
||||
|
||||
currentValue = easing.getValue(time,startValue,endValue-startValue,duration);
|
||||
currentValue = easing.getValue(time,startValue,endValue-startValue);
|
||||
}
|
||||
|
||||
public float value(){
|
||||
@@ -46,16 +46,16 @@ public final class AnimatedFloat{
|
||||
public enum Easing{
|
||||
LINEAR, CUBIC;
|
||||
|
||||
public float getValue(float time, float startValue, float fullStep, float duration){
|
||||
public float getValue(float time, float startValue, float fullStep){
|
||||
switch(this){
|
||||
case CUBIC:
|
||||
if ((time /= duration/2F) < 1)return fullStep/2F*time*time*time+startValue;
|
||||
if ((time *= 2F) < 1)return fullStep/2F*time*time*time+startValue;
|
||||
time -= 2F;
|
||||
return fullStep/2F*(time*time*time+2F)+startValue;
|
||||
|
||||
case LINEAR:
|
||||
default:
|
||||
return startValue+(fullStep*time)/duration;
|
||||
return startValue+(fullStep*time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,14 +35,11 @@ public final class GuiEndPortalRenderer{
|
||||
consistentRandom.setSeed(31100L);
|
||||
|
||||
for(int layer = 0; layer < 16; ++layer){
|
||||
GL11.glPushMatrix();
|
||||
|
||||
float revLayer = (16-layer), scale = 0.09625F, colorMultiplier = 1F/(revLayer+1F);
|
||||
float revLayer = (16-layer), scale = 0.09625F, colorMultiplier = 1F/(revLayer+1F), layerMp = 1F+(layer*0.4F);
|
||||
|
||||
if (layer == 0){
|
||||
gui.mc.getTextureManager().bindTexture(texPortalSky);
|
||||
colorMultiplier = 0.1F;
|
||||
revLayer = 15F;
|
||||
scale = 1.125F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -58,35 +55,22 @@ public final class GuiEndPortalRenderer{
|
||||
}
|
||||
}
|
||||
|
||||
// magic stuff
|
||||
float magicScale = 100F*portalScale;
|
||||
GL11.glTranslatef(0,revLayer*1000,0);
|
||||
GL11.glRotatef(120F,1F,0F,1F);
|
||||
GL11.glTranslatef(0F,5500F,0F);
|
||||
GL11.glScalef(magicScale,magicScale,magicScale);
|
||||
// end of magic stuff
|
||||
GL11.glTexGeni(GL11.GL_S,GL11.GL_TEXTURE_GEN_MODE,GL11.GL_EYE_LINEAR);
|
||||
GL11.glTexGeni(GL11.GL_T,GL11.GL_TEXTURE_GEN_MODE,GL11.GL_EYE_LINEAR);
|
||||
GL11.glTexGeni(GL11.GL_R,GL11.GL_TEXTURE_GEN_MODE,GL11.GL_EYE_LINEAR);
|
||||
GL11.glTexGeni(GL11.GL_Q,GL11.GL_TEXTURE_GEN_MODE,GL11.GL_EYE_LINEAR);
|
||||
GL11.glTexGen(GL11.GL_S,GL11.GL_OBJECT_PLANE,insertIntoBufferAndFlip(1F,0F,0F,0F));
|
||||
GL11.glTexGen(GL11.GL_T,GL11.GL_OBJECT_PLANE,insertIntoBufferAndFlip(0F,0F,1F,0F));
|
||||
GL11.glTexGen(GL11.GL_R,GL11.GL_OBJECT_PLANE,insertIntoBufferAndFlip(0F,0F,0F,1F));
|
||||
GL11.glTexGen(GL11.GL_Q,GL11.GL_EYE_PLANE,insertIntoBufferAndFlip(0F,1F,0F,0F));
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glTranslatef(0F,(Minecraft.getSystemTime()%200000L)/200000F,0F);
|
||||
GL11.glScalef(scale,scale,scale);
|
||||
|
||||
GL11.glTranslatef(0F,layerMp*(Minecraft.getSystemTime()%300000L)/300000F,0F);
|
||||
GL11.glScalef(scale,scale,1F);
|
||||
GL11.glScalef(1F+revLayer*0.15F,1F+revLayer*0.15F,1F);
|
||||
GL11.glTranslatef(0.5F,0.5F,0F);
|
||||
GL11.glRotatef((layer*layer*4321+layer*9)*4F,0F,0F,1F);
|
||||
GL11.glTranslatef(-0.5F,-0.5F,0.0F);
|
||||
GL11.glTranslatef(x*0.015F,y*0.015F,0F); // TRANSLATE
|
||||
|
||||
GL11.glTranslatef(x*0.015F*layerMp,y*0.015F*layerMp,0F);
|
||||
GL11.glTranslatef(0.5F,0.5F,0F);
|
||||
GL11.glScalef(4F,4F,1F);
|
||||
GL11.glScalef(portalScale,portalScale,1F);
|
||||
GL11.glTranslatef(-0.5F,-0.5F,0F);
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
@@ -106,17 +90,6 @@ public final class GuiEndPortalRenderer{
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
private FloatBuffer insertIntoBufferAndFlip(float value1, float value2, float value3, float value4){
|
||||
floatBuffer.clear();
|
||||
floatBuffer.put(value1).put(value2).put(value3).put(value4);
|
||||
floatBuffer.flip();
|
||||
return floatBuffer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package chylex.hee.mechanics.compendium;
|
||||
import chylex.hee.gui.GuiEnderCompendium;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||
|
||||
public final class CompendiumKeyHandler{
|
||||
private static CompendiumKeyHandler instance;
|
||||
|
||||
public static void register(){
|
||||
if (instance == null)FMLCommonHandler.instance().bus().register(instance = new CompendiumKeyHandler());
|
||||
}
|
||||
|
||||
private KeyBinding keyOpenCompendium;
|
||||
|
||||
private CompendiumKeyHandler(){
|
||||
keyOpenCompendium = new KeyBinding("key.openCompendium",25,"Hardcore Ender Expansion");
|
||||
ClientRegistry.registerKeyBinding(keyOpenCompendium);
|
||||
Minecraft.getMinecraft().gameSettings.loadOptions();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeyInput(KeyInputEvent e){
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
if (mc.inGameHasFocus && keyOpenCompendium.isPressed()){
|
||||
mc.displayGuiScreen(new GuiEnderCompendium()); // TODO temp
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ import chylex.hee.entity.weather.EntityWeatherLightningBoltSafe;
|
||||
import chylex.hee.gui.GuiItemViewer;
|
||||
import chylex.hee.item.ItemList;
|
||||
import chylex.hee.mechanics.charms.handler.CharmPouchHandlerClient;
|
||||
import chylex.hee.mechanics.compendium.CompendiumKeyHandler;
|
||||
import chylex.hee.mechanics.knowledge.fragment.CraftingKnowledgeFragment;
|
||||
import chylex.hee.mechanics.knowledge.fragment.EnhancementKnowledgeFragment;
|
||||
import chylex.hee.mechanics.temple.TeleportParticleTickEvent;
|
||||
@@ -121,10 +122,11 @@ public class ModClientProxy extends ModCommonProxy{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserBeam.class, new RenderTileLaserBeam());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBossDragon.class, new RenderBossDragon());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBossEnderDemon.class, new RenderBossEnderDemon());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMiniBossEnderEye.class, new RenderMiniBossEnderEye());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMiniBossFireFiend.class, new RenderMiniBossFireFiend());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBossEnderDemon.class, new RenderBossEnderDemon());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMobAngryEnderman.class, new RenderMobAngryEnderman());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMobBabyEnderman.class, new RenderMobBabyEnderman());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMobParalyzedEnderman.class, new RenderMobParalyzedEnderman());
|
||||
@@ -168,6 +170,7 @@ public class ModClientProxy extends ModCommonProxy{
|
||||
ReflectionPublicizer.loadClient();
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new UpdateNotificationManager());
|
||||
CompendiumKeyHandler.register();
|
||||
OverlayManager.register();
|
||||
TeleportParticleTickEvent.register();
|
||||
MusicManager.register();
|
||||
|
||||
@@ -165,6 +165,8 @@ container.endPowderEnhancements=End Powder Enhancements
|
||||
container.charmPouch=Charm Pouch
|
||||
container.runeCrafting=Rune Crafting
|
||||
|
||||
key.openCompendium=Ender Compendium
|
||||
|
||||
achievement.theMoreYouKnow=The more you know
|
||||
achievement.theMoreYouKnow.desc=Craft an Ender Compendium
|
||||
achievement.newAdventures=Time for new adventures!
|
||||
|
||||
Reference in new issue
Block a user