mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-21 23:13:28 +01:00
More stuff & special render fix testing
This commit is contained in:
parent
8f959c92aa
commit
6db479f94e
6 changed files with 31 additions and 26 deletions
|
@ -1,4 +1,4 @@
|
|||
ellpeck=ActuallyAdditions:blockMiner@0
|
||||
ellpeck=ActuallyAdditions:itemBooklet@0
|
||||
dqmhose=minecraft:torch@0
|
||||
twoofeight=ActuallyAdditions:blockHeatCollector@0
|
||||
larixine=ActuallyAdditions:blockBlackLotus@0
|
|
@ -69,7 +69,7 @@ public class RenderReconstructorLens extends TileEntitySpecialRenderer{
|
|||
}
|
||||
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
AssetUtil.renderItemInWorld(stack, 0);
|
||||
AssetUtil.renderItemInWorld(stack);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
|
|
@ -385,7 +385,7 @@ public class SmileyCloudEasterEggs{
|
|||
GlStateManager.translate(-0.5F, 0.2F, leftHand ? 0.55F : -0.5F);
|
||||
GlStateManager.scale(0.75F, 0.75F, 0.75F);
|
||||
|
||||
AssetUtil.renderItemInWorld(stack, 0);
|
||||
AssetUtil.renderItemInWorld(stack);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.entity.player.EnumPlayerModelParts;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
|
@ -32,18 +33,18 @@ public class RenderSpecial{
|
|||
this.theThingToRender = stack;
|
||||
}
|
||||
|
||||
public void render(EntityPlayer player){
|
||||
if(player.isInvisible() || player.isWearing(EnumPlayerModelParts.CAPE)){
|
||||
public void render(EntityPlayer player, float partialTicks){
|
||||
if(player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE)){
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if(ClientProxy.pumpkinBlurPumpkinBlur){
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -56,15 +57,20 @@ public class RenderSpecial{
|
|||
}
|
||||
|
||||
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.scale(size, size, size);
|
||||
|
||||
if(time-(bobHeight/2) >= lastTimeForBobbing){
|
||||
GlStateManager.translate(0, (time-this.lastTimeForBobbing)/100, 0);
|
||||
GlStateManager.translate(0D, (time-this.lastTimeForBobbing)/100D, 0D);
|
||||
}
|
||||
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);
|
||||
|
@ -75,8 +81,8 @@ public class RenderSpecial{
|
|||
AssetUtil.renderBlockInWorld(Block.getBlockFromItem(this.theThingToRender.getItem()), this.theThingToRender.getItemDamage());
|
||||
}
|
||||
else{
|
||||
GlStateManager.translate(-0.5F, 0F, 0F);
|
||||
AssetUtil.renderItemInWorld(this.theThingToRender, 0);
|
||||
GlStateManager.translate(-0.5D, 0D, 0D);
|
||||
AssetUtil.renderItemInWorld(this.theThingToRender);
|
||||
}
|
||||
}
|
||||
GlStateManager.enableLighting();
|
||||
|
|
|
@ -68,14 +68,13 @@ public class SpecialRenderInit{
|
|||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
//TODO Fix floating item
|
||||
public void onPlayerRender(RenderPlayerEvent.Pre event){
|
||||
if(!specialList.isEmpty()){
|
||||
for(Map.Entry<String, RenderSpecial> entry : specialList.entrySet()){
|
||||
//Does the player have one of the names from the list?
|
||||
if(StringUtil.equalsToLowerCase(entry.getKey(), event.entityPlayer.getName())){
|
||||
//Render the special Item/Block
|
||||
entry.getValue().render(event.entityPlayer);
|
||||
entry.getValue().render(event.entityPlayer, event.partialRenderTick);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -53,22 +54,21 @@ public class AssetUtil{
|
|||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderItemInWorld(ItemStack stack, int renderPass){
|
||||
//TODO Fix rendering items in world
|
||||
/*IIcon icon = stack.getItem().getIcon(stack, renderPass);
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F/16F);*/
|
||||
public static void renderItemInWorld(ItemStack stack){
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.pushAttrib();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(stack, TransformType.FIXED);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.popAttrib();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderBlockInWorld(Block block, int meta){
|
||||
//TODO Fix rendering blocks in world
|
||||
/*Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
RenderBlocks.getInstance().renderBlockAsItem(block, meta, 1F);*/
|
||||
renderItemInWorld(new ItemStack(block, 1, meta));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
Loading…
Reference in a new issue