ItemRenderer, RenderGlobal, StateMap, RenderItem rejects updated.

This commit is contained in:
RainWarrior 2015-11-12 19:12:58 +03:00
parent 9deb54b75f
commit 8000e22830
8 changed files with 114 additions and 158 deletions

View file

@ -13,7 +13,7 @@
if (iblockstate.getBlock().getRenderType() != -1) if (iblockstate.getBlock().getRenderType() != -1)
{ {
+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, blockpos)) + if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, new BlockPos(this.mc.thePlayer)))
this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate));
} }
} }
@ -35,10 +35,10 @@
{ {
if (!this.itemToRender.getIsItemStackEqual(itemstack)) if (!this.itemToRender.getIsItemStackEqual(itemstack))
{ {
+ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayersp.inventory.currentItem)) + if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayer.inventory.currentItem))
+ { + {
+ this.itemToRender = itemstack; + this.itemToRender = itemstack;
+ this.equippedItemSlot = entityplayersp.inventory.currentItem; + this.equippedItemSlot = entityplayer.inventory.currentItem;
+ return; + return;
+ } + }
flag = true; flag = true;

View file

@ -11,7 +11,77 @@
--this.renderEntitiesStartupCounter; --this.renderEntitiesStartupCounter;
} }
else else
@@ -1162,6 +1164,12 @@ @@ -538,9 +540,12 @@
this.theWorld.theProfiler.startSection("prepare");
TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks);
this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks);
+ if(pass == 0)
+ {
this.countEntitiesTotal = 0;
this.countEntitiesRendered = 0;
this.countEntitiesHidden = 0;
+ }
Entity entity = this.mc.getRenderViewEntity();
double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
@@ -552,11 +557,15 @@
this.mc.entityRenderer.enableLightmap();
this.theWorld.theProfiler.endStartSection("global");
List<Entity> list = this.theWorld.getLoadedEntityList();
+ if (pass == 0)
+ {
this.countEntitiesTotal = list.size();
+ }
for (int i = 0; i < this.theWorld.weatherEffects.size(); ++i)
{
Entity entity1 = (Entity)this.theWorld.weatherEffects.get(i);
+ if (!entity1.shouldRenderInPass(pass)) continue;
++this.countEntitiesRendered;
if (entity1.isInRangeToRender3d(d0, d1, d2))
@@ -578,6 +587,7 @@
for (int j = 0; j < list.size(); ++j)
{
Entity entity3 = (Entity)list.get(j);
+ if (!entity3.shouldRenderInPass(pass)) continue;
boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping();
boolean flag1 = entity3.isInRangeToRender3d(d0, d1, d2) && (entity3.ignoreFrustumCheck || p_180446_2_.isBoundingBoxInFrustum(entity3.getEntityBoundingBox()) || entity3.riddenByEntity == this.mc.thePlayer) && entity3 instanceof EntityPlayer;
@@ -627,6 +637,7 @@
}
entity2 = (Entity)iterator.next();
+ if (!entity2.shouldRenderInPass(pass)) continue;
flag2 = this.renderManager.shouldRender(entity2, p_180446_2_, d0, d1, d2) || entity2.riddenByEntity == this.mc.thePlayer;
if (!flag2)
@@ -663,6 +674,7 @@
{
for (TileEntity tileentity2 : list1)
{
+ if (!tileentity2.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity2.getRenderBoundingBox())) continue;
TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, -1);
}
}
@@ -672,6 +684,7 @@
{
for (TileEntity tileentity : this.field_181024_n)
{
+ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue;
TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1);
}
}
@@ -701,7 +714,7 @@
Block block = this.theWorld.getBlockState(blockpos).getBlock();
- if (tileentity1 != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull))
+ if (tileentity1 != null && tileentity1.shouldRenderInPass(pass) && tileentity1.canRenderBreaking() && p_180446_2_.isBoundingBoxInFrustum(tileentity1.getRenderBoundingBox()))
{
TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage());
}
@@ -1162,6 +1175,12 @@
public void renderSky(float partialTicks, int pass) public void renderSky(float partialTicks, int pass)
{ {
@ -24,7 +94,7 @@
if (this.mc.theWorld.provider.getDimensionId() == 1) if (this.mc.theWorld.provider.getDimensionId() == 1)
{ {
this.renderSkyEnd(); this.renderSkyEnd();
@@ -1379,6 +1387,12 @@ @@ -1379,6 +1398,12 @@
public void renderClouds(float p_180447_1_, int p_180447_2_) public void renderClouds(float p_180447_1_, int p_180447_2_)
{ {
@ -37,7 +107,7 @@
if (this.mc.theWorld.provider.isSurfaceWorld()) if (this.mc.theWorld.provider.isSurfaceWorld())
{ {
if (this.mc.gameSettings.func_181147_e() == 2) if (this.mc.gameSettings.func_181147_e() == 2)
@@ -1794,8 +1808,11 @@ @@ -1794,8 +1819,11 @@
double d4 = (double)blockpos.getY() - d1; double d4 = (double)blockpos.getY() - d1;
double d5 = (double)blockpos.getZ() - d2; double d5 = (double)blockpos.getZ() - d2;
Block block = this.theWorld.getBlockState(blockpos).getBlock(); Block block = this.theWorld.getBlockState(blockpos).getBlock();
@ -50,7 +120,7 @@
{ {
if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)
{ {
@@ -1950,13 +1967,16 @@ @@ -1950,13 +1978,16 @@
if (recordName != null) if (recordName != null)
{ {
ItemRecord itemrecord = ItemRecord.getRecord(recordName); ItemRecord itemrecord = ItemRecord.getRecord(recordName);

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java
@@ -39,7 +39,7 @@
}
else
{
- s = ((IProperty)this.property).getName((Comparable)map.remove(this.property));
+ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(p_178132_1_.getBlock())).getResourceDomain(), ((IProperty)this.property).getName((Comparable)map.remove(this.property)));
}
if (this.suffix != null)

View file

@ -24,7 +24,7 @@
} }
+ else + else
+ { + {
+ // TODO: add back getModel; maybe switch to the smart player model / normal smart item model? + // TODO: maybe switch to the smart player model / normal smart item model?
+ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); + modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount());
+ } + }
@ -56,7 +56,31 @@
this.renderItem(stack, ibakedmodel); this.renderItem(stack, ibakedmodel);
GlStateManager.disableAlpha(); GlStateManager.disableAlpha();
GlStateManager.disableRescaleNormal(); GlStateManager.disableRescaleNormal();
@@ -1048,6 +1048,7 @@ @@ -464,10 +464,11 @@
GlStateManager.enableDepth();
}
- if (stack.isItemDamaged())
+ if (stack.getItem().showDurabilityBar(stack))
{
- int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage());
- int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage());
+ double health = stack.getItem().getDurabilityForDisplay(stack);
+ int j = (int)Math.round(13.0D - health * 13.0D);
+ int i = (int)Math.round(255.0D - health * 255.0D);
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
@@ -478,7 +479,7 @@
this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255);
this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255);
- GlStateManager.enableBlend();
+ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line.
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
@@ -1048,6 +1049,7 @@
this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block");
this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block");
this.registerBlock(Blocks.dragon_egg, "dragon_egg"); this.registerBlock(Blocks.dragon_egg, "dragon_egg");

View file

@ -1,21 +0,0 @@
++++ REJECTED PATCH 2
if (this.mc.thePlayer.isEntityInsideOpaqueBlock())
{
- IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer));
+ BlockPos blockpos = new BlockPos(this.mc.thePlayer);
+ IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos);
EntityPlayerSP entityplayersp = this.mc.thePlayer;
for (int i = 0; i < 8; ++i)
++++ END PATCH
++++ REJECTED PATCH 3
double d0 = entityplayersp.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F);
double d1 = entityplayersp.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F);
double d2 = entityplayersp.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F);
- BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2);
+ blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2);
IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos);
if (iblockstate1.getBlock().isVisuallyOpaque())
++++ END PATCH

View file

@ -1,70 +0,0 @@
++++ REJECTED PATCH 2
this.theWorld.theProfiler.startSection("prepare");
TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks);
this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks);
+ if (pass == 0) // no indentation to shrink patch
+ {
this.countEntitiesTotal = 0;
this.countEntitiesRendered = 0;
this.countEntitiesHidden = 0;
+ }
Entity entity1 = this.mc.getRenderViewEntity();
double d3 = entity1.lastTickPosX + (entity1.posX - entity1.lastTickPosX) * (double)partialTicks;
double d4 = entity1.lastTickPosY + (entity1.posY - entity1.lastTickPosY) * (double)partialTicks;
++++ END PATCH
++++ REJECTED PATCH 3
this.mc.entityRenderer.enableLightmap();
this.theWorld.theProfiler.endStartSection("global");
List list = this.theWorld.getLoadedEntityList();
+ if (pass == 0) // no indentation to shrink patch
+ {
this.countEntitiesTotal = list.size();
+ }
int i;
Entity entity2;
for (i = 0; i < this.theWorld.weatherEffects.size(); ++i)
{
entity2 = (Entity)this.theWorld.weatherEffects.get(i);
+ if (!entity2.shouldRenderInPass(pass)) continue;
++this.countEntitiesRendered;
if (entity2.isInRangeToRender3d(d0, d1, d2))
++++ END PATCH
++++ REJECTED PATCH 4
for (i = 0; i < list.size(); ++i)
{
entity2 = (Entity)list.get(i);
+ if (!entity2.shouldRenderInPass(pass)) continue;
boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping();
boolean flag1 = entity2.isInRangeToRender3d(d0, d1, d2) && (entity2.ignoreFrustumCheck || p_180446_2_.isBoundingBoxInFrustum(entity2.getEntityBoundingBox()) || entity2.riddenByEntity == this.mc.thePlayer) && entity2 instanceof EntityPlayer;
++++ END PATCH
++++ REJECTED PATCH 5
while (iterator2.hasNext())
{
Entity entity3 = (Entity)iterator2.next();
+ if (!entity3.shouldRenderInPass(pass)) continue;
boolean flag2 = this.renderManager.shouldRender(entity3, p_180446_2_, d0, d1, d2) || entity3.riddenByEntity == this.mc.thePlayer;
if (flag2)
++++ END PATCH
++++ REJECTED PATCH 6
while (iterator1.hasNext())
{
tileentity = (TileEntity)iterator1.next();
+ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue;
TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1);
}
}
++++ END PATCH
++++ REJECTED PATCH 7
Block block = this.theWorld.getBlockState(blockpos).getBlock();
- if (tileentity != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull))
+ if (tileentity != null && tileentity.shouldRenderInPass(pass) && tileentity.canRenderBreaking() && p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox()))
{
TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, destroyblockprogress.getPartialBlockDamage());
}
++++ END PATCH

View file

@ -1,10 +0,0 @@
++++ REJECTED PATCH 1
}
else
{
- s = this.property.getName((Comparable)linkedhashmap.remove(this.property));
+ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(p_178132_1_.getBlock())).getResourceDomain(), this.property.getName((Comparable)linkedhashmap.remove(this.property)));
}
if (this.suffix != null)
++++ END PATCH

View file

@ -1,48 +0,0 @@
++++ REJECTED PATCH 7
GlStateManager.enableDepth();
}
- if (stack.isItemDamaged())
+ if (stack.getItem().showDurabilityBar(stack))
{
- int j1 = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage());
- int k = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage());
+ double health = stack.getItem().getDurabilityForDisplay(stack);
+ int j1 = (int)Math.round(13.0D - health * 13.0D);
+ int k = (int)Math.round(255.0D - health * 255.0D);
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
++++ END PATCH
++++ REJECTED PATCH 8
this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0);
this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, i1);
this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, j1, 1, l);
- GlStateManager.enableBlend();
+ //GlStateManager.enableBlend(); // Forge: Disable Bled because it screws with a lot of things down the line.
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
++++ END PATCH
++++ REJECTED PATCH 9
public void onResourceManagerReload(IResourceManager resourceManager)
{
this.itemModelMesher.rebuildCache();
}
+ /*==================================== FORGE START ===========================================* /
+ private static RenderItem instance;
+ /**
+ * Returns a single lazy loaded instance of RenderItem, for use in mods who
+ * don't care about the interaction of other objects on the current state of the RenderItem they are using.
+ * @return A global instance of RenderItem
+ * /
+ public static RenderItem getInstance()
+ {
+ if (instance == null) instance = new RenderItem();
+ return instance;
+ }
+ /*==================================== FORGE END =============================================*/
@SideOnly(Side.CLIENT)
++++ END PATCH