Update to 1.15

Due to the massive rendering changes, certain features, such as emissive item rendering and the forge block rendering/lighting pipeline are currently disabled.

Co-authored-by: David Quintana <[email protected]>
Co-authored-by: tterrag <[email protected]>
Co-authored-by: Unnoen <[email protected]>
This commit is contained in:
authored and David Quintana committed 2019-12-17 03:38:12 +01:00
1 parent 9e5ecaaf75
commit 1933d05e36
565 files changed
+11114 -13142

No files matched your search

@@ -38,6 +38,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.ClientResourcePackInfo;
@@ -93,7 +94,7 @@ public class ClientModLoader
SidedProvider.setClient(()->minecraft);
LogicalSidedProvider.setClient(()->minecraft);
LanguageHook.loadForgeAndMCLangs();
earlyLoaderGUI = new EarlyLoaderGUI(minecraft.mainWindow);
earlyLoaderGUI = new EarlyLoaderGUI(minecraft.func_228018_at_());
createRunnableWithCatch(() -> ModLoader.get().gatherAndInitializeMods(earlyLoaderGUI::renderTick)).run();
ResourcePackLoader.loadResourcePacks(defaultResourcePacks, ClientModLoader::buildPackFinder);
mcResourceManager.addReloadListener(ClientModLoader::onreload);
@@ -152,8 +153,8 @@ public class ClientModLoader
public static boolean completeModLoading()
{
GlStateManager.disableTexture();
GlStateManager.enableTexture();
RenderSystem.disableTexture();
RenderSystem.enableTexture();
List<ModLoadingWarning> warnings = ModLoader.get().getWarnings();
boolean showWarnings = true;
try {
@@ -215,7 +216,7 @@ public class ClientModLoader
hiddenPacks.add(e.getValue());
}
}
final T packInfo = ResourcePackInfo.createResourcePack("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources",
final T packInfo = ResourcePackInfo.createResourcePack("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources",
new PackMetadataSection(new TranslationTextComponent("fml.resources.modresources", hiddenPacks.size()), 4),
hiddenPacks), factory, ResourcePackInfo.Priority.BOTTOM);
packList.put("mod_resources", packInfo);
@@ -20,6 +20,8 @@
package net.minecraftforge.fml.client;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.util.math.MathHelper;
@@ -41,9 +43,9 @@ public class EarlyLoaderGUI {
public EarlyLoaderGUI(final MainWindow window) {
this.window = window;
GlStateManager.clearColor(1.0f, 1.0f, 1.0f, 1.0f);
GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC);
window.update(false);
RenderSystem.clearColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC);
window.update();
}
public void handleElsewhere() {
@@ -59,11 +61,10 @@ public class EarlyLoaderGUI {
int guiScale = window.calcGuiScale(0, false);
window.setGuiScale(guiScale);
GlStateManager.clearColor(1.0f, 1.0f, 1.0f, 1.0f);
GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC);
window.loadGUIRenderMatrix(Minecraft.IS_RUNNING_ON_MAC);
RenderSystem.clearColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC);
renderMessages();
window.update(false);
window.update();
}
private void renderMessages() {
@@ -94,20 +95,20 @@ public class EarlyLoaderGUI {
}
void renderMessage(final String message, final float[] colour, int line, float alpha) {
GlStateManager.enableClientState(GL11.GL_VERTEX_ARRAY);
GlStateManager.func_227770_y_(GL11.GL_VERTEX_ARRAY);
ByteBuffer charBuffer = MemoryUtil.memAlloc(message.length() * 270);
int quads = STBEasyFont.stb_easy_font_print(0, 0, message, null, charBuffer);
GlStateManager.vertexPointer(2, GL11.GL_FLOAT, 16, charBuffer);
GL14.glVertexPointer(2, GL11.GL_FLOAT, 16, charBuffer);
GlStateManager.enableBlend();
RenderSystem.enableBlend();
GL14.glBlendColor(0,0,0, alpha);
GlStateManager.blendFunc(GlStateManager.SourceFactor.CONSTANT_ALPHA, GlStateManager.DestFactor.ONE_MINUS_CONSTANT_ALPHA);
GlStateManager.color3f(colour[0],colour[1],colour[2]);
GlStateManager.pushMatrix();
GlStateManager.translatef(10, line * 10, 0);
GlStateManager.scalef(1, 1, 0);
GlStateManager.drawArrays(GL11.GL_QUADS, 0, quads * 4);
GlStateManager.popMatrix();
RenderSystem.blendFunc(GlStateManager.SourceFactor.CONSTANT_ALPHA, GlStateManager.DestFactor.ONE_MINUS_CONSTANT_ALPHA);
RenderSystem.color3f(colour[0],colour[1],colour[2]);
RenderSystem.pushMatrix();
RenderSystem.translatef(10, line * 10, 0);
RenderSystem.scalef(1, 1, 0);
RenderSystem.drawArrays(GL11.GL_QUADS, 0, quads * 4);
RenderSystem.popMatrix();
MemoryUtil.memFree(charBuffer);
}
@@ -20,11 +20,8 @@
package net.minecraftforge.fml.client.config;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.gui.widget.button.Button.IPressable;
/**
* This class provides a button that fixes several bugs present in the vanilla GuiButton drawing code.
* The gist of it is that it allows buttons of any size without gaps in the graphics and with the
@@ -53,7 +50,7 @@ public class GuiButtonExt extends Button
Minecraft mc = Minecraft.getInstance();
this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int k = this.getYImage(this.isHovered);
GuiUtils.drawContinuousTexturedBox(WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.blitOffset);
GuiUtils.drawContinuousTexturedBox(WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
this.renderBg(mc, mouseX, mouseY);
int color = 14737632;
@@ -23,8 +23,6 @@ import net.minecraft.client.Minecraft;
import javax.annotation.Nullable;
import net.minecraft.client.gui.widget.button.Button.IPressable;
/**
* This class is blatantly stolen from iChunUtils with permission.
*
@@ -116,7 +114,7 @@ public class GuiSlider extends GuiButtonExt
updateSlider();
}
GuiUtils.drawContinuousTexturedBox(WIDGETS_LOCATION, this.x + (int)(this.sliderValue * (float)(this.width - 8)), this.y, 0, 66, 8, this.height, 200, 20, 2, 3, 2, 2, this.blitOffset);
GuiUtils.drawContinuousTexturedBox(WIDGETS_LOCATION, this.x + (int)(this.sliderValue * (float)(this.width - 8)), this.y, 0, 66, 8, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
}
}
@@ -19,13 +19,11 @@
package net.minecraftforge.fml.client.config;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.gui.widget.button.Button.IPressable;
/**
* This class provides a button that shows a string glyph at the beginning. The glyph can be scaled using the glyphScale parameter.
*
@@ -51,7 +49,7 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt
Minecraft mc = Minecraft.getInstance();
this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int k = this.getYImage(this.isHovered);
GuiUtils.drawContinuousTexturedBox(Button.WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.blitOffset);
GuiUtils.drawContinuousTexturedBox(Button.WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
this.renderBg(mc, mouseX, mouseY);
String buttonText = this.getMessage();
@@ -66,12 +64,12 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt
strWidth = mc.fontRenderer.getStringWidth(buttonText);
totalWidth = glyphWidth + strWidth;
GlStateManager.pushMatrix();
GlStateManager.scalef(glyphScale, glyphScale, 1.0F);
RenderSystem.pushMatrix();
RenderSystem.scalef(glyphScale, glyphScale, 1.0F);
this.drawCenteredString(mc.fontRenderer, glyph,
(int) (((this.x + (this.width / 2) - (strWidth / 2)) / glyphScale) - (glyphWidth / (2 * glyphScale)) + 2),
(int) (((this.y + ((this.height - 8) / glyphScale) / 2) - 1) / glyphScale), getFGColor());
GlStateManager.popMatrix();
RenderSystem.popMatrix();
this.drawCenteredString(mc.fontRenderer, buttonText, (int) (this.x + (this.width / 2) + (glyphWidth / glyphScale)),
this.y + (this.height - 8) / 2, getFGColor());
@@ -22,9 +22,10 @@ package net.minecraftforge.fml.client.config;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -33,7 +34,8 @@ import net.minecraftforge.common.MinecraftForge;
import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import java.util.ArrayList;
import java.util.List;
@@ -153,9 +155,9 @@ public class GuiUtils
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
{
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.enableBlend();
GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.enableBlend();
RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
int fillerWidth = textureWidth - leftBorder - rightBorder;
int fillerHeight = textureHeight - topBorder - bottomBorder;
@@ -206,10 +208,10 @@ public class GuiUtils
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder wr = tessellator.getBuffer();
wr.begin(GL11.GL_QUADS, 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.func_225582_a_(x , y + height, zLevel).func_225583_a_( u * uScale, ((v + height) * vScale)).endVertex();
wr.func_225582_a_(x + width, y + height, zLevel).func_225583_a_((u + width) * uScale, ((v + height) * vScale)).endVertex();
wr.func_225582_a_(x + width, y , zLevel).func_225583_a_((u + width) * uScale, ( v * vScale)).endVertex();
wr.func_225582_a_(x , y , zLevel).func_225583_a_( u * uScale, ( v * vScale)).endVertex();
tessellator.draw();
}
@@ -264,9 +266,8 @@ public class GuiUtils
if (!textLines.isEmpty())
{
RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font);
if (MinecraftForge.EVENT_BUS.post(event)) {
if (MinecraftForge.EVENT_BUS.post(event))
return;
}
mouseX = event.getX();
mouseY = event.getY();
screenWidth = event.getScreenWidth();
@@ -274,20 +275,15 @@ public class GuiUtils
maxTextWidth = event.getMaxWidth();
font = event.getFontRenderer();
GlStateManager.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableDepthTest();
RenderSystem.disableRescaleNormal();
RenderSystem.disableDepthTest();
int tooltipTextWidth = 0;
for (String textLine : textLines)
{
int textLineWidth = font.getStringWidth(textLine);
if (textLineWidth > tooltipTextWidth)
{
tooltipTextWidth = textLineWidth;
}
}
boolean needsWrap = false;
@@ -300,13 +296,9 @@ public class GuiUtils
if (tooltipX < 4) // if the tooltip doesn't fit on the screen
{
if (mouseX > screenWidth / 2)
{
tooltipTextWidth = mouseX - 12 - 8;
}
else
{
tooltipTextWidth = screenWidth - 16 - mouseX;
}
needsWrap = true;
}
}
@@ -326,17 +318,13 @@ public class GuiUtils
String textLine = textLines.get(i);
List<String> wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth);
if (i == 0)
{
titleLinesCount = wrappedLine.size();
}
for (String line : wrappedLine)
{
int lineWidth = font.getStringWidth(line);
if (lineWidth > wrappedTooltipWidth)
{
wrappedTooltipWidth = lineWidth;
}
wrappedTextLines.add(line);
}
}
@@ -344,13 +332,9 @@ public class GuiUtils
textLines = wrappedTextLines;
if (mouseX > screenWidth / 2)
{
tooltipX = mouseX - 16 - tooltipTextWidth;
}
else
{
tooltipX = mouseX + 12;
}
}
int tooltipY = mouseY - 12;
@@ -359,19 +343,14 @@ public class GuiUtils
if (textLines.size() > 1)
{
tooltipHeight += (textLines.size() - 1) * 10;
if (textLines.size() > titleLinesCount) {
if (textLines.size() > titleLinesCount)
tooltipHeight += 2; // gap between title lines and next lines
}
}
if (tooltipY < 4)
{
tooltipY = 4;
}
else if (tooltipY + tooltipHeight + 4 > screenHeight)
{
tooltipY = screenHeight - tooltipHeight - 4;
}
final int zLevel = 300;
int backgroundColor = 0xF0100010;
@@ -382,6 +361,7 @@ public class GuiUtils
backgroundColor = colorEvent.getBackground();
borderColorStart = colorEvent.getBorderStart();
borderColorEnd = colorEvent.getBorderEnd();
drawGradientRect(zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor);
drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor);
drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
@@ -393,27 +373,32 @@ public class GuiUtils
drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd);
MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostBackground(stack, textLines, tooltipX, tooltipY, font, tooltipTextWidth, tooltipHeight));
IRenderTypeBuffer.Impl renderType = IRenderTypeBuffer.func_228455_a_(Tessellator.getInstance().getBuffer());
MatrixStack textStack = new MatrixStack();
textStack.func_227861_a_(0.0D, 0.0D, (double)zLevel);
Matrix4f textLocation = textStack.func_227866_c_().func_227870_a_();
int tooltipTop = tooltipY;
for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber)
{
String line = textLines.get(lineNumber);
font.drawStringWithShadow(line, (float)tooltipX, (float)tooltipY, -1);
if (line != null)
font.func_228079_a_(line, (float)tooltipX, (float)tooltipY, -1, true, textLocation, renderType, false, 0, 15728880);
if (lineNumber + 1 == titleLinesCount)
{
tooltipY += 2;
}
tooltipY += 10;
}
renderType.func_228461_a_();
MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, textLines, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight));
GlStateManager.enableLighting();
GlStateManager.enableDepthTest();
RenderHelper.enableStandardItemLighting();
GlStateManager.enableRescaleNormal();
RenderSystem.enableDepthTest();
RenderSystem.enableRescaleNormal();
}
}
@@ -428,25 +413,25 @@ public class GuiUtils
float endGreen = (float)(endColor >> 8 & 255) / 255.0F;
float endBlue = (float)(endColor & 255) / 255.0F;
GlStateManager.disableTexture();
GlStateManager.enableBlend();
GlStateManager.disableAlphaTest();
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.shadeModel(GL11.GL_SMOOTH);
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.disableAlphaTest();
RenderSystem.defaultBlendFunc();
RenderSystem.shadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
buffer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
buffer.pos( left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
buffer.pos( left, bottom, zLevel).color( endRed, endGreen, endBlue, endAlpha).endVertex();
buffer.pos(right, bottom, zLevel).color( endRed, endGreen, endBlue, endAlpha).endVertex();
buffer.func_225582_a_(right, top, zLevel).func_227885_a_(startRed, startGreen, startBlue, startAlpha).endVertex();
buffer.func_225582_a_( left, top, zLevel).func_227885_a_(startRed, startGreen, startBlue, startAlpha).endVertex();
buffer.func_225582_a_( left, bottom, zLevel).func_227885_a_( endRed, endGreen, endBlue, endAlpha).endVertex();
buffer.func_225582_a_(right, bottom, zLevel).func_227885_a_( endRed, endGreen, endBlue, endAlpha).endVertex();
tessellator.draw();
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.disableBlend();
GlStateManager.enableAlphaTest();
GlStateManager.enableTexture();
RenderSystem.shadeModel(GL11.GL_FLAT);
RenderSystem.disableBlend();
RenderSystem.enableAlphaTest();
RenderSystem.enableTexture();
}
public static void drawInscribedRect(int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight)
@@ -37,7 +37,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.maven.artifact.versioning.ComparableVersion;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -191,8 +191,8 @@ public class GuiModList extends Screen
{
if (logoPath != null) {
Minecraft.getInstance().getTextureManager().bindTexture(logoPath);
GlStateManager.enableBlend();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.enableBlend();
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
// Draw the logo image inscribed in a rectangle with width entryWidth (minus some padding) and height 50
int headerHeight = 50;
GuiUtils.drawInscribedRect(left, relativeY, width - 5, headerHeight, logoDims.width, logoDims.height, false, true);
@@ -203,10 +203,10 @@ public class GuiModList extends Screen
{
if (line != null)
{
GlStateManager.enableBlend();
RenderSystem.enableBlend();
GuiModList.this.font.drawStringWithShadow(line.getFormattedText(), left + 4, relativeY, 0xFFFFFF);
GlStateManager.disableAlphaTest();
GlStateManager.disableBlend();
RenderSystem.disableAlphaTest();
RenderSystem.disableBlend();
}
relativeY += font.FONT_HEIGHT;
}
@@ -29,7 +29,7 @@ import net.minecraftforge.fml.MavenVersionStringHelper;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
public class GuiSlotModList extends ExtendedList<GuiSlotModList.ModEntry>
{
@@ -92,10 +92,10 @@ public class GuiSlotModList extends ExtendedList<GuiSlotModList.ModEntry>
{
//TODO: Consider adding more icons for visualization
Minecraft.getInstance().getTextureManager().bindTexture(VERSION_CHECK_ICONS);
GlStateManager.color4f(1, 1, 1, 1);
GlStateManager.pushMatrix();
RenderSystem.color4f(1, 1, 1, 1);
RenderSystem.pushMatrix();
AbstractGui.blit(getRight() - (height / 2 + 4), GuiSlotModList.this.getTop() + (height / 2 - 4), vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
GlStateManager.popMatrix();
RenderSystem.popMatrix();
}
}
@@ -21,6 +21,7 @@ package net.minecraftforge.fml.client.registry;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.lang3.ArrayUtils;
@@ -41,10 +42,9 @@ public class ClientRegistry
* Call this during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent}.
* This method is safe to call during parallel mod loading.
*/
public static synchronized <T extends TileEntity> void bindTileEntitySpecialRenderer(Class<T> tileEntityClass, TileEntityRenderer<? super T> specialRenderer)
public static synchronized <T extends TileEntity> void bindTileEntityRenderer(TileEntityType<T> tileEntityType, TileEntityRenderer<? super T> specialRenderer)
{
TileEntityRendererDispatcher.instance.setSpecialRenderer(tileEntityClass, specialRenderer);
specialRenderer.setRendererDispatcher(TileEntityRendererDispatcher.instance);
TileEntityRendererDispatcher.instance.setSpecialRendererInternal(tileEntityType, specialRenderer);
}
/**
@@ -25,12 +25,13 @@ import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
public class RenderingRegistry
{
private static final RenderingRegistry INSTANCE = new RenderingRegistry();
private final Map<Class<? extends Entity>, IRenderFactory<? extends Entity>> entityRenderers = new ConcurrentHashMap<>();
private final Map<EntityType<? extends Entity>, IRenderFactory<? extends Entity>> entityRenderers = new ConcurrentHashMap<>();
/**
* Register an entity rendering handler. This will, after mod initialization, be inserted into the main
@@ -38,7 +39,7 @@ public class RenderingRegistry
* Call this during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent}.
* This method is safe to call during parallel mod loading.
*/
public static <T extends Entity> void registerEntityRenderingHandler(Class<T> entityClass, IRenderFactory<? super T> renderFactory)
public static <T extends Entity> void registerEntityRenderingHandler(EntityType<T> entityClass, IRenderFactory<? super T> renderFactory)
{
INSTANCE.entityRenderers.put(entityClass, renderFactory);
}
@@ -49,8 +50,8 @@ public class RenderingRegistry
}
@SuppressWarnings("unchecked")
private static <T extends Entity> void register(EntityRendererManager manager, Class<T> entityClass, IRenderFactory<?> renderFactory)
private static <T extends Entity> void register(EntityRendererManager manager, EntityType<T> entityType, IRenderFactory<?> renderFactory)
{
manager.register(entityClass, ((IRenderFactory<T>)renderFactory).createRenderFor(manager));
manager.func_229087_a_(entityType, ((IRenderFactory<T>)renderFactory).createRenderFor(manager));
}
}
@@ -34,6 +34,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.FuzzedBiomeMagnifier;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.common.ModDimension;
import net.minecraftforge.fml.LogicalSidedProvider;
@@ -72,9 +73,9 @@ public class FMLPlayMessages
this.typeId = Registry.ENTITY_TYPE.getId(e.getType());
this.entityId = e.getEntityId();
this.uuid = e.getUniqueID();
this.posX = e.posX;
this.posY = e.posY;
this.posZ = e.posZ;
this.posX = e.func_226277_ct_();
this.posY = e.func_226278_cu_();
this.posZ = e.func_226281_cx_();
this.pitch = (byte) MathHelper.floor(e.rotationPitch * 256.0F / 360.0F);
this.yaw = (byte) MathHelper.floor(e.rotationYaw * 256.0F / 360.0F);
this.headYaw = (byte) (e.getRotationYawHead() * 256.0F / 360.0F);
@@ -357,7 +358,7 @@ public class FMLPlayMessages
// default to overworld if no moddim found
if (modDim == null) return DimensionType.OVERWORLD;
modDim.read(extraData, true);
return new DimensionType(id, "dummy", "dummy", modDim.getFactory(), skylight, modDim, extraData);
return new DimensionType(id, "dummy", "dummy", modDim.getFactory(), skylight, FuzzedBiomeMagnifier.INSTANCE, modDim, extraData);
}
public static boolean handle(final DimensionInfoMessage message, final Supplier<NetworkEvent.Context> contextSupplier) {
@@ -1,3 +1,22 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.fml.packs;
import java.io.File;
@@ -1,3 +1,22 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.fml.packs;
import java.io.File;
@@ -63,12 +82,12 @@ public class DelegatingResourcePack extends ResourcePack
}
@Override
public Collection<ResourceLocation> getAllResourceLocations(ResourcePackType type, String pathIn, int maxDepth, Predicate<String> filter)
public Collection<ResourceLocation> func_225637_a_(ResourcePackType type, String pathIn, String pathIn2, int maxDepth, Predicate<String> filter)
{
synchronized(delegates)
{
return delegates.stream()
.flatMap(r -> r.getAllResourceLocations(type, pathIn, maxDepth, filter).stream())
.flatMap(r -> r.func_225637_a_(type, pathIn, pathIn2, maxDepth, filter).stream())
.collect(Collectors.toList());
}
}
@@ -86,8 +86,9 @@ public class ModFileResourcePack extends DelegatableResourcePack
return Files.exists(modFile.getLocator().findPath(modFile, name));
}
@Override
public Collection<ResourceLocation> getAllResourceLocations(ResourcePackType type, String pathIn, int maxDepth, Predicate<String> filter)
public Collection<ResourceLocation> func_225637_a_(ResourcePackType type, String resourceNamespace, String pathIn, int maxDepth, Predicate<String> filter)
{
try
{