mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-29 18:28:34 +01:00
Adjust the special renderer a bit and make it disappear when Elytra flying because it looks stupid
This commit is contained in:
parent
4383c2768e
commit
168d21010b
1 changed files with 12 additions and 24 deletions
|
@ -10,20 +10,15 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.misc.special;
|
package de.ellpeck.actuallyadditions.mod.misc.special;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
public class RenderSpecial{
|
public class RenderSpecial{
|
||||||
|
|
||||||
private final ItemStack theThingToRender;
|
private final ItemStack theThingToRender;
|
||||||
|
@ -33,45 +28,38 @@ public class RenderSpecial{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(EntityPlayer player, float partialTicks){
|
public void render(EntityPlayer player, float partialTicks){
|
||||||
if(player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE)){
|
if(player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE) || player.isElytraFlying()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isBlock = this.theThingToRender.getItem() instanceof ItemBlock;
|
boolean isBlock = this.theThingToRender.getItem() instanceof ItemBlock;
|
||||||
float size = isBlock ? 0.5F : 0.4F;
|
|
||||||
double offsetUp = isBlock ? 0D : 0.1875D;
|
|
||||||
|
|
||||||
double bobHeight = 0.3;
|
|
||||||
double boop = Minecraft.getSystemTime()/1000D;
|
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
|
||||||
Vec3d currentPos = Minecraft.getMinecraft().thePlayer.getPositionEyes(partialTicks);
|
Vec3d currentPos = Minecraft.getMinecraft().thePlayer.getPositionEyes(partialTicks);
|
||||||
Vec3d playerPos = player.getPositionEyes(partialTicks);
|
Vec3d playerPos = player.getPositionEyes(partialTicks);
|
||||||
GlStateManager.translate(playerPos.xCoord-currentPos.xCoord, playerPos.yCoord-currentPos.yCoord-(player.isSneaking() || Minecraft.getMinecraft().thePlayer.isSneaking() ? 0.125D : 0D), playerPos.zCoord-currentPos.zCoord);
|
GlStateManager.translate(playerPos.xCoord-currentPos.xCoord, playerPos.yCoord-currentPos.yCoord, playerPos.zCoord-currentPos.zCoord);
|
||||||
|
|
||||||
GlStateManager.translate(0D, 2.435D+offsetUp, 0D);
|
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;
|
||||||
GlStateManager.scale(size, size, size);
|
GlStateManager.scale(size, size, size);
|
||||||
|
|
||||||
//Make the floaty stuff look nice using sine waves \o/ -xdjackiexd
|
//Make the floaty stuff look nice using sine waves \o/ -xdjackiexd
|
||||||
//Peck edit: What do you mean by "nice" you jackass? >_>
|
//Peck edit: What do you mean by "nice" you jackass? >_>
|
||||||
GlStateManager.translate(0D, Math.sin(boop%(2*Math.PI))*bobHeight, 0D);
|
double boop = Minecraft.getSystemTime()/1000D;
|
||||||
|
GlStateManager.translate(0D, Math.sin(boop%(2*Math.PI))*0.25, 0D);
|
||||||
GlStateManager.rotate((float)(((boop*40D)%360)), 0, 1, 0);
|
GlStateManager.rotate((float)(((boop*40D)%360)), 0, 1, 0);
|
||||||
|
|
||||||
GlStateManager.disableLighting();
|
GlStateManager.disableLighting();
|
||||||
if(this.theThingToRender != null){
|
if(this.theThingToRender != null){
|
||||||
if(isBlock){
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
if(!isBlock){
|
||||||
AssetUtil.renderBlockInWorld(Block.getBlockFromItem(this.theThingToRender.getItem()), this.theThingToRender.getItemDamage());
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
GlStateManager.translate(0D, 0.5D, 0D);
|
GlStateManager.translate(0D, 0.5D, 0D);
|
||||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
|
||||||
AssetUtil.renderItemInWorld(this.theThingToRender);
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||||
|
AssetUtil.renderItemInWorld(this.theThingToRender);
|
||||||
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
GlStateManager.enableLighting();
|
GlStateManager.enableLighting();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue