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 23:15:56 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
2016-02-17 21:45:02 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
2016-02-17 23:15:56 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
2016-02-17 21:45:02 +01:00
|
|
|
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-01-09 17:53:06 +01:00
|
|
|
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
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 23:15:56 +01:00
|
|
|
if(tile instanceof TileEntitySmileyCloud){
|
|
|
|
TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
|
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;
|
|
|
|
}
|
2016-02-17 23:15:56 +01:00
|
|
|
GlStateManager.pushMatrix();
|
2015-08-25 17:59:50 +02:00
|
|
|
|
|
|
|
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-02-17 23:15:56 +01: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 23:15:56 +01:00
|
|
|
if(ClientProxy.bulletForMyValentine || (theCloud.name != null && !theCloud.name.isEmpty() && theCloud.name.equals("Pink Fluffy Unicloud"))){
|
|
|
|
theCloud.setPinkAndFluffy();
|
|
|
|
} else {
|
|
|
|
theCloud.setNormalCloud();
|
|
|
|
}
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2016-02-17 23:15:56 +01: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)){
|
|
|
|
GlStateManager.pushMatrix();
|
|
|
|
switch (PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){
|
|
|
|
case 1: {
|
|
|
|
GlStateManager.rotate(180, 0, 1, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2: {
|
|
|
|
GlStateManager.rotate(270, 0, 1, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3: {
|
|
|
|
GlStateManager.rotate(90, 0, 1, 0);
|
|
|
|
break;
|
|
|
|
}
|
2015-08-24 17:57:11 +02:00
|
|
|
}
|
2016-02-17 23:15:56 +01:00
|
|
|
cloud.renderExtra(0.0625F);
|
|
|
|
GlStateManager.popMatrix();
|
|
|
|
canBreak = true;
|
2015-10-03 10:16:18 +02:00
|
|
|
break;
|
|
|
|
}
|
2015-08-24 20:08:14 +02:00
|
|
|
}
|
2016-02-17 23:15:56 +01:00
|
|
|
if(canBreak){
|
|
|
|
break;
|
|
|
|
}
|
2015-08-24 20:08:14 +02:00
|
|
|
}
|
|
|
|
}
|
2016-01-08 15:21:05 +01:00
|
|
|
GlStateManager.popMatrix();
|
2015-08-24 17:57:11 +02:00
|
|
|
|
2016-02-17 23:15:56 +01:00
|
|
|
if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI) {
|
|
|
|
AssetUtil.renderNameTag(theCloud.name, x + 0.5F, y + 1.3F, z + 0.66);
|
2015-08-23 23:41:46 +02:00
|
|
|
}
|
2016-02-17 23:15:56 +01:00
|
|
|
|
2015-08-23 23:41:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|