Skip to content

Commit

Permalink
Merge branch '1.21.x' into 1.21.x
Browse files Browse the repository at this point in the history
  • Loading branch information
TelepathicGrunt authored Nov 9, 2024
2 parents bf2fb8d + 424b600 commit fdae668
Show file tree
Hide file tree
Showing 1,215 changed files with 13,100 additions and 12,817 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/build-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ jobs:

# GradleUtils will append the branch name to the version,
# but for that we need a properly checked out branch
- name: Create branch for commit
- name: Create branch for commit (PR)
if: ${{ github.event_name == 'pull_request' }}
run:
git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}

- name: Create branch for commit
if: ${{ github.event_name != 'pull_request' }}
run:
git switch -C ${{ github.ref_name }}

- name: Setup JDK 21
uses: neoforged/actions/setup-java@main
with:
Expand All @@ -48,12 +54,13 @@ jobs:
run: ./gradlew assemble checkFormatting

- name: Run JCC
if: ${{ ! startsWith(github.event.pull_request.head.ref, 'refs/heads/port/') }}
if: ${{ ! startsWith(github.event.pull_request.head.ref, 'port/') && ! startsWith(github.ref_name, 'port/') && ! startsWith(github.event.pull_request.base.ref, 'port/') }}
run: ./gradlew checkJarCompatibility

- name: Upload JCC
if: ${{ ! startsWith(github.event.pull_request.head.ref, 'refs/heads/port/') }}
if: ${{ ! startsWith(github.event.pull_request.head.ref, 'port/') && ! startsWith(github.ref_name, 'port/') && ! startsWith(github.event.pull_request.base.ref, 'port/') }}
uses: neoforged/action-jar-compatibility/upload@v1

- name: Publish artifacts
uses: neoforged/action-pr-publishing/upload@v1
if: ${{ github.event_name == 'pull_request' }}
uses: neoforged/action-pr-publishing/upload@v1
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public class MethodRedirector implements ITransformer<ClassNode> {
new MethodRedirection(
Opcodes.INVOKEVIRTUAL,
"finalizeSpawn",
"(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/MobSpawnType;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;",
"(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;",
"finalize_spawn_targets.json",
methodInsnNode -> new MethodInsnNode(
Opcodes.INVOKESTATIC,
"net/neoforged/neoforge/event/EventHooks",
"finalizeMobSpawn",
"(Lnet/minecraft/world/entity/Mob;Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/MobSpawnType;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;",
"(Lnet/minecraft/world/entity/Mob;Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;",
false)));

public MethodRedirector() {
Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Contributing to NeoForge
- Run `gradlew :tests:runGameTestServer` or `Tests: GameTestServer` from IDE
- Run `gradlew :tests:runGameTestClient` or `Tests: GameTestClient` from IDE
- If possible, write an automated test under the tests project. See [NEOGAMETESTS.md](NEOGAMETESTS.md) for more info.
10. Run `gradlew unpackSourcePatches` to generate patch-files from the patched sources
10. Run `gradlew genPatches` to generate patch-files from the patched sources
11. Run `gradlew applyAllFormatting` to automatically format sources
12. Check correct formatting with `gradlew spotlessCheck`
13. Commit & Push
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ org.gradle.debug=false

java_version=21

minecraft_version=1.21.1
neoform_version=20240808.144430
minecraft_version=1.21.3
neoform_version=20241023.131943
# on snapshot versions, used to prefix the version
neoforge_snapshot_next_stable=22.0
neoforge_snapshot_next_stable=21.4

mergetool_version=2.0.0
accesstransformers_version=10.0.1
accesstransformers_version=11.0.1
coremods_version=6.0.4
eventbus_version=8.0.2
modlauncher_version=11.0.4
Expand All @@ -30,7 +30,7 @@ jetbrains_annotations_version=24.0.1
slf4j_api_version=2.0.7
apache_maven_artifact_version=3.8.5
jarjar_version=0.4.1
fancy_mod_loader_version=4.0.24
fancy_mod_loader_version=5.0.1
mojang_logging_version=1.1.1
log4j_version=2.22.1
guava_version=31.1.2-jre
Expand Down
57 changes: 0 additions & 57 deletions patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/platform/GlStateManager.java
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
@@ -945,4 +_,53 @@
@@ -1009,4 +_,53 @@
return INSTANCE.height;
}
}
Expand Down
6 changes: 3 additions & 3 deletions patches/com/mojang/blaze3d/platform/Window.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/platform/Window.java
+++ b/com/mojang/blaze3d/platform/Window.java
@@ -86,7 +_,8 @@
@@ -90,7 +_,8 @@
GLFW.glfwWindowHint(139267, 2);
GLFW.glfwWindowHint(139272, 204801);
GLFW.glfwWindowHint(139270, 1);
Expand All @@ -10,15 +10,15 @@
if (monitor != null) {
VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2;
@@ -98,6 +_,7 @@
@@ -102,6 +_,7 @@
this.windowedX = this.x = aint1[0];
this.windowedY = this.y = aint[0];
}
+ }

GLFW.glfwMakeContextCurrent(this.window);
GL.createCapabilities();
@@ -256,6 +_,7 @@
@@ -269,6 +_,7 @@
GLFW.glfwGetFramebufferSize(this.window, aint, aint1);
this.framebufferWidth = aint[0] > 0 ? aint[0] : 1;
this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1;
Expand Down
2 changes: 1 addition & 1 deletion patches/com/mojang/blaze3d/systems/RenderSystem.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/systems/RenderSystem.java
+++ b/com/mojang/blaze3d/systems/RenderSystem.java
@@ -932,4 +_,14 @@
@@ -822,4 +_,14 @@
void accept(it.unimi.dsi.fastutil.ints.IntConsumer p_157488_, int p_157489_);
}
}
Expand Down
2 changes: 1 addition & 1 deletion patches/com/mojang/blaze3d/vertex/PoseStack.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/vertex/PoseStack.java
+++ b/com/mojang/blaze3d/vertex/PoseStack.java
@@ -13,7 +_,7 @@
@@ -14,7 +_,7 @@
import org.joml.Vector3f;

@OnlyIn(Dist.CLIENT)
Expand Down
14 changes: 7 additions & 7 deletions patches/com/mojang/blaze3d/vertex/VertexConsumer.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/vertex/VertexConsumer.java
+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java
@@ -12,7 +_,7 @@
@@ -13,7 +_,7 @@
import org.lwjgl.system.MemoryStack;

@OnlyIn(Dist.CLIENT)
Expand All @@ -10,19 +10,19 @@

VertexConsumer setColor(int p_350535_, int p_350875_, int p_350886_, int p_350775_);
@@ -131,11 +_,14 @@
f5 = p_331397_[l] * p_85992_ * 255.0F;
f5 = p_331397_[i1] * p_85992_ * 255.0F;
}

- int i1 = FastColor.ARGB32.color(k, (int)f3, (int)f4, (int)f5);
- int j1 = p_331378_[l];
- int j1 = ARGB.color(k, (int)f3, (int)f4, (int)f5);
- int k1 = LightTexture.lightCoordsWithEmission(p_331378_[i1], l);
+ // Neo: also apply alpha that's coming from the baked quad
+ int vertexAlpha = p_331268_ ? (int)((p_331416_ * (float) (bytebuffer.get(15) & 255) / 255.0F) * 255) : k;
+ int i1 = FastColor.ARGB32.color(vertexAlpha, (int)f3, (int)f4, (int)f5);
+ int j1 = applyBakedLighting(p_331378_[l], bytebuffer);
+ int j1 = ARGB.color(vertexAlpha, (int)f3, (int)f4, (int)f5);
+ int k1 = applyBakedLighting(LightTexture.lightCoordsWithEmission(p_331378_[i1], l), bytebuffer);
float f10 = bytebuffer.getFloat(16);
float f9 = bytebuffer.getFloat(20);
Vector3f vector3f1 = matrix4f.transformPosition(f, f1, f2, new Vector3f());
+ applyBakedNormals(vector3f, bytebuffer, p_85988_.normal());
this.addVertex(vector3f1.x(), vector3f1.y(), vector3f1.z(), i1, f10, f9, p_85993_, j1, vector3f.x(), vector3f.y(), vector3f.z());
this.addVertex(vector3f1.x(), vector3f1.y(), vector3f1.z(), j1, f10, f9, p_85993_, k1, vector3f.x(), vector3f.y(), vector3f.z());
}
}
2 changes: 1 addition & 1 deletion patches/com/mojang/blaze3d/vertex/VertexFormat.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/vertex/VertexFormat.java
+++ b/com/mojang/blaze3d/vertex/VertexFormat.java
@@ -237,4 +_,28 @@
@@ -220,4 +_,28 @@
};
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
@@ -127,7 +_,7 @@
@@ -128,7 +_,7 @@
private void drawIcons(GuiGraphics p_282966_) {
int i = this.numberOfPendingInvites;
int j = 24;
Expand Down
4 changes: 2 additions & 2 deletions patches/net/minecraft/SharedConstants.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/SharedConstants.java
+++ b/net/minecraft/SharedConstants.java
@@ -118,7 +_,8 @@
@@ -117,7 +_,8 @@
public static final boolean USE_WORKFLOWS_HOOKS = false;
public static final boolean USE_DEVONLY = false;
public static boolean CHECK_DATA_FIXER_SCHEMA = true;
Expand All @@ -10,7 +10,7 @@
public static final int WORLD_RESOLUTION = 16;
public static final int MAX_CHAT_LENGTH = 256;
public static final int MAX_USER_INPUT_COMMAND_LENGTH = 32500;
@@ -171,6 +_,7 @@
@@ -170,6 +_,7 @@
}

static {
Expand Down
4 changes: 2 additions & 2 deletions patches/net/minecraft/Util.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/Util.java
+++ b/net/minecraft/Util.java
@@ -267,8 +_,8 @@
@@ -264,8 +_,8 @@
.getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion()))
.getChoiceType(p_137552_, p_137553_);
} catch (IllegalArgumentException illegalargumentexception) {
Expand All @@ -11,7 +11,7 @@
throw illegalargumentexception;
}
}
@@ -526,20 +_,20 @@
@@ -630,20 +_,20 @@

public static void logAndPauseIfInIde(String p_143786_) {
LOGGER.error(p_143786_);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/advancements/AdvancementRewards.java
+++ b/net/minecraft/advancements/AdvancementRewards.java
@@ -40,6 +_,7 @@
@@ -41,6 +_,7 @@
LootParams lootparams = new LootParams.Builder(p_9990_.serverLevel())
.withParameter(LootContextParams.THIS_ENTITY, p_9990_)
.withParameter(LootContextParams.ORIGIN, p_9990_.position())
Expand Down
34 changes: 17 additions & 17 deletions patches/net/minecraft/client/Camera.java.patch
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
--- a/net/minecraft/client/Camera.java
+++ b/net/minecraft/client/Camera.java
@@ -42,6 +_,7 @@
@@ -44,6 +_,7 @@
private float eyeHeightOld;
private float partialTickTime;
public static final float FOG_DISTANCE_SCALE = 0.083333336F;
+ private float roll;

public void setup(BlockGetter p_90576_, Entity p_90577_, boolean p_90578_, boolean p_90579_, float p_90580_) {
this.initialized = true;
@@ -49,7 +_,10 @@
this.entity = p_90577_;
this.detached = p_90578_;
this.partialTickTime = p_90580_;
- this.setRotation(p_90577_.getViewYRot(p_90580_), p_90577_.getViewXRot(p_90580_));
+ var cameraSetup = net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ViewportEvent.ComputeCameraAngles(
+ this, p_90580_, p_90577_.getViewYRot(p_90580_), p_90577_.getViewXRot(p_90580_), 0)
+ );
+ this.setRotation(cameraSetup.getYaw(), cameraSetup.getPitch(), cameraSetup.getRoll());
this.setPosition(
Mth.lerp((double)p_90580_, p_90577_.xo, p_90577_.getX()),
Mth.lerp((double)p_90580_, p_90577_.yo, p_90577_.getY()) + (double)Mth.lerp(p_90580_, this.eyeHeightOld, this.eyeHeight),
@@ -57,11 +_,11 @@
);
@@ -62,7 +_,10 @@
this.setRotation(p_90577_.getViewYRot(p_90580_), p_90577_.getViewXRot(p_90580_));
this.setPosition(newminecartbehavior.getCartLerpPosition(p_90580_).add(vec3));
} else {
- this.setRotation(p_90577_.getViewYRot(p_90580_), p_90577_.getViewXRot(p_90580_));
+ var cameraSetup = net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ViewportEvent.ComputeCameraAngles(
+ this, p_90580_, p_90577_.getViewYRot(p_90580_), p_90577_.getViewXRot(p_90580_), 0)
+ );
+ this.setRotation(cameraSetup.getYaw(), cameraSetup.getPitch(), cameraSetup.getRoll());
this.setPosition(
Mth.lerp((double)p_90580_, p_90577_.xo, p_90577_.getX()),
Mth.lerp((double)p_90580_, p_90577_.yo, p_90577_.getY()) + (double)Mth.lerp(p_90580_, this.eyeHeightOld, this.eyeHeight),
@@ -72,11 +_,11 @@

if (p_90578_) {
if (p_90579_) {
- this.setRotation(this.yRot + 180.0F, -this.xRot);
Expand All @@ -34,7 +34,7 @@
} else if (p_90577_ instanceof LivingEntity && ((LivingEntity)p_90577_).isSleeping()) {
Direction direction = ((LivingEntity)p_90577_).getBedOrientation();
this.setRotation(direction != null ? direction.toYRot() - 180.0F : 0.0F, 0.0F);
@@ -102,10 +_,17 @@
@@ -117,10 +_,17 @@
this.setPosition(new Vec3(this.position.x + (double)vector3f.x, this.position.y + (double)vector3f.y, this.position.z + (double)vector3f.z));
}

Expand All @@ -53,7 +53,7 @@
FORWARDS.rotate(this.rotation, this.forwards);
UP.rotate(this.rotation, this.up);
LEFT.rotate(this.rotation, this.left);
@@ -221,6 +_,17 @@
@@ -236,6 +_,17 @@

public float getPartialTickTime() {
return this.partialTickTime;
Expand Down
35 changes: 17 additions & 18 deletions patches/net/minecraft/client/ClientRecipeBook.java.patch
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
--- a/net/minecraft/client/ClientRecipeBook.java
+++ b/net/minecraft/client/ClientRecipeBook.java
@@ -65,7 +_,7 @@
Recipe<?> recipe = recipeholder.value();
if (!recipe.isSpecial() && !recipe.isIncomplete()) {
RecipeBookCategories recipebookcategories = getCategory(recipeholder);
- String s = recipe.getGroup();
+ String s = recipe.getGroup().isEmpty() ? recipeholder.id().toString() : recipe.getGroup(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty.
if (s.isEmpty()) {
map.computeIfAbsent(recipebookcategories, p_90645_ -> Lists.newArrayList()).add(ImmutableList.of(recipeholder));
} else {
@@ -125,6 +_,8 @@
} else if (recipetype == RecipeType.SMITHING) {
return RecipeBookCategories.SMITHING;
} else {
+ RecipeBookCategories categories = net.neoforged.neoforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_301136_);
+ if (categories != null) return categories;
LOGGER.warn(
"Unknown recipe category: {}/{}",
LogUtils.defer(() -> BuiltInRegistries.RECIPE_TYPE.getKey(recipe.getType())),
@@ -74,6 +_,16 @@
.collect(ImmutableList.toImmutableList())
);
}
+ // Neo: Do the same for modded search categories.
+ for (var entry : net.neoforged.neoforge.client.RecipeBookManager.getSearchCategories().entrySet()) {
+ map1.put(
+ entry.getKey(),
+ entry.getValue()
+ .stream()
+ .flatMap(category -> map1.getOrDefault(category, List.of()).stream())
+ .collect(ImmutableList.toImmutableList())
+ );
+ }

this.collectionsByTab = Map.copyOf(map1);
this.allCollections = builder.build();
Loading

0 comments on commit fdae668

Please sign in to comment.