Update to 1.17

Update to Official classnames
Patchwork
Make the game compile and run
Merge in the new HUD overlay API
Merge in the new render properties API
PEEL
Use Gradle 7.2 snapshot to fix eclipse integration bug in 7.1, Would use 7.0 but FG needs 7.1 for some reason.
New FML installer
Update to 1.17.1

Co-authored-by: LexManos <[email protected]>
Co-authored-by: SizableShrimp <[email protected]>
Co-authored-by: cpw <[email protected]>
Co-authored-by: Curle <[email protected]>
Co-authored-by: Unnoen <[email protected]>
Co-authored-by: covers1624 <[email protected]>
Co-authored-by: DaemonUmbra <[email protected]>
Co-authored-by: gigaherz <[email protected]>
Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
authored and Curle committed 2021-07-22 19:57:02 +01:00
1 parent 064ae6961b
commit be5446b91c
1990 files changed
+35661 -37544

No files matched your search

@@ -26,36 +26,36 @@ import java.util.Random;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.datafixers.util.Pair;
import net.minecraft.block.BlockState;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.Direction;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraftforge.client.model.data.IModelData;
public interface IForgeBakedModel
{
default IBakedModel getBakedModel()
private BakedModel self()
{
return (IBakedModel) this;
return (BakedModel) this;
}
@Nonnull
default List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData)
{
return getBakedModel().getQuads(state, side, rand);
return self().getQuads(state, side, rand);
}
default boolean isAmbientOcclusion(BlockState state) { return getBakedModel().useAmbientOcclusion(); }
default boolean isAmbientOcclusion(BlockState state) { return self().useAmbientOcclusion(); }
/**
* Override to tell the new model loader that it shouldn't wrap this model
@@ -66,19 +66,19 @@ public interface IForgeBakedModel
* Returns the pair of the model for the given perspective, and the matrix that
* should be applied to the GL state before rendering it (matrix may be null).
*/
default IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat)
default BakedModel handlePerspective(ItemTransforms.TransformType cameraTransformType, PoseStack poseStack)
{
return net.minecraftforge.client.ForgeHooksClient.handlePerspective(getBakedModel(), cameraTransformType, mat);
return net.minecraftforge.client.ForgeHooksClient.handlePerspective(self(), cameraTransformType, poseStack);
}
default @Nonnull IModelData getModelData(@Nonnull IBlockDisplayReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
default @Nonnull IModelData getModelData(@Nonnull BlockAndTintGetter world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
{
return tileData;
}
default TextureAtlasSprite getParticleTexture(@Nonnull IModelData data)
default TextureAtlasSprite getParticleIcon(@Nonnull IModelData data)
{
return getBakedModel().getParticleIcon();
return self().getParticleIcon();
}
/**
@@ -92,8 +92,8 @@ public interface IForgeBakedModel
/**
* If {@see isLayered()} returns true, this is called to get the list of layers to draw.
*/
default List<Pair<IBakedModel, RenderType>> getLayerModels(ItemStack itemStack, boolean fabulous)
default List<Pair<BakedModel, RenderType>> getLayerModels(ItemStack itemStack, boolean fabulous)
{
return Collections.singletonList(Pair.of(getBakedModel(), RenderTypeLookup.getRenderType(itemStack, fabulous)));
return Collections.singletonList(Pair.of(self(), ItemBlockRenderTypes.getRenderType(itemStack, fabulous)));
}
}
@@ -21,28 +21,28 @@ package net.minecraftforge.client.extensions;
import javax.annotation.Nonnull;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.util.InputMappings;
import net.minecraft.client.KeyMapping;
import com.mojang.blaze3d.platform.InputConstants;
import net.minecraftforge.client.settings.IKeyConflictContext;
import net.minecraftforge.client.settings.KeyModifier;
public interface IForgeKeybinding
public interface IForgeKeyMapping
{
default KeyBinding getKeyBinding() { return (KeyBinding) this; }
private KeyMapping self() { return (KeyMapping) this; }
@Nonnull InputMappings.Input getKey();
@Nonnull InputConstants.Key getKey();
/**
* Checks that the key conflict context and modifier are active, and that the keyCode matches this binding.
*/
default boolean isActiveAndMatches(InputMappings.Input keyCode)
default boolean isActiveAndMatches(InputConstants.Key keyCode)
{
return keyCode != InputMappings.UNKNOWN && keyCode.equals(getKey()) && getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext());
return keyCode != InputConstants.UNKNOWN && keyCode.equals(getKey()) && getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext());
}
default void setToDefault()
{
setKeyModifierAndCode(getKeyModifierDefault(), getKeyBinding().getDefaultKey());
setKeyModifierAndCode(getKeyModifierDefault(), self().getDefaultKey());
}
void setKeyConflictContext(IKeyConflictContext keyConflictContext);
@@ -53,7 +53,7 @@ public interface IForgeKeybinding
KeyModifier getKeyModifier();
void setKeyModifierAndCode(KeyModifier keyModifier, InputMappings.Input keyCode);
void setKeyModifierAndCode(KeyModifier keyModifier, InputConstants.Key keyCode);
default boolean isConflictContextAndModifierActive()
{
@@ -63,7 +63,7 @@ public interface IForgeKeybinding
/**
* Returns true when one of the bindings' key codes conflicts with the other's modifier.
*/
default boolean hasKeyCodeModifierConflict(KeyBinding other)
default boolean hasKeyCodeModifierConflict(KeyMapping other)
{
if (getKeyConflictContext().conflicts(other.getKeyConflictContext()) || other.getKeyConflictContext().conflicts(getKeyConflictContext()))
{
@@ -19,13 +19,13 @@
package net.minecraftforge.client.extensions;
import net.minecraft.util.math.vector.TransformationMatrix;
import com.mojang.math.Transformation;
/**
* An {@code IModelState} is a function from model part to a transformation that should be applied
* when that part is baked, thus representing the current "state" of the model and its parts.
*/
public interface IForgeModelTransform
public interface IForgeModelState
{
/**
* @param part Part of the model we are wanting to transform. An empty optional means
@@ -33,8 +33,8 @@ public interface IForgeModelTransform
* @return A transformation to apply to the part, if any. The coordinate system of the transform
* is determined by the part type.
*/
default TransformationMatrix getPartTransformation(Object part)
default Transformation getPartTransformation(Object part)
{
return TransformationMatrix.identity();
return Transformation.identity();
}
}
@@ -19,9 +19,9 @@
package net.minecraftforge.client.extensions;
import net.minecraft.client.renderer.chunk.ChunkRenderCache;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.client.renderer.chunk.RenderChunkRegion;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
public interface IForgeRenderChunk
{
@@ -38,8 +38,8 @@ public interface IForgeRenderChunk
* the cache a 20x20x20 cube, for a total of 8000 states in the cache.
* @return new RegionRenderCache instance
*/
default ChunkRenderCache createRegionRenderCache(World world, BlockPos from, BlockPos to, int subtract)
default RenderChunkRegion createRegionRenderCache(Level world, BlockPos from, BlockPos to, int subtract)
{
return ChunkRenderCache.createIfNotEmpty(world, from, to, subtract);
return RenderChunkRegion.createIfNotEmpty(world, from, to, subtract);
}
}
@@ -25,8 +25,8 @@ import java.util.function.Function;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.resources.ResourceLocation;
public interface IForgeTextureAtlasSprite
{
@@ -35,7 +35,7 @@ public interface IForgeTextureAtlasSprite
* @deprecated See {@link net.minecraftforge.client.textures.ITextureAtlasSpriteLoader}
*/
@Deprecated
default boolean hasCustomLoader(IResourceManager manager, ResourceLocation location)
default boolean hasCustomLoader(ResourceManager manager, ResourceLocation location)
{
return false;
}
@@ -44,7 +44,7 @@ public interface IForgeTextureAtlasSprite
* @deprecated See {@link net.minecraftforge.client.textures.ITextureAtlasSpriteLoader}
*/
@Deprecated
default boolean load(IResourceManager manager, ResourceLocation location, Function<ResourceLocation, TextureAtlasSprite> textureGetter)
default boolean load(ResourceManager manager, ResourceLocation location, Function<ResourceLocation, TextureAtlasSprite> textureGetter)
{
return true;
}
@@ -19,79 +19,62 @@
package net.minecraftforge.client.extensions;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.util.Direction;
import net.minecraft.util.math.vector.*;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.core.Direction;
/*
* Replacement interface for ModelRotation to allow custom transformations of vanilla models.
* You should probably use TRSRTransformation directly.
*/
public interface IForgeTransformationMatrix
import com.mojang.math.Matrix4f;
import com.mojang.math.Transformation;
import com.mojang.math.Vector3f;
import com.mojang.math.Vector4f;
public interface IForgeTransformation
{
default TransformationMatrix getTransformaion()
private Transformation self()
{
return (TransformationMatrix)this;
return (Transformation)this;
}
default boolean isIdentity()
{
return getTransformaion().equals(TransformationMatrix.identity());
return self().equals(Transformation.identity());
}
default void push(MatrixStack stack)
default void push(PoseStack stack)
{
stack.pushPose();
Vector3f trans = getTransformaion().getTranslation();
Vector3f trans = self().getTranslation();
stack.translate(trans.x(), trans.y(), trans.z());
stack.mulPose(getTransformaion().getLeftRotation());
stack.mulPose(self().getLeftRotation());
Vector3f scale = getTransformaion().getScale();
Vector3f scale = self().getScale();
stack.scale(scale.x(), scale.y(), scale.z());
stack.mulPose(getTransformaion().getRightRot());
stack.mulPose(self().getRightRotation());
}
default TransformationMatrix compose(TransformationMatrix other)
{
if (getTransformaion().isIdentity()) return other;
if (other.isIdentity()) return getTransformaion();
Matrix4f m = getTransformaion().getMatrix();
m.multiply(other.getMatrix());
return new TransformationMatrix(m);
}
default TransformationMatrix inverse()
{
if (isIdentity()) return getTransformaion();
Matrix4f m = getTransformaion().getMatrix().copy();
m.invert();
return new TransformationMatrix(m);
}
default void transformPosition(Vector4f position)
{
position.transform(getTransformaion().getMatrix());
position.transform(self().getMatrix());
}
default void transformNormal(Vector3f normal)
{
normal.transform(getTransformaion().getNormalMatrix());
normal.transform(self().getNormalMatrix());
normal.normalize();
}
default Direction rotateTransform(Direction facing)
{
return Direction.rotate(getTransformaion().getMatrix(), facing);
return Direction.rotate(self().getMatrix(), facing);
}
/**
* convert transformation from assuming center-block system to opposing-corner-block system
*/
default TransformationMatrix blockCenterToCorner()
default Transformation blockCenterToCorner()
{
return applyOrigin(new Vector3f(.5f, .5f, .5f));
}
@@ -99,7 +82,7 @@ public interface IForgeTransformationMatrix
/**
* convert transformation from assuming opposing-corner-block system to center-block system
*/
default TransformationMatrix blockCornerToCenter()
default Transformation blockCornerToCenter()
{
return applyOrigin(new Vector3f(-.5f, -.5f, -.5f));
}
@@ -109,9 +92,9 @@ public interface IForgeTransformationMatrix
* Can be used for switching between coordinate systems.
* Parameter is relative to the current origin.
*/
default TransformationMatrix applyOrigin(Vector3f origin) {
TransformationMatrix transform = getTransformaion();
if (transform.isIdentity()) return TransformationMatrix.identity();
default Transformation applyOrigin(Vector3f origin) {
Transformation transform = self();
if (transform.isIdentity()) return Transformation.identity();
Matrix4f ret = transform.getMatrix();
Matrix4f tmp = Matrix4f.createTranslateMatrix(origin.x(), origin.y(), origin.z());
@@ -119,6 +102,6 @@ public interface IForgeTransformationMatrix
tmp.setIdentity();
tmp.setTranslation(-origin.x(), -origin.y(), -origin.z());
ret.multiply(tmp);
return new TransformationMatrix(ret);
return new Transformation(ret);
}
}
@@ -19,13 +19,11 @@
package net.minecraftforge.client.extensions;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.vector.*;
import net.minecraft.client.renderer.block.model.BakedQuad;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import net.minecraftforge.client.model.pipeline.LightUtil;
import org.lwjgl.system.MemoryStack;
@@ -34,37 +32,41 @@ import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
public interface IForgeVertexBuilder
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import com.mojang.math.Vector4f;
import net.minecraft.core.Vec3i;
public interface IForgeVertexConsumer
{
default IVertexBuilder getVertexBuilder() { return (IVertexBuilder)this; }
// Copy of addQuad, but enables tinting and per-vertex alpha
default void addVertexData(MatrixStack.Entry matrixStack, BakedQuad bakedQuad, float red, float green, float blue, int lightmapCoord, int overlayColor, boolean readExistingColor) {
addVertexData(matrixStack, bakedQuad, red, green, blue, 1.0f, lightmapCoord, overlayColor, readExistingColor);
// Copy of putBulkData, but enables tinting and per-vertex alpha
default void putBulkData(PoseStack.Pose matrixStack, BakedQuad bakedQuad, float red, float green, float blue, int lightmapCoord, int overlayColor, boolean readExistingColor) {
putBulkData(matrixStack, bakedQuad, red, green, blue, 1.0f, lightmapCoord, overlayColor, readExistingColor);
}
// Copy of addQuad with alpha support
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColor) {
addVertexData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, false);
// Copy of putBulkData with alpha support
default void putBulkData(PoseStack.Pose matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColor) {
putBulkData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, false);
}
// Copy of addQuad with alpha support
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColor, boolean readExistingColor) {
addVertexData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, readExistingColor);
// Copy of putBulkData with alpha support
default void putBulkData(PoseStack.Pose matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColor, boolean readExistingColor) {
putBulkData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, readExistingColor);
}
// 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) {
// Copy of putBulkData with alpha support
default void putBulkData(PoseStack.Pose matrixEntry, BakedQuad bakedQuad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean readExistingColor) {
int[] aint = bakedQuad.getVertices();
Vector3i faceNormal = bakedQuad.getDirection().getNormal();
Vec3i faceNormal = bakedQuad.getDirection().getNormal();
Vector3f normal = new Vector3f((float)faceNormal.getX(), (float)faceNormal.getY(), (float)faceNormal.getZ());
Matrix4f matrix4f = matrixEntry.pose();
normal.transform(matrixEntry.normal());
int intSize = DefaultVertexFormats.BLOCK.getIntegerSize();
int intSize = DefaultVertexFormat.BLOCK.getIntegerSize();
int vertexCount = aint.length / intSize;
try (MemoryStack memorystack = MemoryStack.stackPush()) {
ByteBuffer bytebuffer = memorystack.malloc(DefaultVertexFormats.BLOCK.getVertexSize());
ByteBuffer bytebuffer = memorystack.malloc(DefaultVertexFormat.BLOCK.getVertexSize());
IntBuffer intbuffer = bytebuffer.asIntBuffer();
for(int v = 0; v < vertexCount; ++v) {
@@ -99,7 +101,7 @@ public interface IForgeVertexBuilder
Vector4f pos = new Vector4f(f, f1, f2, 1.0F);
pos.transform(matrix4f);
applyBakedNormals(normal, bytebuffer, matrixEntry.normal());
((IVertexBuilder)this).vertex(pos.x(), pos.y(), pos.z(), cr, cg, cb, ca, f9, f10, overlayCoords, lightmapCoord, normal.x(), normal.y(), normal.z());
((VertexConsumer)this).vertex(pos.x(), pos.y(), pos.z(), cr, cg, cb, ca, f9, f10, overlayCoords, lightmapCoord, normal.x(), normal.y(), normal.z());
}
}
}