More stuff & special render fix testing

This commit is contained in:
Ellpeck 2016-01-08 23:36:35 +01:00
parent 8f959c92aa
commit 6db479f94e
6 changed files with 31 additions and 26 deletions

View file

@ -1,4 +1,4 @@
ellpeck=ActuallyAdditions:blockMiner@0 ellpeck=ActuallyAdditions:itemBooklet@0
dqmhose=minecraft:torch@0 dqmhose=minecraft:torch@0
twoofeight=ActuallyAdditions:blockHeatCollector@0 twoofeight=ActuallyAdditions:blockHeatCollector@0
larixine=ActuallyAdditions:blockBlackLotus@0 larixine=ActuallyAdditions:blockBlackLotus@0

View file

@ -69,7 +69,7 @@ public class RenderReconstructorLens extends TileEntitySpecialRenderer{
} }
GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.scale(0.5F, 0.5F, 0.5F);
AssetUtil.renderItemInWorld(stack, 0); AssetUtil.renderItemInWorld(stack);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }

View file

@ -385,7 +385,7 @@ public class SmileyCloudEasterEggs{
GlStateManager.translate(-0.5F, 0.2F, leftHand ? 0.55F : -0.5F); GlStateManager.translate(-0.5F, 0.2F, leftHand ? 0.55F : -0.5F);
GlStateManager.scale(0.75F, 0.75F, 0.75F); GlStateManager.scale(0.75F, 0.75F, 0.75F);
AssetUtil.renderItemInWorld(stack, 0); AssetUtil.renderItemInWorld(stack);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }

View file

@ -20,6 +20,7 @@ import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.init.Blocks; 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.Vec3;
import java.util.Calendar; import java.util.Calendar;
@ -32,18 +33,18 @@ public class RenderSpecial{
this.theThingToRender = stack; this.theThingToRender = stack;
} }
public void render(EntityPlayer player){ public void render(EntityPlayer player, float partialTicks){
if(player.isInvisible() || player.isWearing(EnumPlayerModelParts.CAPE)){ if(player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE)){
return; return;
} }
boolean isBlock = this.theThingToRender.getItem() instanceof ItemBlock; boolean isBlock = this.theThingToRender.getItem() instanceof ItemBlock;
float size = isBlock ? 0.3F : 0.4F; float size = isBlock ? 0.5F : 0.6F;
double offsetUp = isBlock ? 0F : 0.2F; double offsetUp = isBlock ? 0F : 0.2F;
if(ClientProxy.pumpkinBlurPumpkinBlur){ if(ClientProxy.pumpkinBlurPumpkinBlur){
this.theThingToRender = new ItemStack(Calendar.getInstance().get(Calendar.DAY_OF_MONTH)%2 == 0 ? Blocks.lit_pumpkin : Blocks.pumpkin); this.theThingToRender = new ItemStack(Calendar.getInstance().get(Calendar.DAY_OF_MONTH)%2 == 0 ? Blocks.lit_pumpkin : Blocks.pumpkin);
size = 0.3F; size = 0.5F;
offsetUp = 0; offsetUp = 0;
} }
@ -56,15 +57,20 @@ public class RenderSpecial{
} }
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate(0D, -0.775D+offsetUp, 0D);
Vec3 currentPos = Minecraft.getMinecraft().thePlayer.getPositionEyes(partialTicks);
Vec3 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(0D, 2.535D+offsetUp, 0D);
GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F); GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F);
GlStateManager.scale(size, size, size); GlStateManager.scale(size, size, size);
if(time-(bobHeight/2) >= lastTimeForBobbing){ if(time-(bobHeight/2) >= lastTimeForBobbing){
GlStateManager.translate(0, (time-this.lastTimeForBobbing)/100, 0); GlStateManager.translate(0D, (time-this.lastTimeForBobbing)/100D, 0D);
} }
else{ else{
GlStateManager.translate(0, -(time-lastTimeForBobbing)/100+bobHeight/100, 0); GlStateManager.translate(0D, -(time-lastTimeForBobbing)/100D+bobHeight/100D, 0D);
} }
GlStateManager.rotate((float)(theTime/20), 0, 1, 0); GlStateManager.rotate((float)(theTime/20), 0, 1, 0);
@ -75,8 +81,8 @@ public class RenderSpecial{
AssetUtil.renderBlockInWorld(Block.getBlockFromItem(this.theThingToRender.getItem()), this.theThingToRender.getItemDamage()); AssetUtil.renderBlockInWorld(Block.getBlockFromItem(this.theThingToRender.getItem()), this.theThingToRender.getItemDamage());
} }
else{ else{
GlStateManager.translate(-0.5F, 0F, 0F); GlStateManager.translate(-0.5D, 0D, 0D);
AssetUtil.renderItemInWorld(this.theThingToRender, 0); AssetUtil.renderItemInWorld(this.theThingToRender);
} }
} }
GlStateManager.enableLighting(); GlStateManager.enableLighting();

View file

@ -68,14 +68,13 @@ public class SpecialRenderInit{
} }
@SubscribeEvent(priority = EventPriority.HIGHEST) @SubscribeEvent(priority = EventPriority.HIGHEST)
//TODO Fix floating item
public void onPlayerRender(RenderPlayerEvent.Pre event){ public void onPlayerRender(RenderPlayerEvent.Pre event){
if(!specialList.isEmpty()){ if(!specialList.isEmpty()){
for(Map.Entry<String, RenderSpecial> entry : specialList.entrySet()){ for(Map.Entry<String, RenderSpecial> entry : specialList.entrySet()){
//Does the player have one of the names from the list? //Does the player have one of the names from the list?
if(StringUtil.equalsToLowerCase(entry.getKey(), event.entityPlayer.getName())){ if(StringUtil.equalsToLowerCase(entry.getKey(), event.entityPlayer.getName())){
//Render the special Item/Block //Render the special Item/Block
entry.getValue().render(event.entityPlayer); entry.getValue().render(event.entityPlayer, event.partialRenderTick);
break; break;
} }
} }

View file

@ -18,6 +18,7 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -53,22 +54,21 @@ public class AssetUtil{
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public static void renderItemInWorld(ItemStack stack, int renderPass){ public static void renderItemInWorld(ItemStack stack){
//TODO Fix rendering items in world GlStateManager.pushMatrix();
/*IIcon icon = stack.getItem().getIcon(stack, renderPass); GlStateManager.disableLighting();
float f = icon.getMinU(); GlStateManager.pushAttrib();
float f1 = icon.getMaxU(); RenderHelper.enableStandardItemLighting();
float f2 = icon.getMinV(); Minecraft.getMinecraft().getRenderItem().renderItem(stack, TransformType.FIXED);
float f3 = icon.getMaxV(); RenderHelper.disableStandardItemLighting();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); GlStateManager.popAttrib();
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F/16F);*/ GlStateManager.enableLighting();
GlStateManager.popMatrix();
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public static void renderBlockInWorld(Block block, int meta){ public static void renderBlockInWorld(Block block, int meta){
//TODO Fix rendering blocks in world renderItemInWorld(new ItemStack(block, 1, meta));
/*Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
RenderBlocks.getInstance().renderBlockAsItem(block, meta, 1F);*/
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)