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;
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2016-02-17 21:45:02 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.client.renderer.GlStateManager;
|
2016-01-09 17:53:06 +01:00
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
2015-08-23 23:41:46 +02:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2016-02-17 21:45:02 +01:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2016-01-09 17:53:06 +01:00
|
|
|
//TODO Fix Smiley Cloud
|
|
|
|
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2016-02-17 21:45:02 +01:00
|
|
|
private static final ResourceLocation resLocValentine = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/modelPinkFluffyUnicloud.png");
|
2015-08-23 23:41:46 +02:00
|
|
|
|
|
|
|
@Override
|
2016-01-07 23:42:42 +01:00
|
|
|
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int partial){
|
2016-02-17 21:45:02 +01:00
|
|
|
if(!(tile instanceof TileEntitySmileyCloud)){
|
2015-10-03 10:16:18 +02:00
|
|
|
return;
|
|
|
|
}
|
2015-08-24 20:08:14 +02:00
|
|
|
TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.pushMatrix();
|
2015-08-24 20:08:14 +02:00
|
|
|
{
|
2015-10-03 10:16:18 +02:00
|
|
|
if(theCloud.flyHeight == 0){
|
2016-01-07 23:42:42 +01:00
|
|
|
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){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.translate(0, (time-theCloud.lastFlyHeight)/300, 0);
|
2015-08-25 17:59:50 +02:00
|
|
|
}
|
|
|
|
else{
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.translate(0, -(time-theCloud.lastFlyHeight)/300+(double)bobHeight/300, 0);
|
2015-08-25 17:59:50 +02:00
|
|
|
}
|
|
|
|
|
2016-01-08 15:21:05 +01: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);
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2016-02-17 21:45:02 +01:00
|
|
|
/*
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.pushMatrix();
|
2015-08-24 20:08:14 +02:00
|
|
|
{
|
|
|
|
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){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
2015-10-03 10:16:18 +02:00
|
|
|
}
|
|
|
|
if(meta == 1){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
2015-10-03 10:16:18 +02:00
|
|
|
}
|
|
|
|
if(meta == 3){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
2015-10-03 10:16:18 +02:00
|
|
|
}
|
2015-08-24 20:08:14 +02:00
|
|
|
}
|
2015-08-23 23:41:46 +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);
|
|
|
|
}
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2015-08-24 20:08:14 +02:00
|
|
|
theModel.render(0.0625F);
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2015-08-24 20:08:14 +02:00
|
|
|
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-08-24 20:08:14 +02:00
|
|
|
}
|
2015-10-03 10:16:18 +02:00
|
|
|
if(canBreak){
|
|
|
|
break;
|
|
|
|
}
|
2015-08-24 20:08:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.popMatrix();
|
2016-02-17 21:45:02 +01:00
|
|
|
*/
|
2015-08-24 17:57:11 +02:00
|
|
|
|
2015-08-24 20:08:14 +02:00
|
|
|
if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.pushMatrix();
|
2015-08-24 20:08:14 +02:00
|
|
|
{
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.translate(0F, 0.1F, 0F);
|
|
|
|
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
|
|
|
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
|
|
|
|
GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
|
2015-08-24 20:08:14 +02:00
|
|
|
float f = 1.6F;
|
|
|
|
float f1 = 0.016666668F*f;
|
2016-01-08 15:21:05 +01:00
|
|
|
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);
|
2016-02-17 21:45:02 +01:00
|
|
|
/*
|
2016-01-07 23:42:42 +01:00
|
|
|
//TODO Fix nameplate with Smiley Cloud
|
2016-02-17 21:45:02 +01:00
|
|
|
WorldRenderer tessy = Tessellator.getInstance().getWorldRenderer();
|
|
|
|
//GlStateManager.disable(GlStateManager.GL_TEXTURE_2D);
|
|
|
|
tessy.st
|
2016-01-07 23:42:42 +01:00
|
|
|
int i = Minecraft.getMinecraft().fontRendererObj.getStringWidth(theCloud.name)/2;
|
2015-08-24 20:08:14 +02:00
|
|
|
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();
|
2016-01-09 17:53:06 +01:00
|
|
|
GlStateManager.glEnable(GlStateManager.GL_TEXTURE_2D);
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.depthMask(true);
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2016-01-07 23:42:42 +01:00
|
|
|
Minecraft.getMinecraft().fontRendererObj.drawString(theCloud.name, -Minecraft.getMinecraft().fontRendererObj.getStringWidth(theCloud.name)/2, 0, StringUtil.DECIMAL_COLOR_WHITE);
|
2015-08-24 20:08:14 +02:00
|
|
|
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.enableLighting();
|
|
|
|
GlStateManager.disableBlend();
|
|
|
|
GlStateManager.color(1F, 1F, 1F, 1F);
|
|
|
|
GlStateManager.scale(1F/-f1, 1F/-f1, 1F/f1);
|
2016-02-17 21:45:02 +01:00
|
|
|
*/
|
2015-08-23 23:41:46 +02:00
|
|
|
}
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.popMatrix();
|
2015-08-23 23:41:46 +02:00
|
|
|
}
|
|
|
|
}
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.popMatrix();
|
2015-08-23 23:41:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|