2015-08-29 14:33:25 +02:00
|
|
|
/*
|
2016-05-16 22:52:27 +02:00
|
|
|
* This file ("RenderSmileyCloud.java") is part of the Actually Additions mod for Minecraft.
|
2015-08-29 14:33:25 +02:00
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
2016-05-16 22:52:27 +02:00
|
|
|
* http://ellpeck.de/actaddlicense
|
2015-08-29 14:33:25 +02:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 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;
|
2017-02-14 18:40:45 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.misc.special.RenderSpecial;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
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;
|
2017-02-14 18:18:38 +01:00
|
|
|
import net.minecraft.block.BlockHorizontal;
|
2016-07-04 20:15:41 +02:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
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-12-18 17:28:29 +01:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2017-02-14 18:40:45 +01:00
|
|
|
import java.util.Locale;
|
|
|
|
|
2016-12-18 17:28:29 +01:00
|
|
|
@SideOnly(Side.CLIENT)
|
2016-01-09 17:53:06 +01:00
|
|
|
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
2015-08-23 23:41:46 +02:00
|
|
|
|
|
|
|
@Override
|
2016-05-29 23:49:35 +02: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-08-25 17:59:50 +02:00
|
|
|
|
2016-02-17 23:15:56 +01:00
|
|
|
GlStateManager.pushMatrix();
|
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(theCloud.name != null && !theCloud.name.isEmpty()){
|
2017-02-14 18:40:45 +01:00
|
|
|
boolean renderedEaster = false;
|
|
|
|
|
2016-05-02 17:12:31 +02:00
|
|
|
easterEggs:
|
2016-06-17 23:50:38 +02:00
|
|
|
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF){
|
2016-02-17 23:15:56 +01:00
|
|
|
for(String triggerName : cloud.getTriggerNames()){
|
2016-05-10 18:48:35 +02:00
|
|
|
if(triggerName != null && theCloud.name != null){
|
2016-05-26 13:11:43 +02:00
|
|
|
if(triggerName.equalsIgnoreCase(theCloud.name)){
|
2016-05-10 18:48:35 +02:00
|
|
|
GlStateManager.pushMatrix();
|
2016-07-04 20:15:41 +02:00
|
|
|
IBlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
|
2017-02-14 18:18:38 +01:00
|
|
|
|
|
|
|
switch(state.getValue(BlockHorizontal.FACING)){
|
|
|
|
case NORTH:
|
2016-05-10 18:48:35 +02:00
|
|
|
GlStateManager.rotate(180, 0, 1, 0);
|
|
|
|
break;
|
2017-02-14 18:18:38 +01:00
|
|
|
case EAST:
|
2016-05-10 18:48:35 +02:00
|
|
|
GlStateManager.rotate(270, 0, 1, 0);
|
|
|
|
break;
|
2017-02-14 18:18:38 +01:00
|
|
|
case WEST:
|
2016-05-10 18:48:35 +02:00
|
|
|
GlStateManager.rotate(90, 0, 1, 0);
|
|
|
|
break;
|
|
|
|
}
|
2017-02-14 18:18:38 +01:00
|
|
|
|
2016-05-10 18:48:35 +02:00
|
|
|
cloud.renderExtra(0.0625F);
|
|
|
|
GlStateManager.popMatrix();
|
2017-02-14 18:40:45 +01:00
|
|
|
|
|
|
|
renderedEaster = true;
|
2016-05-10 18:48:35 +02:00
|
|
|
break easterEggs;
|
2015-08-24 17:57:11 +02:00
|
|
|
}
|
2015-10-03 10:16:18 +02:00
|
|
|
}
|
2015-08-24 20:08:14 +02:00
|
|
|
}
|
|
|
|
}
|
2017-02-14 18:40:45 +01:00
|
|
|
|
|
|
|
String nameLower = theCloud.name.toLowerCase(Locale.ROOT);
|
|
|
|
if(SpecialRenderInit.SPECIAL_LIST.containsKey(nameLower)){
|
|
|
|
RenderSpecial render = SpecialRenderInit.SPECIAL_LIST.get(nameLower);
|
|
|
|
if(render != null){
|
|
|
|
GlStateManager.pushMatrix();
|
|
|
|
GlStateManager.translate(0F, renderedEaster ? 0.05F : 0.25F, 0F);
|
|
|
|
GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F);
|
|
|
|
GlStateManager.scale(0.75F, 0.75F, 0.75F);
|
|
|
|
render.render();
|
|
|
|
GlStateManager.popMatrix();
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
|
2017-02-14 18:40:45 +01:00
|
|
|
Minecraft mc = Minecraft.getMinecraft();
|
|
|
|
if(theCloud.name != null && !theCloud.name.isEmpty() && !mc.gameSettings.hideGUI){
|
|
|
|
if(mc.player.getDistanceSq(tile.getPos()) <= 36){
|
|
|
|
AssetUtil.renderNameTag(theCloud.name, x+0.5F, y+1.5F, z+0.5F);
|
|
|
|
}
|
2015-08-23 23:41:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|