Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/1.20.x' into 1.20.x
Browse files Browse the repository at this point in the history
  • Loading branch information
XFactHD committed Jan 22, 2024
2 parents 1cb44b8 + 255e6cc commit 55ea652
Show file tree
Hide file tree
Showing 295 changed files with 1,670 additions and 509 deletions.
8 changes: 4 additions & 4 deletions codeformat/formatter-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="-1"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
Expand Down Expand Up @@ -99,7 +99,7 @@
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_if_empty"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="-1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
Expand Down Expand Up @@ -224,7 +224,7 @@
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="-1"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
Expand Down Expand Up @@ -361,7 +361,7 @@
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="-1"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ unsafe_version=0.2.+
typetools_version=0.6.3
nashorn_core_version=15.3
lwjgl_glfw_version=3.3.2
mixin_extras_version=0.3.3
mixin_extras_version=0.3.5

jupiter_api_version=5.7.0
vintage_engine_version=5.+
Expand Down
10 changes: 10 additions & 0 deletions patches/net/minecraft/SharedConstants.java.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
--- a/net/minecraft/SharedConstants.java
+++ b/net/minecraft/SharedConstants.java
@@ -122,7 +_,8 @@
public static final long MAXIMUM_TICK_TIME_NANOS = Duration.ofMillis(300L).toNanos();
public static final boolean USE_WORKFLOWS_HOOKS = false;
public static boolean CHECK_DATA_FIXER_SCHEMA = true;
- public static boolean IS_RUNNING_IN_IDE;
+ public static boolean IS_RUNNING_IN_IDE = !net.neoforged.fml.loading.FMLLoader.isProduction();
+ public static final boolean IS_RUNNING_WITH_JDWP = java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().stream().anyMatch(str -> str.startsWith("-agentlib:jdwp"));
public static Set<TypeReference> DATA_FIX_TYPES_TO_OPTIMIZE = Set.of();
public static final int WORLD_RESOLUTION = 16;
public static final int MAX_CHAT_LENGTH = 256;
@@ -204,6 +_,7 @@
}

Expand Down
30 changes: 28 additions & 2 deletions patches/net/minecraft/Util.java.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
--- a/net/minecraft/Util.java
+++ b/net/minecraft/Util.java
@@ -261,7 +_,7 @@
@@ -261,8 +_,8 @@
.getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion()))
.getChoiceType(p_137552_, p_137553_);
} catch (IllegalArgumentException illegalargumentexception) {
- LOGGER.error("No data fixer registered for {}", p_137553_);
- if (SharedConstants.IS_RUNNING_IN_IDE) {
+ LOGGER.debug("No data fixer registered for {}", p_137553_);
if (SharedConstants.IS_RUNNING_IN_IDE) {
+ if (SharedConstants.IS_RUNNING_IN_IDE && false) {
throw illegalargumentexception;
}
}
@@ -438,20 +_,20 @@

public static void logAndPauseIfInIde(String p_143786_) {
LOGGER.error(p_143786_);
- if (SharedConstants.IS_RUNNING_IN_IDE) {
+ if (SharedConstants.IS_RUNNING_WITH_JDWP) {
doPause(p_143786_);
}
}

public static void logAndPauseIfInIde(String p_200891_, Throwable p_200892_) {
LOGGER.error(p_200891_, p_200892_);
- if (SharedConstants.IS_RUNNING_IN_IDE) {
+ if (SharedConstants.IS_RUNNING_WITH_JDWP) {
doPause(p_200891_);
}
}

public static <T extends Throwable> T pauseInIde(T p_137571_) {
- if (SharedConstants.IS_RUNNING_IN_IDE) {
+ if (SharedConstants.IS_RUNNING_WITH_JDWP) {
LOGGER.error("Trying to throw a fatal exception, pausing in IDE", p_137571_);
doPause(p_137571_.getMessage());
}
11 changes: 11 additions & 0 deletions patches/net/minecraft/client/GameNarrator.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/GameNarrator.java
+++ b/net/minecraft/client/GameNarrator.java
@@ -59,7 +_,7 @@
}

private void logNarratedMessage(String p_168788_) {
- if (SharedConstants.IS_RUNNING_IN_IDE) {
+ if (SharedConstants.IS_RUNNING_IN_IDE && false) {
LOGGER.debug("Narrating: {}", p_168788_.replaceAll("\n", "\\\\n"));
}
}
3 changes: 2 additions & 1 deletion patches/net/minecraft/client/Minecraft.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@
this.setOverlay(
- new LoadingOverlay(
- this, reloadinstance, p_299779_ -> Util.ifElse(p_299779_, p_299772_ -> this.rollbackResourcePacks(p_299772_, minecraft$gameloadcookie), () -> {
- if (SharedConstants.IS_RUNNING_IN_IDE) {
+ net.neoforged.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(
+ () -> this, () -> reloadinstance, p_299779_ -> Util.ifElse(p_299779_, p_299772_ -> this.rollbackResourcePacks(p_299772_, minecraft$gameloadcookie), () -> {
if (SharedConstants.IS_RUNNING_IN_IDE) {
+ if (SharedConstants.IS_RUNNING_IN_IDE && false) {
this.selfTest();
}

Expand Down
16 changes: 16 additions & 0 deletions patches/net/minecraft/client/MouseHandler.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@
if (this.minecraft.player.isSpectator()) {
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k);
@@ -235,12 +_,13 @@
double d1 = d0 - this.lastMouseEventTime;
this.lastMouseEventTime = d0;
if (this.isMouseGrabbed() && this.minecraft.isWindowActive()) {
- double d4 = this.minecraft.options.sensitivity().get() * 0.6F + 0.2F;
+ var event = net.neoforged.neoforge.client.ClientHooks.getTurnPlayerValues(this.minecraft.options.sensitivity().get(), this.minecraft.options.smoothCamera);
+ double d4 = event.getMouseSensitivity() * 0.6F + 0.2F;
double d5 = d4 * d4 * d4;
double d6 = d5 * 8.0;
double d2;
double d3;
- if (this.minecraft.options.smoothCamera) {
+ if (event.getCinematicCameraEnabled()) {
double d7 = this.smoothTurnX.getNewDeltaValue(this.accumulatedDX * d6, d1 * d6);
double d8 = this.smoothTurnY.getNewDeltaValue(this.accumulatedDY * d6, d1 * d6);
d2 = d7;
@@ -292,6 +_,14 @@

public double ypos() {
Expand Down
25 changes: 25 additions & 0 deletions patches/net/minecraft/client/gui/screens/MenuScreens.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,28 @@
}

@Nullable
@@ -58,6 +_,11 @@
return (MenuScreens.ScreenConstructor<T, ?>)SCREENS.get(p_96200_);
}

+ /**
+ @deprecated Use {@link net.neoforged.neoforge.client.event.RegisterMenuScreensEvent} to register menu screens
+ + TODO 1.20.5: remove AT related to this
+ */
+ @Deprecated
public static <M extends AbstractContainerMenu, U extends Screen & MenuAccess<M>> void register(
MenuType<? extends M> p_96207_, MenuScreens.ScreenConstructor<M, U> p_96208_
) {
@@ -65,6 +_,12 @@
if (screenconstructor != null) {
throw new IllegalStateException("Duplicate registration for " + BuiltInRegistries.MENU.getKey(p_96207_));
}
+ }
+
+ @org.jetbrains.annotations.ApiStatus.Internal
+ public static void init() {
+ var event = new net.neoforged.neoforge.client.event.RegisterMenuScreensEvent(SCREENS);
+ net.neoforged.fml.ModLoader.get().postEvent(event);
}

public static boolean selfTest() {
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
posestack.pushPose();
posestack.setIdentity();
- posestack.translate(0.0F, 0.0F, -11000.0F);
+ posestack.translate(0.0D, 0.0D, 1000F - net.neoforged.neoforge.client.ClientHooks.getGuiFarPlane());
+ posestack.translate(0.0D, 0.0D, 10000F - net.neoforged.neoforge.client.ClientHooks.getGuiFarPlane());
RenderSystem.applyModelViewMatrix();
Lighting.setupFor3DItems();
GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource());
Expand Down
10 changes: 10 additions & 0 deletions patches/net/minecraft/client/renderer/RenderBuffers.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/net/minecraft/client/renderer/RenderBuffers.java
+++ b/net/minecraft/client/renderer/RenderBuffers.java
@@ -39,6 +_,7 @@
put(p_307112_, RenderType.waterMask());
ModelBakery.DESTROY_TYPES.forEach(p_173062_ -> put(p_307112_, p_173062_));
});
+ net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.client.event.RegisterRenderBuffersEvent(sortedmap));
this.crumblingBufferSource = MultiBufferSource.immediate(new BufferBuilder(1536));
this.bufferSource = MultiBufferSource.immediateWithBuffers(sortedmap, new BufferBuilder(786432));
this.outlineBufferSource = new OutlineBufferSource(this.bufferSource);
47 changes: 47 additions & 0 deletions patches/net/minecraft/data/recipes/ShapedRecipeBuilder.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--- a/net/minecraft/data/recipes/ShapedRecipeBuilder.java
+++ b/net/minecraft/data/recipes/ShapedRecipeBuilder.java
@@ -25,6 +_,7 @@
private final RecipeCategory category;
private final Item result;
private final int count;
+ private final ItemStack resultStack; // Neo: add stack result support
private final List<String> rows = Lists.newArrayList();
private final Map<Character, Ingredient> key = Maps.newLinkedHashMap();
private final Map<String, Criterion<?>> criteria = new LinkedHashMap<>();
@@ -33,9 +_,14 @@
private boolean showNotification = true;

public ShapedRecipeBuilder(RecipeCategory p_249996_, ItemLike p_251475_, int p_248948_) {
+ this(p_249996_, new ItemStack(p_251475_, p_248948_));
+ }
+
+ public ShapedRecipeBuilder(RecipeCategory p_249996_, ItemStack result) {
this.category = p_249996_;
- this.result = p_251475_.asItem();
- this.count = p_248948_;
+ this.result = result.getItem();
+ this.count = result.getCount();
+ this.resultStack = result;
}

public static ShapedRecipeBuilder shaped(RecipeCategory p_250853_, ItemLike p_249747_) {
@@ -46,6 +_,10 @@
return new ShapedRecipeBuilder(p_251325_, p_250636_, p_249081_);
}

+ public static ShapedRecipeBuilder shaped(RecipeCategory p_251325_, ItemStack result) {
+ return new ShapedRecipeBuilder(p_251325_, result);
+ }
+
public ShapedRecipeBuilder define(Character p_206417_, TagKey<Item> p_206418_) {
return this.define(p_206417_, Ingredient.of(p_206418_));
}
@@ -106,7 +_,7 @@
Objects.requireNonNullElse(this.group, ""),
RecipeBuilder.determineBookCategory(this.category),
shapedrecipepattern,
- new ItemStack(this.result, this.count),
+ this.resultStack,
this.showNotification
);
p_301098_.accept(p_126142_, shapedrecipe, advancement$builder.build(p_126142_.withPrefix("recipes/" + this.category.getFolderName() + "/")));
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
--- a/net/minecraft/data/recipes/ShapelessRecipeBuilder.java
+++ b/net/minecraft/data/recipes/ShapelessRecipeBuilder.java
@@ -22,15 +_,21 @@
private final RecipeCategory category;
private final Item result;
private final int count;
+ private final ItemStack resultStack; // Neo: add stack result support
private final NonNullList<Ingredient> ingredients = NonNullList.create();
private final Map<String, Criterion<?>> criteria = new LinkedHashMap<>();
@Nullable
private String group;

public ShapelessRecipeBuilder(RecipeCategory p_250837_, ItemLike p_251897_, int p_252227_) {
+ this(p_250837_, new ItemStack(p_251897_, p_252227_));
+ }
+
+ public ShapelessRecipeBuilder(RecipeCategory p_250837_, ItemStack result) {
this.category = p_250837_;
- this.result = p_251897_.asItem();
- this.count = p_252227_;
+ this.result = result.getItem();
+ this.count = result.getCount();
+ this.resultStack = result;
}

public static ShapelessRecipeBuilder shapeless(RecipeCategory p_250714_, ItemLike p_249659_) {
@@ -41,6 +_,10 @@
return new ShapelessRecipeBuilder(p_252339_, p_250836_, p_249928_);
}

+ public static ShapelessRecipeBuilder shapeless(RecipeCategory p_252339_, ItemStack result) {
+ return new ShapelessRecipeBuilder(p_252339_, result);
+ }
+
public ShapelessRecipeBuilder requires(TagKey<Item> p_206420_) {
return this.requires(Ingredient.of(p_206420_));
}
@@ -95,7 +_,7 @@
ShapelessRecipe shapelessrecipe = new ShapelessRecipe(
Objects.requireNonNullElse(this.group, ""),
RecipeBuilder.determineBookCategory(this.category),
- new ItemStack(this.result, this.count),
+ this.resultStack,
this.ingredients
);
p_301215_.accept(p_126206_, shapelessrecipe, advancement$builder.build(p_126206_.withPrefix("recipes/" + this.category.getFolderName() + "/")));
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
--- a/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java
+++ b/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java
@@ -27,6 +_,7 @@
private final RecipeCategory category;
private final CookingBookCategory bookCategory;
private final Item result;
+ private final ItemStack stackResult; // Neo: add stack result support
private final Ingredient ingredient;
private final float experience;
private final int cookingTime;
@@ -44,9 +_,22 @@
int p_250189_,
AbstractCookingRecipe.Factory<?> p_311960_
) {
+ this(p_251345_, p_251607_, new ItemStack(p_252112_), p_250362_, p_251204_, p_250189_, p_311960_);
+ }
+
+ private SimpleCookingRecipeBuilder(
+ RecipeCategory p_251345_,
+ CookingBookCategory p_251607_,
+ ItemStack result,
+ Ingredient p_250362_,
+ float p_251204_,
+ int p_250189_,
+ AbstractCookingRecipe.Factory<?> p_311960_
+ ) {
this.category = p_251345_;
this.bookCategory = p_251607_;
- this.result = p_252112_.asItem();
+ this.result = result.getItem();
+ this.stackResult = result;
this.ingredient = p_250362_;
this.experience = p_251204_;
this.cookingTime = p_250189_;
@@ -85,6 +_,38 @@
return new SimpleCookingRecipeBuilder(p_250319_, CookingBookCategory.FOOD, p_250377_, p_248930_, p_252329_, p_250482_, SmokingRecipe::new);
}

+ public static <T extends AbstractCookingRecipe> SimpleCookingRecipeBuilder generic(
+ Ingredient p_250999_,
+ RecipeCategory p_248815_,
+ ItemStack result,
+ float p_251320_,
+ int p_248693_,
+ RecipeSerializer<T> p_250921_,
+ AbstractCookingRecipe.Factory<T> p_312657_
+ ) {
+ return new SimpleCookingRecipeBuilder(p_248815_, determineSmeltingRecipeCategory(result.getItem()), result, p_250999_, p_251320_, p_248693_, p_312657_);
+ }
+
+ public static SimpleCookingRecipeBuilder campfireCooking(Ingredient p_249393_, RecipeCategory p_249372_, ItemStack result, float p_252321_, int p_251916_) {
+ return new SimpleCookingRecipeBuilder(p_249372_, CookingBookCategory.FOOD, result, p_249393_, p_252321_, p_251916_, CampfireCookingRecipe::new);
+ }
+
+ public static SimpleCookingRecipeBuilder blasting(Ingredient p_252115_, RecipeCategory p_249421_, ItemStack result, float p_250383_, int p_250476_) {
+ return new SimpleCookingRecipeBuilder(
+ p_249421_, determineBlastingRecipeCategory(result.getItem()), result, p_252115_, p_250383_, p_250476_, BlastingRecipe::new
+ );
+ }
+
+ public static SimpleCookingRecipeBuilder smelting(Ingredient p_249223_, RecipeCategory p_251240_, ItemStack result, float p_249452_, int p_250496_) {
+ return new SimpleCookingRecipeBuilder(
+ p_251240_, determineSmeltingRecipeCategory(result.getItem()), result, p_249223_, p_249452_, p_250496_, SmeltingRecipe::new
+ );
+ }
+
+ public static SimpleCookingRecipeBuilder smoking(Ingredient p_248930_, RecipeCategory p_250319_, ItemStack result, float p_252329_, int p_250482_) {
+ return new SimpleCookingRecipeBuilder(p_250319_, CookingBookCategory.FOOD, result, p_248930_, p_252329_, p_250482_, SmokingRecipe::new);
+ }
+
public SimpleCookingRecipeBuilder unlockedBy(String p_176792_, Criterion<?> p_300970_) {
this.criteria.put(p_176792_, p_300970_);
return this;
@@ -110,7 +_,7 @@
this.criteria.forEach(advancement$builder::addCriterion);
AbstractCookingRecipe abstractcookingrecipe = this.factory
.create(
- Objects.requireNonNullElse(this.group, ""), this.bookCategory, this.ingredient, new ItemStack(this.result), this.experience, this.cookingTime
+ Objects.requireNonNullElse(this.group, ""), this.bookCategory, this.ingredient, this.stackResult, this.experience, this.cookingTime
);
p_301266_.accept(p_126264_, abstractcookingrecipe, advancement$builder.build(p_126264_.withPrefix("recipes/" + this.category.getFolderName() + "/")));
}
Loading

0 comments on commit 55ea652

Please sign in to comment.