GuiOverlayDebug, ItemModelMesher, RenderManager, Stitcher fixed + minor fixes in forge gui classes.

This commit is contained in:
RainWarrior 2016-03-02 15:32:22 +03:00
parent 3fd09af1d3
commit 24b66ff9f3
8 changed files with 61 additions and 63 deletions

View File

@ -1,12 +1,12 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java
@@ -108,6 +108,9 @@
{
BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ);
@@ -190,6 +190,9 @@
long l = j - k;
List<String> list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.getCpu()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GlStateManager.func_187416_u(7936)}), GlStateManager.func_187416_u(7937), GlStateManager.func_187416_u(7938)});
+ list.add("");
+ list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false));
+
if (this.isReducedDebug())
{
return Lists.newArrayList(new String[] {"Minecraft 1.9 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15)})});
return list;

View File

@ -1,14 +1,13 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java
@@ -50,6 +50,11 @@
}
}
@@ -32,7 +32,9 @@
+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel)
+ {
+ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack);
+ }
+
if (ibakedmodel == null)
{
ibakedmodel = this.modelManager.getMissingModel();
public TextureAtlasSprite getParticleIcon(Item item, int meta)
{
- return this.getItemModel(new ItemStack(item, 1, meta)).getParticleTexture();
+ ItemStack stack = new ItemStack(item, 1, meta);
+ IBakedModel model = this.getItemModel(stack);
+ return model.func_188617_f().handleItemState(model, stack, null, null).getParticleTexture();
}
public IBakedModel getItemModel(ItemStack stack)

View File

@ -19,10 +19,10 @@
Block block = iblockstate.getBlock();
- if (block == Blocks.bed)
+ if (block.isBed(worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn))
+ if (block.isBed(iblockstate, worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn))
{
- int i = ((EnumFacing)iblockstate.getValue(BlockBed.field_185512_D)).getHorizontalIndex();
+ int i = block.getBedDirection(worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex();
+ int i = block.getBedDirection(iblockstate, worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex();
this.playerViewY = (float)(i * 90 + 180);
this.playerViewX = 0.0F;
}

View File

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java
@@ -56,12 +56,17 @@
@@ -56,18 +56,24 @@
{
Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]);
Arrays.sort((Object[])astitcher$holder);
@ -18,14 +18,13 @@
throw new StitcherException(stitcher$holder, s);
}
}
@@ -182,6 +187,7 @@
this.stitchSlots.add(stitcher$slot);
return true;
}
this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth);
this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight);
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
}
@SideOnly(Side.CLIENT)
public List<TextureAtlasSprite> getStichSlots()
@@ -238,7 +244,7 @@
public String toString()

View File

@ -40,8 +40,8 @@ import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.util.TextComponentString;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import net.minecraftforge.common.ForgeHooks;
@ -53,7 +53,7 @@ import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.ModContainer.Disableable;
import net.minecraftforge.fml.common.versioning.ComparableVersion;
import static net.minecraft.util.EnumChatFormatting.*;
import static net.minecraft.util.text.TextFormatting.*;
import org.apache.logging.log4j.Level;
@ -524,13 +524,13 @@ public class GuiModList extends GuiScreen
{
GlStateManager.enableBlend();
GuiModList.this.mc.renderEngine.bindTexture(logoPath);
VertexBuffer wr = tess.getVertexBuffer();
VertexBuffer wr = tess.getWorldRenderer();
int offset = (this.left + this.listWidth/2) - (logoDims.width / 2);
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
wr.pos(offset, top + logoDims.height, zLevel).tex(0, 1).endVertex();
wr.pos(offset + logoDims.width, top + logoDims.height, zLevel).tex(1, 1).endVertex();
wr.pos(offset + logoDims.width, top, zLevel).tex(1, 0).endVertex();
wr.pos(offset, top, zLevel).tex(0, 0).endVertex();
wr.pos(offset, top + logoDims.height, zLevel).func_187315_a(0, 1).endVertex();
wr.pos(offset + logoDims.width, top + logoDims.height, zLevel).func_187315_a(1, 1).endVertex();
wr.pos(offset + logoDims.width, top, zLevel).func_187315_a(1, 0).endVertex();
wr.pos(offset, top, zLevel).func_187315_a(0, 0).endVertex();
tess.draw();
GlStateManager.disableBlend();
top += logoDims.height + 10;
@ -570,7 +570,7 @@ public class GuiModList extends GuiScreen
for (ITextComponent part : (Iterable<ITextComponent>)line) {
if (!(part instanceof TextComponentString))
continue;
k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getTextComponentString_TextValue());
k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getChatComponentText_TextValue());
if (k >= x)
{
GuiModList.this.handleComponentClick(part);

View File

@ -263,7 +263,7 @@ public abstract class GuiScrollingList
this.applyScrollLimits();
Tessellator tess = Tessellator.getInstance();
VertexBuffer worldr = tess.getVertexBuffer();
VertexBuffer worldr = tess.getWorldRenderer();
ScaledResolution res = new ScaledResolution(client);
double scaleW = client.displayWidth / res.getScaledWidth_double();
@ -284,10 +284,10 @@ public abstract class GuiScrollingList
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
float scale = 32.0F;
worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldr.pos(this.left, this.bottom, 0.0D).tex(this.left / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex();
worldr.pos(this.right, this.bottom, 0.0D).tex(this.right / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex();
worldr.pos(this.right, this.top, 0.0D).tex(this.right / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex();
worldr.pos(this.left, this.top, 0.0D).tex(this.left / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex();
worldr.pos(this.left, this.bottom, 0.0D).func_187315_a(this.left / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex();
worldr.pos(this.right, this.bottom, 0.0D).func_187315_a(this.right / scale, (this.bottom + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex();
worldr.pos(this.right, this.top, 0.0D).func_187315_a(this.right / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex();
worldr.pos(this.left, this.top, 0.0D).func_187315_a(this.left / scale, (this.top + (int)this.scrollDistance) / scale).color(0x20, 0x20, 0x20, 0xFF).endVertex();
tess.draw();
}
@ -311,14 +311,14 @@ public abstract class GuiScrollingList
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableTexture2D();
worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldr.pos(min, slotTop + slotBuffer + 2, 0).tex(0, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(max, slotTop + slotBuffer + 2, 0).tex(1, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(max, slotTop - 2, 0).tex(1, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(min, slotTop - 2, 0).tex(0, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(min + 1, slotTop + slotBuffer + 1, 0).tex(0, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(max - 1, slotTop + slotBuffer + 1, 0).tex(1, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(max - 1, slotTop - 1, 0).tex(1, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(min + 1, slotTop - 1, 0).tex(0, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(min, slotTop + slotBuffer + 2, 0).func_187315_a(0, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(max, slotTop + slotBuffer + 2, 0).func_187315_a(1, 1).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(max, slotTop - 2, 0).func_187315_a(1, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(min, slotTop - 2, 0).func_187315_a(0, 0).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(min + 1, slotTop + slotBuffer + 1, 0).func_187315_a(0, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(max - 1, slotTop + slotBuffer + 1, 0).func_187315_a(1, 1).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(max - 1, slotTop - 1, 0).func_187315_a(1, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(min + 1, slotTop - 1, 0).func_187315_a(0, 0).color(0x00, 0x00, 0x00, 0xFF).endVertex();
tess.draw();
GlStateManager.enableTexture2D();
}
@ -347,22 +347,22 @@ public abstract class GuiScrollingList
GlStateManager.disableTexture2D();
worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldr.pos(scrollBarLeft, this.bottom, 0.0D).tex(0.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(scrollBarRight, this.bottom, 0.0D).tex(1.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(scrollBarRight, this.top, 0.0D).tex(1.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(scrollBarLeft, this.top, 0.0D).tex(0.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(scrollBarLeft, this.bottom, 0.0D).func_187315_a(0.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(scrollBarRight, this.bottom, 0.0D).func_187315_a(1.0D, 1.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(scrollBarRight, this.top, 0.0D).func_187315_a(1.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex();
worldr.pos(scrollBarLeft, this.top, 0.0D).func_187315_a(0.0D, 0.0D).color(0x00, 0x00, 0x00, 0xFF).endVertex();
tess.draw();
worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldr.pos(scrollBarLeft, barTop + height, 0.0D).tex(0.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(scrollBarRight, barTop + height, 0.0D).tex(1.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(scrollBarRight, barTop, 0.0D).tex(1.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(scrollBarLeft, barTop, 0.0D).tex(0.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(scrollBarLeft, barTop + height, 0.0D).func_187315_a(0.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(scrollBarRight, barTop + height, 0.0D).func_187315_a(1.0D, 1.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(scrollBarRight, barTop, 0.0D).func_187315_a(1.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex();
worldr.pos(scrollBarLeft, barTop, 0.0D).func_187315_a(0.0D, 0.0D).color(0x80, 0x80, 0x80, 0xFF).endVertex();
tess.draw();
worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldr.pos(scrollBarLeft, barTop + height - 1, 0.0D).tex(0.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex();
worldr.pos(scrollBarRight - 1, barTop + height - 1, 0.0D).tex(1.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex();
worldr.pos(scrollBarRight - 1, barTop, 0.0D).tex(1.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex();
worldr.pos(scrollBarLeft, barTop, 0.0D).tex(0.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex();
worldr.pos(scrollBarLeft, barTop + height - 1, 0.0D).func_187315_a(0.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex();
worldr.pos(scrollBarRight - 1, barTop + height - 1, 0.0D).func_187315_a(1.0D, 1.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex();
worldr.pos(scrollBarRight - 1, barTop, 0.0D).func_187315_a(1.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex();
worldr.pos(scrollBarLeft, barTop, 0.0D).func_187315_a(0.0D, 0.0D).color(0xC0, 0xC0, 0xC0, 0xFF).endVertex();
tess.draw();
}
@ -390,7 +390,7 @@ public abstract class GuiScrollingList
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.shadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer VertexBuffer = tessellator.getVertexBuffer();
VertexBuffer VertexBuffer = tessellator.getWorldRenderer();
VertexBuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
VertexBuffer.pos(right, top, 0.0D).color(r1, g1, b1, a1).endVertex();
VertexBuffer.pos(left, top, 0.0D).color(r1, g1, b1, a1).endVertex();

View File

@ -23,7 +23,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.TextComponentString;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;

View File

@ -184,12 +184,12 @@ public class GuiUtils
float uScale = 1f / 0x100;
float vScale = 1f / 0x100;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer wr = tessellator.getVertexBuffer();
VertexBuffer wr = tessellator.getWorldRenderer();
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
wr.pos(x , y + height, zLevel).tex( u * uScale, ((v + height) * vScale)).endVertex();
wr.pos(x + width, y + height, zLevel).tex((u + width) * uScale, ((v + height) * vScale)).endVertex();
wr.pos(x + width, y , zLevel).tex((u + width) * uScale, ( v * vScale)).endVertex();
wr.pos(x , y , zLevel).tex( u * uScale, ( v * vScale)).endVertex();
wr.pos(x , y + height, zLevel).func_187315_a( u * uScale, ((v + height) * vScale)).endVertex();
wr.pos(x + width, y + height, zLevel).func_187315_a((u + width) * uScale, ((v + height) * vScale)).endVertex();
wr.pos(x + width, y , zLevel).func_187315_a((u + width) * uScale, ( v * vScale)).endVertex();
wr.pos(x , y , zLevel).func_187315_a( u * uScale, ( v * vScale)).endVertex();
tessellator.draw();
}