mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 04:09:51 +00:00
Setup and import of 1.16 YEET
This commit is contained in:
931 files changed
+18847
-9127
No files matched your search
@@ -1,457 +0,0 @@
|
||||
/*
|
||||
* 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.client;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
import org.lwjgl.opengl.GL31;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.settings.CloudOption;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.resources.IReloadableResourceManager;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraftforge.common.ForgeConfig;
|
||||
import net.minecraftforge.resource.IResourceType;
|
||||
import net.minecraftforge.resource.ISelectiveResourceReloadListener;
|
||||
import net.minecraftforge.resource.VanillaResourceType;
|
||||
|
||||
/* TODO: reimplement using the new rendering system? or remove?
|
||||
public class CloudRenderer implements ISelectiveResourceReloadListener
|
||||
{
|
||||
// Shared constants.
|
||||
private static final float PX_SIZE = 1 / 256F;
|
||||
|
||||
// Building constants.
|
||||
private static final VertexFormat FORMAT = DefaultVertexFormats.POSITION_TEX_COLOR;
|
||||
private static final int TOP_SECTIONS = 12; // Number of slices a top face will span.
|
||||
private static final int HEIGHT = 4;
|
||||
private static final float INSET = 0.001F;
|
||||
private static final float ALPHA = 0.8F;
|
||||
|
||||
// Debug
|
||||
private static final boolean WIREFRAME = false;
|
||||
|
||||
// Instance fields
|
||||
private final Minecraft mc = Minecraft.getInstance();
|
||||
private final ResourceLocation texture = new ResourceLocation("textures/environment/clouds.png");
|
||||
|
||||
private VertexBuffer vbo;
|
||||
private CloudOption cloudMode = CloudOption.OFF;
|
||||
private int renderDistance = -1;
|
||||
|
||||
private DynamicTexture COLOR_TEX = null;
|
||||
|
||||
private int texW;
|
||||
private int texH;
|
||||
|
||||
public CloudRenderer()
|
||||
{
|
||||
// Resource manager should always be reloadable.
|
||||
((IReloadableResourceManager) mc.getResourceManager()).addReloadListener(this);
|
||||
}
|
||||
|
||||
private int getScale()
|
||||
{
|
||||
return cloudMode == CloudOption.FANCY ? 12 : 8;
|
||||
}
|
||||
|
||||
private float ceilToScale(float value)
|
||||
{
|
||||
float scale = getScale();
|
||||
return MathHelper.ceil(value / scale) * scale;
|
||||
}
|
||||
|
||||
private void vertices(BufferBuilder buffer)
|
||||
{
|
||||
boolean fancy = cloudMode == CloudOption.FANCY; // Defines whether to hide all but the bottom.
|
||||
|
||||
float scale = getScale();
|
||||
float CULL_DIST = 2 * scale;
|
||||
|
||||
float bCol = fancy ? 0.7F : 1F;
|
||||
|
||||
float sectEnd = ceilToScale((renderDistance * 2) * 16);
|
||||
float sectStart = -sectEnd;
|
||||
|
||||
float sectStep = ceilToScale(sectEnd * 2 / TOP_SECTIONS);
|
||||
float sectPx = PX_SIZE / scale;
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, FORMAT);
|
||||
|
||||
float sectX0 = sectStart;
|
||||
float sectX1 = sectX0;
|
||||
|
||||
while (sectX1 < sectEnd)
|
||||
{
|
||||
sectX1 += sectStep;
|
||||
|
||||
if (sectX1 > sectEnd)
|
||||
sectX1 = sectEnd;
|
||||
|
||||
float sectZ0 = sectStart;
|
||||
float sectZ1 = sectZ0;
|
||||
|
||||
while (sectZ1 < sectEnd)
|
||||
{
|
||||
sectZ1 += sectStep;
|
||||
|
||||
if (sectZ1 > sectEnd)
|
||||
sectZ1 = sectEnd;
|
||||
|
||||
float u0 = sectX0 * sectPx;
|
||||
float u1 = sectX1 * sectPx;
|
||||
float v0 = sectZ0 * sectPx;
|
||||
float v1 = sectZ1 * sectPx;
|
||||
|
||||
// Bottom
|
||||
buffer.pos(sectX0, 0, sectZ0).tex(u0, v0).color(bCol, bCol, bCol, ALPHA).endVertex();
|
||||
buffer.pos(sectX1, 0, sectZ0).tex(u1, v0).color(bCol, bCol, bCol, ALPHA).endVertex();
|
||||
buffer.pos(sectX1, 0, sectZ1).tex(u1, v1).color(bCol, bCol, bCol, ALPHA).endVertex();
|
||||
buffer.pos(sectX0, 0, sectZ1).tex(u0, v1).color(bCol, bCol, bCol, ALPHA).endVertex();
|
||||
|
||||
if (fancy)
|
||||
{
|
||||
// Top
|
||||
buffer.pos(sectX0, HEIGHT, sectZ0).tex(u0, v0).color(1, 1, 1, ALPHA).endVertex();
|
||||
buffer.pos(sectX0, HEIGHT, sectZ1).tex(u0, v1).color(1, 1, 1, ALPHA).endVertex();
|
||||
buffer.pos(sectX1, HEIGHT, sectZ1).tex(u1, v1).color(1, 1, 1, ALPHA).endVertex();
|
||||
buffer.pos(sectX1, HEIGHT, sectZ0).tex(u1, v0).color(1, 1, 1, ALPHA).endVertex();
|
||||
|
||||
float slice;
|
||||
float sliceCoord0;
|
||||
float sliceCoord1;
|
||||
|
||||
for (slice = sectX0; slice < sectX1;)
|
||||
{
|
||||
sliceCoord0 = slice * sectPx;
|
||||
sliceCoord1 = sliceCoord0 + PX_SIZE;
|
||||
|
||||
// X sides
|
||||
if (slice > -CULL_DIST)
|
||||
{
|
||||
slice += INSET;
|
||||
buffer.pos(slice, 0, sectZ1).tex(sliceCoord0, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
|
||||
buffer.pos(slice, HEIGHT, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
|
||||
buffer.pos(slice, HEIGHT, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
|
||||
buffer.pos(slice, 0, sectZ0).tex(sliceCoord0, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
|
||||
slice -= INSET;
|
||||
}
|
||||
|
||||
slice += scale;
|
||||
|
||||
if (slice <= CULL_DIST)
|
||||
{
|
||||
slice -= INSET;
|
||||
buffer.pos(slice, 0, sectZ0).tex(sliceCoord0, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
|
||||
buffer.pos(slice, HEIGHT, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
|
||||
buffer.pos(slice, HEIGHT, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
|
||||
buffer.pos(slice, 0, sectZ1).tex(sliceCoord0, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
|
||||
slice += INSET;
|
||||
}
|
||||
}
|
||||
|
||||
for (slice = sectZ0; slice < sectZ1;)
|
||||
{
|
||||
sliceCoord0 = slice * sectPx;
|
||||
sliceCoord1 = sliceCoord0 + PX_SIZE;
|
||||
|
||||
// Z sides
|
||||
if (slice > -CULL_DIST)
|
||||
{
|
||||
slice += INSET;
|
||||
buffer.pos(sectX0, 0, slice).tex(u0, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
|
||||
buffer.pos(sectX0, HEIGHT, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
|
||||
buffer.pos(sectX1, HEIGHT, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
|
||||
buffer.pos(sectX1, 0, slice).tex(u1, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
|
||||
slice -= INSET;
|
||||
}
|
||||
|
||||
slice += scale;
|
||||
|
||||
if (slice <= CULL_DIST)
|
||||
{
|
||||
slice -= INSET;
|
||||
buffer.pos(sectX1, 0, slice).tex(u1, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
|
||||
buffer.pos(sectX1, HEIGHT, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
|
||||
buffer.pos(sectX0, HEIGHT, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
|
||||
buffer.pos(sectX0, 0, slice).tex(u0, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
|
||||
slice += INSET;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sectZ0 = sectZ1;
|
||||
}
|
||||
|
||||
sectX0 = sectX1;
|
||||
}
|
||||
}
|
||||
|
||||
private void dispose()
|
||||
{
|
||||
if (vbo != null)
|
||||
{
|
||||
vbo.deleteGlBuffers();
|
||||
vbo = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void build()
|
||||
{
|
||||
Tessellator tess = Tessellator.getInstance();
|
||||
BufferBuilder buffer = tess.getBuffer();
|
||||
|
||||
vbo = new VertexBuffer(FORMAT);
|
||||
|
||||
vertices(buffer);
|
||||
|
||||
buffer.finishDrawing();
|
||||
buffer.reset();
|
||||
vbo.bufferData(buffer.getByteBuffer());
|
||||
}
|
||||
|
||||
private int fullCoord(double coord, int scale)
|
||||
{ // Corrects misalignment of UV offset when on negative coords.
|
||||
return ((int) coord / scale) - (coord < 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
private boolean isBuilt()
|
||||
{
|
||||
return vbo != null;
|
||||
}
|
||||
|
||||
public void checkSettings()
|
||||
{
|
||||
boolean newEnabled = ForgeConfig.CLIENT.forgeCloudsEnabled.get()
|
||||
&& mc.gameSettings.getCloudOption() != CloudOption.OFF
|
||||
&& mc.world != null
|
||||
&& mc.world.dimension.isSurfaceWorld();
|
||||
|
||||
if (isBuilt()
|
||||
&& (!newEnabled
|
||||
|| mc.gameSettings.getCloudOption() != cloudMode
|
||||
|| mc.gameSettings.renderDistanceChunks != renderDistance))
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
|
||||
cloudMode = mc.gameSettings.getCloudOption();
|
||||
renderDistance = mc.gameSettings.renderDistanceChunks;
|
||||
|
||||
if (newEnabled && !isBuilt())
|
||||
{
|
||||
build();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean render(int cloudTicks, float partialTicks)
|
||||
{
|
||||
if (!isBuilt())
|
||||
return false;
|
||||
|
||||
Entity entity = mc.getRenderViewEntity();
|
||||
|
||||
double totalOffset = cloudTicks + partialTicks;
|
||||
|
||||
double x = entity.prevPosX + (entity.getPosX() - entity.prevPosX) * partialTicks
|
||||
+ totalOffset * 0.03;
|
||||
double y = mc.world.dimension.getCloudHeight()
|
||||
- (entity.lastTickPosY + (entity.getPosY() - entity.lastTickPosY) * partialTicks)
|
||||
+ 0.33;
|
||||
double z = entity.prevPosZ + (entity.getPosZ() - entity.prevPosZ) * partialTicks;
|
||||
|
||||
int scale = getScale();
|
||||
|
||||
if (cloudMode == CloudOption.FANCY)
|
||||
z += 0.33 * scale;
|
||||
|
||||
// Integer UVs to translate the texture matrix by.
|
||||
int offU = fullCoord(x, scale);
|
||||
int offV = fullCoord(z, scale);
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
// Translate by the remainder after the UV offset.
|
||||
RenderSystem.translated((offU * scale) - x, y, (offV * scale) - z);
|
||||
|
||||
// Modulo to prevent texture samples becoming inaccurate at extreme offsets.
|
||||
offU = offU % texW;
|
||||
offV = offV % texH;
|
||||
|
||||
// Translate the texture.
|
||||
RenderSystem.matrixMode(GL11.GL_TEXTURE);
|
||||
RenderSystem.translatef(offU * PX_SIZE, offV * PX_SIZE, 0);
|
||||
RenderSystem.matrixMode(GL11.GL_MODELVIEW);
|
||||
|
||||
RenderSystem.disableCull();
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
|
||||
// Color multiplier.
|
||||
Vec3d color = mc.world.getCloudColour(partialTicks);
|
||||
float r = (float) color.x;
|
||||
float g = (float) color.y;
|
||||
float b = (float) color.z;
|
||||
|
||||
if (COLOR_TEX == null)
|
||||
COLOR_TEX = new DynamicTexture(1, 1, false);
|
||||
|
||||
// Apply a color multiplier through a texture upload if shaders aren't supported.
|
||||
COLOR_TEX.getTextureData().setPixelRGBA(0, 0, 255 << 24
|
||||
| ((int) (r * 255)) << 16
|
||||
| ((int) (g * 255)) << 8
|
||||
| (int) (b * 255));
|
||||
COLOR_TEX.updateDynamicTexture();
|
||||
|
||||
RenderSystem.activeTexture(GL13.GL_TEXTURE1);
|
||||
RenderSystem.bindTexture(COLOR_TEX.getGlTextureId());
|
||||
RenderSystem.enableTexture();
|
||||
|
||||
// Bind the clouds texture last so the shader's sampler2D is correct.
|
||||
RenderSystem.activeTexture(GL13.GL_TEXTURE0);
|
||||
mc.textureManager.bindTexture(texture);
|
||||
|
||||
ByteBuffer buffer = Tessellator.getInstance().getBuffer().getByteBuffer();
|
||||
|
||||
// Set up pointers for the display list/VBO.
|
||||
vbo.bindBuffer();
|
||||
|
||||
int stride = FORMAT.getSize();
|
||||
RenderSystem.vertexPointer(3, GL11.GL_FLOAT, stride, 0);
|
||||
RenderSystem.enableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
RenderSystem.texCoordPointer(2, GL11.GL_FLOAT, stride, 12);
|
||||
RenderSystem.enableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
RenderSystem.colorPointer(4, GL11.GL_UNSIGNED_BYTE, stride, 20);
|
||||
RenderSystem.enableClientState(GL11.GL_COLOR_ARRAY);
|
||||
|
||||
// Depth pass to prevent insides rendering from the outside.
|
||||
RenderSystem.colorMask(false, false, false, false);
|
||||
vbo.drawArrays(GL11.GL_QUADS);
|
||||
|
||||
// Full render.
|
||||
RenderSystem.colorMask(true, true, true, true);
|
||||
|
||||
// Wireframe for debug.
|
||||
if (WIREFRAME)
|
||||
{
|
||||
RenderSystem.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
|
||||
RenderSystem.lineWidth(2.0F);
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.disableFog();
|
||||
vbo.drawArrays(GL11.GL_QUADS);
|
||||
RenderSystem.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.enableFog();
|
||||
}
|
||||
|
||||
vbo.drawArrays(GL11.GL_QUADS);
|
||||
VertexBuffer.unbindBuffer(); // Unbind buffer and disable pointers.
|
||||
|
||||
buffer.limit(0);
|
||||
for (int i = 0; i < FORMAT.getElements().size(); i++)
|
||||
FORMAT.getElements().get(i).getUsage().postDraw(FORMAT, i, FORMAT.getSize(), buffer);
|
||||
buffer.position(0);
|
||||
|
||||
// Disable our coloring.
|
||||
RenderSystem.activeTexture(GL13.GL_TEXTURE1);
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.activeTexture(GL13.GL_TEXTURE0);
|
||||
|
||||
// Reset texture matrix.
|
||||
RenderSystem.matrixMode(GL11.GL_TEXTURE);
|
||||
RenderSystem.loadIdentity();
|
||||
RenderSystem.matrixMode(GL11.GL_MODELVIEW);
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.enableCull();
|
||||
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void reloadTextures()
|
||||
{
|
||||
if (mc.textureManager != null)
|
||||
{
|
||||
mc.textureManager.bindTexture(texture);
|
||||
texW = GlStateManager.func_227692_c_(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
|
||||
texH = GlStateManager.func_227692_c_(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceManagerReload(@Nonnull IResourceManager resourceManager, @Nonnull Predicate<IResourceType> resourcePredicate)
|
||||
{
|
||||
if (resourcePredicate.test(VanillaResourceType.TEXTURES))
|
||||
{
|
||||
reloadTextures();
|
||||
}
|
||||
}
|
||||
|
||||
private static CloudRenderer cloudRenderer;
|
||||
private static CloudRenderer getCloudRenderer()
|
||||
{
|
||||
if (cloudRenderer == null)
|
||||
cloudRenderer = new CloudRenderer();
|
||||
return cloudRenderer;
|
||||
}
|
||||
|
||||
public static void updateCloudSettings()
|
||||
{
|
||||
getCloudRenderer().checkSettings();
|
||||
}
|
||||
|
||||
public static boolean renderClouds(int cloudTicks, float partialTicks, ClientWorld world, Minecraft client)
|
||||
{
|
||||
IRenderHandler renderer = world.dimension.getCloudRenderer();
|
||||
if (renderer != null)
|
||||
{
|
||||
renderer.render(cloudTicks, partialTicks, world, client);
|
||||
return true;
|
||||
}
|
||||
return getCloudRenderer().render(cloudTicks, partialTicks);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
@@ -52,7 +52,16 @@ import java.util.stream.Stream;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.util.math.vector.Matrix3f;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.model.pipeline.LightUtil;
|
||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||
@@ -82,13 +91,6 @@ import net.minecraft.client.renderer.FogRenderer.FogType;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.client.renderer.color.ItemColors;
|
||||
import net.minecraft.client.renderer.entity.model.BipedModel;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.BlockFaceUV;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.model.ItemTransformVec3f;
|
||||
import net.minecraft.client.renderer.model.Material;
|
||||
import net.minecraft.client.renderer.model.ModelManager;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
@@ -102,7 +104,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.RecipeManager;
|
||||
@@ -116,7 +117,6 @@ import net.minecraft.util.math.EntityRayTraceResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||
@@ -174,12 +174,6 @@ public class ForgeHooksClient
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent(context, info, target, partialTicks, matrix, buffers));
|
||||
}
|
||||
|
||||
@Deprecated // TODO: Remove in 1.16
|
||||
public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, mat, partialTicks));
|
||||
}
|
||||
|
||||
public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks, Matrix4f projectionMatrix, long finishTimeNano)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, mat, partialTicks, projectionMatrix, finishTimeNano));
|
||||
@@ -280,10 +274,11 @@ public class ForgeHooksClient
|
||||
GameSettings settings = Minecraft.getInstance().gameSettings;
|
||||
int[] ranges = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34 };
|
||||
int distance = 0;
|
||||
if (settings.fancyGraphics && ranges.length > 0)
|
||||
{
|
||||
distance = ranges[MathHelper.clamp(settings.renderDistanceChunks, 0, ranges.length-1)];
|
||||
}
|
||||
//TODO, GraphicsFanciness changed, and is getSkyBlendColour used still?
|
||||
// if (settings.fancyGraphics && ranges.length > 0)
|
||||
// {
|
||||
// distance = ranges[MathHelper.clamp(settings.renderDistanceChunks, 0, ranges.length-1)];
|
||||
// }
|
||||
|
||||
int r = 0;
|
||||
int g = 0;
|
||||
@@ -320,16 +315,16 @@ public class ForgeHooksClient
|
||||
//RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance);
|
||||
}
|
||||
|
||||
public static void renderMainMenu(MainMenuScreen gui, FontRenderer font, int width, int height)
|
||||
public static void renderMainMenu(MainMenuScreen gui, MatrixStack mStack, FontRenderer font, int width, int height)
|
||||
{
|
||||
VersionChecker.Status status = ForgeVersion.getStatus();
|
||||
if (status == BETA || status == BETA_OUTDATED)
|
||||
{
|
||||
// render a warning at the top of the screen,
|
||||
String line = I18n.format("forge.update.beta.1", TextFormatting.RED, TextFormatting.RESET);
|
||||
gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (0 * (font.FONT_HEIGHT + 1)), -1);
|
||||
line = I18n.format("forge.update.beta.2");
|
||||
gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (1 * (font.FONT_HEIGHT + 1)), -1);
|
||||
ITextComponent line = new TranslationTextComponent("forge.update.beta.1", TextFormatting.RED, TextFormatting.RESET);
|
||||
gui.func_238472_a_(mStack, font, line, (width - font.func_238414_a_(line)) / 2, 4 + (0 * (font.FONT_HEIGHT + 1)), -1);
|
||||
line = new TranslationTextComponent("forge.update.beta.2");
|
||||
gui.func_238472_a_(mStack, font, line, (width - font.func_238414_a_(line)) / 2, 4 + (1 * (font.FONT_HEIGHT + 1)), -1);
|
||||
}
|
||||
|
||||
String line = null;
|
||||
@@ -362,11 +357,11 @@ public class ForgeHooksClient
|
||||
return worldRenderPass;
|
||||
}
|
||||
|
||||
public static void drawScreen(Screen screen, int mouseX, int mouseY, float partialTicks)
|
||||
public static void drawScreen(Screen screen, MatrixStack mStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if (!MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Pre(screen, mouseX, mouseY, partialTicks)))
|
||||
screen.render(mouseX, mouseY, partialTicks);
|
||||
MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Post(screen, mouseX, mouseY, partialTicks));
|
||||
if (!MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Pre(screen, mStack, mouseX, mouseY, partialTicks)))
|
||||
screen.func_230430_a_(mStack, mouseX, mouseY, partialTicks);
|
||||
MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Post(screen, mStack, mouseX, mouseY, partialTicks));
|
||||
}
|
||||
|
||||
public static float getFogDensity(FogType type, ActiveRenderInfo info, float partial, float density)
|
||||
@@ -394,11 +389,11 @@ public class ForgeHooksClient
|
||||
modelLoader.onPostBakeEvent(modelRegistry);
|
||||
}
|
||||
|
||||
private static final net.minecraft.client.renderer.Matrix4f flipX;
|
||||
private static final net.minecraft.client.renderer.Matrix3f flipXNormal;
|
||||
private static final Matrix4f flipX;
|
||||
private static final Matrix3f flipXNormal;
|
||||
static {
|
||||
flipX = Matrix4f.makeScale(-1,1,1);
|
||||
flipXNormal = new net.minecraft.client.renderer.Matrix3f(flipX);
|
||||
flipXNormal = new Matrix3f(flipX);
|
||||
}
|
||||
|
||||
public static IBakedModel handleCameraTransforms(MatrixStack matrixStack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery)
|
||||
@@ -410,8 +405,8 @@ public class ForgeHooksClient
|
||||
if (!stack.clear())
|
||||
{
|
||||
// Apply the transformation to the real matrix stack, flipping for left hand
|
||||
net.minecraft.client.renderer.Matrix4f tMat = stack.getLast().getMatrix();
|
||||
net.minecraft.client.renderer.Matrix3f nMat = stack.getLast().getNormal();
|
||||
Matrix4f tMat = stack.getLast().getMatrix();
|
||||
Matrix3f nMat = stack.getLast().getNormal();
|
||||
if (leftHandHackery)
|
||||
{
|
||||
tMat.multiplyBackward(flipX);
|
||||
@@ -532,7 +527,7 @@ public class ForgeHooksClient
|
||||
}*/
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static TextureAtlasSprite[] getFluidSprites(ILightReader world, BlockPos pos, IFluidState fluidStateIn)
|
||||
public static TextureAtlasSprite[] getFluidSprites(IBlockDisplayReader world, BlockPos pos, FluidState fluidStateIn)
|
||||
{
|
||||
ResourceLocation overlayTexture = fluidStateIn.getFluid().getAttributes().getOverlayTexture();
|
||||
return new TextureAtlasSprite[] {
|
||||
@@ -542,14 +537,14 @@ public class ForgeHooksClient
|
||||
};
|
||||
}
|
||||
|
||||
public static void gatherFluidTextures(Set<Material> textures)
|
||||
public static void gatherFluidTextures(Set<RenderMaterial> textures)
|
||||
{
|
||||
ForgeRegistries.FLUIDS.getValues().stream()
|
||||
.flatMap(ForgeHooksClient::getFluidMaterials)
|
||||
.forEach(textures::add);
|
||||
}
|
||||
|
||||
public static Stream<Material> getFluidMaterials(Fluid fluid)
|
||||
public static Stream<RenderMaterial> getFluidMaterials(Fluid fluid)
|
||||
{
|
||||
return fluid.getAttributes().getTextures()
|
||||
.filter(Objects::nonNull)
|
||||
@@ -557,9 +552,9 @@ public class ForgeHooksClient
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Material getBlockMaterial(ResourceLocation loc)
|
||||
public static RenderMaterial getBlockMaterial(ResourceLocation loc)
|
||||
{
|
||||
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, loc);
|
||||
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, loc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -631,17 +626,17 @@ public class ForgeHooksClient
|
||||
return from.getItem().shouldCauseReequipAnimation(from, to, changed);
|
||||
}
|
||||
|
||||
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MainWindow res, ClientBossInfo bossInfo, int x, int y, int increment)
|
||||
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MatrixStack mStack, MainWindow res, ClientBossInfo bossInfo, int x, int y, int increment)
|
||||
{
|
||||
RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res),
|
||||
RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(mStack, new RenderGameOverlayEvent(mStack, Animation.getPartialTickTime(), res),
|
||||
BOSSINFO, bossInfo, x, y, increment);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
return evt;
|
||||
}
|
||||
|
||||
public static void bossBarRenderPost(MainWindow res)
|
||||
public static void bossBarRenderPost(MatrixStack mStack, MainWindow res)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO));
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(mStack, new RenderGameOverlayEvent(mStack, Animation.getPartialTickTime(), res), BOSSINFO));
|
||||
}
|
||||
|
||||
public static ScreenshotEvent onScreenshot(NativeImage image, File screenshotFile)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
@@ -48,6 +49,7 @@ public class GuiContainerEvent extends Event
|
||||
*/
|
||||
public static class DrawForeground extends GuiContainerEvent
|
||||
{
|
||||
private final MatrixStack mStack;
|
||||
private final int mouseX;
|
||||
private final int mouseY;
|
||||
|
||||
@@ -55,16 +57,23 @@ public class GuiContainerEvent extends Event
|
||||
* Called directly after the GuiContainer has drawn any foreground elements.
|
||||
*
|
||||
* @param guiContainer The container.
|
||||
* @param mStack The MatrixStack.
|
||||
* @param mouseX The current X position of the players mouse.
|
||||
* @param mouseY The current Y position of the players mouse.
|
||||
*/
|
||||
public DrawForeground(ContainerScreen guiContainer, int mouseX, int mouseY)
|
||||
public DrawForeground(ContainerScreen guiContainer, MatrixStack mStack, int mouseX, int mouseY)
|
||||
{
|
||||
super(guiContainer);
|
||||
this.mStack = mStack;
|
||||
this.mouseX = mouseX;
|
||||
this.mouseY = mouseY;
|
||||
}
|
||||
|
||||
public MatrixStack getMatrixStack()
|
||||
{
|
||||
return mStack;
|
||||
}
|
||||
|
||||
public int getMouseX()
|
||||
{
|
||||
return mouseX;
|
||||
@@ -82,6 +91,7 @@ public class GuiContainerEvent extends Event
|
||||
*/
|
||||
public static class DrawBackground extends GuiContainerEvent
|
||||
{
|
||||
private final MatrixStack mStack;
|
||||
private final int mouseX;
|
||||
private final int mouseY;
|
||||
|
||||
@@ -89,16 +99,23 @@ public class GuiContainerEvent extends Event
|
||||
* Called directly after the GuiContainer has drawn any background elements.
|
||||
*
|
||||
* @param guiContainer The container.
|
||||
* @param mStack The MatrixStack.
|
||||
* @param mouseX The current X position of the players mouse.
|
||||
* @param mouseY The current Y position of the players mouse.
|
||||
*/
|
||||
public DrawBackground(ContainerScreen guiContainer, int mouseX, int mouseY)
|
||||
public DrawBackground(ContainerScreen guiContainer, MatrixStack mStack, int mouseX, int mouseY)
|
||||
{
|
||||
super(guiContainer);
|
||||
this.mStack = mStack;
|
||||
this.mouseX = mouseX;
|
||||
this.mouseY = mouseY;
|
||||
}
|
||||
|
||||
public MatrixStack getMatrixStack()
|
||||
{
|
||||
return mStack;
|
||||
}
|
||||
|
||||
public int getMouseX()
|
||||
{
|
||||
return mouseX;
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.IGuiEventListener;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -127,18 +128,28 @@ public class GuiScreenEvent extends Event
|
||||
|
||||
public static class DrawScreenEvent extends GuiScreenEvent
|
||||
{
|
||||
private final MatrixStack mStack;
|
||||
private final int mouseX;
|
||||
private final int mouseY;
|
||||
private final float renderPartialTicks;
|
||||
|
||||
public DrawScreenEvent(Screen gui, int mouseX, int mouseY, float renderPartialTicks)
|
||||
public DrawScreenEvent(Screen gui, MatrixStack mStack, int mouseX, int mouseY, float renderPartialTicks)
|
||||
{
|
||||
super(gui);
|
||||
this.mStack = mStack;
|
||||
this.mouseX = mouseX;
|
||||
this.mouseY = mouseY;
|
||||
this.renderPartialTicks = renderPartialTicks;
|
||||
}
|
||||
|
||||
/**
|
||||
* The MatrixStack to render with.
|
||||
*/
|
||||
public MatrixStack getMatrixStack()
|
||||
{
|
||||
return mStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* The x coordinate of the mouse pointer on the screen.
|
||||
*/
|
||||
@@ -170,9 +181,9 @@ public class GuiScreenEvent extends Event
|
||||
@Cancelable
|
||||
public static class Pre extends DrawScreenEvent
|
||||
{
|
||||
public Pre(Screen gui, int mouseX, int mouseY, float renderPartialTicks)
|
||||
public Pre(Screen gui, MatrixStack mStack, int mouseX, int mouseY, float renderPartialTicks)
|
||||
{
|
||||
super(gui, mouseX, mouseY, renderPartialTicks);
|
||||
super(gui, mStack, mouseX, mouseY, renderPartialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,9 +192,9 @@ public class GuiScreenEvent extends Event
|
||||
*/
|
||||
public static class Post extends DrawScreenEvent
|
||||
{
|
||||
public Post(Screen gui, int mouseX, int mouseY, float renderPartialTicks)
|
||||
public Post(Screen gui, MatrixStack mStack, int mouseX, int mouseY, float renderPartialTicks)
|
||||
{
|
||||
super(gui, mouseX, mouseY, renderPartialTicks);
|
||||
super(gui, mStack, mouseX, mouseY, renderPartialTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraft.client.MainWindow;
|
||||
@@ -70,19 +71,22 @@ public class RenderGameOverlayEvent extends Event
|
||||
VIGNETTE
|
||||
}
|
||||
|
||||
private final MatrixStack mStack;
|
||||
private final float partialTicks;
|
||||
private final MainWindow window;
|
||||
private final ElementType type;
|
||||
|
||||
public RenderGameOverlayEvent(float partialTicks, MainWindow window)
|
||||
public RenderGameOverlayEvent(MatrixStack mStack, float partialTicks, MainWindow window)
|
||||
{
|
||||
this.mStack = mStack;
|
||||
this.partialTicks = partialTicks;
|
||||
this.window = window;
|
||||
this.type = null;
|
||||
}
|
||||
|
||||
private RenderGameOverlayEvent(RenderGameOverlayEvent parent, ElementType type)
|
||||
private RenderGameOverlayEvent(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type)
|
||||
{
|
||||
this.mStack = mStack;
|
||||
this.partialTicks = parent.getPartialTicks();
|
||||
this.window = parent.getWindow();
|
||||
this.type = type;
|
||||
@@ -90,17 +94,17 @@ public class RenderGameOverlayEvent extends Event
|
||||
|
||||
public static class Pre extends RenderGameOverlayEvent
|
||||
{
|
||||
public Pre(RenderGameOverlayEvent parent, ElementType type)
|
||||
public Pre(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type)
|
||||
{
|
||||
super(parent, type);
|
||||
super(mStack, parent, type);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends RenderGameOverlayEvent
|
||||
{
|
||||
public Post(RenderGameOverlayEvent parent, ElementType type)
|
||||
public Post(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type)
|
||||
{
|
||||
super(parent, type);
|
||||
super(mStack, parent, type);
|
||||
}
|
||||
@Override public boolean isCancelable(){ return false; }
|
||||
}
|
||||
@@ -111,9 +115,9 @@ public class RenderGameOverlayEvent extends Event
|
||||
private final int x;
|
||||
private final int y;
|
||||
private int increment;
|
||||
public BossInfo(RenderGameOverlayEvent parent, ElementType type, ClientBossInfo bossInfo, int x, int y, int increment)
|
||||
public BossInfo(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type, ClientBossInfo bossInfo, int x, int y, int increment)
|
||||
{
|
||||
super(parent, type);
|
||||
super(mStack, parent, type);
|
||||
this.bossInfo = bossInfo;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -166,9 +170,9 @@ public class RenderGameOverlayEvent extends Event
|
||||
{
|
||||
private final ArrayList<String> left;
|
||||
private final ArrayList<String> right;
|
||||
public Text(RenderGameOverlayEvent parent, ArrayList<String> left, ArrayList<String> right)
|
||||
public Text(MatrixStack mStack, RenderGameOverlayEvent parent, ArrayList<String> left, ArrayList<String> right)
|
||||
{
|
||||
super(parent, ElementType.TEXT);
|
||||
super(mStack, parent, ElementType.TEXT);
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
}
|
||||
@@ -189,9 +193,9 @@ public class RenderGameOverlayEvent extends Event
|
||||
private int posX;
|
||||
private int posY;
|
||||
|
||||
public Chat(RenderGameOverlayEvent parent, int posX, int posY)
|
||||
public Chat(MatrixStack mStack, RenderGameOverlayEvent parent, int posX, int posY)
|
||||
{
|
||||
super(parent, ElementType.CHAT);
|
||||
super(mStack, parent, ElementType.CHAT);
|
||||
this.setPosX(posX);
|
||||
this.setPosY(posY);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,11 @@
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
@@ -53,20 +52,14 @@ import net.minecraftforge.eventbus.api.Event;
|
||||
public class RenderNameplateEvent extends EntityEvent
|
||||
{
|
||||
|
||||
private String nameplateContent;
|
||||
private final String originalContent;
|
||||
private ITextComponent nameplateContent;
|
||||
private final ITextComponent originalContent;
|
||||
private final EntityRenderer<?> entityRenderer;
|
||||
private final MatrixStack matrixStack;
|
||||
private final IRenderTypeBuffer renderTypeBuffer;
|
||||
private final int packedLight;
|
||||
|
||||
@Deprecated //TODO 1.16: upon removal, also remove @Nullable on getEntityRenderer(), and update its javadoc
|
||||
public RenderNameplateEvent(Entity entity, String content, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer)
|
||||
{
|
||||
this(entity, content, null, matrixStack, renderTypeBuffer, 0);
|
||||
}
|
||||
|
||||
public RenderNameplateEvent(Entity entity, String content, EntityRenderer<?> entityRenderer, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int packedLight)
|
||||
public RenderNameplateEvent(Entity entity, ITextComponent content, EntityRenderer<?> entityRenderer, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int packedLight)
|
||||
{
|
||||
super(entity);
|
||||
this.originalContent = content;
|
||||
@@ -80,7 +73,7 @@ public class RenderNameplateEvent extends EntityEvent
|
||||
/**
|
||||
* Sets the content that is to be rendered on the name plate/tag
|
||||
*/
|
||||
public void setContent(String contents)
|
||||
public void setContent(ITextComponent contents)
|
||||
{
|
||||
this.nameplateContent = contents;
|
||||
}
|
||||
@@ -88,7 +81,7 @@ public class RenderNameplateEvent extends EntityEvent
|
||||
/**
|
||||
* The content being rendered on the name plate/tag
|
||||
*/
|
||||
public String getContent()
|
||||
public ITextComponent getContent()
|
||||
{
|
||||
return this.nameplateContent;
|
||||
}
|
||||
@@ -96,7 +89,7 @@ public class RenderNameplateEvent extends EntityEvent
|
||||
/**
|
||||
* The original content being rendered on the name plate/tag
|
||||
*/
|
||||
public String getOriginalContent()
|
||||
public ITextComponent getOriginalContent()
|
||||
{
|
||||
return this.originalContent;
|
||||
}
|
||||
@@ -104,7 +97,6 @@ public class RenderNameplateEvent extends EntityEvent
|
||||
/**
|
||||
* The entity renderer that renders the name plate/tag, if it was provided
|
||||
*/
|
||||
@Nullable
|
||||
public EntityRenderer<?> getEntityRenderer()
|
||||
{
|
||||
return this.entityRenderer;
|
||||
|
||||
@@ -26,6 +26,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextProperties;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
@@ -46,12 +47,12 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
{
|
||||
@Nonnull
|
||||
protected final ItemStack stack;
|
||||
protected final List<String> lines;
|
||||
protected final List<? extends ITextProperties> lines;
|
||||
protected int x;
|
||||
protected int y;
|
||||
protected FontRenderer fr;
|
||||
|
||||
public RenderTooltipEvent(@Nonnull ItemStack stack, @Nonnull List<String> lines, int x, int y, @Nonnull FontRenderer fr)
|
||||
public RenderTooltipEvent(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> lines, int x, int y, @Nonnull FontRenderer fr)
|
||||
{
|
||||
this.stack = stack;
|
||||
this.lines = Collections.unmodifiableList(lines); // Leave editing to ItemTooltipEvent
|
||||
@@ -75,7 +76,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
* @return An <i>unmodifiable</i> list of strings. Use {@link ItemTooltipEvent} to modify tooltip text.
|
||||
*/
|
||||
@Nonnull
|
||||
public List<String> getLines()
|
||||
public List<? extends ITextProperties> getLines()
|
||||
{
|
||||
return lines;
|
||||
}
|
||||
@@ -117,7 +118,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
private int screenHeight;
|
||||
private int maxWidth;
|
||||
|
||||
public Pre(@Nonnull ItemStack stack, @Nonnull List<String> lines, int x, int y, int screenWidth, int screenHeight, int maxWidth, @Nonnull FontRenderer fr)
|
||||
public Pre(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> lines, int x, int y, int screenWidth, int screenHeight, int maxWidth, @Nonnull FontRenderer fr)
|
||||
{
|
||||
super(stack, lines, x, y, fr);
|
||||
this.screenWidth = screenWidth;
|
||||
@@ -200,7 +201,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
private final int width;
|
||||
private final int height;
|
||||
|
||||
public Post(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
|
||||
public Post(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
|
||||
{
|
||||
super(stack, textLines, x, y, fr);
|
||||
this.width = width;
|
||||
@@ -229,7 +230,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
*/
|
||||
public static class PostBackground extends Post
|
||||
{
|
||||
public PostBackground(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
|
||||
public PostBackground(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
|
||||
{ super(stack, textLines, x, y, fr, width, height); }
|
||||
}
|
||||
|
||||
@@ -238,7 +239,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
*/
|
||||
public static class PostText extends Post
|
||||
{
|
||||
public PostText(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
|
||||
public PostText(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
|
||||
{ super(stack, textLines, x, y, fr, width, height); }
|
||||
}
|
||||
|
||||
@@ -254,7 +255,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
|
||||
private int borderStart;
|
||||
private int borderEnd;
|
||||
|
||||
public Color(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int background, int borderStart,
|
||||
public Color(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> textLines, int x, int y, @Nonnull FontRenderer fr, int background, int borderStart,
|
||||
int borderEnd)
|
||||
{
|
||||
super(stack, textLines, x, y, fr);
|
||||
|
||||
@@ -21,8 +21,8 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
|
||||
public class RenderWorldLastEvent extends net.minecraftforge.eventbus.api.Event
|
||||
{
|
||||
@@ -32,16 +32,6 @@ public class RenderWorldLastEvent extends net.minecraftforge.eventbus.api.Event
|
||||
private final Matrix4f projectionMatrix;
|
||||
private final long finishTimeNano;
|
||||
|
||||
@Deprecated // TODO: Remove in 1.16
|
||||
public RenderWorldLastEvent(WorldRenderer context, MatrixStack mat, float partialTicks)
|
||||
{
|
||||
this.context = context;
|
||||
this.mat = mat;
|
||||
this.partialTicks = partialTicks;
|
||||
this.projectionMatrix = null;
|
||||
this.finishTimeNano = 0;
|
||||
}
|
||||
|
||||
public RenderWorldLastEvent(WorldRenderer context, MatrixStack mat, float partialTicks, Matrix4f projectionMatrix, long finishTimeNano)
|
||||
{
|
||||
this.context = context;
|
||||
|
||||
@@ -34,7 +34,7 @@ import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
public interface IForgeBakedModel
|
||||
@@ -66,7 +66,7 @@ public interface IForgeBakedModel
|
||||
return net.minecraftforge.client.ForgeHooksClient.handlePerspective(getBakedModel(), cameraTransformType, mat);
|
||||
}
|
||||
|
||||
default @Nonnull IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
|
||||
default @Nonnull IModelData getModelData(@Nonnull IBlockDisplayReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
|
||||
{
|
||||
return tileData;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
|
||||
/**
|
||||
* An {@code IModelState} is a function from model part to a transformation that should be applied
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.vector.*;
|
||||
|
||||
/*
|
||||
* Replacement interface for ModelRotation to allow custom transformations of vanilla models.
|
||||
|
||||
@@ -23,13 +23,9 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.Matrix3f;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.Vector4f;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.math.vector.*;
|
||||
import net.minecraftforge.client.model.pipeline.LightUtil;
|
||||
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
@@ -60,7 +56,7 @@ public interface IForgeVertexBuilder
|
||||
// Copy of addQuad with alpha support
|
||||
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean readExistingColor) {
|
||||
int[] aint = bakedQuad.getVertexData();
|
||||
Vec3i faceNormal = bakedQuad.getFace().getDirectionVec();
|
||||
Vector3i faceNormal = bakedQuad.getFace().getDirectionVec();
|
||||
Vector3f normal = new Vector3f((float)faceNormal.getX(), (float)faceNormal.getY(), (float)faceNormal.getZ());
|
||||
Matrix4f matrix4f = matrixEntry.getMatrix();
|
||||
normal.transform(matrixEntry.getNormal());
|
||||
|
||||
@@ -24,6 +24,7 @@ import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
@@ -33,8 +34,8 @@ import net.minecraft.client.network.play.ClientPlayNetHandler;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
||||
import net.minecraft.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.potion.Effects;
|
||||
@@ -105,11 +106,11 @@ public class ForgeIngameGui extends IngameGui
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderGameOverlay(float partialTicks)
|
||||
public void func_238445_a_(MatrixStack mStack, float partialTicks)
|
||||
{
|
||||
this.scaledWidth = this.mc.getMainWindow().getScaledWidth();
|
||||
this.scaledHeight = this.mc.getMainWindow().getScaledHeight();
|
||||
eventParent = new RenderGameOverlayEvent(partialTicks, this.mc.getMainWindow());
|
||||
eventParent = new RenderGameOverlayEvent(mStack, partialTicks, this.mc.getMainWindow());
|
||||
renderHealthMount = mc.player.getRidingEntity() instanceof LivingEntity;
|
||||
renderFood = mc.player.getRidingEntity() == null;
|
||||
renderJumpBar = mc.player.isRidingHorse();
|
||||
@@ -117,7 +118,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
right_height = 39;
|
||||
left_height = 39;
|
||||
|
||||
if (pre(ALL)) return;
|
||||
if (pre(ALL, mStack)) return;
|
||||
|
||||
fontrenderer = mc.fontRenderer;
|
||||
//mc.entityRenderer.setupOverlayRendering();
|
||||
@@ -132,7 +133,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
RenderSystem.defaultBlendFunc();
|
||||
}
|
||||
|
||||
if (renderHelmet) renderHelmet(partialTicks);
|
||||
if (renderHelmet) renderHelmet(partialTicks, mStack);
|
||||
|
||||
if (renderPortal && !mc.player.isPotionActive(Effects.NAUSEA))
|
||||
{
|
||||
@@ -141,55 +142,55 @@ public class ForgeIngameGui extends IngameGui
|
||||
|
||||
if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
|
||||
{
|
||||
if (renderSpectatorTooltip) spectatorGui.renderTooltip(partialTicks);
|
||||
if (renderSpectatorTooltip) spectatorGui.func_238528_a_(mStack, partialTicks);
|
||||
}
|
||||
else if (!this.mc.gameSettings.hideGUI)
|
||||
{
|
||||
if (renderHotbar) renderHotbar(partialTicks);
|
||||
if (renderHotbar) func_238443_a_(partialTicks, mStack);
|
||||
}
|
||||
|
||||
if (!this.mc.gameSettings.hideGUI) {
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
setBlitOffset(-90);
|
||||
func_230926_e_(-90);
|
||||
rand.setSeed((long)(ticks * 312871));
|
||||
|
||||
if (renderCrosshairs) renderAttackIndicator();
|
||||
if (renderBossHealth) renderBossHealth();
|
||||
if (renderCrosshairs) func_238456_d_(mStack);
|
||||
if (renderBossHealth) renderBossHealth(mStack);
|
||||
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
if (this.mc.playerController.shouldDrawHUD() && this.mc.getRenderViewEntity() instanceof PlayerEntity)
|
||||
{
|
||||
if (renderHealth) renderHealth(this.scaledWidth, this.scaledHeight);
|
||||
if (renderArmor) renderArmor(this.scaledWidth, this.scaledHeight);
|
||||
if (renderFood) renderFood(this.scaledWidth, this.scaledHeight);
|
||||
if (renderHealthMount) renderHealthMount(this.scaledWidth, this.scaledHeight);
|
||||
if (renderAir) renderAir(this.scaledWidth, this.scaledHeight);
|
||||
if (renderHealth) renderHealth(this.scaledWidth, this.scaledHeight, mStack);
|
||||
if (renderArmor) renderArmor(mStack, this.scaledWidth, this.scaledHeight);
|
||||
if (renderFood) renderFood(this.scaledWidth, this.scaledHeight, mStack);
|
||||
if (renderHealthMount) renderHealthMount(this.scaledWidth, this.scaledHeight, mStack);
|
||||
if (renderAir) renderAir(this.scaledWidth, this.scaledHeight, mStack);
|
||||
}
|
||||
|
||||
if (renderJumpBar)
|
||||
{
|
||||
renderHorseJumpBar(this.scaledWidth / 2 - 91);
|
||||
func_238446_a_(mStack, this.scaledWidth / 2 - 91);
|
||||
}
|
||||
else if (renderExperiance)
|
||||
{
|
||||
renderExperience(this.scaledWidth / 2 - 91);
|
||||
renderExperience(this.scaledWidth / 2 - 91, mStack);
|
||||
}
|
||||
if (this.mc.gameSettings.heldItemTooltips && this.mc.playerController.getCurrentGameType() != GameType.SPECTATOR) {
|
||||
this.renderSelectedItem();
|
||||
this.func_238453_b_(mStack);
|
||||
} else if (this.mc.player.isSpectator()) {
|
||||
this.spectatorGui.renderSelectedItem();
|
||||
this.spectatorGui.func_238527_a_(mStack);
|
||||
}
|
||||
}
|
||||
|
||||
renderSleepFade(this.scaledWidth, this.scaledHeight);
|
||||
renderSleepFade(this.scaledWidth, this.scaledHeight, mStack);
|
||||
|
||||
renderHUDText(this.scaledWidth, this.scaledHeight);
|
||||
renderFPSGraph();
|
||||
renderPotionEffects();
|
||||
renderHUDText(this.scaledWidth, this.scaledHeight, mStack);
|
||||
renderFPSGraph(mStack);
|
||||
func_238444_a_(mStack);
|
||||
if (!mc.gameSettings.hideGUI) {
|
||||
renderRecordOverlay(this.scaledWidth, this.scaledHeight, partialTicks);
|
||||
renderSubtitles();
|
||||
renderTitle(this.scaledWidth, this.scaledHeight, partialTicks);
|
||||
renderRecordOverlay(this.scaledWidth, this.scaledHeight, partialTicks, mStack);
|
||||
renderSubtitles(mStack);
|
||||
renderTitle(this.scaledWidth, this.scaledHeight, partialTicks, mStack);
|
||||
}
|
||||
|
||||
|
||||
@@ -204,66 +205,67 @@ public class ForgeIngameGui extends IngameGui
|
||||
ScoreObjective scoreobjective1 = objective != null ? objective : scoreboard.getObjectiveInDisplaySlot(1);
|
||||
if (renderObjective && scoreobjective1 != null)
|
||||
{
|
||||
this.renderScoreboard(scoreobjective1);
|
||||
this.func_238447_a_(mStack, scoreobjective1);
|
||||
}
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
RenderSystem.disableAlphaTest();
|
||||
|
||||
renderChat(this.scaledWidth, this.scaledHeight);
|
||||
renderChat(this.scaledWidth, this.scaledHeight, mStack);
|
||||
|
||||
renderPlayerList(this.scaledWidth, this.scaledHeight);
|
||||
renderPlayerList(this.scaledWidth, this.scaledHeight, mStack);
|
||||
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.enableAlphaTest();
|
||||
|
||||
post(ALL);
|
||||
post(ALL, mStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderAttackIndicator()
|
||||
protected void func_238456_d_(MatrixStack mStack)
|
||||
{
|
||||
if (pre(CROSSHAIRS)) return;
|
||||
bind(AbstractGui.GUI_ICONS_LOCATION);
|
||||
if (pre(CROSSHAIRS, mStack)) return;
|
||||
bind(AbstractGui.field_230665_h_);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableAlphaTest();
|
||||
super.renderAttackIndicator();
|
||||
post(CROSSHAIRS);
|
||||
super.func_238456_d_(mStack);
|
||||
post(CROSSHAIRS, mStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderPotionEffects()
|
||||
protected void func_238444_a_(MatrixStack mStack)
|
||||
{
|
||||
if (pre(POTION_ICONS)) return;
|
||||
super.renderPotionEffects();
|
||||
post(POTION_ICONS);
|
||||
if (pre(POTION_ICONS, mStack)) return;
|
||||
super.func_238444_a_(mStack);
|
||||
post(POTION_ICONS, mStack);
|
||||
}
|
||||
|
||||
protected void renderSubtitles()
|
||||
protected void renderSubtitles(MatrixStack mStack)
|
||||
{
|
||||
if (pre(SUBTITLES)) return;
|
||||
this.overlaySubtitle.render();
|
||||
post(SUBTITLES);
|
||||
if (pre(SUBTITLES, mStack)) return;
|
||||
this.overlaySubtitle.render(mStack);
|
||||
post(SUBTITLES, mStack);
|
||||
}
|
||||
|
||||
protected void renderBossHealth()
|
||||
protected void renderBossHealth(MatrixStack mStack)
|
||||
{
|
||||
if (pre(BOSSHEALTH)) return;
|
||||
bind(AbstractGui.GUI_ICONS_LOCATION);
|
||||
if (pre(BOSSHEALTH, mStack)) return;
|
||||
bind(AbstractGui.field_230665_h_);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
mc.getProfiler().startSection("bossHealth");
|
||||
RenderSystem.enableBlend();
|
||||
this.overlayBoss.render();
|
||||
this.overlayBoss.func_238484_a_(mStack);
|
||||
RenderSystem.disableBlend();
|
||||
mc.getProfiler().endSection();
|
||||
post(BOSSHEALTH);
|
||||
post(BOSSHEALTH, mStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderVignette(Entity entity)
|
||||
{
|
||||
if (pre(VIGNETTE))
|
||||
MatrixStack mStack = new MatrixStack();
|
||||
if (pre(VIGNETTE, mStack))
|
||||
{
|
||||
// Need to put this here, since Vanilla assumes this state after the vignette was rendered.
|
||||
RenderSystem.enableDepthTest();
|
||||
@@ -271,12 +273,13 @@ public class ForgeIngameGui extends IngameGui
|
||||
return;
|
||||
}
|
||||
super.renderVignette(entity);
|
||||
post(VIGNETTE);
|
||||
post(VIGNETTE, mStack);
|
||||
}
|
||||
|
||||
private void renderHelmet(float partialTicks)
|
||||
|
||||
private void renderHelmet(float partialTicks, MatrixStack mStack)
|
||||
{
|
||||
if (pre(HELMET)) return;
|
||||
if (pre(HELMET, mStack)) return;
|
||||
|
||||
ItemStack itemstack = this.mc.player.inventory.armorItemInSlot(3);
|
||||
|
||||
@@ -293,12 +296,12 @@ public class ForgeIngameGui extends IngameGui
|
||||
}
|
||||
}
|
||||
|
||||
post(HELMET);
|
||||
post(HELMET, mStack);
|
||||
}
|
||||
|
||||
protected void renderArmor(int width, int height)
|
||||
protected void renderArmor(MatrixStack mStack, int width, int height)
|
||||
{
|
||||
if (pre(ARMOR)) return;
|
||||
if (pre(ARMOR, mStack)) return;
|
||||
mc.getProfiler().startSection("armor");
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
@@ -310,15 +313,15 @@ public class ForgeIngameGui extends IngameGui
|
||||
{
|
||||
if (i < level)
|
||||
{
|
||||
blit(left, top, 34, 9, 9, 9);
|
||||
func_238474_b_(mStack, left, top, 34, 9, 9, 9);
|
||||
}
|
||||
else if (i == level)
|
||||
{
|
||||
blit(left, top, 25, 9, 9, 9);
|
||||
func_238474_b_(mStack, left, top, 25, 9, 9, 9);
|
||||
}
|
||||
else if (i > level)
|
||||
{
|
||||
blit(left, top, 16, 9, 9, 9);
|
||||
func_238474_b_(mStack, left, top, 16, 9, 9, 9);
|
||||
}
|
||||
left += 8;
|
||||
}
|
||||
@@ -326,13 +329,14 @@ public class ForgeIngameGui extends IngameGui
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
mc.getProfiler().endSection();
|
||||
post(ARMOR);
|
||||
post(ARMOR, mStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderPortal(float partialTicks)
|
||||
{
|
||||
if (pre(PORTAL)) return;
|
||||
MatrixStack mStack = new MatrixStack();
|
||||
if (pre(PORTAL, mStack)) return;
|
||||
|
||||
float f1 = mc.player.prevTimeInPortal + (mc.player.timeInPortal - mc.player.prevTimeInPortal) * partialTicks;
|
||||
|
||||
@@ -341,35 +345,29 @@ public class ForgeIngameGui extends IngameGui
|
||||
super.renderPortal(f1);
|
||||
}
|
||||
|
||||
post(PORTAL);
|
||||
post(PORTAL, mStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderHotbar(float partialTicks)
|
||||
protected void func_238443_a_(float partialTicks, MatrixStack mStack)
|
||||
{
|
||||
if (pre(HOTBAR)) return;
|
||||
if (pre(HOTBAR, mStack)) return;
|
||||
|
||||
if (mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
|
||||
{
|
||||
this.spectatorGui.renderTooltip(partialTicks);
|
||||
this.spectatorGui.func_238528_a_(mStack, partialTicks);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.renderHotbar(partialTicks);
|
||||
super.func_238443_a_(partialTicks, mStack);
|
||||
}
|
||||
|
||||
post(HOTBAR);
|
||||
post(HOTBAR, mStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverlayMessage(ITextComponent component, boolean animateColor)
|
||||
protected void renderAir(int width, int height, MatrixStack mStack)
|
||||
{
|
||||
this.setOverlayMessage(component.getFormattedText(), animateColor);
|
||||
}
|
||||
|
||||
protected void renderAir(int width, int height)
|
||||
{
|
||||
if (pre(AIR)) return;
|
||||
if (pre(AIR, mStack)) return;
|
||||
mc.getProfiler().startSection("air");
|
||||
PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity();
|
||||
RenderSystem.enableBlend();
|
||||
@@ -384,20 +382,20 @@ public class ForgeIngameGui extends IngameGui
|
||||
|
||||
for (int i = 0; i < full + partial; ++i)
|
||||
{
|
||||
blit(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
|
||||
func_238474_b_(mStack, left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
|
||||
}
|
||||
right_height += 10;
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
mc.getProfiler().endSection();
|
||||
post(AIR);
|
||||
post(AIR, mStack);
|
||||
}
|
||||
|
||||
public void renderHealth(int width, int height)
|
||||
public void renderHealth(int width, int height, MatrixStack mStack)
|
||||
{
|
||||
bind(GUI_ICONS_LOCATION);
|
||||
if (pre(HEALTH)) return;
|
||||
bind(field_230665_h_);
|
||||
if (pre(HEALTH, mStack)) return;
|
||||
mc.getProfiler().startSection("health");
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
@@ -426,7 +424,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
this.playerHealth = health;
|
||||
int healthLast = this.lastPlayerHealth;
|
||||
|
||||
IAttributeInstance attrMaxHealth = player.getAttribute(SharedMonsterAttributes.MAX_HEALTH);
|
||||
ModifiableAttributeInstance attrMaxHealth = player.getAttribute(Attributes.field_233818_a_);
|
||||
float healthMax = (float)attrMaxHealth.getValue();
|
||||
float absorb = MathHelper.ceil(player.getAbsorptionAmount());
|
||||
|
||||
@@ -463,46 +461,46 @@ public class ForgeIngameGui extends IngameGui
|
||||
if (health <= 4) y += rand.nextInt(2);
|
||||
if (i == regen) y -= 2;
|
||||
|
||||
blit(x, y, BACKGROUND, TOP, 9, 9);
|
||||
func_238474_b_(mStack, x, y, BACKGROUND, TOP, 9, 9);
|
||||
|
||||
if (highlight)
|
||||
{
|
||||
if (i * 2 + 1 < healthLast)
|
||||
blit(x, y, MARGIN + 54, TOP, 9, 9); //6
|
||||
func_238474_b_(mStack, x, y, MARGIN + 54, TOP, 9, 9); //6
|
||||
else if (i * 2 + 1 == healthLast)
|
||||
blit(x, y, MARGIN + 63, TOP, 9, 9); //7
|
||||
func_238474_b_(mStack, x, y, MARGIN + 63, TOP, 9, 9); //7
|
||||
}
|
||||
|
||||
if (absorbRemaining > 0.0F)
|
||||
{
|
||||
if (absorbRemaining == absorb && absorb % 2.0F == 1.0F)
|
||||
{
|
||||
blit(x, y, MARGIN + 153, TOP, 9, 9); //17
|
||||
func_238474_b_(mStack, x, y, MARGIN + 153, TOP, 9, 9); //17
|
||||
absorbRemaining -= 1.0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
blit(x, y, MARGIN + 144, TOP, 9, 9); //16
|
||||
func_238474_b_(mStack, x, y, MARGIN + 144, TOP, 9, 9); //16
|
||||
absorbRemaining -= 2.0F;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i * 2 + 1 < health)
|
||||
blit(x, y, MARGIN + 36, TOP, 9, 9); //4
|
||||
func_238474_b_(mStack, x, y, MARGIN + 36, TOP, 9, 9); //4
|
||||
else if (i * 2 + 1 == health)
|
||||
blit(x, y, MARGIN + 45, TOP, 9, 9); //5
|
||||
func_238474_b_(mStack, x, y, MARGIN + 45, TOP, 9, 9); //5
|
||||
}
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
mc.getProfiler().endSection();
|
||||
post(HEALTH);
|
||||
post(HEALTH, mStack);
|
||||
}
|
||||
|
||||
public void renderFood(int width, int height)
|
||||
public void renderFood(int width, int height, MatrixStack mStack)
|
||||
{
|
||||
if (pre(FOOD)) return;
|
||||
if (pre(FOOD, mStack)) return;
|
||||
mc.getProfiler().startSection("food");
|
||||
|
||||
PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity();
|
||||
@@ -535,19 +533,19 @@ public class ForgeIngameGui extends IngameGui
|
||||
y = top + (rand.nextInt(3) - 1);
|
||||
}
|
||||
|
||||
blit(x, y, 16 + background * 9, 27, 9, 9);
|
||||
func_238474_b_(mStack, x, y, 16 + background * 9, 27, 9, 9);
|
||||
|
||||
if (idx < level)
|
||||
blit(x, y, icon + 36, 27, 9, 9);
|
||||
func_238474_b_(mStack, x, y, icon + 36, 27, 9, 9);
|
||||
else if (idx == level)
|
||||
blit(x, y, icon + 45, 27, 9, 9);
|
||||
func_238474_b_(mStack, x, y, icon + 45, 27, 9, 9);
|
||||
}
|
||||
RenderSystem.disableBlend();
|
||||
mc.getProfiler().endSection();
|
||||
post(FOOD);
|
||||
post(FOOD, mStack);
|
||||
}
|
||||
|
||||
protected void renderSleepFade(int width, int height)
|
||||
protected void renderSleepFade(int width, int height, MatrixStack mStack)
|
||||
{
|
||||
if (mc.player.getSleepTimer() > 0)
|
||||
{
|
||||
@@ -563,48 +561,48 @@ public class ForgeIngameGui extends IngameGui
|
||||
}
|
||||
|
||||
int color = (int)(220.0F * opacity) << 24 | 1052704;
|
||||
fill(0, 0, width, height, color);
|
||||
func_238467_a_(mStack, 0, 0, width, height, color);
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.enableDepthTest();
|
||||
mc.getProfiler().endSection();
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderExperience(int x)
|
||||
protected void renderExperience(int x, MatrixStack mStack)
|
||||
{
|
||||
bind(GUI_ICONS_LOCATION);
|
||||
if (pre(EXPERIENCE)) return;
|
||||
bind(field_230665_h_);
|
||||
if (pre(EXPERIENCE, mStack)) return;
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.disableBlend();
|
||||
|
||||
if (mc.playerController.gameIsSurvivalOrAdventure())
|
||||
{
|
||||
super.renderExpBar(x);
|
||||
super.func_238454_b_(mStack, x);
|
||||
}
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
post(EXPERIENCE);
|
||||
post(EXPERIENCE, mStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHorseJumpBar(int x)
|
||||
public void func_238446_a_(MatrixStack mStack, int x)
|
||||
{
|
||||
bind(GUI_ICONS_LOCATION);
|
||||
if (pre(JUMPBAR)) return;
|
||||
bind(field_230665_h_);
|
||||
if (pre(JUMPBAR, mStack)) return;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.disableBlend();
|
||||
|
||||
super.renderHorseJumpBar(x);
|
||||
super.func_238446_a_(mStack, x);
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
mc.getProfiler().endSection();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
post(JUMPBAR);
|
||||
post(JUMPBAR, mStack);
|
||||
}
|
||||
|
||||
protected void renderHUDText(int width, int height)
|
||||
protected void renderHUDText(int width, int height, MatrixStack mStack)
|
||||
{
|
||||
mc.getProfiler().startSection("forgeHudText");
|
||||
RenderSystem.defaultBlendFunc();
|
||||
@@ -624,23 +622,23 @@ public class ForgeIngameGui extends IngameGui
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG))
|
||||
if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG, mStack))
|
||||
{
|
||||
debugOverlay.update();
|
||||
listL.addAll(debugOverlay.getLeft());
|
||||
listR.addAll(debugOverlay.getRight());
|
||||
post(DEBUG);
|
||||
post(DEBUG, mStack);
|
||||
}
|
||||
|
||||
RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(eventParent, listL, listR);
|
||||
RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(mStack, eventParent, listL, listR);
|
||||
if (!MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
int top = 2;
|
||||
for (String msg : listL)
|
||||
{
|
||||
if (msg == null) continue;
|
||||
fill(1, top - 1, 2 + fontrenderer.getStringWidth(msg) + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752);
|
||||
fontrenderer.drawStringWithShadow(msg, 2, top, 14737632);
|
||||
func_238467_a_(mStack, 1, top - 1, 2 + fontrenderer.getStringWidth(msg) + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752);
|
||||
fontrenderer.func_238421_b_(mStack, msg, 2, top, 14737632);
|
||||
top += fontrenderer.FONT_HEIGHT;
|
||||
}
|
||||
|
||||
@@ -650,26 +648,26 @@ public class ForgeIngameGui extends IngameGui
|
||||
if (msg == null) continue;
|
||||
int w = fontrenderer.getStringWidth(msg);
|
||||
int left = width - 2 - w;
|
||||
fill(left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752);
|
||||
fontrenderer.drawStringWithShadow(msg, left, top, 14737632);
|
||||
func_238467_a_(mStack, left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752);
|
||||
fontrenderer.func_238421_b_(mStack, msg, left, top, 14737632);
|
||||
top += fontrenderer.FONT_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
mc.getProfiler().endSection();
|
||||
post(TEXT);
|
||||
post(TEXT, mStack);
|
||||
}
|
||||
|
||||
protected void renderFPSGraph()
|
||||
protected void renderFPSGraph(MatrixStack mStack)
|
||||
{
|
||||
if (this.mc.gameSettings.showDebugInfo && this.mc.gameSettings.showLagometer && !pre(FPS_GRAPH))
|
||||
if (this.mc.gameSettings.showDebugInfo && this.mc.gameSettings.showLagometer && !pre(FPS_GRAPH, mStack))
|
||||
{
|
||||
this.debugOverlay.render();
|
||||
post(FPS_GRAPH);
|
||||
this.debugOverlay.render(mStack);
|
||||
post(FPS_GRAPH, mStack);
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderRecordOverlay(int width, int height, float partialTicks)
|
||||
protected void renderRecordOverlay(int width, int height, float partialTicks, MatrixStack mStack)
|
||||
{
|
||||
if (overlayMessageTime > 0)
|
||||
{
|
||||
@@ -685,8 +683,8 @@ public class ForgeIngameGui extends IngameGui
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
int color = (animateOverlayMessageColor ? MathHelper.hsvToRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
|
||||
renderTextBackground(fontrenderer, -4, fontrenderer.getStringWidth(overlayMessage));
|
||||
fontrenderer.drawString(overlayMessage, -fontrenderer.getStringWidth(overlayMessage) / 2, -4, color | (opacity << 24));
|
||||
func_238448_a_(mStack, fontrenderer, -4, fontrenderer.func_238414_a_(overlayMessage), 16777215 | (opacity << 24));
|
||||
fontrenderer.func_238422_b_(mStack, overlayMessage, -fontrenderer.func_238414_a_(overlayMessage) / 2, -4, color | (opacity << 24));
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
@@ -695,7 +693,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderTitle(int width, int height, float partialTicks)
|
||||
protected void renderTitle(int width, int height, float partialTicks, MatrixStack mStack)
|
||||
{
|
||||
if (titlesTimer > 0)
|
||||
{
|
||||
@@ -721,11 +719,11 @@ public class ForgeIngameGui extends IngameGui
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.scalef(4.0F, 4.0F, 4.0F);
|
||||
int l = opacity << 24 & -16777216;
|
||||
this.getFontRenderer().drawStringWithShadow(this.displayedTitle, (float)(-this.getFontRenderer().getStringWidth(this.displayedTitle) / 2), -10.0F, 16777215 | l);
|
||||
this.getFontRenderer().func_238407_a_(mStack, this.displayedTitle, (float)(-this.getFontRenderer().func_238414_a_(this.displayedTitle) / 2), -10.0F, 16777215 | l);
|
||||
RenderSystem.popMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.scalef(2.0F, 2.0F, 2.0F);
|
||||
this.getFontRenderer().drawStringWithShadow(this.displayedSubTitle, (float)(-this.getFontRenderer().getStringWidth(this.displayedSubTitle) / 2), 5.0F, 16777215 | l);
|
||||
this.getFontRenderer().func_238407_a_(mStack, this.displayedSubTitle, (float)(-this.getFontRenderer().func_238414_a_(this.displayedSubTitle) / 2), 5.0F, 16777215 | l);
|
||||
RenderSystem.popMatrix();
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.popMatrix();
|
||||
@@ -735,24 +733,24 @@ public class ForgeIngameGui extends IngameGui
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderChat(int width, int height)
|
||||
protected void renderChat(int width, int height, MatrixStack mStack)
|
||||
{
|
||||
mc.getProfiler().startSection("chat");
|
||||
|
||||
RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48);
|
||||
RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(mStack, eventParent, 0, height - 48);
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) return;
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef((float) event.getPosX(), (float) event.getPosY(), 0.0F);
|
||||
persistantChatGUI.render(ticks);
|
||||
persistantChatGUI.func_238492_a_(mStack, ticks);
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
post(CHAT);
|
||||
post(CHAT, mStack);
|
||||
|
||||
mc.getProfiler().endSection();
|
||||
}
|
||||
|
||||
protected void renderPlayerList(int width, int height)
|
||||
protected void renderPlayerList(int width, int height, MatrixStack mStack)
|
||||
{
|
||||
ScoreObjective scoreobjective = this.mc.world.getScoreboard().getObjectiveInDisplaySlot(0);
|
||||
ClientPlayNetHandler handler = mc.player.connection;
|
||||
@@ -760,9 +758,9 @@ public class ForgeIngameGui extends IngameGui
|
||||
if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null))
|
||||
{
|
||||
this.overlayPlayerList.setVisible(true);
|
||||
if (pre(PLAYER_LIST)) return;
|
||||
this.overlayPlayerList.render(width, this.mc.world.getScoreboard(), scoreobjective);
|
||||
post(PLAYER_LIST);
|
||||
if (pre(PLAYER_LIST, mStack)) return;
|
||||
this.overlayPlayerList.func_238523_a_(mStack, width, this.mc.world.getScoreboard(), scoreobjective);
|
||||
post(PLAYER_LIST, mStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -770,15 +768,15 @@ public class ForgeIngameGui extends IngameGui
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderHealthMount(int width, int height)
|
||||
protected void renderHealthMount(int width, int height, MatrixStack mStack)
|
||||
{
|
||||
PlayerEntity player = (PlayerEntity)mc.getRenderViewEntity();
|
||||
Entity tmp = player.getRidingEntity();
|
||||
if (!(tmp instanceof LivingEntity)) return;
|
||||
|
||||
bind(GUI_ICONS_LOCATION);
|
||||
bind(field_230665_h_);
|
||||
|
||||
if (pre(HEALTHMOUNT)) return;
|
||||
if (pre(HEALTHMOUNT, mStack)) return;
|
||||
|
||||
boolean unused = false;
|
||||
int left_align = width / 2 + 91;
|
||||
@@ -807,28 +805,28 @@ public class ForgeIngameGui extends IngameGui
|
||||
for (int i = 0; i < rowCount; ++i)
|
||||
{
|
||||
int x = left_align - i * 8 - 9;
|
||||
blit(x, top, BACKGROUND, 9, 9, 9);
|
||||
func_238474_b_(mStack, x, top, BACKGROUND, 9, 9, 9);
|
||||
|
||||
if (i * 2 + 1 + heart < health)
|
||||
blit(x, top, FULL, 9, 9, 9);
|
||||
func_238474_b_(mStack, x, top, FULL, 9, 9, 9);
|
||||
else if (i * 2 + 1 + heart == health)
|
||||
blit(x, top, HALF, 9, 9, 9);
|
||||
func_238474_b_(mStack, x, top, HALF, 9, 9, 9);
|
||||
}
|
||||
|
||||
right_height += 10;
|
||||
}
|
||||
RenderSystem.disableBlend();
|
||||
post(HEALTHMOUNT);
|
||||
post(HEALTHMOUNT, mStack);
|
||||
}
|
||||
|
||||
//Helper macros
|
||||
private boolean pre(ElementType type)
|
||||
private boolean pre(ElementType type, MatrixStack mStack)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(eventParent, type));
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(mStack, eventParent, type));
|
||||
}
|
||||
private void post(ElementType type)
|
||||
private void post(ElementType type, MatrixStack mStack)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(eventParent, type));
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(mStack, eventParent, type));
|
||||
}
|
||||
private void bind(ResourceLocation res)
|
||||
{
|
||||
@@ -849,8 +847,8 @@ public class ForgeIngameGui extends IngameGui
|
||||
this.rayTraceBlock = entity.pick(rayTraceDistance, 0.0F, false);
|
||||
this.rayTraceFluid = entity.pick(rayTraceDistance, 0.0F, true);
|
||||
}
|
||||
@Override protected void renderDebugInfoLeft(){}
|
||||
@Override protected void renderDebugInfoRight(){}
|
||||
@Override protected void renderDebugInfoLeft(MatrixStack mStack){}
|
||||
@Override protected void renderDebugInfoRight(MatrixStack mStack){}
|
||||
private List<String> getLeft()
|
||||
{
|
||||
List<String> ret = this.getDebugInfoLeft();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.minecraftforge.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -51,7 +52,7 @@ public class NotificationModUpdateScreen extends Screen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
public void func_231160_c_()
|
||||
{
|
||||
if (!hasCheckedForUpdates)
|
||||
{
|
||||
@@ -64,7 +65,7 @@ public class NotificationModUpdateScreen extends Screen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks)
|
||||
public void func_230430_a_(MatrixStack mStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.runVersionCheck())
|
||||
{
|
||||
@@ -73,22 +74,20 @@ public class NotificationModUpdateScreen extends Screen
|
||||
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(VERSION_CHECK_ICONS);
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
int x = modButton.x;
|
||||
int y = modButton.y;
|
||||
int w = modButton.getWidth();
|
||||
int x = modButton.field_230690_l_;
|
||||
int y = modButton.field_230691_m_;
|
||||
int w = modButton.func_230998_h_();
|
||||
int h = modButton.getHeight();
|
||||
|
||||
blit(x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16);
|
||||
RenderSystem.popMatrix();
|
||||
func_238463_a_(mStack, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16);
|
||||
}
|
||||
|
||||
public static NotificationModUpdateScreen init(MainMenuScreen guiMainMenu, Button modButton)
|
||||
{
|
||||
NotificationModUpdateScreen notificationModUpdateScreen = new NotificationModUpdateScreen(modButton);
|
||||
notificationModUpdateScreen.init(guiMainMenu.getMinecraft(), guiMainMenu.width, guiMainMenu.height);
|
||||
notificationModUpdateScreen.init();
|
||||
notificationModUpdateScreen.func_231152_a_(guiMainMenu.getMinecraft(), guiMainMenu.field_230708_k_, guiMainMenu.field_230709_l_);
|
||||
notificationModUpdateScreen.func_231160_c_();
|
||||
return notificationModUpdateScreen;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -75,7 +76,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
|
||||
* @param mouseY
|
||||
* @param mouseX
|
||||
*/
|
||||
protected abstract void drawPanel(int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY);
|
||||
protected abstract void drawPanel(MatrixStack mStack, int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY);
|
||||
|
||||
protected boolean clickPanel(double mouseX, double mouseY, int button) { return false; }
|
||||
|
||||
@@ -105,7 +106,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(double mouseX, double mouseY, double scroll)
|
||||
public boolean func_231043_a_(double mouseX, double mouseY, double scroll)
|
||||
{
|
||||
if (scroll != 0)
|
||||
{
|
||||
@@ -122,15 +123,15 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOver(double mouseX, double mouseY)
|
||||
public boolean func_231047_b_(double mouseX, double mouseY)
|
||||
{
|
||||
return mouseX >= this.left && mouseX <= this.left + this.width &&
|
||||
mouseY >= this.top && mouseY <= this.bottom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
if (super.mouseClicked(mouseX, mouseY, button))
|
||||
public boolean func_231044_a_(double mouseX, double mouseY, int button) {
|
||||
if (super.func_231044_a_(mouseX, mouseY, button))
|
||||
return true;
|
||||
|
||||
this.scrolling = button == 0 && mouseX >= barLeft && mouseX < barLeft + barWidth;
|
||||
@@ -147,8 +148,8 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) {
|
||||
if (super.mouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_))
|
||||
public boolean func_231048_c_(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) {
|
||||
if (super.func_231048_c_(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_))
|
||||
return true;
|
||||
boolean ret = this.scrolling;
|
||||
this.scrolling = false;
|
||||
@@ -168,7 +169,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)
|
||||
public boolean func_231045_a_(double mouseX, double mouseY, int button, double deltaX, double deltaY)
|
||||
{
|
||||
if (this.scrolling)
|
||||
{
|
||||
@@ -182,7 +183,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks)
|
||||
public void func_230430_a_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.drawBackground();
|
||||
|
||||
@@ -196,13 +197,13 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
|
||||
|
||||
if (this.client.world != null)
|
||||
{
|
||||
this.drawGradientRect(this.left, this.top, this.right, this.bottom, 0xC0101010, 0xD0101010);
|
||||
this.drawGradientRect(matrix, this.left, this.top, this.right, this.bottom, 0xC0101010, 0xD0101010);
|
||||
}
|
||||
else // Draw dark dirt background
|
||||
{
|
||||
RenderSystem.disableLighting();
|
||||
RenderSystem.disableFog();
|
||||
this.client.getTextureManager().bindTexture(AbstractGui.BACKGROUND_LOCATION);
|
||||
this.client.getTextureManager().bindTexture(AbstractGui.field_230663_f_);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
final float texScale = 32.0F;
|
||||
worldr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
@@ -214,7 +215,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
|
||||
}
|
||||
|
||||
int baseY = this.top + border - (int)this.scrollDistance;
|
||||
this.drawPanel(right, baseY, tess, mouseX, mouseY);
|
||||
this.drawPanel(matrix, right, baseY, tess, mouseX, mouseY);
|
||||
|
||||
RenderSystem.disableDepthTest();
|
||||
|
||||
@@ -257,13 +258,13 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
protected void drawGradientRect(int left, int top, int right, int bottom, int color1, int color2)
|
||||
protected void drawGradientRect(MatrixStack mStack, int left, int top, int right, int bottom, int color1, int color2)
|
||||
{
|
||||
GuiUtils.drawGradientRect(0, left, top, right, bottom, color1, color2);
|
||||
GuiUtils.drawGradientRect(mStack.getLast().getMatrix(), 0, left, top, right, bottom, color1, color2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends IGuiEventListener> children()
|
||||
public List<? extends IGuiEventListener> func_231039_at__()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
|
||||
@@ -33,7 +33,7 @@ import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
public abstract class BakedModelWrapper<T extends IBakedModel> implements IBakedModel
|
||||
@@ -126,7 +126,7 @@ public abstract class BakedModelWrapper<T extends IBakedModel> implements IBaked
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
|
||||
public IModelData getModelData(@Nonnull IBlockDisplayReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
|
||||
{
|
||||
return originalModel.getModelData(world, pos, state, tileData);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class BlockModelConfiguration implements IModelConfiguration
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material resolveTexture(String name)
|
||||
public RenderMaterial resolveTexture(String name)
|
||||
{
|
||||
return owner.resolveTextureName(name);
|
||||
}
|
||||
@@ -144,14 +144,14 @@ public class BlockModelConfiguration implements IModelConfiguration
|
||||
this.visibilityData.copyFrom(other.visibilityData);
|
||||
}
|
||||
|
||||
public Collection<Material> getTextureDependencies(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextureDependencies(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
IModelGeometry<?> geometry = getCustomGeometry();
|
||||
return geometry == null ? Collections.emptySet() :
|
||||
geometry.getTextures(this, modelGetter, missingTextureErrors);
|
||||
}
|
||||
|
||||
public IBakedModel bake(ModelBakery bakery, Function<Material, TextureAtlasSprite> bakedTextureGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
public IBakedModel bake(ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
{
|
||||
IModelGeometry<?> geometry = getCustomGeometry();
|
||||
if (geometry == null)
|
||||
|
||||
@@ -175,19 +175,19 @@ public class CompositeModel implements IDynamicBakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
{
|
||||
throw new UnsupportedOperationException("Attempted to call adQuads on a Submodel instance. Please don't.");
|
||||
}
|
||||
|
||||
public IBakedModel bakeModel(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
public IBakedModel bakeModel(ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
{
|
||||
return model.bakeModel(bakery, spriteGetter, new ModelTransformComposition(this.modelTransform, modelTransform,
|
||||
this.modelTransform.isUvLock() || modelTransform.isUvLock()), modelLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
return model.getTextures(modelGetter, missingTextureErrors);
|
||||
}
|
||||
@@ -215,9 +215,9 @@ public class CompositeModel implements IDynamicBakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
{
|
||||
Material particleLocation = owner.resolveTexture("particle");
|
||||
RenderMaterial particleLocation = owner.resolveTexture("particle");
|
||||
TextureAtlasSprite particle = spriteGetter.apply(particleLocation);
|
||||
|
||||
ImmutableMap.Builder<String, IBakedModel> bakedParts = ImmutableMap.builder();
|
||||
@@ -232,9 +232,9 @@ public class CompositeModel implements IDynamicBakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
Set<Material> textures = new HashSet<>();
|
||||
Set<RenderMaterial> textures = new HashSet<>();
|
||||
for(Submodel part : parts.values())
|
||||
{
|
||||
textures.addAll(part.getTextures(owner, modelGetter, missingTextureErrors));
|
||||
|
||||
@@ -26,8 +26,9 @@ import com.google.common.collect.Sets;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.renderer.Quaternion;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.math.vector.Quaternion;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.MissingTextureSprite;
|
||||
@@ -94,27 +95,27 @@ public final class DynamicBucketModel implements IModelGeometry<DynamicBucketMod
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
{
|
||||
Material particleLocation = owner.resolveTexture("particle");
|
||||
RenderMaterial particleLocation = owner.resolveTexture("particle");
|
||||
if (MissingTextureSprite.getLocation().equals(particleLocation.getTextureLocation()))
|
||||
{
|
||||
particleLocation = null;
|
||||
}
|
||||
|
||||
Material baseLocation = owner.resolveTexture("base");
|
||||
RenderMaterial baseLocation = owner.resolveTexture("base");
|
||||
if (MissingTextureSprite.getLocation().equals(baseLocation.getTextureLocation()))
|
||||
{
|
||||
baseLocation = null;
|
||||
}
|
||||
|
||||
Material fluidMaskLocation = owner.resolveTexture("fluid");
|
||||
RenderMaterial fluidMaskLocation = owner.resolveTexture("fluid");
|
||||
if (MissingTextureSprite.getLocation().equals(fluidMaskLocation.getTextureLocation()))
|
||||
{
|
||||
fluidMaskLocation = null;
|
||||
}
|
||||
|
||||
Material coverLocation = owner.resolveTexture("cover");
|
||||
RenderMaterial coverLocation = owner.resolveTexture("cover");
|
||||
if (!MissingTextureSprite.getLocation().equals(coverLocation.getTextureLocation()))
|
||||
{
|
||||
// cover (the actual item around the other two)
|
||||
@@ -188,9 +189,9 @@ public final class DynamicBucketModel implements IModelGeometry<DynamicBucketMod
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
Set<Material> texs = Sets.newHashSet();
|
||||
Set<RenderMaterial> texs = Sets.newHashSet();
|
||||
|
||||
texs.add(owner.resolveTexture("particle"));
|
||||
texs.add(owner.resolveTexture("base"));
|
||||
@@ -265,7 +266,7 @@ public final class DynamicBucketModel implements IModelGeometry<DynamicBucketMod
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity)
|
||||
public IBakedModel func_239290_a_(IBakedModel originalModel, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity)
|
||||
{
|
||||
return FluidUtil.getFluidContained(stack)
|
||||
.map(fluidStack -> {
|
||||
|
||||
@@ -1,246 +0,0 @@
|
||||
/*
|
||||
* 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.client.model;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.Quaternion;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraftforge.common.ForgeConfig;
|
||||
import net.minecraftforge.common.model.TransformationHelper;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
final class FancyMissingModel implements IUnbakedModel
|
||||
{
|
||||
private static final ResourceLocation font = new ResourceLocation("minecraft", "textures/font/ascii.png");
|
||||
private static final Material font2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft", "font/ascii"));
|
||||
private static final TransformationMatrix smallTransformation = new TransformationMatrix(null, null, new Vector3f(.25f, .25f, .25f), null)
|
||||
.blockCenterToCorner();
|
||||
private static final SimpleModelFontRenderer fontRenderer = Util.make(() -> {
|
||||
float [] mv = new float[16];
|
||||
mv[2*4+0] = 1f / 128f;
|
||||
mv[0*4+1] =mv[1*4+2] = -mv[2*4+0];
|
||||
mv[3*4+3] = 1;
|
||||
mv[0*4+3] = 1;
|
||||
mv[0*4+3] = 1 + 1f / 0x100;
|
||||
mv[0*4+3] = 0;
|
||||
Matrix4f m = new Matrix4f(mv);
|
||||
return new SimpleModelFontRenderer(
|
||||
Minecraft.getInstance().gameSettings,
|
||||
font,
|
||||
Minecraft.getInstance().getTextureManager(),
|
||||
false,
|
||||
m
|
||||
) {/* TODO Implement once SimpleModelFontRenderer is fixed
|
||||
@Override
|
||||
protected float renderUnicodeChar(char c, boolean italic)
|
||||
{
|
||||
return super.renderDefaultChar(126, italic);
|
||||
}
|
||||
*/};
|
||||
});
|
||||
|
||||
private final IUnbakedModel missingModel;
|
||||
private final String message;
|
||||
|
||||
public FancyMissingModel(IUnbakedModel missingModel, String message)
|
||||
{
|
||||
this.missingModel = missingModel;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
return ImmutableList.of(font2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bakeModel(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
{
|
||||
IBakedModel bigMissing = missingModel.bakeModel(bakery, spriteGetter, modelTransform, modelLocation);
|
||||
ModelTransformComposition smallState = new ModelTransformComposition(modelTransform, new SimpleModelTransform(smallTransformation));
|
||||
IBakedModel smallMissing = missingModel.bakeModel(bakery, spriteGetter, smallState, modelLocation);
|
||||
return new BakedModel(bigMissing, smallMissing, fontRenderer, message, spriteGetter.apply(font2));
|
||||
}
|
||||
|
||||
static final class BakedModel implements IBakedModel
|
||||
{
|
||||
private final SimpleModelFontRenderer fontRenderer;
|
||||
private final String message;
|
||||
private final TextureAtlasSprite fontTexture;
|
||||
private final IBakedModel missingModel;
|
||||
private final IBakedModel otherModel;
|
||||
private final boolean big;
|
||||
private ImmutableList<BakedQuad> quads;
|
||||
|
||||
public BakedModel(IBakedModel bigMissing, IBakedModel smallMissing, SimpleModelFontRenderer fontRenderer, String message, TextureAtlasSprite fontTexture)
|
||||
{
|
||||
this.missingModel = bigMissing;
|
||||
otherModel = new BakedModel(smallMissing, fontRenderer, message, fontTexture, this);
|
||||
this.big = true;
|
||||
this.fontRenderer = fontRenderer;
|
||||
this.message = message;
|
||||
this.fontTexture = fontTexture;
|
||||
}
|
||||
|
||||
public BakedModel(IBakedModel smallMissing, SimpleModelFontRenderer fontRenderer, String message, TextureAtlasSprite fontTexture, BakedModel big)
|
||||
{
|
||||
this.missingModel = smallMissing;
|
||||
otherModel = big;
|
||||
this.big = false;
|
||||
this.fontRenderer = fontRenderer;
|
||||
this.message = message;
|
||||
this.fontTexture = fontTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand)
|
||||
{
|
||||
if (side == null)
|
||||
{
|
||||
if (quads == null)
|
||||
{
|
||||
fontRenderer.setSprite(fontTexture);
|
||||
fontRenderer.setFillBlanks(true);
|
||||
String[] lines = message.split("\\r?\\n");
|
||||
List<String> splitLines = Lists.newArrayList();
|
||||
for (int y = 0; y < lines.length; y++)
|
||||
{
|
||||
splitLines.addAll(fontRenderer.listFormattedStringToWidth(lines[y], 0x80));
|
||||
}
|
||||
for (int y = 0; y < splitLines.size(); y++)
|
||||
{
|
||||
fontRenderer.drawString(splitLines.get(y), 0, ((y - splitLines.size() / 2f) * fontRenderer.FONT_HEIGHT) + 0x40, 0xFF00FFFF);
|
||||
}
|
||||
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
|
||||
builder.addAll(missingModel.getQuads (state, side, rand));
|
||||
builder.addAll(fontRenderer.build());
|
||||
quads = builder.build();
|
||||
}
|
||||
return quads;
|
||||
}
|
||||
return missingModel.getQuads (state, side, rand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() { return true; }
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() { return false; }
|
||||
|
||||
@Override
|
||||
public boolean func_230044_c_() { return false; }
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() { return false; }
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() { return fontTexture; }
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() { return ItemOverrideList.EMPTY; }
|
||||
|
||||
@Override
|
||||
public boolean doesHandlePerspectives()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat)
|
||||
{
|
||||
TransformationMatrix transform = TransformationMatrix.identity();
|
||||
boolean big = true;
|
||||
switch (cameraTransformType)
|
||||
{
|
||||
|
||||
case THIRD_PERSON_LEFT_HAND:
|
||||
break;
|
||||
case THIRD_PERSON_RIGHT_HAND:
|
||||
break;
|
||||
case FIRST_PERSON_LEFT_HAND:
|
||||
transform = new TransformationMatrix(new Vector3f(-0.62f, 0.5f, -.5f), new Quaternion(1, -1, -1, 1), null, null);
|
||||
big = false;
|
||||
break;
|
||||
case FIRST_PERSON_RIGHT_HAND:
|
||||
transform = new TransformationMatrix(new Vector3f(-0.5f, 0.5f, -.5f), new Quaternion(1, 1, 1, 1), null, null);
|
||||
big = false;
|
||||
break;
|
||||
case HEAD:
|
||||
break;
|
||||
case GUI:
|
||||
if (ForgeConfig.CLIENT.zoomInMissingModelTextInGui.get())
|
||||
{
|
||||
transform = new TransformationMatrix(null, new Quaternion(1, 1, 1, 1), new Vector3f(4, 4, 4), null);
|
||||
big = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
transform = new TransformationMatrix(null, new Quaternion(1, 1, 1, 1), null, null);
|
||||
big = true;
|
||||
}
|
||||
break;
|
||||
case FIXED:
|
||||
transform = new TransformationMatrix(null, new Quaternion(-1, -1, 1, 1), null, null);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mat.getLast().getMatrix().mul(transform.getMatrix());
|
||||
if (big != this.big)
|
||||
{
|
||||
return otherModel;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -73,13 +73,13 @@ public final class FluidModel implements IModelGeometry<FluidModel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
return ForgeHooksClient.getFluidMaterials(fluid).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
{
|
||||
FluidAttributes attrs = fluid.getAttributes();
|
||||
return new CachingBakedFluid(
|
||||
|
||||
@@ -22,7 +22,7 @@ package net.minecraftforge.client.model;
|
||||
import net.minecraft.client.renderer.model.IModelTransform;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.model.Material;
|
||||
import net.minecraft.client.renderer.model.RenderMaterial;
|
||||
import net.minecraftforge.client.model.geometry.IModelGeometryPart;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -55,7 +55,7 @@ public interface IModelConfiguration {
|
||||
* @param name The name of a texture channel.
|
||||
* @return The location of the texture, or the missing texture if not found.
|
||||
*/
|
||||
Material resolveTexture(String name);
|
||||
RenderMaterial resolveTexture(String name);
|
||||
|
||||
/**
|
||||
* @return True if the item uses 3D lighting.
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -38,7 +38,6 @@ import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.Vec2f;
|
||||
import net.minecraftforge.client.model.geometry.IModelGeometry;
|
||||
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
|
||||
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
||||
@@ -64,7 +63,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
|
||||
private static final Direction[] HORIZONTALS = {Direction.UP, Direction.DOWN};
|
||||
private static final Direction[] VERTICALS = {Direction.WEST, Direction.EAST};
|
||||
|
||||
private ImmutableList<Material> textures;
|
||||
private ImmutableList<RenderMaterial> textures;
|
||||
private final ImmutableSet<Integer> fullbrightLayers;
|
||||
|
||||
public ItemLayerModel()
|
||||
@@ -72,20 +71,20 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
|
||||
this(null, ImmutableSet.of());
|
||||
}
|
||||
|
||||
public ItemLayerModel(ImmutableList<Material> textures)
|
||||
public ItemLayerModel(ImmutableList<RenderMaterial> textures)
|
||||
{
|
||||
this(textures, ImmutableSet.of());
|
||||
}
|
||||
|
||||
public ItemLayerModel(@Nullable ImmutableList<Material> textures, ImmutableSet<Integer> fullbrightLayers)
|
||||
public ItemLayerModel(@Nullable ImmutableList<RenderMaterial> textures, ImmutableSet<Integer> fullbrightLayers)
|
||||
{
|
||||
this.textures = textures;
|
||||
this.fullbrightLayers = fullbrightLayers;
|
||||
}
|
||||
|
||||
private static ImmutableList<Material> getTextures(IModelConfiguration model)
|
||||
private static ImmutableList<RenderMaterial> getTextures(IModelConfiguration model)
|
||||
{
|
||||
ImmutableList.Builder<Material> builder = ImmutableList.builder();
|
||||
ImmutableList.Builder<RenderMaterial> builder = ImmutableList.builder();
|
||||
for(int i = 0; model.isTexturePresent("layer" + i); i++)
|
||||
{
|
||||
builder.add(model.resolveTexture("layer" + i));
|
||||
@@ -94,7 +93,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
{
|
||||
//TODO: Verify
|
||||
TransformationMatrix transform = modelTransform.getRotation();
|
||||
@@ -106,12 +105,12 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
|
||||
return new BakedItemModel(quads, particle, map, overrides, transform.isIdentity(), owner.isSideLit());
|
||||
}
|
||||
|
||||
public static ImmutableList<BakedQuad> getQuadsForSprites(List<Material> textures, TransformationMatrix transform, Function<Material, TextureAtlasSprite> spriteGetter)
|
||||
public static ImmutableList<BakedQuad> getQuadsForSprites(List<RenderMaterial> textures, TransformationMatrix transform, Function<RenderMaterial, TextureAtlasSprite> spriteGetter)
|
||||
{
|
||||
return getQuadsForSprites(textures, transform, spriteGetter, Collections.emptySet());
|
||||
}
|
||||
|
||||
public static ImmutableList<BakedQuad> getQuadsForSprites(List<Material> textures, TransformationMatrix transform, Function<Material, TextureAtlasSprite> spriteGetter, Set<Integer> fullbrights)
|
||||
public static ImmutableList<BakedQuad> getQuadsForSprites(List<RenderMaterial> textures, TransformationMatrix transform, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, Set<Integer> fullbrights)
|
||||
{
|
||||
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
|
||||
for(int i = 0; i < textures.size(); i++)
|
||||
@@ -303,7 +302,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
textures = getTextures(owner);
|
||||
return textures;
|
||||
|
||||
@@ -21,7 +21,7 @@ package net.minecraftforge.client.model;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
|
||||
@@ -162,7 +162,7 @@ public final class ModelLoader extends ModelBakery
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, LOCATION).getSprite();
|
||||
instance = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, LOCATION).getSprite();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
@@ -262,9 +262,9 @@ public final class ModelLoader extends ModelBakery
|
||||
/**
|
||||
* Get the default texture getter the models will be baked with.
|
||||
*/
|
||||
public static Function<Material, TextureAtlasSprite> defaultTextureGetter()
|
||||
public static Function<RenderMaterial, TextureAtlasSprite> defaultTextureGetter()
|
||||
{
|
||||
return Material::getSprite;
|
||||
return RenderMaterial::getSprite;
|
||||
}
|
||||
|
||||
public static Function<ResourceLocation, IUnbakedModel> defaultModelGetter()
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.google.common.collect.Sets;
|
||||
import com.google.gson.*;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.MissingTextureSprite;
|
||||
@@ -36,6 +35,7 @@ import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraftforge.client.model.geometry.IModelGeometry;
|
||||
import net.minecraftforge.client.model.geometry.ISimpleModelGeometry;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
@@ -141,7 +141,7 @@ public class ModelLoaderRegistry
|
||||
private static final Pattern FILESYSTEM_PATH_TO_RESLOC =
|
||||
Pattern.compile("(?:.*[\\\\/]assets[\\\\/](?<namespace>[a-z_-]+)[\\\\/]textures[\\\\/])?(?<path>[a-z_\\\\/-]+)\\.png");
|
||||
|
||||
public static Material resolveTexture(@Nullable String tex, IModelConfiguration owner)
|
||||
public static RenderMaterial resolveTexture(@Nullable String tex, IModelConfiguration owner)
|
||||
{
|
||||
if (tex == null)
|
||||
return blockMaterial(WHITE_TEXTURE);
|
||||
@@ -163,14 +163,14 @@ public class ModelLoaderRegistry
|
||||
return blockMaterial(tex);
|
||||
}
|
||||
|
||||
public static Material blockMaterial(String location)
|
||||
public static RenderMaterial blockMaterial(String location)
|
||||
{
|
||||
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(location));
|
||||
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(location));
|
||||
}
|
||||
|
||||
public static Material blockMaterial(ResourceLocation location)
|
||||
public static RenderMaterial blockMaterial(ResourceLocation location)
|
||||
{
|
||||
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, location);
|
||||
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, location);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -244,7 +244,7 @@ public class ModelLoaderRegistry
|
||||
}
|
||||
}
|
||||
|
||||
public static IBakedModel bakeHelper(BlockModel blockModel, ModelBakery modelBakery, BlockModel otherModel, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation, boolean guiLight3d)
|
||||
public static IBakedModel bakeHelper(BlockModel blockModel, ModelBakery modelBakery, BlockModel otherModel, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation, boolean guiLight3d)
|
||||
{
|
||||
IBakedModel model;
|
||||
IModelGeometry<?> customModel = blockModel.customData.getCustomGeometry();
|
||||
@@ -273,7 +273,7 @@ public class ModelLoaderRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
{
|
||||
for(BlockPart blockpart : elements) {
|
||||
for(Direction direction : blockpart.mapFaces.keySet()) {
|
||||
@@ -291,13 +291,13 @@ public class ModelLoaderRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
Set<Material> textures = Sets.newHashSet();
|
||||
Set<RenderMaterial> textures = Sets.newHashSet();
|
||||
|
||||
for(BlockPart part : elements) {
|
||||
for(BlockPartFace face : part.mapFaces.values()) {
|
||||
Material texture = owner.resolveTexture(face.texture);
|
||||
RenderMaterial texture = owner.resolveTexture(face.texture);
|
||||
if (Objects.equals(texture, MissingTextureSprite.getLocation().toString())) {
|
||||
missingTextureErrors.add(Pair.of(face.texture, owner.getModelName()));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.IModelTransform;
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -67,16 +67,16 @@ public final class MultiLayerModel implements IModelGeometry<MultiLayerModel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
Set<Material> materials = Sets.newHashSet();
|
||||
Set<RenderMaterial> materials = Sets.newHashSet();
|
||||
materials.add(owner.resolveTexture("particle"));
|
||||
for (IUnbakedModel m : models.values())
|
||||
materials.addAll(m.getTextures(modelGetter, missingTextureErrors));
|
||||
return materials;
|
||||
}
|
||||
|
||||
private static ImmutableMap<RenderType, IBakedModel> buildModels(ImmutableMap<RenderType, IUnbakedModel> models, IModelTransform modelTransform, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, ResourceLocation modelLocation)
|
||||
private static ImmutableMap<RenderType, IBakedModel> buildModels(ImmutableMap<RenderType, IUnbakedModel> models, IModelTransform modelTransform, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, ResourceLocation modelLocation)
|
||||
{
|
||||
ImmutableMap.Builder<RenderType, IBakedModel> builder = ImmutableMap.builder();
|
||||
for(Map.Entry<RenderType, IUnbakedModel> entry : models.entrySet())
|
||||
@@ -87,7 +87,7 @@ public final class MultiLayerModel implements IModelGeometry<MultiLayerModel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
{
|
||||
IUnbakedModel missing = ModelLoader.instance().getMissingModel();
|
||||
|
||||
|
||||
@@ -26,12 +26,13 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.data.IDynamicBakedModel;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
@@ -164,9 +165,9 @@ public class PerspectiveMapWrapper implements IDynamicBakedModel
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel getModelWithOverrides(IBakedModel model, ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn)
|
||||
public IBakedModel func_239290_a_(IBakedModel model, ItemStack stack, @Nullable ClientWorld worldIn, @Nullable LivingEntity entityIn)
|
||||
{
|
||||
model = parent.getOverrides().getModelWithOverrides(parent, stack, worldIn, entityIn);
|
||||
model = parent.getOverrides().func_239290_a_(parent, stack, worldIn, entityIn);
|
||||
return new PerspectiveMapWrapper(model, transforms);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.Vector4f;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector4f;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
@@ -176,7 +176,7 @@ public class QuadTransformer
|
||||
int[] outData = Arrays.copyOf(inData, inData.length);
|
||||
processVertices(inData, outData);
|
||||
|
||||
return new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.shouldApplyDiffuseLighting());
|
||||
return new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.func_239287_f_());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +208,7 @@ public class QuadTransformer
|
||||
int[] outData = Arrays.copyOf(inData, inData.length);
|
||||
processVertices(inData, outData);
|
||||
|
||||
outputs.add(new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.shouldApplyDiffuseLighting()));
|
||||
outputs.add(new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.func_239287_f_()));
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* 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.client.model;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.GameSettings;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.Vector4f;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
|
||||
|
||||
public abstract class SimpleModelFontRenderer extends FontRenderer {
|
||||
|
||||
private float r, g, b, a;
|
||||
private final TransformationMatrix transform;
|
||||
private ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
|
||||
private final Vector3f normal = new Vector3f(0, 0, 1);
|
||||
private final Direction orientation;
|
||||
private boolean fillBlanks = false;
|
||||
|
||||
private TextureAtlasSprite sprite;
|
||||
|
||||
public SimpleModelFontRenderer(GameSettings settings, ResourceLocation font, TextureManager manager, boolean isUnicode, Matrix4f matrix)
|
||||
{
|
||||
super(manager, null);
|
||||
this.transform = new TransformationMatrix(matrix);
|
||||
transform.transformNormal(normal);
|
||||
orientation = Direction.getFacingFromVector(normal.getX(), normal.getY(), normal.getZ());
|
||||
}
|
||||
|
||||
public void setSprite(TextureAtlasSprite sprite)
|
||||
{
|
||||
this.sprite = sprite;
|
||||
}
|
||||
|
||||
public void setFillBlanks(boolean fillBlanks)
|
||||
{
|
||||
this.fillBlanks = fillBlanks;
|
||||
}
|
||||
|
||||
private final Vector4f vec = new Vector4f();
|
||||
|
||||
private void addVertex(BakedQuadBuilder quadBuilder, float x, float y, float u, float v)
|
||||
{
|
||||
ImmutableList<VertexFormatElement> elements = quadBuilder.getVertexFormat().getElements();
|
||||
for(int e = 0; e < elements.size(); e++)
|
||||
{
|
||||
VertexFormatElement element = elements.get(e);
|
||||
switch(element.getUsage())
|
||||
{
|
||||
case POSITION:
|
||||
vec.set(x, y, 0f, 1f);
|
||||
transform.transformPosition(vec);
|
||||
quadBuilder.put(e, vec.getX(), vec.getY(), vec.getZ(), vec.getW());
|
||||
break;
|
||||
case COLOR:
|
||||
quadBuilder.put(e, r, g, b, a);
|
||||
break;
|
||||
case NORMAL:
|
||||
//quadBuilder.put(e, normal.x, normal.y, normal.z, 1);
|
||||
quadBuilder.put(e, 0, 0, 1, 1);
|
||||
break;
|
||||
case UV:
|
||||
if(element.getIndex() == 0)
|
||||
{
|
||||
quadBuilder.put(e, sprite.getInterpolatedU(u * 16), sprite.getInterpolatedV(v * 16), 0, 1);
|
||||
break;
|
||||
}
|
||||
// else fallthrough to default
|
||||
default:
|
||||
quadBuilder.put(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ImmutableList<BakedQuad> build()
|
||||
{
|
||||
ImmutableList<BakedQuad> ret = builder.build();
|
||||
builder = ImmutableList.builder();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -19,10 +19,10 @@
|
||||
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.IModelTransform;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
|
||||
/**
|
||||
* Simple implementation of IModelState via a map and a default value.
|
||||
|
||||
+6
-5
@@ -27,6 +27,7 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -43,14 +44,14 @@ public final class AnimationItemOverrideList extends ItemOverrideList
|
||||
private final IModelTransform state;
|
||||
|
||||
|
||||
private final Function<Material, TextureAtlasSprite> bakedTextureGetter;
|
||||
private final Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter;
|
||||
|
||||
public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function<Material, TextureAtlasSprite> bakedTextureGetter, ItemOverrideList overrides)
|
||||
public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter, ItemOverrideList overrides)
|
||||
{
|
||||
this(bakery, model, modelLoc, state, bakedTextureGetter, overrides.getOverrides().reverse());
|
||||
}
|
||||
|
||||
public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function<Material, TextureAtlasSprite> bakedTextureGetter, List<ItemOverride> overrides)
|
||||
public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter, List<ItemOverride> overrides)
|
||||
{
|
||||
super(bakery, model, ModelLoader.defaultModelGetter(), bakedTextureGetter, overrides);
|
||||
this.bakery = bakery;
|
||||
@@ -61,7 +62,7 @@ public final class AnimationItemOverrideList extends ItemOverrideList
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity)
|
||||
public IBakedModel func_239290_a_(IBakedModel originalModel, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity)
|
||||
{
|
||||
return stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)
|
||||
.map(asm ->
|
||||
@@ -80,6 +81,6 @@ public final class AnimationItemOverrideList extends ItemOverrideList
|
||||
})
|
||||
// TODO where should uvlock data come from?
|
||||
.map(state -> model.bakeModel(bakery, bakedTextureGetter, new ModelTransformComposition(state, this.state), modelLoc))
|
||||
.orElseGet(() -> super.getModelWithOverrides(originalModel, stack, world, entity));
|
||||
.orElseGet(() -> super.func_239290_a_(originalModel, stack, world, entity));
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,11 @@ import java.util.TreeMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.model.IModelTransform;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.util.math.vector.Quaternion;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.client.model.ModelDataManager;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
@@ -66,7 +66,7 @@ public class TileEntityRendererAnimation<T extends TileEntity> extends TileEntit
|
||||
}
|
||||
if(blockRenderer == null) blockRenderer = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
BlockPos pos = te.getPos();
|
||||
ILightReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
|
||||
IBlockDisplayReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
|
||||
BlockState state = world.getBlockState(pos);
|
||||
IBakedModel model = blockRenderer.getBlockModelShapes().getModel(state);
|
||||
IModelData data = model.getModelData(world, pos, state, ModelDataManager.getModelData(te.getWorld(), pos));
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package net.minecraftforge.client.model.b3d;
|
||||
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraftforge.client.model.b3d.B3DLoader.NodeJoint;
|
||||
import net.minecraftforge.client.model.b3d.B3DModel.Key;
|
||||
import net.minecraftforge.client.model.b3d.B3DModel.Node;
|
||||
|
||||
@@ -38,9 +38,9 @@ import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.MissingTextureSprite;
|
||||
@@ -446,10 +446,10 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
return textures.values().stream().filter(loc -> !loc.startsWith("#"))
|
||||
.map(t -> new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(t)))
|
||||
.map(t -> new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(t)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -461,10 +461,10 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bakeModel(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
public IBakedModel bakeModel(ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
{
|
||||
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
|
||||
TextureAtlasSprite missing = spriteGetter.apply(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, MissingTextureSprite.getLocation()));
|
||||
TextureAtlasSprite missing = spriteGetter.apply(new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, MissingTextureSprite.getLocation()));
|
||||
for(Map.Entry<String, String> e : textures.entrySet())
|
||||
{
|
||||
if(e.getValue().startsWith("#"))
|
||||
@@ -474,7 +474,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.put(e.getKey(), spriteGetter.apply(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(e.getValue()))));
|
||||
builder.put(e.getKey(), spriteGetter.apply(new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(e.getValue()))));
|
||||
}
|
||||
}
|
||||
builder.put("missingno", missing);
|
||||
|
||||
@@ -39,8 +39,7 @@ import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.util.math.Vec2f;
|
||||
import net.minecraft.util.math.vector.*;
|
||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -249,8 +248,8 @@ public class B3DModel
|
||||
String path = readString();
|
||||
int flags = buf.getInt();
|
||||
int blend = buf.getInt();
|
||||
Vec2f pos = new Vec2f(buf.getFloat(), buf.getFloat());
|
||||
Vec2f scale = new Vec2f(buf.getFloat(), buf.getFloat());
|
||||
Vector2f pos = new Vector2f(buf.getFloat(), buf.getFloat());
|
||||
Vector2f scale = new Vector2f(buf.getFloat(), buf.getFloat());
|
||||
float rot = buf.getFloat();
|
||||
ret.add(new Texture(path, flags, blend, pos, scale, rot));
|
||||
}
|
||||
@@ -529,15 +528,15 @@ public class B3DModel
|
||||
|
||||
public static class Texture
|
||||
{
|
||||
public static final Texture White = new Texture("builtin/white", 0, 0, new Vec2f(0, 0), new Vec2f(1, 1), 0);
|
||||
public static final Texture White = new Texture("builtin/white", 0, 0, new Vector2f(0, 0), new Vector2f(1, 1), 0);
|
||||
private final String path;
|
||||
private final int flags;
|
||||
private final int blend;
|
||||
private final Vec2f pos;
|
||||
private final Vec2f scale;
|
||||
private final Vector2f pos;
|
||||
private final Vector2f scale;
|
||||
private final float rot;
|
||||
|
||||
public Texture(String path, int flags, int blend, Vec2f pos, Vec2f scale, float rot)
|
||||
public Texture(String path, int flags, int blend, Vector2f pos, Vector2f scale, float rot)
|
||||
{
|
||||
this.path = path;
|
||||
this.flags = flags;
|
||||
@@ -562,12 +561,12 @@ public class B3DModel
|
||||
return blend;
|
||||
}
|
||||
|
||||
public Vec2f getPos()
|
||||
public Vector2f getPos()
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
public Vec2f getScale()
|
||||
public Vector2f getScale()
|
||||
{
|
||||
return scale;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ import net.minecraft.block.DoorBlock;
|
||||
import net.minecraft.block.FenceBlock;
|
||||
import net.minecraft.block.FenceGateBlock;
|
||||
import net.minecraft.block.FourWayBlock;
|
||||
import net.minecraft.block.LogBlock;
|
||||
import net.minecraft.block.PaneBlock;
|
||||
import net.minecraft.block.RotatedPillarBlock;
|
||||
import net.minecraft.block.SixWayBlock;
|
||||
@@ -194,7 +193,7 @@ public abstract class BlockStateProvider implements IDataProvider {
|
||||
axisBlock(block, blockTexture(block));
|
||||
}
|
||||
|
||||
public void logBlock(LogBlock block) {
|
||||
public void logBlock(RotatedPillarBlock block) {
|
||||
axisBlock(block, blockTexture(block), extend(blockTexture(block), "_top"));
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ public class ExistingFileHelper {
|
||||
private final boolean enable;
|
||||
|
||||
public ExistingFileHelper(Collection<Path> existingPacks, boolean enable) {
|
||||
this.clientResources = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, Thread.currentThread());
|
||||
this.serverData = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA, Thread.currentThread());
|
||||
this.clientResources = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES);
|
||||
this.serverData = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA);
|
||||
this.clientResources.addResourcePack(new VanillaPack("minecraft", "realms"));
|
||||
this.serverData.addResourcePack(new VanillaPack("minecraft"));
|
||||
for (Path existing : existingPacks) {
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.client.renderer.model.BlockFaceUV;
|
||||
import net.minecraft.client.renderer.model.BlockPart;
|
||||
import net.minecraft.client.renderer.model.BlockPartFace;
|
||||
@@ -53,11 +53,11 @@ import net.minecraft.util.math.MathHelper;
|
||||
/**
|
||||
* General purpose model builder, contains all the commonalities between item
|
||||
* and block models.
|
||||
*
|
||||
*
|
||||
* @see ModelProvider
|
||||
* @see BlockModelBuilder
|
||||
* @see ItemModelBuilder
|
||||
*
|
||||
*
|
||||
* @param <T> Self type, for simpler chaining of methods.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -89,7 +89,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Set the parent model for the current model.
|
||||
*
|
||||
*
|
||||
* @param parent the parent model
|
||||
* @return this builder
|
||||
* @throws NullPointerException if {@code parent} is {@code null}
|
||||
@@ -104,7 +104,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Set the texture for a given dictionary key.
|
||||
*
|
||||
*
|
||||
* @param key the texture key
|
||||
* @param texture the texture, can be another key e.g. {@code "#all"}
|
||||
* @return this builder
|
||||
@@ -133,7 +133,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Set the texture for a given dictionary key.
|
||||
*
|
||||
*
|
||||
* @param key the texture key
|
||||
* @param texture the texture
|
||||
* @return this builder
|
||||
@@ -170,7 +170,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
public T gui3d(boolean gui3d) {
|
||||
return self();
|
||||
}
|
||||
|
||||
|
||||
public T guiLight(GuiLight light) {
|
||||
this.guiLight = light;
|
||||
return self();
|
||||
@@ -184,7 +184,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Get an existing element builder
|
||||
*
|
||||
*
|
||||
* @param index the index of the existing element builder
|
||||
* @return the element builder
|
||||
* @throws IndexOutOfBoundsException if {@code} index is out of bounds
|
||||
@@ -204,7 +204,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
if (!this.ambientOcclusion) {
|
||||
root.addProperty("ambientocclusion", this.ambientOcclusion);
|
||||
}
|
||||
|
||||
|
||||
if (this.guiLight != null) {
|
||||
root.addProperty("gui_light", this.guiLight.getSerializedName());
|
||||
}
|
||||
@@ -240,7 +240,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
if (!this.elements.isEmpty()) {
|
||||
JsonArray elements = new JsonArray();
|
||||
this.elements.stream().map(ElementBuilder::build).forEach(part -> {
|
||||
this.elements.stream().map(ElementBuilder::build).forEach(part -> {
|
||||
JsonObject partObj = new JsonObject();
|
||||
partObj.add("from", serializeVector3f(part.positionFrom));
|
||||
partObj.add("to", serializeVector3f(part.positionTo));
|
||||
@@ -248,7 +248,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
if (part.partRotation != null) {
|
||||
JsonObject rotation = new JsonObject();
|
||||
rotation.add("origin", serializeVector3f(part.partRotation.origin));
|
||||
rotation.addProperty("axis", part.partRotation.axis.getName());
|
||||
rotation.addProperty("axis", part.partRotation.axis.func_176610_l());
|
||||
rotation.addProperty("angle", part.partRotation.angle);
|
||||
if (part.partRotation.rescale) {
|
||||
rotation.addProperty("rescale", part.partRotation.rescale);
|
||||
@@ -271,7 +271,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
faceObj.add("uv", new Gson().toJsonTree(face.blockFaceUV.uvs));
|
||||
}
|
||||
if (face.cullFace != null) {
|
||||
faceObj.addProperty("cullface", face.cullFace.getName());
|
||||
faceObj.addProperty("cullface", face.cullFace.func_176610_l());
|
||||
}
|
||||
if (face.blockFaceUV.rotation != 0) {
|
||||
faceObj.addProperty("rotation", face.blockFaceUV.rotation);
|
||||
@@ -279,7 +279,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
if (face.tintIndex != -1) {
|
||||
faceObj.addProperty("tintindex", face.tintIndex);
|
||||
}
|
||||
faces.add(dir.getName(), faceObj);
|
||||
faces.add(dir.func_176610_l(), faceObj);
|
||||
}
|
||||
if (!part.mapFaces.isEmpty()) {
|
||||
partObj.add("faces", faces);
|
||||
@@ -341,7 +341,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Set the "from" position for this element.
|
||||
*
|
||||
*
|
||||
* @param x x-position for this vector
|
||||
* @param y y-position for this vector
|
||||
* @param z z-position for this vector
|
||||
@@ -358,7 +358,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Set the "to" position for this element.
|
||||
*
|
||||
*
|
||||
* @param x x-position for this vector
|
||||
* @param y y-position for this vector
|
||||
* @param z z-position for this vector
|
||||
@@ -375,7 +375,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Return or create the face builder for the given direction.
|
||||
*
|
||||
*
|
||||
* @param dir the direction
|
||||
* @return the face builder for the given direction
|
||||
* @throws NullPointerException if {@code dir} is {@code null}
|
||||
@@ -400,7 +400,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
/**
|
||||
* Modify all <em>possible</em> faces dynamically using a function, creating new
|
||||
* faces as necessary.
|
||||
*
|
||||
*
|
||||
* @param action the function to apply to each direction
|
||||
* @return this builder
|
||||
* @throws NullPointerException if {@code action} is {@code null}
|
||||
@@ -413,7 +413,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Modify all <em>existing</em> faces dynamically using a function.
|
||||
*
|
||||
*
|
||||
* @param action the function to apply to each direction
|
||||
* @return this builder
|
||||
* @throws NullPointerException if {@code action} is {@code null}
|
||||
@@ -427,7 +427,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
/**
|
||||
* Texture all <em>possible</em> faces in the current element with the given
|
||||
* texture, creating new faces where necessary.
|
||||
*
|
||||
*
|
||||
* @param texture the texture
|
||||
* @return this builder
|
||||
* @throws NullPointerException if {@code texture} is {@code null}
|
||||
@@ -439,7 +439,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
/**
|
||||
* Texture all <em>existing</em> faces in the current element with the given
|
||||
* texture.
|
||||
*
|
||||
*
|
||||
* @param texture the texture
|
||||
* @return this builder
|
||||
* @throws NullPointerException if {@code texture} is {@code null}
|
||||
@@ -451,7 +451,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
/**
|
||||
* Create a typical cube element, creating new faces as needed, applying the
|
||||
* given texture, and setting the cullface.
|
||||
*
|
||||
*
|
||||
* @param texture the texture
|
||||
* @return this builder
|
||||
* @throws NullPointerException if {@code texture} is {@code null}
|
||||
@@ -496,7 +496,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Set the texture for the current face.
|
||||
*
|
||||
*
|
||||
* @param texture the texture
|
||||
* @return this builder
|
||||
* @throws NullPointerException if {@code texture} is {@code null}
|
||||
@@ -514,7 +514,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Set the texture rotation for the current face.
|
||||
*
|
||||
*
|
||||
* @param rot the rotation
|
||||
* @return this builder
|
||||
* @throws NullPointerException if {@code rot} is {@code null}
|
||||
@@ -625,7 +625,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
|
||||
|
||||
/**
|
||||
* Begin building a new transform for the given perspective.
|
||||
*
|
||||
*
|
||||
* @param type the perspective to create or return the builder for
|
||||
* @return the builder for the given perspective
|
||||
* @throws NullPointerException if {@code type} is {@code null}
|
||||
|
||||
+5
-5
@@ -32,7 +32,7 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
|
||||
public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate {
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate {
|
||||
public class PartBuilder {
|
||||
public BlockStateProvider.ConfiguredModelList models;
|
||||
public boolean useOr;
|
||||
public final Multimap<IProperty<?>, Comparable<?>> conditions = HashMultimap.create();
|
||||
public final Multimap<Property<?>, Comparable<?>> conditions = HashMultimap.create();
|
||||
|
||||
PartBuilder(BlockStateProvider.ConfiguredModelList models) {
|
||||
this.models = models;
|
||||
@@ -101,7 +101,7 @@ public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate {
|
||||
* current block's state
|
||||
*/
|
||||
@SafeVarargs
|
||||
public final <T extends Comparable<T>> PartBuilder condition(IProperty<T> prop, T... values) {
|
||||
public final <T extends Comparable<T>> PartBuilder condition(Property<T> prop, T... values) {
|
||||
Preconditions.checkNotNull(prop, "Property must not be null");
|
||||
Preconditions.checkNotNull(values, "Value list must not be null");
|
||||
Preconditions.checkArgument(values.length > 0, "Value list must not be empty");
|
||||
@@ -117,12 +117,12 @@ public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate {
|
||||
JsonObject out = new JsonObject();
|
||||
if (!conditions.isEmpty()) {
|
||||
JsonObject when = new JsonObject();
|
||||
for (Entry<IProperty<?>, Collection<Comparable<?>>> e : conditions.asMap().entrySet()) {
|
||||
for (Entry<Property<?>, Collection<Comparable<?>>> e : conditions.asMap().entrySet()) {
|
||||
StringBuilder activeString = new StringBuilder();
|
||||
for (Comparable<?> val : e.getValue()) {
|
||||
if (activeString.length() > 0)
|
||||
activeString.append("|");
|
||||
activeString.append(((IProperty) e.getKey()).getName(val));
|
||||
activeString.append(((Property) e.getKey()).getName(val));
|
||||
}
|
||||
when.addProperty(e.getKey().getName(), activeString.toString());
|
||||
}
|
||||
|
||||
+18
-18
@@ -44,7 +44,7 @@ import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraftforge.client.model.generators.BlockStateProvider.ConfiguredModelList;
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ import net.minecraftforge.client.model.generators.BlockStateProvider.ConfiguredM
|
||||
* <p>
|
||||
* This class also provides the convenience methods
|
||||
* {@link #forAllStates(Function)} and
|
||||
* {@link #forAllStatesExcept(Function, IProperty...)} for cases where the model
|
||||
* {@link #forAllStatesExcept(Function, Property...)} for cases where the model
|
||||
* for each variant can be decided dynamically based on the state's property
|
||||
* values.
|
||||
*
|
||||
@@ -160,11 +160,11 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
|
||||
return forAllStatesExcept(mapper);
|
||||
}
|
||||
|
||||
public VariantBlockStateBuilder forAllStatesExcept(Function<BlockState, ConfiguredModel[]> mapper, IProperty<?>... ignored) {
|
||||
public VariantBlockStateBuilder forAllStatesExcept(Function<BlockState, ConfiguredModel[]> mapper, Property<?>... ignored) {
|
||||
Set<PartialBlockstate> seen = new HashSet<>();
|
||||
for (BlockState fullState : owner.getStateContainer().getValidStates()) {
|
||||
Map<IProperty<?>, Comparable<?>> propertyValues = Maps.newLinkedHashMap(fullState.getValues());
|
||||
for (IProperty<?> p : ignored) {
|
||||
Map<Property<?>, Comparable<?>> propertyValues = Maps.newLinkedHashMap(fullState.getValues());
|
||||
for (Property<?> p : ignored) {
|
||||
propertyValues.remove(p);
|
||||
}
|
||||
PartialBlockstate partialState = new PartialBlockstate(owner, propertyValues, this);
|
||||
@@ -177,7 +177,7 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
|
||||
|
||||
public static class PartialBlockstate implements Predicate<BlockState> {
|
||||
private final Block owner;
|
||||
private final SortedMap<IProperty<?>, Comparable<?>> setStates;
|
||||
private final SortedMap<Property<?>, Comparable<?>> setStates;
|
||||
@Nullable
|
||||
private final VariantBlockStateBuilder outerBuilder;
|
||||
|
||||
@@ -185,22 +185,22 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
|
||||
this(owner, ImmutableMap.of(), outerBuilder);
|
||||
}
|
||||
|
||||
PartialBlockstate(Block owner, Map<IProperty<?>, Comparable<?>> setStates, @Nullable VariantBlockStateBuilder outerBuilder) {
|
||||
PartialBlockstate(Block owner, Map<Property<?>, Comparable<?>> setStates, @Nullable VariantBlockStateBuilder outerBuilder) {
|
||||
this.owner = owner;
|
||||
this.outerBuilder = outerBuilder;
|
||||
for (Map.Entry<IProperty<?>, Comparable<?>> entry : setStates.entrySet()) {
|
||||
IProperty<?> prop = entry.getKey();
|
||||
for (Map.Entry<Property<?>, Comparable<?>> entry : setStates.entrySet()) {
|
||||
Property<?> prop = entry.getKey();
|
||||
Comparable<?> value = entry.getValue();
|
||||
Preconditions.checkArgument(owner.getStateContainer().getProperties().contains(prop), "Property %s not found on block %s", entry, this.owner);
|
||||
Preconditions.checkArgument(prop.getAllowedValues().contains(value), "%s is not a valid value for %s", value, prop);
|
||||
}
|
||||
this.setStates = Maps.newTreeMap(Comparator.comparing(IProperty::getName));
|
||||
this.setStates = Maps.newTreeMap(Comparator.comparing(Property::getName));
|
||||
this.setStates.putAll(setStates);
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> PartialBlockstate with(IProperty<T> prop, T value) {
|
||||
public <T extends Comparable<T>> PartialBlockstate with(Property<T> prop, T value) {
|
||||
Preconditions.checkArgument(!setStates.containsKey(prop), "Property %s has already been set", prop);
|
||||
Map<IProperty<?>, Comparable<?>> newState = new HashMap<>(setStates);
|
||||
Map<Property<?>, Comparable<?>> newState = new HashMap<>(setStates);
|
||||
newState.put(prop, value);
|
||||
return new PartialBlockstate(owner, newState, outerBuilder);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public SortedMap<IProperty<?>, Comparable<?>> getSetStates() {
|
||||
public SortedMap<Property<?>, Comparable<?>> getSetStates() {
|
||||
return setStates;
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
|
||||
if (blockState.getBlock() != getOwner()) {
|
||||
return false;
|
||||
}
|
||||
for (Map.Entry<IProperty<?>, Comparable<?>> entry : setStates.entrySet()) {
|
||||
for (Map.Entry<Property<?>, Comparable<?>> entry : setStates.entrySet()) {
|
||||
if (blockState.get(entry.getKey()) != entry.getValue()) {
|
||||
return false;
|
||||
}
|
||||
@@ -301,13 +301,13 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder ret = new StringBuilder();
|
||||
for (Map.Entry<IProperty<?>, Comparable<?>> entry : setStates.entrySet()) {
|
||||
for (Map.Entry<Property<?>, Comparable<?>> entry : setStates.entrySet()) {
|
||||
if (ret.length() > 0) {
|
||||
ret.append(',');
|
||||
}
|
||||
ret.append(entry.getKey().getName())
|
||||
.append('=')
|
||||
.append(((IProperty) entry.getKey()).getName(entry.getValue()));
|
||||
.append(((Property) entry.getKey()).getName(entry.getValue()));
|
||||
}
|
||||
return ret.toString();
|
||||
}
|
||||
@@ -316,10 +316,10 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
|
||||
public static Comparator<PartialBlockstate> comparingByProperties() {
|
||||
// Sort variants inversely by property values, to approximate vanilla style
|
||||
return (s1, s2) -> {
|
||||
SortedSet<IProperty<?>> propUniverse = new TreeSet<>(s1.getSetStates().comparator().reversed());
|
||||
SortedSet<Property<?>> propUniverse = new TreeSet<>(s1.getSetStates().comparator().reversed());
|
||||
propUniverse.addAll(s1.getSetStates().keySet());
|
||||
propUniverse.addAll(s2.getSetStates().keySet());
|
||||
for (IProperty<?> prop : propUniverse) {
|
||||
for (Property<?> prop : propUniverse) {
|
||||
Comparable val1 = s1.getSetStates().get(prop);
|
||||
Comparable val2 = s2.getSetStates().get(prop);
|
||||
if (val1 == null && val2 != null) {
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface IModelGeometry<T extends IModelGeometry<T>>
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation);
|
||||
IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation);
|
||||
|
||||
Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors);
|
||||
Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors);
|
||||
}
|
||||
@@ -22,8 +22,8 @@ package net.minecraftforge.client.model.geometry;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.renderer.model.IModelTransform;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.Material;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.model.RenderMaterial;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModelBuilder;
|
||||
@@ -38,9 +38,9 @@ public interface IModelGeometryPart
|
||||
{
|
||||
String name();
|
||||
|
||||
void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation);
|
||||
void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation);
|
||||
|
||||
default Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
|
||||
default Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
|
||||
// No texture dependencies
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ import com.google.common.collect.Sets;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.renderer.model.IModelTransform;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.Material;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.model.RenderMaterial;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModelBuilder;
|
||||
@@ -43,16 +43,16 @@ public interface IMultipartModelGeometry<T extends IMultipartModelGeometry<T>> e
|
||||
Optional<? extends IModelGeometryPart> getPart(String name);
|
||||
|
||||
@Override
|
||||
default void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
default void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
{
|
||||
getParts().stream().filter(part -> owner.getPartVisibility(part))
|
||||
.forEach(part -> part.addQuads(owner, modelBuilder, bakery, spriteGetter, modelTransform, modelLocation));
|
||||
}
|
||||
|
||||
@Override
|
||||
default Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
default Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
Set<Material> combined = Sets.newHashSet();
|
||||
Set<RenderMaterial> combined = Sets.newHashSet();
|
||||
for (IModelGeometryPart part : getParts())
|
||||
combined.addAll(part.getTextures(owner, modelGetter, missingTextureErrors));
|
||||
return combined;
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.function.Function;
|
||||
public interface ISimpleModelGeometry<T extends ISimpleModelGeometry<T>> extends IModelGeometry<T>
|
||||
{
|
||||
@Override
|
||||
default IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
default IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
|
||||
{
|
||||
TextureAtlasSprite particle = spriteGetter.apply(owner.resolveTexture("particle"));
|
||||
|
||||
@@ -44,8 +44,8 @@ public interface ISimpleModelGeometry<T extends ISimpleModelGeometry<T>> extends
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation);
|
||||
void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation);
|
||||
|
||||
@Override
|
||||
Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors);
|
||||
Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ package net.minecraftforge.client.model.obj;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import joptsimple.internal.Strings;
|
||||
import net.minecraft.client.renderer.Vector4f;
|
||||
import net.minecraft.util.math.vector.Vector4f;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -24,16 +24,16 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import joptsimple.internal.Strings;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.Vector4f;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec2f;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.Vector2f;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector4f;
|
||||
import net.minecraftforge.client.model.*;
|
||||
import net.minecraftforge.client.model.geometry.IModelGeometryPart;
|
||||
import net.minecraftforge.client.model.geometry.IMultipartModelGeometry;
|
||||
@@ -52,17 +52,17 @@ import java.util.stream.Collectors;
|
||||
public class OBJModel implements IMultipartModelGeometry<OBJModel>
|
||||
{
|
||||
private static Vector4f COLOR_WHITE = new Vector4f(1, 1, 1, 1);
|
||||
private static Vec2f[] DEFAULT_COORDS = {
|
||||
new Vec2f(0, 0),
|
||||
new Vec2f(0, 1),
|
||||
new Vec2f(1, 1),
|
||||
new Vec2f(1, 0),
|
||||
private static Vector2f[] DEFAULT_COORDS = {
|
||||
new Vector2f(0, 0),
|
||||
new Vector2f(0, 1),
|
||||
new Vector2f(1, 1),
|
||||
new Vector2f(1, 0),
|
||||
};
|
||||
|
||||
private final Map<String, ModelGroup> parts = Maps.newHashMap();
|
||||
|
||||
private final List<Vector3f> positions = Lists.newArrayList();
|
||||
private final List<Vec2f> texCoords = Lists.newArrayList();
|
||||
private final List<Vector2f> texCoords = Lists.newArrayList();
|
||||
private final List<Vector3f> normals = Lists.newArrayList();
|
||||
private final List<Vector4f> colors = Lists.newArrayList();
|
||||
|
||||
@@ -296,12 +296,12 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
|
||||
}
|
||||
}
|
||||
|
||||
public static Vec2f parseVector2(String[] line)
|
||||
public static Vector2f parseVector2(String[] line)
|
||||
{
|
||||
switch (line.length) {
|
||||
case 1: return new Vec2f(0,0);
|
||||
case 2: return new Vec2f(Float.parseFloat(line[1]), 0);
|
||||
default: return new Vec2f(Float.parseFloat(line[1]), Float.parseFloat(line[2]));
|
||||
case 1: return new Vector2f(0,0);
|
||||
case 2: return new Vector2f(Float.parseFloat(line[1]), 0);
|
||||
default: return new Vector2f(Float.parseFloat(line[1]), Float.parseFloat(line[2]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,11 +366,11 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
|
||||
|
||||
builder.setQuadTint(tintIndex);
|
||||
|
||||
Vec2f uv2 = new Vec2f(0, 0);
|
||||
Vector2f uv2 = new Vector2f(0, 0);
|
||||
if (ambientToFullbright)
|
||||
{
|
||||
int fakeLight = (int) ((ambientColor.getX() + ambientColor.getY() + ambientColor.getZ()) * 15 / 3.0f);
|
||||
uv2 = new Vec2f((fakeLight << 4) / 32767.0f, (fakeLight << 4) / 32767.0f);
|
||||
uv2 = new Vector2f((fakeLight << 4) / 32767.0f, (fakeLight << 4) / 32767.0f);
|
||||
builder.setApplyDiffuseLighting(fakeLight == 0);
|
||||
}
|
||||
else
|
||||
@@ -387,7 +387,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
|
||||
int[] index = indices[Math.min(i,indices.length-1)];
|
||||
Vector3f pos0 = positions.get(index[0]);
|
||||
Vector4f position = new Vector4f(pos0);
|
||||
Vec2f texCoord = index.length >= 2 && texCoords.size() > 0 ? texCoords.get(index[1]) : DEFAULT_COORDS[i];
|
||||
Vector2f texCoord = index.length >= 2 && texCoords.size() > 0 ? texCoords.get(index[1]) : DEFAULT_COORDS[i];
|
||||
Vector3f norm0 = !needsNormalRecalculation && index.length >= 3 && normals.size() > 0 ? normals.get(index[2]) : faceNormal;
|
||||
Vector3f normal = norm0;
|
||||
Vector4f color = index.length >= 4 && colors.size() > 0 ? colors.get(index[3]) : COLOR_WHITE;
|
||||
@@ -465,7 +465,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
|
||||
return Pair.of(builder.build(), cull);
|
||||
}
|
||||
|
||||
private void putVertexData(IVertexConsumer consumer, Vector4f position0, Vec2f texCoord0, Vector3f normal0, Vector4f color0, Vec2f uv2, TextureAtlasSprite texture)
|
||||
private void putVertexData(IVertexConsumer consumer, Vector4f position0, Vector2f texCoord0, Vector3f normal0, Vector4f color0, Vector2f uv2, TextureAtlasSprite texture)
|
||||
{
|
||||
ImmutableList<VertexFormatElement> elements = consumer.getVertexFormat().getElements();
|
||||
for(int j=0;j<elements.size();j++)
|
||||
@@ -524,7 +524,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
{
|
||||
for(ModelMesh mesh : meshes)
|
||||
{
|
||||
@@ -547,7 +547,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
return meshes.stream().map(mesh -> ModelLoaderRegistry.resolveTexture(mesh.mat.diffuseColorMap, owner)).collect(Collectors.toSet());
|
||||
}
|
||||
@@ -568,7 +568,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
|
||||
{
|
||||
super.addQuads(owner, modelBuilder, bakery, spriteGetter, modelTransform, modelLocation);
|
||||
|
||||
@@ -577,9 +577,9 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
|
||||
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
|
||||
{
|
||||
Set<Material> combined = Sets.newHashSet();
|
||||
Set<RenderMaterial> combined = Sets.newHashSet();
|
||||
combined.addAll(super.getTextures(owner, modelGetter, missingTextureErrors));
|
||||
for (IModelGeometryPart part : getParts())
|
||||
combined.addAll(part.getTextures(owner, modelGetter, missingTextureErrors));
|
||||
|
||||
@@ -27,16 +27,16 @@ import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
|
||||
public class BlockInfo
|
||||
{
|
||||
private static final Direction[] SIDES = Direction.values();
|
||||
|
||||
private final BlockColors colors;
|
||||
private ILightReader world;
|
||||
private IBlockDisplayReader world;
|
||||
private BlockState state;
|
||||
private BlockPos blockPos;
|
||||
|
||||
@@ -71,13 +71,13 @@ public class BlockInfo
|
||||
|
||||
public void updateShift()
|
||||
{
|
||||
Vec3d offset = state.getOffset(world, blockPos);
|
||||
Vector3d offset = state.getOffset(world, blockPos);
|
||||
shx = (float) offset.x;
|
||||
shy = (float) offset.y;
|
||||
shz = (float) offset.z;
|
||||
}
|
||||
|
||||
public void setWorld(ILightReader world)
|
||||
public void setWorld(IBlockDisplayReader world)
|
||||
{
|
||||
this.world = world;
|
||||
cachedTint = -1;
|
||||
@@ -206,7 +206,7 @@ public class BlockInfo
|
||||
}
|
||||
}
|
||||
|
||||
public ILightReader getWorld()
|
||||
public IBlockDisplayReader getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.common.ForgeConfig;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderModelFlat(ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
|
||||
public boolean renderModelFlat(IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
|
||||
{
|
||||
if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get())
|
||||
{
|
||||
@@ -71,7 +71,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderModelSmooth(ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
|
||||
public boolean renderModelSmooth(IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
|
||||
{
|
||||
if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get())
|
||||
{
|
||||
@@ -90,7 +90,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean render(VertexLighterFlat lighter, ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, boolean checkSides, Random rand, long seed, IModelData modelData)
|
||||
public static boolean render(VertexLighterFlat lighter, IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, boolean checkSides, Random rand, long seed, IModelData modelData)
|
||||
{
|
||||
lighter.setWorld(world);
|
||||
lighter.setState(state);
|
||||
|
||||
@@ -93,7 +93,7 @@ public class LightUtil
|
||||
{
|
||||
consumer.setQuadTint(quad.getTintIndex());
|
||||
}
|
||||
consumer.setApplyDiffuseLighting(quad.shouldApplyDiffuseLighting());
|
||||
consumer.setApplyDiffuseLighting(quad.func_239287_f_());
|
||||
float[] data = new float[4];
|
||||
VertexFormat formatFrom = consumer.getVertexFormat();
|
||||
VertexFormat formatTo = DefaultVertexFormats.BLOCK;
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
package net.minecraftforge.client.model.pipeline;
|
||||
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.Vector4f;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector4f;
|
||||
|
||||
public class TRSRTransformer extends VertexTransformer
|
||||
{
|
||||
|
||||
@@ -24,9 +24,7 @@ import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
@@ -34,8 +32,9 @@ import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector4f;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -222,7 +221,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
switch(element.getUsage())
|
||||
{
|
||||
case POSITION:
|
||||
final net.minecraft.client.renderer.Vector4f pos = new net.minecraft.client.renderer.Vector4f(
|
||||
final Vector4f pos = new Vector4f(
|
||||
position[v][0], position[v][1], position[v][2], 1);
|
||||
pos.transform(pose.getMatrix());
|
||||
|
||||
@@ -232,7 +231,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
parent.put(e, position[v]);
|
||||
break;
|
||||
case NORMAL:
|
||||
final net.minecraft.client.renderer.Vector3f norm = new net.minecraft.client.renderer.Vector3f(normal[v]);
|
||||
final Vector3f norm = new Vector3f(normal[v]);
|
||||
norm.transform(pose.getNormal());
|
||||
|
||||
normal[v][0] = norm.getX();
|
||||
@@ -306,7 +305,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
this.diffuse = diffuse;
|
||||
}
|
||||
|
||||
public void setWorld(ILightReader world)
|
||||
public void setWorld(IBlockDisplayReader world)
|
||||
{
|
||||
blockInfo.setWorld(world);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public enum KeyModifier {
|
||||
@Override
|
||||
public boolean isActive(@Nullable IKeyConflictContext conflictContext)
|
||||
{
|
||||
return Screen.hasControlDown();
|
||||
return Screen.func_231172_r_();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +70,7 @@ public enum KeyModifier {
|
||||
@Override
|
||||
public boolean isActive(@Nullable IKeyConflictContext conflictContext)
|
||||
{
|
||||
return Screen.hasShiftDown();
|
||||
return Screen.func_231173_s_();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,7 +89,7 @@ public enum KeyModifier {
|
||||
@Override
|
||||
public boolean isActive(@Nullable IKeyConflictContext conflictContext)
|
||||
{
|
||||
return Screen.hasAltDown();
|
||||
return Screen.func_231174_t_();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user