Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to 1.21.1 #240

Open
wants to merge 83 commits into
base: 1.20/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
56b0fce
Port to 1.20.4
IThundxr May 5, 2024
8c61f3f
Obfuscated Obfuscation
IThundxr May 12, 2024
cbdc318
fixme fixedme fixed...
IThundxr May 12, 2024
68d40b9
port rebase fixes
IThundxr May 13, 2024
25a5522
fix deps
IThundxr Jun 4, 2024
4190ac7
fix issues here and there
IThundxr Jun 7, 2024
52d99e3
fix param name
IThundxr Jun 7, 2024
47e80a6
optimize imports
IThundxr Jun 7, 2024
349e7b3
fix mixin
IThundxr Jun 7, 2024
045771d
fix param names
IThundxr Jun 7, 2024
a9127be
fix instance textures
IThundxr Jun 7, 2024
a9c4e5c
Merge branch 'refs/heads/1.20/dev' into feat/multi-loader-1.20.4
IThundxr Jul 3, 2024
eccbfbc
build: update dependencies
IThundxr Jul 10, 2024
d587ec0
1.21 Port I
IThundxr Jul 10, 2024
d092417
1.21 Port II
IThundxr Jul 10, 2024
e374365
1.21 Port III
IThundxr Jul 10, 2024
10d032c
1.21 Port IV
IThundxr Jul 10, 2024
dfbd451
1.21 Port V
IThundxr Jul 10, 2024
1cce5da
Mixin Fixin'
IThundxr Jul 15, 2024
eeb6e0f
style: javadoc fixes
IThundxr Jul 15, 2024
1d9f96a
string substitution fixes
IThundxr Jul 15, 2024
6533723
feat(api): Make PartialModel's use RL's instead of MRL's
IThundxr Jul 15, 2024
246939b
Merge remote-tracking branch 'refs/remotes/upstream/1.20/dev' into fe…
IThundxr Jul 19, 2024
5e64224
Merge remote-tracking branch 'refs/remotes/upstream/1.20/dev' into fe…
IThundxr Jul 28, 2024
44c2f78
merge: post merge fixes & porting
IThundxr Jul 28, 2024
b55afc9
Merge remote-tracking branch 'refs/remotes/upstream/1.20/dev' into fe…
IThundxr Jul 28, 2024
68393d1
fix(mixins): broken LevelRenderer injector
IThundxr Jul 29, 2024
475b1d8
fix view -IMS
IThundxr Aug 10, 2024
f2c0b79
uncomment the comments
IThundxr Aug 10, 2024
5313585
update neoforge & fix mixins
IThundxr Aug 11, 2024
44f045b
Fix lighting
IThundxr Aug 15, 2024
4e1a4b6
fix jittery visual animations
IThundxr Aug 17, 2024
c32fccc
Sodium 0.6
IThundxr Aug 22, 2024
6cf9f36
iris support
IThundxr Aug 23, 2024
a932d5d
Merge remote-tracking branch 'upstream/1.20/dev' into feat/multi-load…
IThundxr Aug 23, 2024
0919c0f
Merge remote-tracking branch 'upstream/1.20/dev' into feat/multi-load…
IThundxr Aug 23, 2024
3453715
forge porting
IThundxr Aug 23, 2024
42290b2
Merge remote-tracking branch 'upstream/1.20/dev' into feat/multi-load…
IThundxr Sep 14, 2024
fc61ff1
Add sodium 0.6 compat
IThundxr Sep 14, 2024
3176f1d
Fix issues
IThundxr Sep 14, 2024
9365011
fix remapping
IThundxr Sep 14, 2024
e7e3579
Merge branch '1.20/dev' into feat/multi-loader-1.21
IThundxr Sep 20, 2024
556e11a
Fix compile errors
IThundxr Sep 20, 2024
a3bb585
Merge branch '1.20/dev' into feat/multi-loader-1.21
IThundxr Sep 22, 2024
42bdd36
port changes to 1.21
IThundxr Sep 22, 2024
08866ed
Merge branch '1.20/dev' into feat/multi-loader-1.21
IThundxr Oct 2, 2024
ae4e4e7
post merge fixes
IThundxr Oct 2, 2024
05b82b5
Fix sprite UVs being messed up
IThundxr Oct 6, 2024
6cc2b74
Fix iris compat
IThundxr Oct 6, 2024
b408191
Build against 1.21.1
IThundxr Oct 10, 2024
93c1163
Last fixes
IThundxr Oct 11, 2024
178dd6c
address review
IThundxr Oct 12, 2024
6f946fc
Rename class
IThundxr Oct 12, 2024
dc3e264
post to correct bus
IThundxr Oct 12, 2024
e39554e
fix breaks formatting
IThundxr Oct 12, 2024
f6ca19c
bring back comment
IThundxr Oct 12, 2024
68e545b
forgeEventBus -> gameEventBus
IThundxr Oct 12, 2024
aeb9781
Remove unused check
IThundxr Oct 12, 2024
008b098
fix meshemitter
IThundxr Oct 14, 2024
fa57f34
formatting changes
IThundxr Oct 14, 2024
c705fdf
address requested changes
IThundxr Oct 14, 2024
68d1504
address requested changes
IThundxr Oct 14, 2024
07e66bb
Merge remote-tracking branch 'upstream/1.20/dev' into feat/multi-load…
IThundxr Oct 29, 2024
ad93839
post merge fixes
IThundxr Oct 29, 2024
d881ba5
Twas a snowy night full of scripting the builds
IThundxr Nov 1, 2024
ad2f3c8
Stubborn stubs
IThundxr Nov 3, 2024
69f4899
VertexConsumer-related clean up
PepperCode1 Nov 4, 2024
fd786b0
Merge remote-tracking branch 'upstream/1.20/dev' into feat/multi-load…
IThundxr Nov 13, 2024
c95bd4c
Merge remote-tracking branch 'upstream/1.20/dev' into feat/multi-load…
IThundxr Nov 13, 2024
e59b741
Mining the errors away'
IThundxr Nov 13, 2024
0d29710
Fix VertexWriter
PepperCode1 Nov 13, 2024
e359558
Update test mod for neoforge
IThundxr Nov 13, 2024
b2476c2
Work on fixing testmod
IThundxr Nov 13, 2024
cc21fd2
Rename subproject to neoforge
IThundxr Nov 13, 2024
c726d7c
Misc renames
IThundxr Nov 13, 2024
89d8755
Merge remote-tracking branch 'upstream/1.20/dev' into feat/multi-load…
IThundxr Nov 13, 2024
eb1c56e
Merge remote-tracking branch 'upstream/1.20/dev' into feat/multi-load…
IThundxr Nov 16, 2024
69d9209
fix sodium dep
IThundxr Nov 20, 2024
db9e1b7
Merge remote-tracking branch 'upstream/1.20/dev' into feat/multi-load…
IThundxr Dec 8, 2024
566df48
Embeddium compat
IThundxr Dec 8, 2024
7617c8e
Fix sodium compat
IThundxr Dec 8, 2024
2697fc1
Inline platform-specific model builders
PepperCode1 Dec 8, 2024
9f37eff
Update fabric.mod.json
IThundxr Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build
on: [ workflow_dispatch, pull_request, push ]

env:
JAVA_VERSION: 17
JAVA_VERSION: 21

jobs:
build:
Expand Down Expand Up @@ -43,13 +43,13 @@ jobs:
path: |
common/build/libs/
fabric/build/libs/
forge/build/libs/
neoforge/build/libs/

test:
strategy:
fail-fast: false
matrix:
loader: [ forge, fabric ]
loader: [ neoforge, fabric ]
needs: build
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ plugins {
repositories {
gradlePluginPortal()
mavenCentral()
maven("https://maven.minecraftforge.net/") {
name = "MinecraftForge"
maven("https://maven.neoforged.net/releases/") {
name = "NeoForged"
}
maven("https://maven.architectury.dev/") {
name = "Architectury"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class SubprojectPlugin: Plugin<Project> {
}
}

val processResourcesExpandFiles = listOf("pack.mcmeta", "fabric.mod.json", "META-INF/mods.toml")
val processResourcesExpandFiles = listOf("pack.mcmeta", "fabric.mod.json", "META-INF/neoforge.mods.toml")

val processResourcesExpandProperties = listOf(
"mod_id",
Expand All @@ -180,6 +180,6 @@ val processResourcesExpandProperties = listOf(
"minecraft_semver_version_range",
"minecraft_maven_version_range",
"fabric_api_version_range",
"forge_version_range",
"neoforge_version_range",
)

10 changes: 4 additions & 6 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ plugins {
val api = sourceSets.create("api")
val lib = sourceSets.create("lib")
val backend = sourceSets.create("backend")
val stubs = sourceSets.create("stubs")
val main = sourceSets.getByName("main")

transitiveSourceSets {
Expand All @@ -26,11 +25,8 @@ transitiveSourceSets {
rootCompile()
compile(api, lib)
}
sourceSet(stubs) {
rootCompile()
}
sourceSet(main) {
compile(api, lib, backend, stubs)
compile(api, lib, backend)
}
sourceSet(sourceSets.getByName("test")) {
implementation(api, lib, backend)
Expand All @@ -46,7 +42,6 @@ jarSets {
outgoing("commonApiOnly", api)
outgoing("commonLib", lib)
outgoing("commonBackend", backend)
outgoing("commonStubs", stubs)
outgoing("commonImpl", main)

// For publishing.
Expand Down Expand Up @@ -77,6 +72,9 @@ jarSets {
dependencies {
modCompileOnly("net.fabricmc:fabric-loader:${property("fabric_loader_version")}")

modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}-fabric")
modCompileOnly("maven.modrinth:iris:${property("iris_version")}-fabric")

testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ private Flywheel() {
}

public static ResourceLocation rl(String path) {
return new ResourceLocation(ID, path);
return ResourceLocation.fromNamespaceAndPath(ID, path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import org.joml.Matrix4fc;

import com.mojang.blaze3d.vertex.PoseStack;

import net.minecraft.client.Camera;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.LevelRenderer;
Expand All @@ -16,7 +14,7 @@ public interface RenderContext {

RenderBuffers buffers();

PoseStack stack();
Matrix4fc modelView();

Matrix4fc projection();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void update(RenderContext context) {
var camY = (float) (cameraPos.y - renderOrigin.getY());
var camZ = (float) (cameraPos.z - renderOrigin.getZ());

VIEW.set(context.stack().last().pose());
VIEW.set(context.modelView());
VIEW.translate(-camX, -camY, -camZ);
PROJECTION.set(context.projection());
VIEW_PROJECTION.set(context.viewProjection());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ShaderSources(ResourceManager manager) {
}

private static ResourceLocation locationWithoutFlywheelPrefix(ResourceLocation loc) {
return new ResourceLocation(loc.getNamespace(), loc.getPath()
return ResourceLocation.fromNamespaceAndPath(loc.getNamespace(), loc.getPath()
.substring(SHADER_DIR.length()));
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/backend/resources/flywheel.backend.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "dev.engine_room.flywheel.backend.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"refmap": "backend-flywheel.refmap.json",
"client": [
"AbstractClientPlayerAccessor",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface FlwLibLink {

Map<String, ModelPart> getModelPartChildren(ModelPart part);

void compileModelPart(ModelPart part, PoseStack.Pose pose, VertexConsumer consumer, int light, int overlay, float red, float green, float blue, float alpha);
void compileModelPart(ModelPart part, PoseStack.Pose pose, VertexConsumer consumer, int light, int overlay, int color);

Deque<PoseStack.Pose> getPoseStack(PoseStack stack);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
import org.jetbrains.annotations.UnknownNullability;

import dev.engine_room.flywheel.api.internal.DependencyInjection;
import dev.engine_room.flywheel.lib.model.SimpleModel;
import dev.engine_room.flywheel.lib.model.baked.BakedModelBuilder;
import dev.engine_room.flywheel.lib.model.baked.BlockModelBuilder;
import dev.engine_room.flywheel.lib.model.baked.MultiBlockModelBuilder;
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState;

public interface FlwLibXplat {
FlwLibXplat INSTANCE = DependencyInjection.load(FlwLibXplat.class, "dev.engine_room.flywheel.impl.FlwLibXplatImpl");
Expand All @@ -22,9 +20,9 @@ public interface FlwLibXplat {

BlockRenderDispatcher createVanillaBlockRenderDispatcher();

BakedModelBuilder createBakedModelBuilder(BakedModel bakedModel);
SimpleModel buildBakedModelBuilder(BakedModelBuilder builder);

BlockModelBuilder createBlockModelBuilder(BlockState state);
SimpleModel buildBlockModelBuilder(BlockModelBuilder builder);

MultiBlockModelBuilder createMultiBlockModelBuilder(BlockAndTintGetter level, Iterable<BlockPos> positions);
SimpleModel buildMultiBlockModelBuilder(MultiBlockModelBuilder builder);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public final class ModelUtil {
/**
* An alternative BlockRenderDispatcher that circumvents the Forge rendering pipeline to ensure consistency.
* An alternative BlockRenderDispatcher that circumvents the NeoForge rendering pipeline to ensure consistency.
* Meant to be used for virtual rendering.
*/
public static final BlockRenderDispatcher VANILLA_RENDERER = FlwLibXplat.INSTANCE.createVanillaBlockRenderDispatcher();
Expand Down Expand Up @@ -60,7 +60,7 @@ public static Material getItemMaterial(RenderType renderType) {
if (renderType == Sheets.translucentCullBlockSheet() || renderType == Sheets.translucentItemSheet()) {
return Materials.CUTOUT_BLOCK;
}
if (renderType == RenderType.glint() || renderType == RenderType.glintDirect()) {
if (renderType == RenderType.glint() || renderType == RenderType.glintTranslucent()) {
return Materials.GLINT;
}
if (renderType == RenderType.entityGlint() || renderType == RenderType.entityGlintDirect()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
* method with the same parameters will return the same object.
*/
public final class Models {
private static final ResourceReloadCache<BlockState, Model> BLOCK_STATE = new ResourceReloadCache<>(it -> BlockModelBuilder.create(it)
private static final ResourceReloadCache<BlockState, Model> BLOCK_STATE = new ResourceReloadCache<>(it -> new BlockModelBuilder(it)
.build());
private static final ResourceReloadCache<PartialModel, Model> PARTIAL = new ResourceReloadCache<>(it -> BakedModelBuilder.create(it.get())
private static final ResourceReloadCache<PartialModel, Model> PARTIAL = new ResourceReloadCache<>(it -> new BakedModelBuilder(it.get())
.build());
private static final ResourceReloadCache<TransformedPartial<?>, Model> TRANSFORMED_PARTIAL = new ResourceReloadCache<>(TransformedPartial::create);

Expand Down Expand Up @@ -88,7 +88,7 @@ private record TransformedPartial<T>(PartialModel partial, T key, BiConsumer<T,
private Model create() {
var stack = new PoseStack();
transformer.accept(key, stack);
return BakedModelBuilder.create(partial.get())
return new BakedModelBuilder(partial.get())
.poseStack(stack)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

import java.util.function.BiFunction;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;

import com.mojang.blaze3d.vertex.PoseStack;

import dev.engine_room.flywheel.api.material.Material;
import dev.engine_room.flywheel.lib.internal.FlwLibXplat;
import dev.engine_room.flywheel.lib.model.ModelUtil;
import dev.engine_room.flywheel.lib.model.SimpleModel;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState;

@ApiStatus.NonExtendable
public abstract class BakedModelBuilder {
public final class BakedModelBuilder {
final BakedModel bakedModel;
@Nullable
BlockAndTintGetter level;
Expand All @@ -27,14 +26,10 @@ public abstract class BakedModelBuilder {
@Nullable
BiFunction<RenderType, Boolean, Material> materialFunc;

BakedModelBuilder(BakedModel bakedModel) {
public BakedModelBuilder(BakedModel bakedModel) {
this.bakedModel = bakedModel;
}

public static BakedModelBuilder create(BakedModel bakedModel) {
return FlwLibXplat.INSTANCE.createBakedModelBuilder(bakedModel);
}

public BakedModelBuilder level(BlockAndTintGetter level) {
this.level = level;
return this;
Expand All @@ -55,5 +50,11 @@ public BakedModelBuilder materialFunc(BiFunction<RenderType, Boolean, Material>
return this;
}

public abstract SimpleModel build();
public SimpleModel build() {
if (materialFunc == null) {
materialFunc = ModelUtil::getMaterial;
}

return FlwLibXplat.INSTANCE.buildBakedModelBuilder(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

import java.util.function.BiFunction;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;

import com.mojang.blaze3d.vertex.PoseStack;

import dev.engine_room.flywheel.api.material.Material;
import dev.engine_room.flywheel.lib.internal.FlwLibXplat;
import dev.engine_room.flywheel.lib.model.ModelUtil;
import dev.engine_room.flywheel.lib.model.SimpleModel;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState;

@ApiStatus.NonExtendable
public abstract class BlockModelBuilder {
public final class BlockModelBuilder {
final BlockState state;
@Nullable
BlockAndTintGetter level;
Expand All @@ -24,14 +23,10 @@ public abstract class BlockModelBuilder {
@Nullable
BiFunction<RenderType, Boolean, Material> materialFunc;

BlockModelBuilder(BlockState state) {
public BlockModelBuilder(BlockState state) {
this.state = state;
}

public static BlockModelBuilder create(BlockState state) {
return FlwLibXplat.INSTANCE.createBlockModelBuilder(state);
}

public BlockModelBuilder level(BlockAndTintGetter level) {
this.level = level;
return this;
Expand All @@ -47,5 +42,11 @@ public BlockModelBuilder materialFunc(BiFunction<RenderType, Boolean, Material>
return this;
}

public abstract SimpleModel build();
public SimpleModel build() {
if (materialFunc == null) {
materialFunc = ModelUtil::getMaterial;
}

return FlwLibXplat.INSTANCE.buildBlockModelBuilder(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.jetbrains.annotations.Nullable;
import org.lwjgl.system.MemoryUtil;

import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.MeshData;

import dev.engine_room.flywheel.lib.memory.MemoryBlock;
import dev.engine_room.flywheel.lib.model.SimpleQuadMesh;
Expand All @@ -16,15 +16,15 @@ final class MeshHelper {
private MeshHelper() {
}

public static SimpleQuadMesh blockVerticesToMesh(BufferBuilder.RenderedBuffer buffer, @Nullable String meshDescriptor) {
BufferBuilder.DrawState drawState = buffer.drawState();
public static SimpleQuadMesh blockVerticesToMesh(MeshData data, @Nullable String meshDescriptor) {
MeshData.DrawState drawState = data.drawState();
int vertexCount = drawState.vertexCount();
long srcStride = drawState.format().getVertexSize();

VertexView vertexView = new NoOverlayVertexView();
long dstStride = vertexView.stride();

ByteBuffer src = buffer.vertexBuffer();
ByteBuffer src = data.vertexBuffer();
MemoryBlock dst = MemoryBlock.mallocTracked((long) vertexCount * dstStride);
long srcPtr = MemoryUtil.memAddress(src);
long dstPtr = dst.ptr();
Expand Down
Loading
Loading