This repository has been archived by the owner on May 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from GTNewHorizons/bees
Render bees inside Mega Apiary
- Loading branch information
Showing
5 changed files
with
124 additions
and
6 deletions.
There are no files selected for viewing
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
100 changes: 100 additions & 0 deletions
100
src/main/java/kubatech/client/effect/MegaApiaryBeesRenderer.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package kubatech.client.effect; | ||
|
||
import static net.minecraft.client.renderer.entity.RenderManager.*; | ||
|
||
import kubatech.api.enums.ItemList; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.particle.EntityFX; | ||
import net.minecraft.client.renderer.OpenGlHelper; | ||
import net.minecraft.client.renderer.Tessellator; | ||
import net.minecraft.client.renderer.entity.RenderItem; | ||
import net.minecraft.client.renderer.texture.TextureMap; | ||
import net.minecraft.util.IIcon; | ||
import net.minecraft.world.World; | ||
import org.lwjgl.opengl.GL11; | ||
import org.lwjgl.opengl.GL12; | ||
|
||
public class MegaApiaryBeesRenderer extends EntityFX { | ||
public MegaApiaryBeesRenderer(World world, double x, double y, double z, int age) { | ||
super(world, x, y + 2, z); | ||
this.particleMaxAge = age; | ||
} | ||
|
||
@Override | ||
public void onUpdate() { | ||
if (this.particleAge++ == this.particleMaxAge) this.setDead(); | ||
if (this.particleAge % 4 == 0) | ||
if (this.particleAge % 8 == 0) this.posY += 0.1; | ||
else this.posY -= 0.1; | ||
} | ||
|
||
@Override | ||
public boolean shouldRenderInPass(int pass) { | ||
return pass == 3; | ||
} | ||
|
||
@Override | ||
public int getFXLayer() { | ||
return 3; | ||
} | ||
|
||
@Override | ||
public void renderParticle( | ||
Tessellator p_70539_1_, | ||
float p_70539_2_, | ||
float p_70539_3_, | ||
float p_70539_4_, | ||
float p_70539_5_, | ||
float p_70539_6_, | ||
float p_70539_7_) { | ||
|
||
GL11.glDisable(GL11.GL_LIGHTING); | ||
GL11.glEnable(GL11.GL_BLEND); | ||
OpenGlHelper.glBlendFunc(770, 771, 1, 0); | ||
|
||
GL11.glPushMatrix(); | ||
GL11.glTranslatef( | ||
(float) (this.posX - renderPosX), (float) (this.posY - renderPosY), (float) (this.posZ - renderPosZ)); | ||
GL11.glEnable(GL12.GL_RESCALE_NORMAL); | ||
GL11.glRotatef(180f, 1f, 0f, 0f); | ||
|
||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationItemsTexture); | ||
|
||
GL11.glDisable(GL11.GL_LIGHTING); | ||
GL11.glEnable(GL11.GL_ALPHA_TEST); | ||
GL11.glEnable(GL11.GL_BLEND); | ||
|
||
GL11.glColor4f(1f, 1f, 1f, 1F); | ||
|
||
IIcon icon = ItemList.Beeeeee.get(1).getIconIndex(); | ||
|
||
GL11.glPushMatrix(); | ||
GL11.glTranslatef(0f, 0f, -4f); | ||
GL11.glScalef(0.1f, 0.1f, 0.1f); | ||
RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); | ||
GL11.glPopMatrix(); | ||
|
||
GL11.glPushMatrix(); | ||
GL11.glTranslatef(1f, 0f, 3f); | ||
GL11.glRotatef(180f, 0f, 1f, 0f); | ||
GL11.glScalef(0.1f, 0.1f, 0.1f); | ||
RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); | ||
GL11.glPopMatrix(); | ||
|
||
GL11.glPushMatrix(); | ||
GL11.glTranslatef(4f, 0f, -1f); | ||
GL11.glRotatef(-90f, 0f, 1f, 0f); | ||
GL11.glScalef(0.1f, 0.1f, 0.1f); | ||
RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); | ||
GL11.glPopMatrix(); | ||
|
||
GL11.glPushMatrix(); | ||
GL11.glTranslatef(-3f, 0f, 1f); | ||
GL11.glRotatef(90f, 0f, 1f, 0f); | ||
GL11.glScalef(0.1f, 0.1f, 0.1f); | ||
RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); | ||
GL11.glPopMatrix(); | ||
|
||
GL11.glPopMatrix(); | ||
} | ||
} |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.