mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Made Smiley Clouds render special people stuff
This commit is contained in:
parent
a7f3565404
commit
1ef3b268ff
3 changed files with 46 additions and 12 deletions
|
@ -12,6 +12,8 @@ package de.ellpeck.actuallyadditions.mod.blocks.render;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.special.RenderSpecial;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
|
@ -23,6 +25,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
||||
|
||||
|
@ -37,6 +41,8 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
|||
GlStateManager.translate(0.0F, -2F, 0.0F);
|
||||
|
||||
if(theCloud.name != null && !theCloud.name.isEmpty()){
|
||||
boolean renderedEaster = false;
|
||||
|
||||
easterEggs:
|
||||
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF){
|
||||
for(String triggerName : cloud.getTriggerNames()){
|
||||
|
@ -59,18 +65,35 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
|||
|
||||
cloud.renderExtra(0.0625F);
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
renderedEaster = true;
|
||||
break easterEggs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){
|
||||
AssetUtil.renderNameTag(theCloud.name, x+0.5F, y+1.5F, z+0.66);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,19 +29,30 @@ public class RenderSpecial{
|
|||
}
|
||||
|
||||
public void render(EntityPlayer player, float partialTicks){
|
||||
if(player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE) || player.isElytraFlying()){
|
||||
return;
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
Vec3d currentPos = Minecraft.getMinecraft().player.getPositionEyes(partialTicks);
|
||||
Vec3d playerPos = player.getPositionEyes(partialTicks);
|
||||
GlStateManager.translate(playerPos.xCoord-currentPos.xCoord, playerPos.yCoord-currentPos.yCoord, playerPos.zCoord-currentPos.zCoord);
|
||||
GlStateManager.translate(0D, 2.375D-(player.isSneaking() ? 0.125D : 0D), 0D);
|
||||
|
||||
this.render();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public void render(){
|
||||
if(StackUtil.isValid(this.theThingToRender)){
|
||||
if(player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE) || player.isElytraFlying()){
|
||||
return;
|
||||
}
|
||||
boolean isBlock = this.theThingToRender.getItem() instanceof ItemBlock;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
Vec3d currentPos = Minecraft.getMinecraft().player.getPositionEyes(partialTicks);
|
||||
Vec3d playerPos = player.getPositionEyes(partialTicks);
|
||||
GlStateManager.translate(playerPos.xCoord-currentPos.xCoord, playerPos.yCoord-currentPos.yCoord, playerPos.zCoord-currentPos.zCoord);
|
||||
|
||||
GlStateManager.translate(0D, 2.375D-(player.isSneaking() ? 0.125D : 0D)+(isBlock ? 0D : 0.1875D), 0D);
|
||||
if(isBlock){
|
||||
GlStateManager.translate(0D, -0.1875D, 0D);
|
||||
}
|
||||
GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F);
|
||||
|
||||
float size = isBlock ? 0.5F : 0.4F;
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Properties;
|
|||
|
||||
public class SpecialRenderInit{
|
||||
|
||||
private static final HashMap<String, RenderSpecial> SPECIAL_LIST = new HashMap<String, RenderSpecial>();
|
||||
public static final HashMap<String, RenderSpecial> SPECIAL_LIST = new HashMap<String, RenderSpecial>();
|
||||
|
||||
public SpecialRenderInit(){
|
||||
new ThreadSpecialFetcher();
|
||||
|
|
Loading…
Reference in a new issue