mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-14 12:19:10 +01:00
make smiley clouds render special stuff
This commit is contained in:
parent
62255d9ace
commit
4b0d5e4dfc
2 changed files with 45 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.ISmileyCloudEasterEgg;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
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.tile.TileEntitySmileyCloud;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -20,6 +22,8 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,6 +39,8 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
||||||
theCloud.setStatus(theCloud.name != null && !theCloud.name.isEmpty() && theCloud.name.equals("Pink Fluffy Unicloud"));
|
theCloud.setStatus(theCloud.name != null && !theCloud.name.isEmpty() && theCloud.name.equals("Pink Fluffy Unicloud"));
|
||||||
|
|
||||||
if(theCloud.name != null && !theCloud.name.isEmpty()){
|
if(theCloud.name != null && !theCloud.name.isEmpty()){
|
||||||
|
boolean renderedEaster = false;
|
||||||
|
|
||||||
easterEggs:
|
easterEggs:
|
||||||
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF){
|
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF){
|
||||||
for(String triggerName : cloud.getTriggerNames()){
|
for(String triggerName : cloud.getTriggerNames()){
|
||||||
|
@ -55,18 +61,35 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
||||||
}
|
}
|
||||||
cloud.renderExtra(0.0625F);
|
cloud.renderExtra(0.0625F);
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
|
renderedEaster = true;
|
||||||
break easterEggs;
|
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();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
AssetUtil.renderNameTag(theCloud.name, x+0.5F, y+1.5F, z+0.66);
|
if(theCloud.name != null && !theCloud.name.isEmpty() && !mc.gameSettings.hideGUI){
|
||||||
|
if(mc.thePlayer.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){
|
public void render(EntityPlayer player, float partialTicks){
|
||||||
|
if(player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE) || player.isElytraFlying()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
|
||||||
|
Vec3d currentPos = Minecraft.getMinecraft().thePlayer.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(StackUtil.isValid(this.theThingToRender)){
|
||||||
if(player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE) || player.isElytraFlying()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
boolean isBlock = this.theThingToRender.getItem() instanceof ItemBlock;
|
boolean isBlock = this.theThingToRender.getItem() instanceof ItemBlock;
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
|
||||||
Vec3d currentPos = Minecraft.getMinecraft().thePlayer.getPositionEyes(partialTicks);
|
if(isBlock){
|
||||||
Vec3d playerPos = player.getPositionEyes(partialTicks);
|
GlStateManager.translate(0D, -0.1875D, 0D);
|
||||||
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);
|
|
||||||
GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F);
|
GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F);
|
||||||
|
|
||||||
float size = isBlock ? 0.5F : 0.4F;
|
float size = isBlock ? 0.5F : 0.4F;
|
||||||
|
@ -68,5 +79,4 @@ public class RenderSpecial{
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue