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

140 lines
6 KiB
Java
Raw Normal View History

2015-08-29 14:33:25 +02:00
/*
* This file ("RenderSmileyCloud.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
2016-01-03 16:05:51 +01:00
* http://ellpeck.de/actaddlicense/
2015-08-29 14:33:25 +02:00
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2016-01-03 16:05:51 +01:00
* © 2016 Ellpeck
2015-08-29 14:33:25 +02:00
*/
2016-01-05 04:47:35 +01:00
package de.ellpeck.actuallyadditions.mod.blocks.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
//TODO Fix Smiley Cloud
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
//private static final ResourceLocation resLocValentine = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/modelPinkFluffyUnicloud.png");
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int partial){
/*if(!(tile instanceof TileEntitySmileyCloud)){
2015-10-03 10:16:18 +02:00
return;
}
TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
GlStateManager.pushMatrix();
{
2015-10-03 10:16:18 +02:00
if(theCloud.flyHeight == 0){
theCloud.flyHeight = tile.getWorld().rand.nextInt(30)+30;
2015-10-03 10:16:18 +02:00
}
2015-08-25 17:59:50 +02:00
int bobHeight = theCloud.flyHeight;
2015-12-15 21:43:02 +01:00
double theTime = Minecraft.getSystemTime();
double time = theTime/50;
2015-08-25 17:59:50 +02:00
if(time-bobHeight >= theCloud.lastFlyHeight){
theCloud.lastFlyHeight = time;
}
if(time-(bobHeight/2) >= theCloud.lastFlyHeight){
GlStateManager.translate(0, (time-theCloud.lastFlyHeight)/300, 0);
2015-08-25 17:59:50 +02:00
}
else{
GlStateManager.translate(0, -(time-theCloud.lastFlyHeight)/300+(double)bobHeight/300, 0);
2015-08-25 17:59:50 +02:00
}
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.0F, -2F, 0.0F);
GlStateManager.pushMatrix();
{
if(theModel.doesRotate()){
2016-01-08 13:31:58 +01:00
int meta = PosUtil.getMetadata(tile.getPos(), tile.getWorld());
2015-10-03 10:16:18 +02:00
if(meta == 0){
GlStateManager.rotate(180F, 0F, 1F, 0F);
2015-10-03 10:16:18 +02:00
}
if(meta == 1){
GlStateManager.rotate(90F, 0F, 1F, 0F);
2015-10-03 10:16:18 +02:00
}
if(meta == 3){
GlStateManager.rotate(270F, 0F, 1F, 0F);
2015-10-03 10:16:18 +02:00
}
}
2015-11-06 23:22:38 +01:00
if(ClientProxy.bulletForMyValentine || (theCloud.name != null && !theCloud.name.isEmpty() && theCloud.name.equals("Pink Fluffy Unicloud"))){
this.bindTexture(resLocValentine);
}
else{
this.bindTexture(resLoc);
}
theModel.render(0.0625F);
if(theCloud.name != null && !theCloud.name.isEmpty()){
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){
boolean canBreak = false;
for(String triggerName : cloud.getTriggerNames()){
if(StringUtil.equalsToLowerCase(triggerName, theCloud.name)){
cloud.renderExtra(0.0625F);
canBreak = true;
break;
2015-08-24 17:57:11 +02:00
}
}
2015-10-03 10:16:18 +02:00
if(canBreak){
break;
}
}
}
}
GlStateManager.popMatrix();
2015-08-24 17:57:11 +02:00
if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){
GlStateManager.pushMatrix();
{
GlStateManager.translate(0F, 0.1F, 0F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
float f = 1.6F;
float f1 = 0.016666668F*f;
GlStateManager.scale(-f1, -f1, f1);
GlStateManager.disableLighting();
GlStateManager.translate(0.0F, 0F/f1, 0.0F);
GlStateManager.depthMask(false);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
//TODO Fix nameplate with Smiley Cloud
Tessellator tessellator = Tessellator.getInstance();
GlStateManager.glDisable(GlStateManager.GL_TEXTURE_2D);
tessellator.startDrawingQuads();
int i = Minecraft.getMinecraft().fontRendererObj.getStringWidth(theCloud.name)/2;
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
tessellator.addVertex(-i-1, -1.0D, 0.0D);
tessellator.addVertex(-i-1, 8.0D, 0.0D);
tessellator.addVertex(i+1, 8.0D, 0.0D);
tessellator.addVertex(i+1, -1.0D, 0.0D);
tessellator.draw();
GlStateManager.glEnable(GlStateManager.GL_TEXTURE_2D);
GlStateManager.depthMask(true);
Minecraft.getMinecraft().fontRendererObj.drawString(theCloud.name, -Minecraft.getMinecraft().fontRendererObj.getStringWidth(theCloud.name)/2, 0, StringUtil.DECIMAL_COLOR_WHITE);
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.scale(1F/-f1, 1F/-f1, 1F/f1);
}
GlStateManager.popMatrix();
}
}
GlStateManager.popMatrix();
*/
}
}