Created
August 21, 2014 22:46
-
-
Save maxpowa/eabf394c2bd0dd02c9c4 to your computer and use it in GitHub Desktop.
2d end void effect - credit to @chylex for inspiration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final ResourceLocation texPortalSky = new ResourceLocation("textures/environment/end_sky.png"); | |
private static final ResourceLocation texPortal = new ResourceLocation("textures/entity/end_portal.png"); | |
private static final Random consistentRandom = new Random(31100L); | |
public void drawCenteredEndEffect(int x, int y, int width, int height, float scale) { | |
drawEndEffect(x-(width/2), y-(height/2), width, height, scale); | |
} | |
public void drawEndEffect(int x, int y, int width, int height, float scale) { | |
consistentRandom.setSeed(31100L); | |
Minecraft.getMinecraft().getTextureManager().bindTexture(texPortalSky); | |
float baseScale = 1.0f/scale; | |
GL11.glMatrixMode(GL11.GL_TEXTURE); | |
GL11.glPushMatrix(); | |
GL11.glScalef(4F,4F,1F); | |
GL11.glColor4f(0.1f,0.1f,0.1f,1F); | |
this.drawTexturedModalRect(x, y, 0, 0, width, height); | |
GL11.glPopMatrix(); | |
GL11.glPushMatrix(); | |
GL11.glEnable(GL11.GL_BLEND); | |
GL11.glBlendFunc(GL11.GL_ONE,GL11.GL_ONE); | |
for(int layer = 0; layer < 16; ++layer){ | |
float revLayer = (16-layer), layerMp = 1F+(layer*0.4F), colorMultiplier = 1F/(revLayer+1F); | |
scale = baseScale*0.2F; | |
Minecraft.getMinecraft().getTextureManager().bindTexture(texPortal); | |
GL11.glMatrixMode(GL11.GL_TEXTURE); | |
GL11.glPushMatrix(); | |
GL11.glTranslatef(0F,layerMp*(Minecraft.getSystemTime()%400000L)/400000F,0F); | |
GL11.glScalef(scale,scale,1F); | |
GL11.glRotatef((layer*layer+layer*9)*4F+180F,0F,0F,1F); | |
GL11.glScalef(4F,4F,1F); | |
float red = consistentRandom.nextFloat()*0.5F+0.1F; | |
float green = consistentRandom.nextFloat()*0.5F+0.4F; | |
float blue = consistentRandom.nextFloat()*0.5F+0.5F; | |
GL11.glColor4f(red*colorMultiplier,green*colorMultiplier,blue*colorMultiplier,1F); | |
this.drawTexturedModalRect(x, y, 0, 0, width, height); | |
GL11.glPopMatrix(); | |
} | |
GL11.glPopMatrix(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment