Skip to content

Commit

Permalink
Merge branch '1.21.1' into 1211load-gametest-resources-once
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt authored Dec 4, 2024
2 parents 5751e0b + cc9dfb4 commit b4323cf
Show file tree
Hide file tree
Showing 68 changed files with 1,865 additions and 36 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ jobs:
run: ./gradlew assemble checkFormatting

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

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

- name: Publish artifacts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-jcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
publish-jcc:
if: true
if: ${{ ! startsWith(github.event.workflow_run.head_branch, 'port/') }}
uses: neoforged/actions/.github/workflows/publish-jcc.yml@main
with:
beta_version_pattern: .*-beta.*
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=4.0.34
mojang_logging_version=1.1.1
log4j_version=2.22.1
guava_version=31.1.2-jre
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
+ this.pages.clear();
+ int tabIndex = 0;
+ List<CreativeModeTab> currentPage = new java.util.ArrayList<>();
+ for (CreativeModeTab sortedCreativeModeTab : net.neoforged.neoforge.common.CreativeModeTabRegistry.getSortedCreativeModeTabs()) {
+ for (CreativeModeTab sortedCreativeModeTab : net.neoforged.neoforge.common.CreativeModeTabRegistry.getSortedCreativeModeTabs().stream().filter(CreativeModeTab::hasAnyItems).toList()) {
+ currentPage.add(sortedCreativeModeTab);
+ tabIndex++;
+ if (tabIndex == 10) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/net/minecraft/client/gui/screens/worldselection/ExperimentsScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/ExperimentsScreen.java
@@ -50,6 +_,11 @@

@Override
protected void init() {
+ if (net.minecraft.world.flag.FeatureFlags.REGISTRY.hasAnyModdedFlags()) {
+ this.minecraft.setScreen(new net.neoforged.neoforge.client.gui.ScrollableExperimentsScreen(this.parent, this.packRepository, this.output));
+ return;
+ }
+
this.layout.addTitleHeader(TITLE, this.font);
LinearLayout linearlayout = this.layout.addToContents(LinearLayout.vertical());
linearlayout.addChild(new MultiLineTextWidget(INFO, this.font).setMaxWidth(310), p_293611_ -> p_293611_.paddingBottom(15));
Original file line number Diff line number Diff line change
@@ -1,15 +1,42 @@
--- a/net/minecraft/client/renderer/block/LiquidBlockRenderer.java
+++ b/net/minecraft/client/renderer/block/LiquidBlockRenderer.java
@@ -38,6 +_,7 @@
@@ -38,12 +_,17 @@
this.waterIcons[0] = Minecraft.getInstance().getModelManager().getBlockModelShaper().getBlockModel(Blocks.WATER.defaultBlockState()).getParticleIcon();
this.waterIcons[1] = ModelBakery.WATER_FLOW.sprite();
this.waterOverlay = ModelBakery.WATER_OVERLAY.sprite();
+ net.neoforged.neoforge.client.textures.FluidSpriteCache.reload();
}

private static boolean isNeighborSameFluid(FluidState p_203186_, FluidState p_203187_) {
@@ -70,8 +_,9 @@
return p_203187_.getType().isSame(p_203186_.getType());
}

+ private static boolean isNeighborStateHidingOverlay(FluidState selfState, BlockState otherState, Direction neighborFace) {
+ return otherState.shouldHideAdjacentFluidFace(neighborFace, selfState);
+ }
+
private static boolean isFaceOccludedByState(BlockGetter p_110979_, Direction p_110980_, float p_110981_, BlockPos p_110982_, BlockState p_110983_) {
if (p_110983_.canOcclude()) {
VoxelShape voxelshape = Shapes.box(0.0, 0.0, 0.0, 1.0, (double)p_110981_, 1.0);
@@ -62,16 +_,26 @@
return isFaceOccludedByState(p_110960_, p_110963_.getOpposite(), 1.0F, p_110961_, p_110962_);
}

+ /** @deprecated Neo: use overload that accepts BlockState */
public static boolean shouldRenderFace(
BlockAndTintGetter p_203167_, BlockPos p_203168_, FluidState p_203169_, BlockState p_203170_, Direction p_203171_, FluidState p_203172_
) {
return !isFaceOccludedBySelf(p_203167_, p_203168_, p_203170_, p_203171_) && !isNeighborSameFluid(p_203169_, p_203172_);
}

+ public static boolean shouldRenderFace(
+ BlockAndTintGetter level, BlockPos pos, FluidState fluidState, BlockState selfState, Direction direction, BlockState otherState
+ ) {
+ return !isFaceOccludedBySelf(level, pos, selfState, direction) && !isNeighborStateHidingOverlay(fluidState, otherState, direction.getOpposite());
+ }
+
+
+
public void tesselate(BlockAndTintGetter p_234370_, BlockPos p_234371_, VertexConsumer p_234372_, BlockState p_234373_, FluidState p_234374_) {
boolean flag = p_234374_.is(FluidTags.LAVA);
- TextureAtlasSprite[] atextureatlassprite = flag ? this.lavaIcons : this.waterIcons;
Expand All @@ -20,6 +47,26 @@
float f = (float)(i >> 16 & 0xFF) / 255.0F;
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
float f2 = (float)(i & 0xFF) / 255.0F;
@@ -87,13 +_,13 @@
FluidState fluidstate4 = blockstate4.getFluidState();
BlockState blockstate5 = p_234370_.getBlockState(p_234371_.relative(Direction.EAST));
FluidState fluidstate5 = blockstate5.getFluidState();
- boolean flag1 = !isNeighborSameFluid(p_234374_, fluidstate1);
- boolean flag2 = shouldRenderFace(p_234370_, p_234371_, p_234374_, p_234373_, Direction.DOWN, fluidstate)
+ boolean flag1 = !isNeighborStateHidingOverlay(p_234374_, blockstate1, Direction.DOWN);
+ boolean flag2 = shouldRenderFace(p_234370_, p_234371_, p_234374_, p_234373_, Direction.DOWN, blockstate)
&& !isFaceOccludedByNeighbor(p_234370_, p_234371_, Direction.DOWN, 0.8888889F, blockstate);
- boolean flag3 = shouldRenderFace(p_234370_, p_234371_, p_234374_, p_234373_, Direction.NORTH, fluidstate2);
- boolean flag4 = shouldRenderFace(p_234370_, p_234371_, p_234374_, p_234373_, Direction.SOUTH, fluidstate3);
- boolean flag5 = shouldRenderFace(p_234370_, p_234371_, p_234374_, p_234373_, Direction.WEST, fluidstate4);
- boolean flag6 = shouldRenderFace(p_234370_, p_234371_, p_234374_, p_234373_, Direction.EAST, fluidstate5);
+ boolean flag3 = shouldRenderFace(p_234370_, p_234371_, p_234374_, p_234373_, Direction.NORTH, blockstate2);
+ boolean flag4 = shouldRenderFace(p_234370_, p_234371_, p_234374_, p_234373_, Direction.SOUTH, blockstate3);
+ boolean flag5 = shouldRenderFace(p_234370_, p_234371_, p_234374_, p_234373_, Direction.WEST, blockstate4);
+ boolean flag6 = shouldRenderFace(p_234370_, p_234371_, p_234374_, p_234373_, Direction.EAST, blockstate5);
if (flag1 || flag2 || flag6 || flag5 || flag3 || flag4) {
float f3 = p_234370_.getShade(Direction.DOWN, true);
float f4 = p_234370_.getShade(Direction.UP, true);
@@ -181,15 +_,15 @@
float f57 = f4 * f;
float f29 = f4 * f1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/resources/model/ModelManager.java
+++ b/net/minecraft/client/resources/model/ModelManager.java
@@ -63,13 +_,14 @@
@@ -63,18 +_,20 @@
TextureAtlas.LOCATION_BLOCKS,
ResourceLocation.withDefaultNamespace("blocks")
);
Expand All @@ -16,6 +16,12 @@

public ModelManager(TextureManager p_119406_, BlockColors p_119407_, int p_119408_) {
this.blockColors = p_119407_;
this.maxMipmapLevels = p_119408_;
this.blockModelShaper = new BlockModelShaper(this);
+ Map<ResourceLocation, ResourceLocation> VANILLA_ATLASES = net.neoforged.neoforge.client.ClientHooks.gatherMaterialAtlases(ModelManager.VANILLA_ATLASES);
this.atlases = new AtlasSet(VANILLA_ATLASES, p_119406_);
}

@@ -100,6 +_,7 @@
Executor p_249221_
) {
Expand Down
28 changes: 28 additions & 0 deletions patches/net/minecraft/world/flag/FeatureFlag.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- a/net/minecraft/world/flag/FeatureFlag.java
+++ b/net/minecraft/world/flag/FeatureFlag.java
@@ -3,9 +_,25 @@
public class FeatureFlag {
final FeatureFlagUniverse universe;
final long mask;
+ final int extMaskIndex;
+ final boolean modded;

+ /**
+ * @deprecated Neo: use {@link #FeatureFlag(FeatureFlagUniverse, int, int, boolean)} instead
+ */
+ @Deprecated
FeatureFlag(FeatureFlagUniverse p_249115_, int p_251067_) {
+ this(p_249115_, p_251067_, 0, false);
+ }
+
+ FeatureFlag(FeatureFlagUniverse p_249115_, int p_251067_, int offset, boolean modded) {
this.universe = p_249115_;
this.mask = 1L << p_251067_;
+ this.extMaskIndex = offset - 1;
+ this.modded = modded;
+ }
+
+ public boolean isModded() {
+ return modded;
}
}
44 changes: 44 additions & 0 deletions patches/net/minecraft/world/flag/FeatureFlagRegistry.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
--- a/net/minecraft/world/flag/FeatureFlagRegistry.java
+++ b/net/minecraft/world/flag/FeatureFlagRegistry.java
@@ -75,6 +_,18 @@
}, p_249796_ -> List.copyOf(this.toNames(p_249796_)));
}

+ public FeatureFlag getFlag(ResourceLocation name) {
+ return com.google.common.base.Preconditions.checkNotNull(this.names.get(name), "Flag %s was not registered", name);
+ }
+
+ public Map<ResourceLocation, FeatureFlag> getAllFlags() {
+ return this.names;
+ }
+
+ public boolean hasAnyModdedFlags() {
+ return this.names.values().stream().anyMatch(FeatureFlag::isModded);
+ }
+
public static class Builder {
private final FeatureFlagUniverse universe;
private int id;
@@ -88,11 +_,20 @@
return this.create(ResourceLocation.withDefaultNamespace(p_251782_));
}

+ /**
+ * @deprecated Neo: use {@link #create(ResourceLocation, boolean)} instead
+ */
+ @Deprecated
public FeatureFlag create(ResourceLocation p_250098_) {
- if (this.id >= 64) {
+ return create(p_250098_, false);
+ }
+
+ public FeatureFlag create(ResourceLocation p_250098_, boolean modded) {
+ if (this.id >= 64 && false) {
throw new IllegalStateException("Too many feature flags");
} else {
- FeatureFlag featureflag = new FeatureFlag(this.universe, this.id++);
+ FeatureFlag featureflag = new FeatureFlag(this.universe, this.id % FeatureFlagSet.MAX_CONTAINER_SIZE, this.id / FeatureFlagSet.MAX_CONTAINER_SIZE, modded);
+ this.id++;
FeatureFlag featureflag1 = this.flags.put(p_250098_, featureflag);
if (featureflag1 != null) {
throw new IllegalStateException("Duplicate feature flag " + p_250098_);
Loading

0 comments on commit b4323cf

Please sign in to comment.