ActuallyAdditions/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderSmileyCloud.java

59 lines
2 KiB
Java

package ellpeck.actuallyadditions.blocks.render;
import ellpeck.actuallyadditions.gadget.cloud.ISmileyCloudEasterEgg;
import ellpeck.actuallyadditions.gadget.cloud.SmileyCloudEasterEggs;
import ellpeck.actuallyadditions.tile.TileEntitySmileyCloud;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import java.util.Objects;
public class RenderSmileyCloud extends RenderTileEntity{
public RenderSmileyCloud(ModelBaseAA model){
super(model);
}
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
GL11.glPushMatrix();
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
if(theModel.doesRotate()){
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
if(meta == 0) GL11.glRotatef(180F, 0F, 1F, 0F);
if(meta == 1) GL11.glRotatef(90F, 0F, 1F, 0F);
if(meta == 3) GL11.glRotatef(270F, 0F, 1F, 0F);
}
this.bindTexture(resLoc);
if(tile instanceof TileEntitySmileyCloud){
boolean hasRendered = false;
TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
if(theCloud.name != null && !theCloud.name.isEmpty()){
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){
if(Objects.equals(cloud.getTriggerName(), theCloud.name)){
if(cloud.shouldRenderOriginal()){
theModel.render(0.0625F);
}
//this.bindTexture(cloud.getResLoc());
cloud.renderExtra(0.0625F);
hasRendered = true;
break;
}
}
}
if(!hasRendered) theModel.render(0.0625F);
}
GL11.glPopMatrix();
}
}