Upload magma

This commit is contained in:
Diamond Creeper 2024-03-04 21:16:02 +13:00
commit dfa9ee0b24
5008 changed files with 653442 additions and 0 deletions

View file

@ -0,0 +1,8 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/</h1><hr><pre><a href="../">../</a>
<a href="minecraft/">minecraft/</a> 06-Nov-2023 18:00 -
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="7930c6c2f88f371df667b03f38bed395" data-cf-beacon='{"rayId":"85f01584c9c950c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,62 @@
--- a/net/minecraft/CrashReport.java
+++ b/net/minecraft/CrashReport.java
@@ -33,6 +_,7 @@
public CrashReport(String p_127509_, Throwable p_127510_) {
this.f_127500_ = p_127509_;
this.f_127501_ = p_127510_;
+ this.f_178624_.m_143522_("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
}
public String m_127511_() {
@@ -57,14 +_,9 @@
if (this.f_127506_ != null && this.f_127506_.length > 0) {
p_127520_.append("-- Head --\n");
p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
- p_127520_.append("Stacktrace:\n");
-
- for(StackTraceElement stacktraceelement : this.f_127506_) {
- p_127520_.append("\t").append("at ").append((Object)stacktraceelement);
- p_127520_.append("\n");
- }
-
- p_127520_.append("\n");
+ p_127520_.append("Stacktrace:");
+ p_127520_.append(net.minecraftforge.logging.CrashReportAnalyser.appendSuspectedMods(this.f_127501_, this.f_127506_));
+ p_127520_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_127506_));
}
for(CrashReportCategory crashreportcategory : this.f_127503_) {
@@ -72,6 +_,7 @@
p_127520_.append("\n\n");
}
+ net.minecraftforge.logging.CrashReportExtender.extendSystemReport(f_178624_);
this.f_178624_.m_143525_(p_127520_);
}
@@ -91,23 +_,13 @@
throwable.setStackTrace(this.f_127501_.getStackTrace());
}
- String s;
- try {
- stringwriter = new StringWriter();
- printwriter = new PrintWriter(stringwriter);
- throwable.printStackTrace(printwriter);
- s = stringwriter.toString();
- } finally {
- IOUtils.closeQuietly((Writer)stringwriter);
- IOUtils.closeQuietly((Writer)printwriter);
- }
-
- return s;
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
}
public String m_127526_() {
StringBuilder stringbuilder = new StringBuilder();
stringbuilder.append("---- Minecraft Crash Report ----\n");
+ net.minecraftforge.logging.CrashReportExtender.addCrashReportHeader(stringbuilder, this);
stringbuilder.append("// ");
stringbuilder.append(m_127531_());
stringbuilder.append("\n\n");

View file

@ -0,0 +1,38 @@
--- a/net/minecraft/CrashReportCategory.java
+++ b/net/minecraft/CrashReportCategory.java
@@ -102,8 +_,10 @@
if (astacktraceelement.length <= 0) {
return 0;
} else {
- this.f_128139_ = new StackTraceElement[astacktraceelement.length - 3 - p_128149_];
- System.arraycopy(astacktraceelement, 3 + p_128149_, this.f_128139_, 0, this.f_128139_.length);
+ int len = astacktraceelement.length - 3 - p_128149_;
+ if (len <= 0) len = astacktraceelement.length;
+ this.f_128139_ = new StackTraceElement[len];
+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.f_128139_, 0, this.f_128139_.length);
return this.f_128139_.length;
}
}
@@ -147,17 +_,17 @@
if (this.f_128139_ != null && this.f_128139_.length > 0) {
p_128169_.append("\nStacktrace:");
-
- for(StackTraceElement stacktraceelement : this.f_128139_) {
- p_128169_.append("\n\tat ");
- p_128169_.append((Object)stacktraceelement);
- }
+ p_128169_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_128139_));
}
}
public StackTraceElement[] m_128143_() {
return this.f_128139_;
+ }
+
+ public void applyStackTrace(Throwable t) {
+ this.f_128139_ = t.getStackTrace();
}
public static void m_178950_(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, @Nullable BlockState p_178954_) {

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/SharedConstants.java
+++ b/net/minecraft/SharedConstants.java
@@ -210,6 +_,7 @@
}
static {
+ if (System.getProperty("io.netty.leakDetection.level") == null) // Forge: allow level to be manually specified
ResourceLeakDetector.setLevel(f_136180_);
CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES = false;
CommandSyntaxException.BUILT_IN_EXCEPTIONS = new BrigadierExceptions();

View file

@ -0,0 +1,23 @@
--- a/net/minecraft/Util.java
+++ b/net/minecraft/Util.java
@@ -171,6 +_,11 @@
return 255;
}
+ // We add these inner classes to compensate for Mojang's missing inner classes and shift the anonymous class index.
+ // This allows us to obfuscate subsequent anonymous inner classes correctly.
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT1 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT2 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
+
public static ExecutorService m_183991_() {
return f_137444_;
}
@@ -239,7 +_,7 @@
try {
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().m_183476_().m_193006_())).getChoiceType(p_137552_, p_137553_);
} catch (IllegalArgumentException illegalargumentexception) {
- f_137446_.error("No data fixer registered for {}", (Object)p_137553_);
+ f_137446_.debug("No data fixer registered for {}", (Object)p_137553_);
if (SharedConstants.f_136183_) {
throw illegalargumentexception;
}

View file

@ -0,0 +1,34 @@
--- a/net/minecraft/advancements/Advancement.java
+++ b/net/minecraft/advancements/Advancement.java
@@ -37,6 +_,7 @@
private final Set<Advancement> f_138304_ = Sets.newLinkedHashSet();
private final Component f_138305_;
private final boolean f_285575_;
+ public final org.bukkit.advancement.Advancement bukkit = new org.bukkit.craftbukkit.advancement.CraftAdvancement(this); // CraftBukkit
public Advancement(ResourceLocation p_286878_, @Nullable Advancement p_286496_, @Nullable DisplayInfo p_286499_, AdvancementRewards p_286389_, Map<String, Criterion> p_286635_, String[][] p_286882_, boolean p_286478_) {
this.f_138301_ = p_286878_;
@@ -150,7 +_,7 @@
return this.f_138305_;
}
- public static class Builder {
+ public static class Builder implements net.minecraftforge.common.extensions.IForgeAdvancementBuilder {
@Nullable
private ResourceLocation f_138332_;
@Nullable
@@ -340,7 +_,14 @@
return "Task Advancement{parentId=" + this.f_138332_ + ", display=" + this.f_138334_ + ", rewards=" + this.f_138335_ + ", criteria=" + this.f_138336_ + ", requirements=" + Arrays.deepToString(this.f_138337_) + ", sends_telemetry_event=" + this.f_285655_ + "}";
}
+ /** @deprecated Forge: use {@linkplain #fromJson(JsonObject, DeserializationContext, net.minecraftforge.common.crafting.conditions.ICondition.IContext) overload with context}. */
+ @Deprecated
public static Advancement.Builder m_138380_(JsonObject p_138381_, DeserializationContext p_138382_) {
+ return fromJson(p_138381_, p_138382_, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY);
+ }
+
+ public static Advancement.Builder fromJson(JsonObject p_138381_, DeserializationContext p_138382_, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) {
+ if ((p_138381_ = net.minecraftforge.common.crafting.ConditionalAdvancement.processConditional(p_138381_, context)) == null) return null;
ResourceLocation resourcelocation = p_138381_.has("parent") ? new ResourceLocation(GsonHelper.m_13906_(p_138381_, "parent")) : null;
DisplayInfo displayinfo = p_138381_.has("display") ? DisplayInfo.m_14981_(GsonHelper.m_13930_(p_138381_, "display")) : null;
AdvancementRewards advancementrewards = p_138381_.has("rewards") ? AdvancementRewards.m_9991_(GsonHelper.m_13930_(p_138381_, "rewards")) : AdvancementRewards.f_9978_;

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/advancements/AdvancementList.java
+++ b/net/minecraft/advancements/AdvancementList.java
@@ -90,7 +_,7 @@
}
}
- f_139325_.info("Loaded {} advancements", (int)this.f_139326_.size());
+ // LOGGER.info("Loaded {} advancements", (int)this.advancements.size()); // CraftBukkit - moved to ServerAdvancementManager#reload
}
public void m_139332_() {

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/advancements/AdvancementRewards.java
+++ b/net/minecraft/advancements/AdvancementRewards.java
@@ -43,7 +_,7 @@
public void m_9989_(ServerPlayer p_9990_) {
p_9990_.m_6756_(this.f_9979_);
- LootParams lootparams = (new LootParams.Builder(p_9990_.m_284548_())).m_287286_(LootContextParams.f_81455_, p_9990_).m_287286_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_287235_(LootContextParamSets.f_81418_);
+ LootParams lootparams = (new LootParams.Builder(p_9990_.m_284548_())).m_287286_(LootContextParams.f_81455_, p_9990_).m_287286_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_287239_(p_9990_.m_36336_()).m_287235_(LootContextParamSets.f_81418_); // Forge: Add luck to LootContext
boolean flag = false;
for(ResourceLocation resourcelocation : this.f_9980_) {

View file

@ -0,0 +1,47 @@
--- a/net/minecraft/advancements/critereon/ItemPredicate.java
+++ b/net/minecraft/advancements/critereon/ItemPredicate.java
@@ -29,6 +_,8 @@
import net.minecraft.world.level.ItemLike;
public class ItemPredicate {
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> custom_predicates = new java.util.HashMap<>();
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates);
public static final ItemPredicate f_45028_ = new ItemPredicate();
@Nullable
private final TagKey<Item> f_45029_;
@@ -81,7 +_,7 @@
return false;
} else {
if (this.f_45033_.length > 0) {
- Map<Enchantment, Integer> map = EnchantmentHelper.m_44882_(p_45050_.m_41785_());
+ Map<Enchantment, Integer> map = p_45050_.getAllEnchantments();
for(EnchantmentPredicate enchantmentpredicate : this.f_45033_) {
if (!enchantmentpredicate.m_30476_(map)) {
@@ -108,6 +_,11 @@
public static ItemPredicate m_45051_(@Nullable JsonElement p_45052_) {
if (p_45052_ != null && !p_45052_.isJsonNull()) {
JsonObject jsonobject = GsonHelper.m_13918_(p_45052_, "item");
+ if (jsonobject.has("type")) {
+ final ResourceLocation rl = new ResourceLocation(GsonHelper.m_13906_(jsonobject, "type"));
+ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject);
+ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl);
+ }
MinMaxBounds.Ints minmaxbounds$ints = MinMaxBounds.Ints.m_55373_(jsonobject.get("count"));
MinMaxBounds.Ints minmaxbounds$ints1 = MinMaxBounds.Ints.m_55373_(jsonobject.get("durability"));
if (jsonobject.has("data")) {
@@ -215,6 +_,14 @@
} else {
return new ItemPredicate[0];
}
+ }
+
+ public static void register(ResourceLocation name, java.util.function.Function<JsonObject, ItemPredicate> deserializer) {
+ custom_predicates.put(name, deserializer);
+ }
+
+ public static Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> getPredicates() {
+ return unmod_predicates;
}
public static class Builder {

View file

@ -0,0 +1,8 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/advancements/critereon/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/advancements/critereon/</h1><hr><pre><a href="../">../</a>
<a href="ItemPredicate.java.patch">ItemPredicate.java.patch</a> 07-Oct-2023 14:12 2365
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="e57713214af9fa1374960307c2ec0530" data-cf-beacon='{"rayId":"85f016f979e550c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,11 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/advancements/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/advancements/</h1><hr><pre><a href="../">../</a>
<a href="critereon/">critereon/</a> 07-Oct-2023 14:12 -
<a href="Advancement.java.patch">Advancement.java.patch</a> 07-Oct-2023 14:12 2472
<a href="AdvancementList.java.patch">AdvancementList.java.patch</a> 07-Oct-2023 14:12 401
<a href="AdvancementRewards.java.patch">AdvancementRewards.java.patch</a> 07-Oct-2023 14:12 825
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="228be583271dda8e0f092eaeefdd8379" data-cf-beacon='{"rayId":"85f016423b3650c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,21 @@
--- a/net/minecraft/client/Camera.java
+++ b/net/minecraft/client/Camera.java
@@ -206,6 +_,18 @@
this.f_90549_ = false;
}
+ public void setAnglesInternal(float yaw, float pitch) {
+ this.f_90558_ = yaw;
+ this.f_90557_ = pitch;
+ }
+
+ public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() {
+ if (!this.f_90549_)
+ return net.minecraft.world.level.block.Blocks.f_50016_.m_49966_();
+ else
+ return this.f_90550_.m_8055_(this.f_90553_).getStateAtViewpoint(this.f_90550_, this.f_90553_, this.f_90552_);
+ }
+
@OnlyIn(Dist.CLIENT)
public static class NearPlane {
final Vec3 f_167687_;

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/ClientBrandRetriever.java
+++ b/net/minecraft/client/ClientBrandRetriever.java
@@ -10,6 +_,6 @@
@DontObfuscate
public static String getClientModName() {
- return "vanilla";
+ return net.minecraftforge.internal.BrandingControl.getClientBranding();
}
}

View file

@ -0,0 +1,20 @@
--- a/net/minecraft/client/ClientRecipeBook.java
+++ b/net/minecraft/client/ClientRecipeBook.java
@@ -54,7 +_,7 @@
for(Recipe<?> recipe : p_90643_) {
if (!recipe.m_5598_() && !recipe.m_142505_()) {
RecipeBookCategories recipebookcategories = m_90646_(recipe);
- String s = recipe.m_6076_();
+ String s = recipe.m_6076_().isEmpty() ? recipe.m_6423_().toString() : recipe.m_6076_(); // 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_) -> {
return Lists.newArrayList();
@@ -141,6 +_,8 @@
} else if (recipetype == RecipeType.f_44113_) {
return RecipeBookCategories.SMITHING;
} else {
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_90647_);
+ if (categories != null) return categories;
f_90618_.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
return BuiltInRegistries.f_256990_.m_7981_(p_90647_.m_6671_());
}), LogUtils.defer(p_90647_::m_6423_));

View file

@ -0,0 +1,182 @@
--- a/net/minecraft/client/KeyMapping.java
+++ b/net/minecraft/client/KeyMapping.java
@@ -13,13 +_,13 @@
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
-public class KeyMapping implements Comparable<KeyMapping> {
+public class KeyMapping implements Comparable<KeyMapping>, net.minecraftforge.client.extensions.IForgeKeyMapping {
private static final Map<String, KeyMapping> f_90809_ = Maps.newHashMap();
- private static final Map<InputConstants.Key, KeyMapping> f_90810_ = Maps.newHashMap();
+ private static final net.minecraftforge.client.settings.KeyMappingLookup f_90810_ = new net.minecraftforge.client.settings.KeyMappingLookup();
private static final Set<String> f_90811_ = Sets.newHashSet();
public static final String f_167805_ = "key.categories.movement";
public static final String f_167806_ = "key.categories.misc";
- public static final String f_167807_ = "key.categories.multiplayer";
+ public static final String CATEGORY_M1ULTIPLAYER = "key.categories.multiplayer";
public static final String f_167808_ = "key.categories.gameplay";
public static final String f_167809_ = "key.categories.inventory";
public static final String f_167810_ = "key.categories.ui";
@@ -41,7 +_,7 @@
private int f_90818_;
public static void m_90835_(InputConstants.Key p_90836_) {
- KeyMapping keymapping = f_90810_.get(p_90836_);
+ for (KeyMapping keymapping : f_90810_.getAll(p_90836_))
if (keymapping != null) {
++keymapping.f_90818_;
}
@@ -49,7 +_,7 @@
}
public static void m_90837_(InputConstants.Key p_90838_, boolean p_90839_) {
- KeyMapping keymapping = f_90810_.get(p_90838_);
+ for (KeyMapping keymapping : f_90810_.getAll(p_90838_))
if (keymapping != null) {
keymapping.m_7249_(p_90839_);
}
@@ -105,7 +_,7 @@
}
public boolean m_90857_() {
- return this.f_90817_;
+ return this.f_90817_ && isConflictContextAndModifierActive();
}
public String m_90858_() {
@@ -139,7 +_,13 @@
}
public int compareTo(KeyMapping p_90841_) {
- return this.f_90815_.equals(p_90841_.f_90815_) ? I18n.m_118938_(this.f_90813_).compareTo(I18n.m_118938_(p_90841_.f_90813_)) : f_90812_.get(this.f_90815_).compareTo(f_90812_.get(p_90841_.f_90815_));
+ if (this.f_90815_.equals(p_90841_.f_90815_)) return I18n.m_118938_(this.f_90813_).compareTo(I18n.m_118938_(p_90841_.f_90813_));
+ Integer tCat = f_90812_.get(this.f_90815_);
+ Integer oCat = f_90812_.get(p_90841_.f_90815_);
+ if (tCat == null && oCat != null) return 1;
+ if (tCat != null && oCat == null) return -1;
+ if (tCat == null && oCat == null) return I18n.m_118938_(this.f_90815_).compareTo(I18n.m_118938_(p_90841_.f_90815_));
+ return tCat.compareTo(oCat);
}
public static Supplier<Component> m_90842_(String p_90843_) {
@@ -150,6 +_,20 @@
}
public boolean m_90850_(KeyMapping p_90851_) {
+ if (getKeyConflictContext().conflicts(p_90851_.getKeyConflictContext()) || p_90851_.getKeyConflictContext().conflicts(getKeyConflictContext())) {
+ net.minecraftforge.client.settings.KeyModifier keyModifier = getKeyModifier();
+ net.minecraftforge.client.settings.KeyModifier otherKeyModifier = p_90851_.getKeyModifier();
+ if (keyModifier.matches(p_90851_.getKey()) || otherKeyModifier.matches(getKey())) {
+ return true;
+ } else if (getKey().equals(p_90851_.getKey())) {
+ // IN_GAME key contexts have a conflict when at least one modifier is NONE.
+ // For example: If you hold shift to crouch, you can still press E to open your inventory. This means that a Shift+E hotkey is in conflict with E.
+ // GUI and other key contexts do not have this limitation.
+ return keyModifier == otherKeyModifier ||
+ (getKeyConflictContext().conflicts(net.minecraftforge.client.settings.KeyConflictContext.IN_GAME) &&
+ (keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE));
+ }
+ }
return this.f_90816_.equals(p_90851_.f_90816_);
}
@@ -170,11 +_,13 @@
}
public Component m_90863_() {
+ return getKeyModifier().getCombinedName(f_90816_, () -> {
return this.f_90816_.m_84875_();
+ });
}
public boolean m_90864_() {
- return this.f_90816_.equals(this.f_90814_);
+ return this.f_90816_.equals(this.f_90814_) && getKeyModifier() == getDefaultKeyModifier();
}
public String m_90865_() {
@@ -184,4 +_,84 @@
public void m_7249_(boolean p_90846_) {
this.f_90817_ = p_90846_;
}
+
+ /****************** Forge Start *****************************/
+ private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE;
+ private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
+ private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL;
+
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
+ */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputConstants.Type inputType, final int keyCode, String category) {
+ this(description, keyConflictContext, inputType.m_84895_(keyCode), category);
+ }
+
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
+ */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, InputConstants.Key keyCode, String category) {
+ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category);
+ }
+
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
+ */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputConstants.Type inputType, final int keyCode, String category) {
+ this(description, keyConflictContext, keyModifier, inputType.m_84895_(keyCode), category);
+ }
+
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
+ */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode, String category) {
+ this.f_90813_ = description;
+ this.f_90816_ = keyCode;
+ this.f_90814_ = keyCode;
+ this.f_90815_ = category;
+ this.keyConflictContext = keyConflictContext;
+ this.keyModifier = keyModifier;
+ this.keyModifierDefault = keyModifier;
+ if (this.keyModifier.matches(keyCode))
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
+ f_90809_.put(description, this);
+ f_90810_.put(keyCode, this);
+ f_90811_.add(category);
+ }
+
+ @Override
+ public InputConstants.Key getKey() {
+ return this.f_90816_;
+ }
+
+ @Override
+ public void setKeyConflictContext(net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext) {
+ this.keyConflictContext = keyConflictContext;
+ }
+
+ @Override
+ public net.minecraftforge.client.settings.IKeyConflictContext getKeyConflictContext() {
+ return keyConflictContext;
+ }
+
+ @Override
+ public net.minecraftforge.client.settings.KeyModifier getDefaultKeyModifier() {
+ return keyModifierDefault;
+ }
+
+ @Override
+ public net.minecraftforge.client.settings.KeyModifier getKeyModifier() {
+ return keyModifier;
+ }
+
+ @Override
+ public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode) {
+ this.f_90816_ = keyCode;
+ if (keyModifier.matches(keyCode))
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
+ f_90810_.remove(this);
+ this.keyModifier = keyModifier;
+ f_90810_.put(keyCode, this);
+ }
+ /****************** Forge End *****************************/
}

View file

@ -0,0 +1,71 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -329,7 +_,9 @@
}
}
- if (p_90897_ == 1 && (!(this.f_90867_.f_91080_ instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).f_193976_ <= Util.m_137550_() - 20L)) {
+
+ if ((!(this.f_90867_.f_91080_ instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).f_193976_ <= Util.m_137550_() - 20L)) {
+ if (p_90897_ == 1) {
if (this.f_90867_.f_91066_.f_92105_.m_90832_(p_90895_, p_90896_)) {
this.f_90867_.m_91268_().m_85438_();
this.f_90867_.f_91066_.m_231829_().m_231514_(this.f_90867_.m_91268_().m_85440_());
@@ -347,6 +_,8 @@
});
return;
}
+ } else if (p_90897_ == 0 /*GLFW_RELEASE*/ && this.f_90867_.f_91080_ instanceof KeyBindsScreen)
+ ((KeyBindsScreen)this.f_90867_.f_91080_).f_193975_ = null; //Forge: Unset pure modifiers.
}
if (this.f_90867_.m_240477_().m_93316_()) {
@@ -369,11 +_,15 @@
Screen.m_96579_(() -> {
if (p_90897_ != 1 && p_90897_ != 2) {
if (p_90897_ == 0) {
- aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(screen, p_90895_, p_90896_, p_90898_);
+ if (!aboolean[0]) aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPost(screen, p_90895_, p_90896_, p_90898_);
}
} else {
screen.m_169416_();
- aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPre(screen, p_90895_, p_90896_, p_90898_);
+ if (!aboolean[0]) aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPost(screen, p_90895_, p_90896_, p_90898_);
}
}, "keyPressed event handler", screen.getClass().getCanonicalName());
@@ -424,22 +_,26 @@
}
}
}
-
+ net.minecraftforge.client.ForgeHooksClient.onKeyInput(p_90895_, p_90896_, p_90897_, p_90898_);
}
}
private void m_90889_(long p_90890_, int p_90891_, int p_90892_) {
if (p_90890_ == this.f_90867_.m_91268_().m_85439_()) {
- GuiEventListener guieventlistener = this.f_90867_.f_91080_;
+ Screen guieventlistener = this.f_90867_.f_91080_;
if (guieventlistener != null && this.f_90867_.m_91265_() == null) {
if (Character.charCount(p_90891_) == 1) {
Screen.m_96579_(() -> {
- guieventlistener.m_5534_((char)p_90891_, p_90892_);
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, (char)p_90891_, p_90892_)) return;
+ if (guieventlistener.m_5534_((char)p_90891_, p_90892_)) return;
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, (char)p_90891_, p_90892_);
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
} else {
for(char c0 : Character.toChars(p_90891_)) {
Screen.m_96579_(() -> {
- guieventlistener.m_5534_(c0, p_90892_);
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, c0, p_90892_)) return;
+ if (guieventlistener.m_5534_(c0, p_90892_)) return;
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, c0, p_90892_);
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
}
}

View file

@ -0,0 +1,467 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -249,7 +_,7 @@
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
-public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler {
+public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft {
static Minecraft f_90981_;
private static final Logger f_90982_ = LogUtils.getLogger();
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
@@ -413,7 +_,6 @@
this.f_193584_ = this.m_193585_(this.f_231338_, p_91084_);
this.f_90998_ = p_91084_.f_101905_.f_101942_;
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_());
- f_90982_.debug("(Session ID is {})", (Object)this.f_90998_.m_92544_());
this.f_91033_ = p_91084_.f_101908_.f_101926_;
this.f_91034_ = !p_91084_.f_101908_.f_101929_;
this.f_91035_ = !p_91084_.f_101908_.f_101930_;
@@ -449,15 +_,15 @@
}
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
+ // FORGE: Move mouse and keyboard handler setup further below
this.f_91067_ = new MouseHandler(this);
- this.f_91067_.m_91524_(this.f_90990_.m_85439_());
this.f_91068_ = new KeyboardHandler(this);
- this.f_91068_.m_90887_(this.f_90990_.m_85439_());
RenderSystem.initRenderer(this.f_91066_.f_92035_, false);
this.f_91042_ = new MainTarget(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F);
this.f_91042_.m_83954_(f_91002_);
this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_);
this.f_91038_.m_10506_();
this.f_91066_.m_92145_(this.f_91038_);
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
@@ -504,10 +_,13 @@
this.f_91063_ = new GameRenderer(this, this.f_90994_.m_234586_(), this.f_91036_, this.f_90993_);
this.f_91036_.m_7217_(this.f_91063_.m_247116_());
this.f_91060_ = new LevelRenderer(this, this.f_90994_, this.f_167845_, this.f_90993_);
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
this.f_91036_.m_7217_(this.f_91060_);
- this.m_91271_();
+ // Forge: We delay this to allow registration of modded creative mode tabs
+ // this.createSearchTrees();
this.f_91036_.m_7217_(this.f_90997_);
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.f_91061_);
this.f_91036_.m_7217_(this.f_91061_);
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
this.f_91036_.m_7217_(this.f_91053_);
@@ -516,7 +_,10 @@
this.f_91047_ = new GpuWarnlistManager();
this.f_91036_.m_7217_(this.f_91047_);
this.f_91036_.m_7217_(this.f_205120_);
- this.f_91065_ = new Gui(this, this.f_90995_);
+ this.f_91065_ = new net.minecraftforge.client.gui.overlay.ForgeGui(this);
+ // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them.
+ this.f_91067_.m_91524_(this.f_90990_.m_85439_());
+ this.f_91068_.m_90887_(this.f_90990_.m_85439_());
this.f_91064_ = new DebugRenderer(this);
RealmsClient realmsclient = RealmsClient.m_239151_(this);
this.f_238717_ = new RealmsDataFetcher(realmsclient);
@@ -536,6 +_,7 @@
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
}
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.f_91036_);
this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_());
this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_());
this.f_90990_.m_85426_();
@@ -554,7 +_,7 @@
this.f_167847_.m_168557_(ResourceLoadStateTracker.ReloadReason.INITIAL, list);
ReloadInstance reloadinstance = this.f_91036_.m_142463_(Util.m_183991_(), this, f_90983_, list);
GameLoadTimesEvent.f_285635_.m_285833_(TelemetryProperty.f_285629_);
- this.m_91150_(new LoadingOverlay(this, reloadinstance, (p_210745_) -> {
+ this.m_91150_(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(()->this, () ->reloadinstance, (p_210745_) -> {
Util.m_137521_(p_210745_, this::m_91239_, () -> {
if (SharedConstants.f_136183_) {
this.m_91273_();
@@ -562,20 +_,23 @@
this.f_167847_.m_168556_();
this.m_286052_();
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading())
+ return; // Do not overwrite the error screen if there are errors
+ // FORGE: Move opening initial screen to after startup and events are enabled
+ if (this.m_239929_()) {
+ this.m_91152_(BanNoticeScreen.m_239967_((p_278873_) -> {
+ if (p_278873_) {
+ Util.m_137581_().m_137646_("https://aka.ms/mcjavamoderation");
+ }
+
+ this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
+ }, this.m_239210_()));
+ } else {
+ this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
+ }
});
- }, false));
+ }, false).get());
this.f_278504_ = QuickPlayLog.m_278648_(p_91084_.f_278410_.f_278493_());
- if (this.m_239929_()) {
- this.m_91152_(BanNoticeScreen.m_239967_((p_278873_) -> {
- if (p_278873_) {
- Util.m_137581_().m_137646_("https://aka.ms/mcjavamoderation");
- }
-
- this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
- }, this.m_239210_()));
- } else {
- this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
- }
}
@@ -611,7 +_,7 @@
private String m_91270_() {
StringBuilder stringbuilder = new StringBuilder("Minecraft");
if (m_193589_().m_184597_()) {
- stringbuilder.append("*");
+ stringbuilder.append(' ').append(net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.BRANDING_NAME).append('*');
}
stringbuilder.append(" ");
@@ -635,6 +_,8 @@
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
try {
+ if ("0".equals(p_193587_.f_101905_.f_101942_.m_92547_())) // Forge: We use "0" in dev. Short circuit to stop exception spam.
+ return UserApiService.OFFLINE;
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_());
} catch (AuthenticationException authenticationexception) {
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
@@ -647,7 +_,7 @@
}
private void m_91239_(Throwable p_91240_) {
- if (this.f_91038_.m_10523_().size() > 1) {
+ if (this.f_91038_.m_10524_().stream().anyMatch(e -> !e.m_10449_())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
this.m_91241_(p_91240_, (Component)null);
} else {
Util.m_137559_(p_91240_);
@@ -739,7 +_,10 @@
}
public void m_91271_() {
- this.f_90997_.m_235232_(SearchRegistry.f_119941_, (p_231389_) -> {
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
+ for (var nameSearchKey : nameSearchKeys.values())
+ this.f_90997_.m_235232_(nameSearchKey, (p_231389_) -> {
return new FullTextSearchTree<>((p_210797_) -> {
return p_210797_.m_41651_((Player)null, TooltipFlag.Default.f_256752_.m_257777_()).stream().map((p_210807_) -> {
return ChatFormatting.m_126649_(p_210807_.getString()).trim();
@@ -750,7 +_,8 @@
return Stream.of(BuiltInRegistries.f_257033_.m_7981_(p_91317_.m_41720_()));
}, p_231389_);
});
- this.f_90997_.m_235232_(SearchRegistry.f_119942_, (p_231430_) -> {
+ for (var tagSearchKey : tagSearchKeys.values())
+ this.f_90997_.m_235232_(tagSearchKey, (p_231430_) -> {
return new IdSearchTree<>((p_231353_) -> {
return p_231353_.m_204131_().map(TagKey::f_203868_);
}, p_231430_);
@@ -770,9 +_,12 @@
});
}, p_231451_);
});
- CreativeModeTabs.m_258007_().m_257882_((p_255439_) -> {
- this.m_231374_(SearchRegistry.f_119941_, p_255439_);
- this.m_231374_(SearchRegistry.f_119942_, p_255439_);
+ nameSearchKeys.forEach((tab, nameSearchKey) -> {
+ var tagSearchKey = tagSearchKeys.get(tab);
+ tab.m_257882_(contents -> {
+ this.m_231374_(nameSearchKey, contents);
+ this.m_231374_(tagSearchKey, contents);
+ });
});
}
@@ -824,13 +_,13 @@
Bootstrap.m_135875_(p_91333_.m_127526_());
if (p_91333_.m_127527_() != null) {
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_());
- System.exit(-1);
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-1);
} else if (p_91333_.m_127512_(file2)) {
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
- System.exit(-1);
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-1);
} else {
Bootstrap.m_135875_("#@?@# Game crashed! Crash report could not be saved. #@?@#");
- System.exit(-2);
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-2);
}
}
@@ -954,10 +_,6 @@
f_90982_.error("setScreen called from non-game thread");
}
- if (this.f_91080_ != null) {
- this.f_91080_.m_7861_();
- }
-
if (p_91153_ == null && this.f_91073_ == null) {
p_91153_ = new TitleScreen();
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
@@ -968,6 +_,19 @@
}
}
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
+ Screen old = this.f_91080_;
+ if (p_91153_ != null) {
+ var event = new net.minecraftforge.client.event.ScreenEvent.Opening(old, p_91153_);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
+ p_91153_ = event.getNewScreen();
+ }
+
+ if (old != null && p_91153_ != old) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Closing(old));
+ old.m_7861_();
+ }
+
this.f_91080_ = p_91153_;
if (this.f_91080_ != null) {
this.f_91080_.m_274333_();
@@ -1113,9 +_,12 @@
RenderSystem.enableCull();
this.f_91026_.m_7238_();
if (!this.f_91079_) {
+ this.realPartialTick = this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_; // Cache this since pause is volatile
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick);
this.f_91026_.m_6182_("gameRenderer");
this.f_91063_.m_109093_(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_, i, p_91384_);
this.f_91026_.m_7238_();
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
}
if (this.f_91056_ != null) {
@@ -1240,10 +_,12 @@
this.f_90990_.m_85378_((double)i);
if (this.f_91080_ != null) {
this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
}
RenderTarget rendertarget = this.m_91385_();
rendertarget.m_83941_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_(), f_91002_);
+ if (this.f_91063_ != null)
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
this.f_91067_.m_91599_();
}
@@ -1517,6 +_,7 @@
}
public void m_91395_() {
+ if (this.m_91396_()) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.GameShuttingDownEvent());
this.f_91019_ = false;
}
@@ -1546,10 +_,18 @@
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) {
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
BlockPos blockpos = blockhitresult.m_82425_();
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
+ if (!this.f_91073_.m_46859_(blockpos)) {
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
+ if (inputEvent.isCanceled()) {
+ if (inputEvent.shouldSwingHand()) {
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
+ this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
+ }
+ return;
+ }
Direction direction = blockhitresult.m_82434_();
- if (this.f_91072_.m_105283_(blockpos, direction)) {
- this.f_91061_.m_107367_(blockpos, direction);
+ if (this.f_91072_.m_105283_(blockpos, direction) && inputEvent.shouldSwingHand()) {
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
}
}
@@ -1578,6 +_,8 @@
return false;
} else {
boolean flag = false;
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
+ if (!inputEvent.isCanceled())
switch (this.f_91077_.m_6662_()) {
case ENTITY:
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
@@ -1585,7 +_,7 @@
case BLOCK:
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
BlockPos blockpos = blockhitresult.m_82425_();
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
+ if (!this.f_91073_.m_46859_(blockpos)) {
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
flag = true;
@@ -1598,8 +_,10 @@
}
this.f_91074_.m_36334_();
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
}
+ if (inputEvent.shouldSwingHand())
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
return flag;
}
@@ -1615,6 +_,11 @@
}
for(InteractionHand interactionhand : InteractionHand.values()) {
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.f_91066_.f_92095_, interactionhand);
+ if (inputEvent.isCanceled()) {
+ if (inputEvent.shouldSwingHand()) this.f_91074_.m_6674_(interactionhand);
+ return;
+ }
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
if (!itemstack.m_246617_(this.f_91073_.m_246046_())) {
return;
@@ -1635,7 +_,7 @@
}
if (interactionresult.m_19077_()) {
- if (interactionresult.m_19080_()) {
+ if (interactionresult.m_19080_() && inputEvent.shouldSwingHand()) {
this.f_91074_.m_6674_(interactionhand);
}
@@ -1647,7 +_,7 @@
int i = itemstack.m_41613_();
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult);
if (interactionresult1.m_19077_()) {
- if (interactionresult1.m_19080_()) {
+ if (interactionresult1.m_19080_() && inputEvent.shouldSwingHand()) {
this.f_91074_.m_6674_(interactionhand);
if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) {
this.f_91063_.f_109055_.m_109320_(interactionhand);
@@ -1663,6 +_,9 @@
}
}
+ if (itemstack.m_41619_() && (this.f_91077_ == null || this.f_91077_.m_6662_() == HitResult.Type.MISS))
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.f_91074_, interactionhand);
+
if (!itemstack.m_41619_()) {
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
if (interactionresult2.m_19077_()) {
@@ -1689,6 +_,8 @@
--this.f_91011_;
}
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
+
this.f_91026_.m_6180_("gui");
this.f_240378_.m_240688_();
this.f_91065_.m_193832_(this.f_91012_);
@@ -1780,6 +_,7 @@
this.f_91005_.m_120596_();
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.f_91073_, () -> true);
try {
this.f_91073_.m_104726_(() -> {
return true;
@@ -1795,6 +_,7 @@
throw new ReportedException(crashreport);
}
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.f_91073_, () -> true);
}
this.f_91026_.m_6182_("animateTick");
@@ -1814,6 +_,8 @@
this.f_91026_.m_6182_("keyboard");
this.f_91068_.m_90931_();
this.f_91026_.m_7238_();
+
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
}
private boolean m_91278_() {
@@ -2011,6 +_,7 @@
}
public void m_91156_(ClientLevel p_91157_) {
+ if (this.f_91073_ != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.f_91073_));
ProgressScreen progressscreen = new ProgressScreen(true);
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
this.m_91362_(progressscreen);
@@ -2044,10 +_,12 @@
IntegratedServer integratedserver = this.f_91007_;
this.f_91007_ = null;
this.f_91063_.m_109150_();
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogout(this.f_91072_, this.f_91074_);
this.f_91072_ = null;
this.f_240365_.m_93328_();
this.m_91362_(p_91321_);
if (this.f_91073_ != null) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.f_91073_));
if (integratedserver != null) {
this.f_91026_.m_6180_("waitForServer");
@@ -2061,6 +_,7 @@
this.f_243981_.m_246151_();
this.f_91065_.m_93089_();
this.f_91010_ = false;
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.f_91073_);
}
this.f_91073_ = null;
@@ -2167,6 +_,7 @@
private void m_91280_() {
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
+ if (net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.f_91066_.f_92097_, InteractionHand.MAIN_HAND).isCanceled()) return;
boolean flag = this.f_91074_.m_150110_().f_35937_;
BlockEntity blockentity = null;
HitResult.Type hitresult$type = this.f_91077_.m_6662_();
@@ -2179,10 +_,7 @@
}
Block block = blockstate.m_60734_();
- itemstack = block.m_7397_(this.f_91073_, blockpos, blockstate);
- if (itemstack.m_41619_()) {
- return;
- }
+ itemstack = blockstate.getCloneItemStack(this.f_91077_, this.f_91073_, blockpos, this.f_91074_);
if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
blockentity = this.f_91073_.m_7702_(blockpos);
@@ -2193,7 +_,7 @@
}
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
- itemstack = entity.m_142340_();
+ itemstack = entity.getPickedResult(this.f_91077_);
if (itemstack == null) {
return;
}
@@ -2732,6 +_,19 @@
public void m_91312_(int p_91313_) {
this.f_91051_.m_119410_(p_91313_);
+ }
+
+ public ItemColors getItemColors() {
+ return this.f_91041_;
+ }
+
+ public SearchRegistry getSearchTreeManager() {
+ return this.f_90997_;
+ }
+
+ private float realPartialTick;
+ public float getPartialTick() {
+ return this.realPartialTick;
}
public EntityModelSet m_167973_() {

View file

@ -0,0 +1,96 @@
--- a/net/minecraft/client/MouseHandler.java
+++ b/net/minecraft/client/MouseHandler.java
@@ -73,6 +_,7 @@
this.f_91510_ = -1;
}
+ if (net.minecraftforge.client.ForgeHooksClient.onMouseButtonPre(p_91532_, p_91533_, p_91534_)) return;
boolean[] aboolean = new boolean[]{false};
if (this.f_91503_.m_91265_() == null) {
if (this.f_91503_.f_91080_ == null) {
@@ -86,11 +_,19 @@
if (flag) {
screen.m_169415_();
Screen.m_96579_(() -> {
- aboolean[0] = screen.m_6375_(d0, d1, i);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPre(screen, d0, d1, i);
+ if (!aboolean[0]) {
+ aboolean[0] = this.f_91503_.f_91080_.m_6375_(d0, d1, i);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPost(screen, d0, d1, i, aboolean[0]);
+ }
}, "mouseClicked event handler", screen.getClass().getCanonicalName());
} else {
Screen.m_96579_(() -> {
- aboolean[0] = screen.m_6348_(d0, d1, i);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPre(screen, d0, d1, i);
+ if (!aboolean[0]) {
+ aboolean[0] = this.f_91503_.f_91080_.m_6348_(d0, d1, i);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPost(screen, d0, d1, i, aboolean[0]);
+ }
}, "mouseReleased event handler", screen.getClass().getCanonicalName());
}
}
@@ -114,19 +_,26 @@
}
}
}
-
+ net.minecraftforge.client.ForgeHooksClient.onMouseButtonPost(p_91532_, p_91533_, p_91534_);
}
}
private void m_91526_(long p_91527_, double p_91528_, double p_91529_) {
if (p_91527_ == Minecraft.m_91087_().m_91268_().m_85439_()) {
- double d0 = (this.f_91503_.f_91066_.m_231821_().m_231551_() ? Math.signum(p_91529_) : p_91529_) * this.f_91503_.f_91066_.m_232122_().m_231551_();
+ // FORGE: Allows for Horizontal Scroll to be recognized as Vertical Scroll - Fixes MC-121772
+ double offset = p_91529_;
+ if (Minecraft.f_91002_ && p_91529_ == 0) {
+ offset = p_91528_;
+ }
+ double d0 = (this.f_91503_.f_91066_.m_231821_().m_231551_() ? Math.signum(offset) : offset) * this.f_91503_.f_91066_.m_232122_().m_231551_();
if (this.f_91503_.m_91265_() == null) {
if (this.f_91503_.f_91080_ != null) {
double d1 = this.f_91507_ * (double)this.f_91503_.m_91268_().m_85445_() / (double)this.f_91503_.m_91268_().m_85443_();
double d2 = this.f_91508_ * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_();
- this.f_91503_.f_91080_.m_6050_(d1, d2, d0);
this.f_91503_.f_91080_.m_169415_();
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseScrollPre(this, this.f_91503_.f_91080_, d0)) return;
+ if (this.f_91503_.f_91080_.m_6050_(d1, d2, d0)) return;
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseScrollPost(this, this.f_91503_.f_91080_, d0);
} else if (this.f_91503_.f_91074_ != null) {
if (this.f_91518_ != 0.0D && Math.signum(d0) != Math.signum(this.f_91518_)) {
this.f_91518_ = 0.0D;
@@ -139,6 +_,7 @@
}
this.f_91518_ -= (double)i;
+ if (net.minecraftforge.client.ForgeHooksClient.onMouseScroll(this, d0)) return;
if (this.f_91503_.f_91074_.m_5833_()) {
if (this.f_91503_.f_91065_.m_93085_().m_94768_()) {
this.f_91503_.f_91065_.m_93085_().m_205380_(-i);
@@ -207,7 +_,9 @@
double d2 = (p_91563_ - this.f_91507_) * (double)this.f_91503_.m_91268_().m_85445_() / (double)this.f_91503_.m_91268_().m_85443_();
double d3 = (p_91564_ - this.f_91508_) * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_();
Screen.m_96579_(() -> {
- screen.m_7979_(d0, d1, this.f_91510_, d2, d3);
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPre(screen, d0, d1, this.f_91510_, d2, d3)) return;
+ if (screen.m_7979_(d0, d1, this.f_91510_, d2, d3)) return;
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPost(screen, d0, d1, this.f_91510_, d2, d3);
}, "mouseDragged event handler", screen.getClass().getCanonicalName());
}
@@ -290,6 +_,14 @@
public double m_91594_() {
return this.f_91508_;
+ }
+
+ public double getXVelocity() {
+ return this.f_91516_;
+ }
+
+ public double getYVelocity() {
+ return this.f_91517_;
}
public void m_91599_() {

View file

@ -0,0 +1,96 @@
--- a/net/minecraft/client/Options.java
+++ b/net/minecraft/client/Options.java
@@ -545,7 +_,8 @@
}, new OptionInstance.LazyEnum<>(() -> {
return Stream.concat(Stream.of(""), Minecraft.m_91087_().m_91106_().m_194525_().stream()).toList();
}, (p_232011_) -> {
- return Minecraft.m_91087_().m_91396_() && p_232011_ != "" && !Minecraft.m_91087_().m_91106_().m_194525_().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
+ // FORGE: fix incorrect string comparison - PR #8767
+ return Minecraft.m_91087_().m_91396_() && (p_232011_ == null || !p_232011_.isEmpty()) && !Minecraft.m_91087_().m_91106_().m_194525_().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
}, Codec.STRING), "", (p_275584_) -> {
SoundManager soundmanager = Minecraft.m_91087_().m_91106_();
soundmanager.m_194526_();
@@ -869,6 +_,7 @@
}
public Options(Minecraft p_92138_, File p_92139_) {
+ setForgeKeybindProperties();
this.f_92060_ = p_92138_;
this.f_92110_ = new File(p_92139_, "options.txt");
boolean flag = p_92138_.m_91103_();
@@ -990,11 +_,21 @@
p_168428_.m_213982_("telemetryOptInExtra", this.f_260461_);
this.f_263744_ = p_168428_.m_142682_("onboardAccessibility", this.f_263744_);
+ net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.processOptions(p_168428_);
+ processOptionsForge(p_168428_);
+ }
+ // FORGE: split off to allow reloading options after mod loading is done
+ private void processOptionsForge(Options.FieldAccess p_168428_)
+ {
for(KeyMapping keymapping : this.f_92059_) {
- String s = keymapping.m_90865_();
+ String s = keymapping.m_90865_() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
String s1 = p_168428_.m_141943_("key_" + keymapping.m_90860_(), s);
if (!s.equals(s1)) {
- keymapping.m_90848_(InputConstants.m_84851_(s1));
+ if (s1.indexOf(':') != -1) {
+ String[] pts = s1.split(":");
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.m_84851_(pts[0]));
+ } else
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.m_84851_(s1));
}
}
@@ -1013,6 +_,9 @@
}
public void m_92140_() {
+ this.load(false);
+ }
+ public void load(boolean limited) {
try {
if (!this.f_92110_.exists()) {
return;
@@ -1041,7 +_,8 @@
}
}
- this.m_168427_(new Options.FieldAccess() {
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsForge : this::m_168427_;
+ processor.accept(new Options.FieldAccess() {
@Nullable
private String m_168458_(String p_168459_) {
return compoundtag1.m_128441_(p_168459_) ? compoundtag1.m_128461_(p_168459_) : null;
@@ -1204,6 +_,7 @@
}
public void m_92172_() {
+ if (net.minecraftforge.client.loading.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
if (this.f_92060_.f_91074_ != null) {
int i = 0;
@@ -1268,6 +_,23 @@
}
p_92146_.m_10509_(set);
+ }
+
+ private void setForgeKeybindProperties() {
+ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME;
+ f_92085_.setKeyConflictContext(inGame);
+ f_92086_.setKeyConflictContext(inGame);
+ f_92087_.setKeyConflictContext(inGame);
+ f_92088_.setKeyConflictContext(inGame);
+ f_92089_.setKeyConflictContext(inGame);
+ f_92090_.setKeyConflictContext(inGame);
+ f_92091_.setKeyConflictContext(inGame);
+ f_92096_.setKeyConflictContext(inGame);
+ f_92098_.setKeyConflictContext(inGame);
+ f_92099_.setKeyConflictContext(inGame);
+ f_92100_.setKeyConflictContext(inGame);
+ f_92103_.setKeyConflictContext(inGame);
+ f_92104_.setKeyConflictContext(inGame);
}
public CameraType m_92176_() {

View file

@ -0,0 +1,39 @@
--- a/net/minecraft/client/RecipeBookCategories.java
+++ b/net/minecraft/client/RecipeBookCategories.java
@@ -12,7 +_,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
-public enum RecipeBookCategories {
+public enum RecipeBookCategories implements net.minecraftforge.common.IExtensibleEnum {
CRAFTING_SEARCH(new ItemStack(Items.f_42522_)),
CRAFTING_BUILDING_BLOCKS(new ItemStack(Blocks.f_50076_)),
CRAFTING_REDSTONE(new ItemStack(Items.f_42451_)),
@@ -36,7 +_,7 @@
public static final List<RecipeBookCategories> f_92257_ = ImmutableList.of(BLAST_FURNACE_SEARCH, BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC);
public static final List<RecipeBookCategories> f_92258_ = ImmutableList.of(FURNACE_SEARCH, FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC);
public static final List<RecipeBookCategories> f_92259_ = ImmutableList.of(CRAFTING_SEARCH, CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE);
- public static final Map<RecipeBookCategories, List<RecipeBookCategories>> f_92260_ = ImmutableMap.of(CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD));
+ public static final Map<RecipeBookCategories, List<RecipeBookCategories>> f_92260_ = net.minecraftforge.client.RecipeBookManager.getAggregateCategories();
private final List<ItemStack> f_92261_;
private RecipeBookCategories(ItemStack... p_92267_) {
@@ -59,7 +_,7 @@
list = f_92256_;
break;
default:
- throw new IncompatibleClassChangeError();
+ return net.minecraftforge.client.RecipeBookManager.getCustomCategoriesOrEmpty(p_92270_);
}
return list;
@@ -67,5 +_,9 @@
public List<ItemStack> m_92268_() {
return this.f_92261_;
+ }
+
+ public static RecipeBookCategories create(String name, ItemStack... icons) {
+ throw new IllegalStateException("Enum not extended");
}
}

View file

@ -0,0 +1,29 @@
--- a/net/minecraft/client/Screenshot.java
+++ b/net/minecraft/client/Screenshot.java
@@ -56,13 +_,23 @@
file2 = new File(file1, p_92307_);
}
+ net.minecraftforge.client.event.ScreenshotEvent event = net.minecraftforge.client.ForgeHooksClient.onScreenshot(nativeimage, file2);
+ if (event.isCanceled()) {
+ p_92311_.accept(event.getCancelMessage());
+ return;
+ }
+ final File target = event.getScreenshotFile();
+
Util.m_183992_().execute(() -> {
try {
- nativeimage.m_85056_(file2);
+ nativeimage.m_85056_(target);
Component component = Component.m_237113_(file2.getName()).m_130940_(ChatFormatting.UNDERLINE).m_130938_((p_168608_) -> {
- return p_168608_.m_131142_(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
+ return p_168608_.m_131142_(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath()));
});
- p_92311_.accept(Component.m_237110_("screenshot.success", component));
+ if (event.getResultMessage() != null)
+ p_92311_.accept(event.getResultMessage());
+ else
+ p_92311_.accept(Component.m_237110_("screenshot.success", component));
} catch (Exception exception) {
f_92276_.warn("Couldn't save screenshot", (Throwable)exception);
p_92311_.accept(Component.m_237110_("screenshot.failure", exception.getMessage()));

View file

@ -0,0 +1,19 @@
--- a/net/minecraft/client/ToggleKeyMapping.java
+++ b/net/minecraft/client/ToggleKeyMapping.java
@@ -16,7 +_,7 @@
public void m_7249_(boolean p_92534_) {
if (this.f_92527_.getAsBoolean()) {
- if (p_92534_) {
+ if (p_92534_ && isConflictContextAndModifierActive()) {
super.m_7249_(!this.m_90857_());
}
} else {
@@ -24,6 +_,7 @@
}
}
+ @Override public boolean m_90857_() { return this.f_90817_ && (isConflictContextAndModifierActive() || f_92527_.getAsBoolean()); }
protected void m_289748_() {
super.m_7249_(false);

View file

@ -0,0 +1,49 @@
--- a/net/minecraft/client/User.java
+++ b/net/minecraft/client/User.java
@@ -21,8 +_,22 @@
private final Optional<String> f_193796_;
private final Optional<String> f_193797_;
private final User.Type f_92538_;
+ /** Forge: Cache of the local session's GameProfile properties. */
+ private com.mojang.authlib.properties.PropertyMap properties;
public User(String p_193799_, String p_193800_, String p_193801_, Optional<String> p_193802_, Optional<String> p_193803_, User.Type p_193804_) {
+ if (p_193799_ == null || p_193799_.isEmpty()) {
+ p_193799_ = "MissingName";
+ p_193800_ = p_193801_ = "NotValid";
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(getClass().getName());
+ logger.warn("=========================================================");
+ logger.warn("WARNING!! the username was not set for this session, typically");
+ logger.warn("this means you installed Forge incorrectly. We have set your");
+ logger.warn("name to \"MissingName\" and your session to nothing. Please");
+ logger.warn("check your installation and post a console log from the launcher");
+ logger.warn("when asking for help!");
+ logger.warn("=========================================================");
+ }
this.f_92535_ = p_193799_;
this.f_92536_ = p_193800_;
this.f_92537_ = p_193801_;
@@ -64,8 +_,22 @@
}
}
+ //For internal use only. Modders should never need to use this.
+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) {
+ if (this.properties == null)
+ this.properties = properties;
+ }
+
+ public boolean hasCachedProperties() {
+ return properties != null;
+ }
+
public GameProfile m_92548_() {
- return new GameProfile(this.m_240411_(), this.m_92546_());
+ // FORGE: Add cached GameProfile properties to returned GameProfile. This helps to cut down on calls to the session service.
+ GameProfile ret = new GameProfile(this.m_240411_(), this.m_92546_());
+ if (this.properties != null)
+ ret.getProperties().putAll(this.properties);
+ return ret;
}
public User.Type m_168638_() {

View file

@ -0,0 +1,44 @@
--- a/net/minecraft/client/color/block/BlockColors.java
+++ b/net/minecraft/client/color/block/BlockColors.java
@@ -28,7 +_,8 @@
@OnlyIn(Dist.CLIENT)
public class BlockColors {
private static final int f_168640_ = -1;
- private final IdMapper<BlockColor> f_92571_ = new IdMapper<>(32);
+ // FORGE: Use registry delegate as non-Vanilla block ids are not constant
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Block>, BlockColor> f_92571_ = new java.util.HashMap<>();
private final Map<Block, Set<Property<?>>> f_92572_ = Maps.newHashMap();
public static BlockColors m_92574_() {
@@ -80,11 +_,12 @@
blockcolors.m_92589_((p_92596_, p_92597_, p_92598_, p_92599_) -> {
return p_92597_ != null && p_92598_ != null ? 2129968 : 7455580;
}, Blocks.f_50196_);
+ net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors);
return blockcolors;
}
public int m_92582_(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) {
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92583_.m_60734_()));
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.m_60734_()));
if (blockcolor != null) {
return blockcolor.m_92566_(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
} else {
@@ -94,13 +_,15 @@
}
public int m_92577_(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92578_.m_60734_()));
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.m_60734_()));
return blockcolor == null ? -1 : blockcolor.m_92566_(p_92578_, p_92579_, p_92580_, p_92581_);
}
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Block} */
+ @Deprecated
public void m_92589_(BlockColor p_92590_, Block... p_92591_) {
for(Block block : p_92591_) {
- this.f_92571_.m_122664_(p_92590_, BuiltInRegistries.f_256975_.m_7447_(block));
+ this.f_92571_.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_);
}
}

View file

@ -0,0 +1,8 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/color/block/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/color/block/</h1><hr><pre><a href="../">../</a>
<a href="BlockColors.java.patch">BlockColors.java.patch</a> 07-Oct-2023 14:12 2388
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="e057d2b1269df64940dda48b9c783574" data-cf-beacon='{"rayId":"85f019dc6d6850c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,9 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/color/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/color/</h1><hr><pre><a href="../">../</a>
<a href="block/">block/</a> 07-Oct-2023 14:12 -
<a href="item/">item/</a> 07-Oct-2023 14:12 -
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="19c9222a69f2e0fb44d371de832793d4" data-cf-beacon='{"rayId":"85f017032c8e50c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,35 @@
--- a/net/minecraft/client/color/item/ItemColors.java
+++ b/net/minecraft/client/color/item/ItemColors.java
@@ -25,7 +_,8 @@
@OnlyIn(Dist.CLIENT)
public class ItemColors {
private static final int f_168642_ = -1;
- private final IdMapper<ItemColor> f_92674_ = new IdMapper<>(32);
+ // FORGE: Use registry delegate as non-Vanilla item ids are not constant
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Item>, ItemColor> f_92674_ = new java.util.HashMap<>();
public static ItemColors m_92683_(BlockColors p_92684_) {
ItemColors itemcolors = new ItemColors();
@@ -88,17 +_,20 @@
itemcolors.m_92689_((p_232352_, p_232353_) -> {
return p_232353_ == 0 ? -1 : MapItem.m_42918_(p_232352_);
}, Items.f_42573_);
+ net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_92684_);
return itemcolors;
}
public int m_92676_(ItemStack p_92677_, int p_92678_) {
- ItemColor itemcolor = this.f_92674_.m_7942_(BuiltInRegistries.f_257033_.m_7447_(p_92677_.m_41720_()));
+ ItemColor itemcolor = this.f_92674_.get(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_92677_.m_41720_()));
return itemcolor == null ? -1 : itemcolor.m_92671_(p_92677_, p_92678_);
}
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Item} */
+ @Deprecated
public void m_92689_(ItemColor p_92690_, ItemLike... p_92691_) {
for(ItemLike itemlike : p_92691_) {
- this.f_92674_.m_122664_(p_92690_, Item.m_41393_(itemlike.m_5456_()));
+ this.f_92674_.put(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(itemlike.m_5456_()), p_92690_);
}
}

View file

@ -0,0 +1,8 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/color/item/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/color/item/</h1><hr><pre><a href="../">../</a>
<a href="ItemColors.java.patch">ItemColors.java.patch</a> 07-Oct-2023 14:12 1757
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="556059d552d531dc27510e954927e2ed" data-cf-beacon='{"rayId":"85f019dec9f050c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,20 @@
--- a/net/minecraft/client/gui/Font.java
+++ b/net/minecraft/client/gui/Font.java
@@ -31,7 +_,7 @@
import org.joml.Vector3f;
@OnlyIn(Dist.CLIENT)
-public class Font {
+public class Font implements net.minecraftforge.client.extensions.IForgeFont {
private static final float f_168643_ = 0.01F;
private static final Vector3f f_92712_ = new Vector3f(0.0F, 0.0F, 0.03F);
public static final int f_193827_ = 8;
@@ -202,6 +_,8 @@
public StringSplitter m_92865_() {
return this.f_92714_;
}
+
+ @Override public Font self() { return this; }
@OnlyIn(Dist.CLIENT)
public static enum DisplayMode {

View file

@ -0,0 +1,68 @@
--- a/net/minecraft/client/gui/Gui.java
+++ b/net/minecraft/client/gui/Gui.java
@@ -424,6 +_,8 @@
for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
MobEffect mobeffect = mobeffectinstance.m_19544_();
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (!renderer.isVisibleInGui(mobeffectinstance)) continue;
if (mobeffectinstance.m_19575_()) {
int i = this.f_92977_;
int j = 1;
@@ -452,6 +_,7 @@
}
}
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, i, j, 0, f)) continue;
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
int i1 = j;
float f1 = f;
@@ -572,16 +_,21 @@
}
public void m_280295_(GuiGraphics p_283501_) {
+ renderSelectedItemName(p_283501_, 0);
+ }
+
+ public void renderSelectedItemName(GuiGraphics p_283501_, int yShift) {
this.f_92986_.m_91307_().m_6180_("selectedItemName");
if (this.f_92993_ > 0 && !this.f_92994_.m_41619_()) {
- MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.f_92994_.m_41786_()).m_130940_(this.f_92994_.m_41791_().f_43022_);
+ MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.f_92994_.m_41786_()).m_130938_(this.f_92994_.m_41791_().getStyleModifier());
if (this.f_92994_.m_41788_()) {
mutablecomponent.m_130940_(ChatFormatting.ITALIC);
}
- int i = this.m_93082_().m_92852_(mutablecomponent);
+ Component highlightTip = this.f_92994_.getHighlightTip(mutablecomponent);
+ int i = this.m_93082_().m_92852_(highlightTip);
int j = (this.f_92977_ - i) / 2;
- int k = this.f_92978_ - 59;
+ int k = this.f_92978_ - Math.max(yShift, 59);
if (!this.f_92986_.f_91072_.m_105205_()) {
k += 14;
}
@@ -593,7 +_,13 @@
if (l > 0) {
p_283501_.m_280509_(j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0));
- p_283501_.m_280430_(this.m_93082_(), mutablecomponent, j, k, 16777215 + (l << 24));
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(f_92994_).getFont(f_92994_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
+ if (font == null) {
+ p_283501_.m_280430_(this.m_93082_(), highlightTip, j, k, 16777215 + (l << 24));
+ } else {
+ j = (this.f_92977_ - font.m_92852_(highlightTip)) / 2;
+ p_283501_.m_280430_(font, highlightTip, j, k, 16777215 + (l << 24));
+ }
}
}
@@ -1037,7 +_,7 @@
ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_();
if (itemstack.m_41619_()) {
this.f_92993_ = 0;
- } else if (!this.f_92994_.m_41619_() && itemstack.m_150930_(this.f_92994_.m_41720_()) && itemstack.m_41786_().equals(this.f_92994_.m_41786_())) {
+ } else if (!this.f_92994_.m_41619_() && itemstack.m_41720_() == this.f_92994_.m_41720_() && (itemstack.m_41786_().equals(this.f_92994_.m_41786_()) && itemstack.getHighlightTip(itemstack.m_41786_()).equals(f_92994_.getHighlightTip(f_92994_.m_41786_())))) {
if (this.f_92993_ > 0) {
--this.f_92993_;
}

View file

@ -0,0 +1,160 @@
--- a/net/minecraft/client/gui/GuiGraphics.java
+++ b/net/minecraft/client/gui/GuiGraphics.java
@@ -56,7 +_,7 @@
import org.joml.Vector2ic;
@OnlyIn(Dist.CLIENT)
-public class GuiGraphics {
+public class GuiGraphics implements net.minecraftforge.client.extensions.IForgeGuiGraphics {
public static final float f_289044_ = 10000.0F;
public static final float f_289038_ = -10000.0F;
private static final int f_279564_ = 2;
@@ -270,6 +_,11 @@
}
public int m_280056_(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) {
+ return this.drawString(p_283343_, p_281896_, (float)p_283569_, (float)p_283418_, p_281560_, p_282130_);
+ }
+
+ // Forge: Add float variant for x,y coordinates
+ public int drawString(Font p_283343_, @Nullable String p_281896_, float p_283569_, float p_283418_, int p_281560_, boolean p_282130_) {
if (p_281896_ == null) {
return 0;
} else {
@@ -284,6 +_,11 @@
}
public int m_280649_(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) {
+ return this.drawString(p_282636_, p_281596_, (float)p_281586_, (float)p_282816_, p_281743_, p_282394_);
+ }
+
+ // Forge: Add float variant for x,y coordinates
+ public int drawString(Font p_282636_, FormattedCharSequence p_281596_, float p_281586_, float p_282816_, int p_281743_, boolean p_282394_) {
int i = p_282636_.m_272191_(p_281596_, (float)p_281586_, (float)p_282816_, p_281743_, p_282394_, this.f_279612_.m_85850_().m_252922_(), this.f_279627_, Font.DisplayMode.NORMAL, 0, 15728880);
this.m_286081_();
return i;
@@ -405,6 +_,10 @@
}
public void m_280543_(ResourceLocation p_283059_, int p_283575_, int p_283192_, int p_281790_, int p_283642_, int p_282691_, int p_281912_, int p_281728_, int p_282324_) {
+ blitRepeating(p_283059_, p_283575_, p_283192_, p_281790_, p_283642_, p_282691_, p_281912_, p_281728_, p_282324_, 256, 256);
+ }
+
+ public void blitRepeating(ResourceLocation p_283059_, int p_283575_, int p_283192_, int p_281790_, int p_283642_, int p_282691_, int p_281912_, int p_281728_, int p_282324_, int textureWidth, int textureHeight) {
int i = p_283575_;
int j;
@@ -417,7 +_,7 @@
for(IntIterator intiterator1 = m_280358_(p_283642_, p_282324_); intiterator1.hasNext(); l += i1) {
i1 = intiterator1.nextInt();
int j1 = (p_282324_ - i1) / 2;
- this.m_280218_(p_283059_, i, l, p_282691_ + k, p_281912_ + j1, j, i1);
+ this.m_280163_(p_283059_, i, l, p_282691_ + k, p_281912_ + j1, j, i1, textureWidth, textureHeight);
}
}
@@ -477,6 +_,7 @@
crashreportcategory.m_128165_("Item Type", () -> {
return String.valueOf((Object)p_281675_.m_41720_());
});
+ crashreportcategory.m_128165_("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_281675_.m_41720_())));
crashreportcategory.m_128165_("Item Damage", () -> {
return String.valueOf(p_281675_.m_41773_());
});
@@ -524,18 +_,26 @@
}
this.f_279612_.m_85849_();
+ net.minecraftforge.client.ItemDecoratorHandler.of(p_283349_).render(this, p_282005_, p_283349_, p_282641_, p_282146_);
}
}
+
+ private ItemStack tooltipStack = ItemStack.f_41583_;
public void m_280153_(Font p_282308_, ItemStack p_282781_, int p_282687_, int p_282292_) {
+ this.tooltipStack = p_282781_;
this.m_280677_(p_282308_, Screen.m_280152_(this.f_279544_, p_282781_), p_282781_.m_150921_(), p_282687_, p_282292_);
+ this.tooltipStack = ItemStack.f_41583_;
+ }
+
+ public void renderTooltip(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY) {
+ this.tooltipStack = stack;
+ this.m_280677_(font, textComponents, tooltipComponent, mouseX, mouseY);
+ this.tooltipStack = ItemStack.f_41583_;
}
public void m_280677_(Font p_283128_, List<Component> p_282716_, Optional<TooltipComponent> p_281682_, int p_283678_, int p_281696_) {
- List<ClientTooltipComponent> list = p_282716_.stream().map(Component::m_7532_).map(ClientTooltipComponent::m_169948_).collect(Collectors.toList());
- p_281682_.ifPresent((p_282969_) -> {
- list.add(1, ClientTooltipComponent.m_169950_(p_282969_));
- });
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_282716_, p_281682_, p_283678_, m_280182_(), m_280206_(), p_283128_);
this.m_280497_(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.f_262752_);
}
@@ -544,7 +_,15 @@
}
public void m_280666_(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
- this.m_280245_(p_282739_, Lists.transform(p_281832_, Component::m_7532_), p_282191_, p_282446_);
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_281832_, p_282191_, m_280182_(), m_280206_(), p_282739_);
+ this.m_280497_(p_282739_, components, p_282191_, p_282446_, DefaultTooltipPositioner.f_262752_);
+ }
+
+ public void renderComponentTooltip(Font font, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
+ this.tooltipStack = stack;
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, m_280182_(), m_280206_(), font);
+ this.m_280497_(font, components, mouseX, mouseY, DefaultTooltipPositioner.f_262752_);
+ this.tooltipStack = ItemStack.f_41583_;
}
public void m_280245_(Font p_282192_, List<? extends FormattedCharSequence> p_282297_, int p_281680_, int p_283325_) {
@@ -557,11 +_,13 @@
private void m_280497_(Font p_282675_, List<ClientTooltipComponent> p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) {
if (!p_282615_.isEmpty()) {
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, this, p_283230_, p_283417_, m_280182_(), m_280206_(), p_282615_, p_282675_, p_282442_);
+ if (preEvent.isCanceled()) return;
int i = 0;
int j = p_282615_.size() == 1 ? -2 : 0;
for(ClientTooltipComponent clienttooltipcomponent : p_282615_) {
- int k = clienttooltipcomponent.m_142069_(p_282675_);
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFont());
if (k > i) {
i = k;
}
@@ -571,20 +_,21 @@
int i2 = i;
int j2 = j;
- Vector2ic vector2ic = p_282442_.m_262814_(this.m_280182_(), this.m_280206_(), p_283230_, p_283417_, i2, j2);
+ Vector2ic vector2ic = p_282442_.m_262814_(this.m_280182_(), this.m_280206_(), preEvent.getX(), preEvent.getY(), i2, j2);
int l = vector2ic.x();
int i1 = vector2ic.y();
this.f_279612_.m_85836_();
int j1 = 400;
this.m_286007_(() -> {
- TooltipRenderUtil.m_280205_(this, l, i1, i2, j2, 400);
+ net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, this, l, i1, preEvent.getFont(), p_282615_);
+ TooltipRenderUtil.renderTooltipBackground(this, l, i1, i2, j2, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd(), colorEvent.getBorderStart(), colorEvent.getBorderEnd());
});
this.f_279612_.m_252880_(0.0F, 0.0F, 400.0F);
int k1 = i1;
for(int l1 = 0; l1 < p_282615_.size(); ++l1) {
ClientTooltipComponent clienttooltipcomponent1 = p_282615_.get(l1);
- clienttooltipcomponent1.m_142440_(p_282675_, l, k1, this.f_279612_.m_85850_().m_252922_(), this.f_279627_);
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), l, k1, this.f_279612_.m_85850_().m_252922_(), this.f_279627_);
k1 += clienttooltipcomponent1.m_142103_() + (l1 == 0 ? 2 : 0);
}
@@ -592,7 +_,7 @@
for(int k2 = 0; k2 < p_282615_.size(); ++k2) {
ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2);
- clienttooltipcomponent2.m_183452_(p_282675_, l, k1, this);
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), l, k1, this);
k1 += clienttooltipcomponent2.m_142103_() + (k2 == 0 ? 2 : 0);
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/MapRenderer.java
+++ b/net/minecraft/client/gui/MapRenderer.java
@@ -118,6 +_,7 @@
for(MapDecoration mapdecoration : this.f_93280_.m_164811_()) {
if (!p_93294_ || mapdecoration.m_77809_()) {
+ if (mapdecoration.render(k)) { k++; continue; }
p_93292_.m_85836_();
p_93292_.m_252880_(0.0F + (float)mapdecoration.m_77804_() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.m_77805_() / 2.0F + 64.0F, -0.02F);
p_93292_.m_252781_(Axis.f_252403_.m_252977_((float)(mapdecoration.m_77806_() * 360) / 16.0F));

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/components/AbstractButton.java
+++ b/net/minecraft/client/gui/components/AbstractButton.java
@@ -32,7 +_,7 @@
RenderSystem.enableDepthTest();
p_281670_.m_280027_(f_93617_, this.m_252754_(), this.m_252907_(), this.m_5711_(), this.m_93694_(), 20, 4, 200, 20, 0, this.m_274533_());
p_281670_.m_280246_(1.0F, 1.0F, 1.0F, 1.0F);
- int i = this.f_93623_ ? 16777215 : 10526880;
+ int i = getFGColor();
this.m_280139_(p_281670_, minecraft.f_91062_, i | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
}

View file

@ -0,0 +1,16 @@
--- a/net/minecraft/client/gui/components/AbstractSelectionList.java
+++ b/net/minecraft/client/gui/components/AbstractSelectionList.java
@@ -514,6 +_,13 @@
return new ScreenRectangle(this.f_93393_, this.f_93390_, this.f_93392_ - this.f_93393_, this.f_93391_ - this.f_93390_);
}
+ public int getWidth() { return this.f_93388_; }
+ public int getHeight() { return this.f_93389_; }
+ public int getTop() { return this.f_93390_; }
+ public int getBottom() { return this.f_93391_; }
+ public int getLeft() { return this.f_93393_; }
+ public int getRight() { return this.f_93392_; }
+
@OnlyIn(Dist.CLIENT)
protected abstract static class Entry<E extends AbstractSelectionList.Entry<E>> implements GuiEventListener {
/** @deprecated */

View file

@ -0,0 +1,33 @@
--- a/net/minecraft/client/gui/components/AbstractWidget.java
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
@@ -234,6 +_,10 @@
this.f_93618_ = p_93675_;
}
+ public void setHeight(int value) {
+ this.f_93619_ = value;
+ }
+
public void m_93650_(float p_93651_) {
this.f_93625_ = p_93651_;
}
@@ -264,6 +_,19 @@
public void m_93692_(boolean p_93693_) {
this.f_93616_ = p_93693_;
+ }
+
+ public static final int UNSET_FG_COLOR = -1;
+ protected int packedFGColor = UNSET_FG_COLOR;
+ public int getFGColor() {
+ if (packedFGColor != UNSET_FG_COLOR) return packedFGColor;
+ return this.f_93623_ ? 16777215 : 10526880; // White : Light Grey
+ }
+ public void setFGColor(int color) {
+ this.packedFGColor = color;
+ }
+ public void clearFGColor() {
+ this.packedFGColor = UNSET_FG_COLOR;
}
public NarratableEntry.NarrationPriority m_142684_() {

View file

@ -0,0 +1,20 @@
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
@@ -33,13 +_,16 @@
for(LerpingBossEvent lerpingbossevent : this.f_93699_.values()) {
int k = i / 2 - 91;
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_283175_, this.f_93698_.m_91268_(), lerpingbossevent, k, j, 10 + this.f_93698_.f_91062_.f_92710_);
+ if (!event.isCanceled()) {
this.m_280106_(p_283175_, k, j, lerpingbossevent);
Component component = lerpingbossevent.m_18861_();
int l = this.f_93698_.f_91062_.m_92852_(component);
int i1 = i / 2 - l / 2;
int j1 = j - 9;
p_283175_.m_280430_(this.f_93698_.f_91062_, component, i1, j1, 16777215);
- j += 10 + 9;
+ }
+ j += event.getIncrement();
if (j >= p_283175_.m_280206_() / 3) {
break;
}

View file

@ -0,0 +1,29 @@
--- a/net/minecraft/client/gui/components/Button.java
+++ b/net/minecraft/client/gui/components/Button.java
@@ -29,6 +_,11 @@
this.f_252416_ = p_259552_;
}
+ protected Button(Builder builder) {
+ this(builder.f_252538_, builder.f_252462_, builder.f_252510_, builder.f_252447_, builder.f_252401_, builder.f_252468_, builder.f_252431_);
+ m_257544_(builder.f_256855_); // Forge: Make use of the Builder tooltip
+ }
+
public void m_5691_() {
this.f_93717_.m_93750_(this);
}
@@ -92,9 +_,11 @@
}
public Button m_253136_() {
- Button button = new Button(this.f_252538_, this.f_252462_, this.f_252510_, this.f_252447_, this.f_252401_, this.f_252468_, this.f_252431_);
- button.m_257544_(this.f_256855_);
- return button;
+ return build(Button::new);
+ }
+
+ public Button build(java.util.function.Function<Builder, Button> builder) {
+ return builder.apply(this);
}
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/components/DebugScreenOverlay.java
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
@@ -403,6 +_,7 @@
list.add("");
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
list.add(String.valueOf((Object)BuiltInRegistries.f_256780_.m_7981_(entity.m_6095_())));
+ entity.m_6095_().m_204041_().m_203616_().forEach(t -> list.add("#" + t.f_203868_()));
}
return list;

View file

@ -0,0 +1,14 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/components/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/components/</h1><hr><pre><a href="../">../</a>
<a href="toasts/">toasts/</a> 07-Oct-2023 14:12 -
<a href="AbstractButton.java.patch">AbstractButton.java.patch</a> 07-Oct-2023 14:12 567
<a href="AbstractSelectionList.java.patch">AbstractSelectionList.java.patch</a> 07-Oct-2023 14:12 770
<a href="AbstractWidget.java.patch">AbstractWidget.java.patch</a> 07-Oct-2023 14:12 949
<a href="BossHealthOverlay.java.patch">BossHealthOverlay.java.patch</a> 07-Oct-2023 14:12 1013
<a href="Button.java.patch">Button.java.patch</a> 07-Oct-2023 14:12 982
<a href="DebugScreenOverlay.java.patch">DebugScreenOverlay.java.patch</a> 07-Oct-2023 14:12 484
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="62b15bbba87bd05e3bb57034ac264a58" data-cf-beacon='{"rayId":"85f019e15fa950c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/components/toasts/ToastComponent.java
+++ b/net/minecraft/client/gui/components/toasts/ToastComponent.java
@@ -101,6 +_,7 @@
}
public void m_94922_(Toast p_94923_) {
+ if (net.minecraftforge.client.ForgeHooksClient.onToastAdd(p_94923_)) return;
this.f_94916_.add(p_94923_);
}

View file

@ -0,0 +1,8 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/components/toasts/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/components/toasts/</h1><hr><pre><a href="../">../</a>
<a href="ToastComponent.java.patch">ToastComponent.java.patch</a> 07-Oct-2023 14:12 335
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="f96695581150d5829807f728f92e0428" data-cf-beacon='{"rayId":"85f0272cfaec1c5c","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,13 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/</h1><hr><pre><a href="../">../</a>
<a href="components/">components/</a> 07-Oct-2023 14:12 -
<a href="screens/">screens/</a> 07-Oct-2023 14:12 -
<a href="Font.java.patch">Font.java.patch</a> 07-Oct-2023 14:12 630
<a href="Gui.java.patch">Gui.java.patch</a> 07-Oct-2023 14:12 3575
<a href="GuiGraphics.java.patch">GuiGraphics.java.patch</a> 07-Oct-2023 14:12 8812
<a href="MapRenderer.java.patch">MapRenderer.java.patch</a> 07-Oct-2023 14:12 613
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="6c2fee4bf419100282da4259d0677032" data-cf-beacon='{"rayId":"85f0170598fa50c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/ChatScreen.java
+++ b/net/minecraft/client/gui/screens/ChatScreen.java
@@ -225,7 +_,7 @@
this.f_96541_.f_91074_.f_108617_.m_246175_(p_242400_);
}
- return true;
+ return f_96541_.f_91080_ == this; // FORGE: Prevent closing the screen if another screen has been opened.
}
}

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/ConnectScreen.java
+++ b/net/minecraft/client/gui/screens/ConnectScreen.java
@@ -86,6 +_,8 @@
}
if (!optional.isPresent()) {
+ ConnectScreen.f_95683_.error("Couldn't connect to server: Unknown host \"{}\"", p_249536_.m_171863_());
+ net.minecraftforge.network.DualStackUtils.logInitialPreferences();
p_251955_.execute(() -> {
p_251955_.m_91152_(new DisconnectedScreen(ConnectScreen.this.f_95686_, ConnectScreen.this.f_278471_, ConnectScreen.f_169260_));
});

View file

@ -0,0 +1,18 @@
--- a/net/minecraft/client/gui/screens/LoadingOverlay.java
+++ b/net/minecraft/client/gui/screens/LoadingOverlay.java
@@ -132,6 +_,7 @@
}
if (this.f_96168_ == -1L && this.f_96164_.m_7746_() && (!this.f_96166_ || f1 >= 2.0F)) {
+ this.f_96168_ = Util.m_137550_(); // Moved up to guard against inf loops caused by callback
try {
this.f_96164_.m_7748_();
this.f_96165_.accept(Optional.empty());
@@ -139,7 +_,6 @@
this.f_96165_.accept(Optional.of(throwable));
}
- this.f_96168_ = Util.m_137550_();
if (this.f_96163_.f_91080_ != null) {
this.f_96163_.f_91080_.m_6575_(this.f_96163_, p_281839_.m_280182_(), p_281839_.m_280206_());
}

View file

@ -0,0 +1,25 @@
--- a/net/minecraft/client/gui/screens/MenuScreens.java
+++ b/net/minecraft/client/gui/screens/MenuScreens.java
@@ -40,6 +_,10 @@
private static final Map<MenuType<?>, MenuScreens.ScreenConstructor<?, ?>> f_96196_ = Maps.newHashMap();
public static <T extends AbstractContainerMenu> void m_96201_(@Nullable MenuType<T> p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) {
+ getScreenFactory(p_96202_, p_96203_, p_96204_, p_96205_).ifPresent(f -> f.m_96209_(p_96205_, p_96202_, p_96203_, p_96204_));
+ }
+
+ public static <T extends AbstractContainerMenu> java.util.Optional<ScreenConstructor<T, ?>> getScreenFactory(@Nullable MenuType<T> p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) {
if (p_96202_ == null) {
f_96195_.warn("Trying to open invalid screen with name: {}", (Object)p_96205_.getString());
} else {
@@ -47,9 +_,10 @@
if (screenconstructor == null) {
f_96195_.warn("Failed to create screen for menu type: {}", (Object)BuiltInRegistries.f_256818_.m_7981_(p_96202_));
} else {
- screenconstructor.m_96209_(p_96205_, p_96202_, p_96203_, p_96204_);
+ return java.util.Optional.of(screenconstructor);
}
}
+ return java.util.Optional.empty();
}
@Nullable

View file

@ -0,0 +1,17 @@
--- a/net/minecraft/client/gui/screens/OptionsScreen.java
+++ b/net/minecraft/client/gui/screens/OptionsScreen.java
@@ -151,6 +_,14 @@
super.m_88315_(p_283520_, p_281826_, p_283378_, p_281975_);
}
+ @Override
+ public void m_7379_() {
+ // We need to consider 2 potential parent screens here:
+ // 1. From the main menu, in which case display the main menu
+ // 2. From the pause menu, in which case exit back to game
+ this.f_96541_.m_91152_(this.f_96235_ instanceof PauseScreen ? null : this.f_96235_);
+ }
+
private Button m_260993_(Component p_261565_, Supplier<Screen> p_262119_) {
return Button.m_253074_(p_261565_, (p_280808_) -> {
this.f_96541_.m_91152_(p_262119_.get());

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/screens/PauseScreen.java
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
@@ -82,6 +_,7 @@
} else {
gridlayout$rowhelper.m_264139_(this.m_262456_(f_262254_, SocialInteractionsScreen::new));
}
+ gridlayout$rowhelper.m_264108_(Button.m_253074_(Component.m_237115_("fml.menu.mods"), button -> this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this))).m_252780_(f_262268_).m_253136_(), 2);
Component component = this.f_96541_.m_91090_() ? f_262217_ : f_262246_;
this.f_252482_ = gridlayout$rowhelper.m_264108_(Button.m_253074_(component, (p_280815_) -> {

View file

@ -0,0 +1,74 @@
--- a/net/minecraft/client/gui/screens/Screen.java
+++ b/net/minecraft/client/gui/screens/Screen.java
@@ -205,7 +_,7 @@
}
public void m_7379_() {
- this.f_96541_.m_91152_((Screen)null);
+ this.f_96541_.popGuiLayer();
}
protected <T extends GuiEventListener & Renderable & NarratableEntry> T m_142416_(T p_169406_) {
@@ -317,7 +_,10 @@
this.f_96543_ = p_96608_;
this.f_96544_ = p_96609_;
if (!this.f_267454_) {
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.f_96540_, this::addEventWidget, this::m_169411_))) {
this.m_7856_();
+ }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.f_96540_, this::addEventWidget, this::m_169411_));
} else {
this.m_267719_();
}
@@ -330,7 +_,10 @@
protected void m_232761_() {
this.m_169413_();
this.m_264131_();
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.f_96540_, this::addEventWidget, this::m_169411_))) {
this.m_7856_();
+ }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.f_96540_, this::addEventWidget, this::m_169411_));
}
public List<? extends GuiEventListener> m_6702_() {
@@ -352,6 +_,7 @@
public void m_280273_(GuiGraphics p_283688_) {
if (this.f_96541_.f_91073_ != null) {
p_283688_.m_280024_(0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_283688_));
} else {
this.m_280039_(p_283688_);
}
@@ -363,6 +_,7 @@
int i = 32;
p_282281_.m_280398_(f_279548_, 0, 0, 0, 0.0F, 0.0F, this.f_96543_, this.f_96544_, 32, 32);
p_282281_.m_280246_(1.0F, 1.0F, 1.0F, 1.0F);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_282281_));
}
public boolean m_7043_() {
@@ -456,6 +_,10 @@
public void m_7400_(List<Path> p_96591_) {
}
+ public Minecraft getMinecraft() {
+ return this.f_96541_;
+ }
+
private void m_169380_(long p_169381_, boolean p_169382_) {
this.f_169377_ = Util.m_137550_() + p_169381_;
if (p_169382_) {
@@ -622,5 +_,13 @@
this.f_169421_ = p_169425_;
this.f_169422_ = p_169426_;
}
+ }
+
+ private void addEventWidget(GuiEventListener b) {
+ if (b instanceof Renderable r)
+ this.f_169369_.add(r);
+ if (b instanceof NarratableEntry ne)
+ this.f_169368_.add(ne);
+ f_96540_.add(b);
}
}

View file

@ -0,0 +1,67 @@
--- a/net/minecraft/client/gui/screens/TitleScreen.java
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
@@ -63,6 +_,7 @@
@Nullable
private TitleScreen.WarningLabel f_232768_;
private final LogoRenderer f_263781_;
+ private net.minecraftforge.client.gui.TitleScreenModUpdateIndicator modUpdateNotification;
public TitleScreen() {
this(false);
@@ -113,11 +_,15 @@
int j = this.f_96543_ - i - 2;
int k = 24;
int l = this.f_96544_ / 4 + 48;
+ Button modButton = null;
if (this.f_96541_.m_91402_()) {
this.m_96772_(l, 24);
} else {
this.m_96763_(l, 24);
+ modButton = this.m_142416_(Button.m_253074_(Component.m_237115_("fml.menu.mods"), button -> this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this)))
+ .m_252794_(this.f_96543_ / 2 - 100, l + 24 * 2).m_253046_(98, 20).m_253136_());
}
+ modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton);
this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, l + 72 + 12, 20, 20, 0, 106, 20, Button.f_93617_, 256, 256, (p_280830_) -> {
this.f_96541_.m_91152_(new LanguageSelectScreen(this, this.f_96541_.f_91066_, this.f_96541_.m_91102_()));
@@ -162,7 +_,7 @@
}).m_252987_(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag;
(this.m_142416_(Button.m_253074_(Component.m_237115_("menu.online"), (p_210872_) -> {
this.m_96793_();
- }).m_252987_(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag;
+ }).m_252987_(this.f_96543_ / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag;
}
@Nullable
@@ -244,6 +_,7 @@
this.f_232768_.m_280409_(p_282860_, i);
}
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_282860_, this.f_96547_, this.f_96543_, this.f_96544_, i);
if (this.f_96721_ != null) {
this.f_96721_.m_280672_(p_282860_, this.f_96543_, this.f_96547_, i);
}
@@ -259,7 +_,14 @@
s = s + I18n.m_118938_("menu.modded");
}
- p_282860_.m_280488_(this.f_96547_, s, 2, this.f_96544_ - 10, 16777215 | i);
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brdline, brd) ->
+ p_282860_.m_280488_(this.f_96547_, brd, 2, this.f_96544_ - ( 10 + brdline * (this.f_96547_.f_92710_ + 1)), 16777215 | i)
+ );
+
+ net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brdline, brd) ->
+ p_282860_.m_280488_(this.f_96547_, brd, this.f_96543_ - f_96547_.m_92895_(brd), this.f_96544_ - (10 + (brdline + 1) * ( this.f_96547_.f_92710_ + 1)), 16777215 | i)
+ );
+
for(GuiEventListener guieventlistener : this.m_6702_()) {
if (guieventlistener instanceof AbstractWidget) {
@@ -272,6 +_,7 @@
RenderSystem.enableDepthTest();
this.f_96726_.m_88315_(p_282860_, p_281753_, p_283539_, p_282628_);
}
+ if (f1 >= 1.0f) modUpdateNotification.m_88315_(p_282860_, p_281753_, p_283539_, p_282628_);
}
}

View file

@ -0,0 +1,37 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
@@ -36,6 +_,7 @@
private int f_97141_ = Integer.MIN_VALUE;
private float f_97142_;
private boolean f_97143_;
+ private int page;
public AdvancementTab(Minecraft p_97145_, AdvancementsScreen p_97146_, AdvancementTabType p_97147_, int p_97148_, Advancement p_97149_, DisplayInfo p_97150_) {
this.f_97126_ = p_97145_;
@@ -50,6 +_,15 @@
this.m_97175_(this.f_97134_, p_97149_);
}
+ public AdvancementTab(Minecraft mc, AdvancementsScreen screen, AdvancementTabType type, int index, int page, Advancement adv, DisplayInfo info) {
+ this(mc, screen, type, index, adv, info);
+ this.page = page;
+ }
+
+ public int getPage() {
+ return page;
+ }
+
public AdvancementTabType m_169538_() {
return this.f_97128_;
}
@@ -143,8 +_,8 @@
return null;
} else {
for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) {
- if (p_97173_ < advancementtabtype.m_97210_()) {
- return new AdvancementTab(p_97171_, p_97172_, advancementtabtype, p_97173_, p_97174_, p_97174_.m_138320_());
+ if ((p_97173_ % AdvancementTabType.MAX_TABS) < advancementtabtype.m_97210_()) {
+ return new AdvancementTab(p_97171_, p_97172_, advancementtabtype, p_97173_ % AdvancementTabType.MAX_TABS, p_97173_ / AdvancementTabType.MAX_TABS, p_97174_, p_97174_.m_138320_());
}
p_97173_ -= advancementtabtype.m_97210_();

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java
@@ -12,6 +_,7 @@
LEFT(0, 64, 32, 28, 5),
RIGHT(96, 64, 32, 28, 5);
+ public static final int MAX_TABS = java.util.Arrays.stream(values()).mapToInt(e -> e.f_97199_).sum();
private final int f_97195_;
private final int f_97196_;
private final int f_97197_;

View file

@ -0,0 +1,74 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
@@ -41,6 +_,7 @@
@Nullable
private AdvancementTab f_97336_;
private boolean f_97337_;
+ private static int tabPage, maxPages;
public AdvancementsScreen(ClientAdvancements p_97340_) {
super(GameNarrator.f_93310_);
@@ -56,7 +_,15 @@
} else {
this.f_97334_.m_104401_(this.f_97336_ == null ? null : this.f_97336_.m_97182_(), true);
}
-
+ if (this.f_97335_.size() > AdvancementTabType.MAX_TABS) {
+ int guiLeft = (this.f_96543_ - 252) / 2;
+ int guiTop = (this.f_96544_ - 140) / 2;
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))
+ .m_252794_(guiLeft, guiTop - 50).m_253046_(20, 20).m_253136_());
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))
+ .m_252794_(guiLeft + f_169556_ - 20, guiTop - 50).m_253046_(20, 20).m_253136_());
+ maxPages = this.f_97335_.size() / AdvancementTabType.MAX_TABS;
+ }
}
public void m_7861_() {
@@ -74,7 +_,7 @@
int j = (this.f_96544_ - 140) / 2;
for(AdvancementTab advancementtab : this.f_97335_.values()) {
- if (advancementtab.m_97154_(i, j, p_97343_, p_97344_)) {
+ if (advancementtab.getPage() == tabPage && advancementtab.m_97154_(i, j, p_97343_, p_97344_)) {
this.f_97334_.m_104401_(advancementtab.m_97182_(), true);
break;
}
@@ -98,9 +_,15 @@
int i = (this.f_96543_ - 252) / 2;
int j = (this.f_96544_ - 140) / 2;
this.m_280273_(p_282589_);
+ if (maxPages != 0) {
+ net.minecraft.network.chat.Component page = Component.m_237113_(String.format("%d / %d", tabPage + 1, maxPages + 1));
+ int width = this.f_96547_.m_92852_(page);
+ p_282589_.m_280648_(this.f_96547_, page.m_7532_(), i + (252 / 2) - (width / 2), j - 44, -1);
+ }
this.m_97373_(p_282589_, p_282255_, p_283354_, i, j);
this.m_280088_(p_282589_, i, j);
this.m_280355_(p_282589_, p_282255_, p_283354_, i, j);
+ super.m_88315_(p_282589_, p_282255_, p_283354_, p_283123_);
}
public boolean m_7979_(double p_97347_, double p_97348_, int p_97349_, double p_97350_, double p_97351_) {
@@ -135,10 +_,12 @@
p_283395_.m_280218_(f_97329_, p_281890_, p_282532_, 0, 0, 252, 140);
if (this.f_97335_.size() > 1) {
for(AdvancementTab advancementtab : this.f_97335_.values()) {
+ if (advancementtab.getPage() == tabPage)
advancementtab.m_280105_(p_283395_, p_281890_, p_282532_, advancementtab == this.f_97336_);
}
for(AdvancementTab advancementtab1 : this.f_97335_.values()) {
+ if (advancementtab1.getPage() == tabPage)
advancementtab1.m_280485_(p_283395_, p_281890_, p_282532_);
}
}
@@ -158,7 +_,7 @@
if (this.f_97335_.size() > 1) {
for(AdvancementTab advancementtab : this.f_97335_.values()) {
- if (advancementtab.m_97154_(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) {
+ if (advancementtab.getPage() == tabPage && advancementtab.m_97154_(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) {
p_282784_.m_280557_(this.f_96547_, advancementtab.m_97189_(), p_283556_, p_282458_);
}
}

View file

@ -0,0 +1,10 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/advancements/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/advancements/</h1><hr><pre><a href="../">../</a>
<a href="AdvancementTab.java.patch">AdvancementTab.java.patch</a> 07-Oct-2023 14:12 1614
<a href="AdvancementTabType.java.patch">AdvancementTabType.java.patch</a> 07-Oct-2023 14:12 431
<a href="AdvancementsScreen.java.patch">AdvancementsScreen.java.patch</a> 07-Oct-2023 14:12 3634
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="b15d698b99d1657c6cc2adc3de61d61c" data-cf-beacon='{"rayId":"85f0273dfc2d1c5c","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,42 @@
--- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java
@@ -64,7 +_,7 @@
}
protected int m_5756_() {
- return super.m_5756_() + 15;
+ return super.m_5756_() + 15 + 20;
}
public int m_5759_() {
@@ -129,10 +_,11 @@
this.f_193912_ = Button.m_253074_(p_193917_, (p_269618_) -> {
KeyBindsList.this.f_193858_.f_193975_ = p_193916_;
KeyBindsList.this.m_269130_();
- }).m_252987_(0, 0, 75, 20).m_252778_((p_253311_) -> {
+ }).m_252987_(0, 0, 75 + 20 /* Forge: Add space */, 20).m_252778_((p_253311_) -> {
return p_193916_.m_90862_() ? Component.m_237110_("narrator.controls.unbound", p_193917_) : Component.m_237110_("narrator.controls.bound", p_193917_, p_253311_.get());
}).m_253136_();
this.f_193913_ = Button.m_253074_(Component.m_237115_("controls.reset"), (p_269616_) -> {
+ this.f_193910_.setToDefault();
KeyBindsList.this.f_93386_.f_91066_.m_92159_(p_193916_, p_193916_.m_90861_());
KeyBindsList.this.m_269130_();
}).m_252987_(0, 0, 50, 20).m_252778_((p_253313_) -> {
@@ -144,7 +_,7 @@
public void m_6311_(GuiGraphics p_281805_, int p_281298_, int p_282357_, int p_281373_, int p_283433_, int p_281932_, int p_282224_, int p_282053_, boolean p_282605_, float p_281432_) {
int k = p_281373_ + 90 - KeyBindsList.this.f_193859_;
p_281805_.m_280614_(KeyBindsList.this.f_93386_.f_91062_, this.f_193911_, k, p_282357_ + p_281932_ / 2 - 9 / 2, 16777215, false);
- this.f_193913_.m_252865_(p_281373_ + 190);
+ this.f_193913_.m_252865_(p_281373_ + 190 + 20);
this.f_193913_.m_253211_(p_282357_);
this.f_193913_.m_88315_(p_281805_, p_282224_, p_282053_, p_281432_);
this.f_193912_.m_252865_(p_281373_ + 105);
@@ -173,7 +_,7 @@
MutableComponent mutablecomponent = Component.m_237119_();
if (!this.f_193910_.m_90862_()) {
for(KeyMapping keymapping : KeyBindsList.this.f_93386_.f_91066_.f_92059_) {
- if (keymapping != this.f_193910_ && this.f_193910_.m_90850_(keymapping)) {
+ if ((keymapping != this.f_193910_ && this.f_193910_.m_90850_(keymapping)) || keymapping.hasKeyModifierConflict(this.f_193910_)) { // FORGE: gracefully handle conflicts like SHIFT vs SHIFT+G
if (this.f_268447_) {
mutablecomponent.m_130946_(", ");
}

View file

@ -0,0 +1,26 @@
--- a/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
@@ -31,7 +_,7 @@
this.m_7787_(this.f_193977_);
this.f_193978_ = this.m_142416_(Button.m_253074_(Component.m_237115_("controls.resetAll"), (p_269619_) -> {
for(KeyMapping keymapping : this.f_96282_.f_92059_) {
- keymapping.m_90848_(keymapping.m_90861_());
+ keymapping.setToDefault();
}
this.f_193977_.m_269130_();
@@ -55,11 +_,14 @@
public boolean m_7933_(int p_193987_, int p_193988_, int p_193989_) {
if (this.f_193975_ != null) {
if (p_193987_ == 256) {
+ this.f_193975_.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputConstants.f_84822_);
this.f_96282_.m_92159_(this.f_193975_, InputConstants.f_84822_);
} else {
+ this.f_193975_.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputConstants.m_84827_(p_193987_, p_193988_));
this.f_96282_.m_92159_(this.f_193975_, InputConstants.m_84827_(p_193987_, p_193988_));
}
+ if(!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.f_193975_.getKey()))
this.f_193975_ = null;
this.f_193976_ = Util.m_137550_();
this.f_193977_.m_269130_();

View file

@ -0,0 +1,9 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/controls/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/controls/</h1><hr><pre><a href="../">../</a>
<a href="KeyBindsList.java.patch">KeyBindsList.java.patch</a> 07-Oct-2023 14:12 2545
<a href="KeyBindsScreen.java.patch">KeyBindsScreen.java.patch</a> 07-Oct-2023 14:12 1424
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="f0b4f815ada5a968bf069250689c998d" data-cf-beacon='{"rayId":"85f02740698c1c5c","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,22 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/</h1><hr><pre><a href="../">../</a>
<a href="advancements/">advancements/</a> 07-Oct-2023 14:12 -
<a href="controls/">controls/</a> 07-Oct-2023 14:12 -
<a href="inventory/">inventory/</a> 07-Oct-2023 14:12 -
<a href="multiplayer/">multiplayer/</a> 07-Oct-2023 14:12 -
<a href="packs/">packs/</a> 07-Oct-2023 14:12 -
<a href="recipebook/">recipebook/</a> 07-Oct-2023 14:12 -
<a href="worldselection/">worldselection/</a> 07-Oct-2023 14:12 -
<a href="ChatScreen.java.patch">ChatScreen.java.patch</a> 07-Oct-2023 14:12 366
<a href="ConnectScreen.java.patch">ConnectScreen.java.patch</a> 07-Oct-2023 14:12 625
<a href="LoadingOverlay.java.patch">LoadingOverlay.java.patch</a> 07-Oct-2023 14:12 753
<a href="MenuScreens.java.patch">MenuScreens.java.patch</a> 07-Oct-2023 14:12 1321
<a href="OptionsScreen.java.patch">OptionsScreen.java.patch</a> 07-Oct-2023 14:12 751
<a href="PauseScreen.java.patch">PauseScreen.java.patch</a> 07-Oct-2023 14:12 655
<a href="Screen.java.patch">Screen.java.patch</a> 07-Oct-2023 14:12 2934
<a href="TitleScreen.java.patch">TitleScreen.java.patch</a> 07-Oct-2023 14:12 3309
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="83b941420d7b8b1887ee892c7ac23c8b" data-cf-beacon='{"rayId":"85f019e3bbb050c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,188 @@
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
@@ -90,6 +_,7 @@
int i = this.f_97735_;
int j = this.f_97736_;
this.m_7286_(p_283479_, p_281886_, p_283661_, p_281248_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Background(this, p_283479_, p_283661_, p_281248_));
RenderSystem.disableDepthTest();
super.m_88315_(p_283479_, p_283661_, p_281248_, p_281886_);
p_283479_.m_280168_().m_85836_();
@@ -107,12 +_,13 @@
int l = slot.f_40220_;
int i1 = slot.f_40221_;
if (this.f_97734_.m_280329_()) {
- m_280359_(p_283479_, l, i1, 0);
+ renderSlotHighlight(p_283479_, l, i1, 0, getSlotColor(k));
}
}
}
this.m_280003_(p_283479_, p_283661_, p_281248_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground(this, p_283479_, p_283661_, p_281248_));
ItemStack itemstack = this.f_97711_.m_41619_() ? this.f_97732_.m_142621_() : this.f_97711_;
if (!itemstack.m_41619_()) {
int l1 = 8;
@@ -149,13 +_,16 @@
}
public static void m_280359_(GuiGraphics p_283692_, int p_281453_, int p_281915_, int p_283504_) {
- p_283692_.m_285978_(RenderType.m_286086_(), p_281453_, p_281915_, p_281453_ + 16, p_281915_ + 16, -2130706433, -2130706433, p_283504_);
+ renderSlotHighlight(p_283692_, p_281453_, p_281915_, p_283504_, -2130706433);
+ }
+ public static void renderSlotHighlight(GuiGraphics p_283692_, int p_281453_, int p_281915_, int p_283504_, int color) {
+ p_283692_.m_285978_(RenderType.m_286086_(), p_281453_, p_281915_, p_281453_ + 16, p_281915_ + 16, color, color, p_283504_);
}
protected void m_280072_(GuiGraphics p_283594_, int p_282171_, int p_281909_) {
if (this.f_97732_.m_142621_().m_41619_() && this.f_97734_ != null && this.f_97734_.m_6657_()) {
ItemStack itemstack = this.f_97734_.m_7993_();
- p_283594_.m_280677_(this.f_96547_, this.m_280553_(itemstack), itemstack.m_150921_(), p_282171_, p_281909_);
+ p_283594_.renderTooltip(this.f_96547_, this.m_280553_(itemstack), itemstack.m_150921_(), itemstack, p_282171_, p_281909_);
}
}
@@ -168,7 +_,8 @@
p_282567_.m_280168_().m_85836_();
p_282567_.m_280168_().m_252880_(0.0F, 0.0F, 232.0F);
p_282567_.m_280480_(p_281330_, p_281772_, p_281689_);
- p_282567_.m_280302_(this.f_96547_, p_281330_, p_281772_, p_281689_ - (this.f_97711_.m_41619_() ? 0 : 8), p_282568_);
+ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_281330_).getFont(p_281330_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT);
+ p_282567_.m_280302_(font == null ? this.f_96547_ : font, p_281330_, p_281772_, p_281689_ - (this.f_97711_.m_41619_() ? 0 : 8), p_282568_);
p_282567_.m_280168_().m_85849_();
}
@@ -270,7 +_,8 @@
if (super.m_6375_(p_97748_, p_97749_, p_97750_)) {
return true;
} else {
- boolean flag = this.f_96541_.f_91066_.f_92097_.m_90830_(p_97750_) && this.f_96541_.f_91072_.m_105290_();
+ InputConstants.Key mouseKey = InputConstants.Type.MOUSE.m_84895_(p_97750_);
+ boolean flag = this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey);
Slot slot = this.m_97744_(p_97748_, p_97749_);
long i = Util.m_137550_();
this.f_97723_ = this.f_97709_ == slot && i - this.f_97721_ < 250L && this.f_97722_ == p_97750_;
@@ -281,6 +_,7 @@
int j = this.f_97735_;
int k = this.f_97736_;
boolean flag1 = this.m_7467_(p_97748_, p_97749_, j, k, p_97750_);
+ if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
int l = -1;
if (slot != null) {
l = slot.f_40219_;
@@ -306,7 +_,7 @@
}
} else if (!this.f_97738_) {
if (this.f_97732_.m_142621_().m_41619_()) {
- if (flag) {
+ if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) {
this.m_6597_(slot, l, p_97750_, ClickType.CLONE);
} else {
boolean flag2 = l != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344));
@@ -330,7 +_,7 @@
this.f_97717_ = 0;
} else if (p_97750_ == 1) {
this.f_97717_ = 1;
- } else if (flag) {
+ } else if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) {
this.f_97717_ = 2;
}
}
@@ -399,10 +_,13 @@
}
public boolean m_6348_(double p_97812_, double p_97813_, int p_97814_) {
+ super.m_6348_(p_97812_, p_97813_, p_97814_); //Forge, Call parent to release buttons
Slot slot = this.m_97744_(p_97812_, p_97813_);
int i = this.f_97735_;
int j = this.f_97736_;
boolean flag = this.m_7467_(p_97812_, p_97813_, i, j, p_97814_);
+ if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
+ InputConstants.Key mouseKey = InputConstants.Type.MOUSE.m_84895_(p_97814_);
int k = -1;
if (slot != null) {
k = slot.f_40219_;
@@ -416,7 +_,7 @@
if (m_96638_()) {
if (!this.f_97724_.m_41619_()) {
for(Slot slot2 : this.f_97732_.f_38839_) {
- if (slot2 != null && slot2.m_8010_(this.f_96541_.f_91074_) && slot2.m_6657_() && slot2.f_40218_ == slot.f_40218_ && AbstractContainerMenu.m_38899_(slot2, this.f_97724_, true)) {
+ if (slot2 != null && slot2.m_8010_(this.f_96541_.f_91074_) && slot2.m_6657_() && slot2.isSameInventory(slot) && AbstractContainerMenu.m_38899_(slot2, this.f_97724_, true)) {
this.m_6597_(slot2, slot2.f_40219_, p_97814_, ClickType.QUICK_MOVE);
}
}
@@ -479,7 +_,7 @@
this.m_6597_((Slot)null, -999, AbstractContainerMenu.m_38930_(2, this.f_97717_), ClickType.QUICK_CRAFT);
} else if (!this.f_97732_.m_142621_().m_41619_()) {
- if (this.f_96541_.f_91066_.f_92097_.m_90830_(p_97814_)) {
+ if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) {
this.m_6597_(slot, k, p_97814_, ClickType.CLONE);
} else {
boolean flag1 = k != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344));
@@ -526,34 +_,39 @@
}
public boolean m_7933_(int p_97765_, int p_97766_, int p_97767_) {
+ InputConstants.Key mouseKey = InputConstants.m_84827_(p_97765_, p_97766_);
if (super.m_7933_(p_97765_, p_97766_, p_97767_)) {
return true;
- } else if (this.f_96541_.f_91066_.f_92092_.m_90832_(p_97765_, p_97766_)) {
+ } else if (this.f_96541_.f_91066_.f_92092_.isActiveAndMatches(mouseKey)) {
this.m_7379_();
return true;
} else {
- this.m_97805_(p_97765_, p_97766_);
+ boolean handled = this.m_97805_(p_97765_, p_97766_);// Forge MC-146650: Needs to return true when the key is handled
if (this.f_97734_ != null && this.f_97734_.m_6657_()) {
- if (this.f_96541_.f_91066_.f_92097_.m_90832_(p_97765_, p_97766_)) {
+ if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) {
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, 0, ClickType.CLONE);
- } else if (this.f_96541_.f_91066_.f_92094_.m_90832_(p_97765_, p_97766_)) {
+ handled = true;
+ } else if (this.f_96541_.f_91066_.f_92094_.isActiveAndMatches(mouseKey)) {
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, m_96637_() ? 1 : 0, ClickType.THROW);
+ handled = true;
}
+ } else if (this.f_96541_.f_91066_.f_92094_.isActiveAndMatches(mouseKey)) {
+ handled = true; // Forge MC-146650: Emulate MC bug, so we don't drop from hotbar when pressing drop without hovering over a item.
}
- return true;
+ return handled;
}
}
protected boolean m_97805_(int p_97806_, int p_97807_) {
if (this.f_97732_.m_142621_().m_41619_() && this.f_97734_ != null) {
- if (this.f_96541_.f_91066_.f_92093_.m_90832_(p_97806_, p_97807_)) {
+ if (this.f_96541_.f_91066_.f_92093_.isActiveAndMatches(InputConstants.m_84827_(p_97806_, p_97807_))) {
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, 40, ClickType.SWAP);
return true;
}
for(int i = 0; i < 9; ++i) {
- if (this.f_96541_.f_91066_.f_92056_[i].m_90832_(p_97806_, p_97807_)) {
+ if (this.f_96541_.f_91066_.f_92056_[i].isActiveAndMatches(InputConstants.m_84827_(p_97806_, p_97807_))) {
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, i, ClickType.SWAP);
return true;
}
@@ -588,6 +_,18 @@
public T m_6262_() {
return this.f_97732_;
+ }
+
+ @org.jetbrains.annotations.Nullable
+ public Slot getSlotUnderMouse() { return this.f_97734_; }
+ public int getGuiLeft() { return f_97735_; }
+ public int getGuiTop() { return f_97736_; }
+ public int getXSize() { return f_97726_; }
+ public int getYSize() { return f_97727_; }
+
+ protected int slotColor = -2130706433;
+ public int getSlotColor(int index) {
+ return slotColor;
}
public void m_7379_() {

View file

@ -0,0 +1,292 @@
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
@@ -74,6 +_,8 @@
private boolean f_98515_;
private final Set<TagKey<Item>> f_98516_ = new HashSet<>();
private final boolean f_256872_;
+ private final List<net.minecraftforge.client.gui.CreativeTabsScreenPage> pages = new java.util.ArrayList<>();
+ private net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>());
public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) {
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.m_150109_(), CommonComponents.f_237098_);
@@ -107,7 +_,7 @@
private void m_257687_(Collection<ItemStack> p_261591_) {
int i = this.f_97732_.m_257485_(this.f_98508_);
(this.f_97732_).f_98639_.clear();
- if (f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH) {
+ if (f_98507_.hasSearchBar()) {
this.m_98630_();
} else {
(this.f_97732_).f_98639_.addAll(p_261591_);
@@ -263,6 +_,34 @@
protected void m_7856_() {
if (this.f_96541_.f_91072_.m_105290_()) {
super.m_7856_();
+ this.pages.clear();
+ int tabIndex = 0;
+ List<CreativeModeTab> currentPage = new java.util.ArrayList<>();
+ for (CreativeModeTab sortedCreativeModeTab : net.minecraftforge.common.CreativeModeTabRegistry.getSortedCreativeModeTabs()) {
+ currentPage.add(sortedCreativeModeTab);
+ tabIndex++;
+ if (tabIndex == 10) {
+ this.pages.add(new net.minecraftforge.client.gui.CreativeTabsScreenPage(currentPage));
+ currentPage = new java.util.ArrayList<>();
+ tabIndex = 0;
+ }
+ }
+ if (tabIndex != 0) {
+ this.pages.add(new net.minecraftforge.client.gui.CreativeTabsScreenPage(currentPage));
+ }
+ if (this.pages.isEmpty()) {
+ this.currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>());
+ } else {
+ this.currentPage = this.pages.get(0);
+ }
+ if (this.pages.size() > 1) {
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_("<"), b -> setCurrentPage(this.pages.get(Math.max(this.pages.indexOf(this.currentPage) - 1, 0)))).m_252794_(f_97735_, f_97736_ - 50).m_253046_(20, 20).m_253136_());
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_(">"), b -> setCurrentPage(this.pages.get(Math.min(this.pages.indexOf(this.currentPage) + 1, this.pages.size() - 1)))).m_252794_(f_97735_ + f_97726_ - 20, f_97736_ - 50).m_253046_(20, 20).m_253136_());
+ }
+ this.currentPage = this.pages.stream().filter(page -> page.getVisibleTabs().contains(f_98507_)).findFirst().orElse(this.currentPage);
+ if (!this.currentPage.getVisibleTabs().contains(f_98507_)) {
+ f_98507_ = this.currentPage.getVisibleTabs().get(0);
+ }
this.f_98510_ = new EditBox(this.f_96547_, this.f_97735_ + 82, this.f_97736_ + 6, 80, 9, Component.m_237115_("itemGroup.search"));
this.f_98510_.m_94199_(50);
this.f_98510_.m_94182_(false);
@@ -308,7 +_,7 @@
public boolean m_5534_(char p_98521_, int p_98522_) {
if (this.f_98514_) {
return false;
- } else if (f_98507_.m_257962_() != CreativeModeTab.Type.SEARCH) {
+ } else if (!f_98507_.hasSearchBar()) {
return false;
} else {
String s = this.f_98510_.m_94155_();
@@ -326,7 +_,7 @@
public boolean m_7933_(int p_98547_, int p_98548_, int p_98549_) {
this.f_98514_ = false;
- if (f_98507_.m_257962_() != CreativeModeTab.Type.SEARCH) {
+ if (!f_98507_.hasSearchBar()) {
if (this.f_96541_.f_91066_.f_92098_.m_90832_(p_98547_, p_98548_)) {
this.f_98514_ = true;
this.m_98560_(CreativeModeTabs.m_258007_());
@@ -361,6 +_,7 @@
}
private void m_98630_() {
+ if (!f_98507_.hasSearchBar()) return;
(this.f_97732_).f_98639_.clear();
this.f_98516_.clear();
String s = this.f_98510_.m_94155_();
@@ -370,10 +_,10 @@
SearchTree<ItemStack> searchtree;
if (s.startsWith("#")) {
s = s.substring(1);
- searchtree = this.f_96541_.m_231372_(SearchRegistry.f_119942_);
+ searchtree = this.f_96541_.m_231372_(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(f_98507_));
this.m_98619_(s);
} else {
- searchtree = this.f_96541_.m_231372_(SearchRegistry.f_119941_);
+ searchtree = this.f_96541_.m_231372_(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(f_98507_));
}
(this.f_97732_).f_98639_.addAll(searchtree.m_6293_(s.toLowerCase(Locale.ROOT)));
@@ -405,7 +_,8 @@
protected void m_280003_(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
if (f_98507_.m_40789_()) {
- p_283168_.m_280614_(this.f_96547_, f_98507_.m_40786_(), 8, 6, 4210752, false);
+ com.mojang.blaze3d.systems.RenderSystem.disableBlend();
+ p_283168_.m_280614_(this.f_96547_, f_98507_.m_40786_(), 8, 6, f_98507_.getLabelColor(), false);
}
}
@@ -415,7 +_,7 @@
double d0 = p_98531_ - (double)this.f_97735_;
double d1 = p_98532_ - (double)this.f_97736_;
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98562_(creativemodetab, d0, d1)) {
return true;
}
@@ -436,7 +_,7 @@
double d1 = p_98623_ - (double)this.f_97736_;
this.f_98509_ = false;
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98562_(creativemodetab, d0, d1)) {
this.m_98560_(creativemodetab);
return true;
@@ -454,6 +_,7 @@
private void m_98560_(CreativeModeTab p_98561_) {
CreativeModeTab creativemodetab = f_98507_;
f_98507_ = p_98561_;
+ slotColor = p_98561_.getSlotColor();
this.f_97737_.clear();
(this.f_97732_).f_98639_.clear();
this.m_238391_();
@@ -530,13 +_,15 @@
this.f_98511_ = null;
}
- if (f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH) {
+ if (f_98507_.hasSearchBar()) {
this.f_98510_.m_94194_(true);
this.f_98510_.m_94190_(false);
this.f_98510_.m_93692_(true);
if (creativemodetab != p_98561_) {
this.f_98510_.m_94144_("");
}
+ this.f_98510_.m_93674_(f_98507_.getSearchBarWidth());
+ this.f_98510_.m_252865_(this.f_97735_ + (82 /*default left*/ + 89 /*default width*/) - this.f_98510_.m_5711_());
this.m_98630_();
} else {
@@ -593,7 +_,7 @@
this.m_280273_(p_283000_);
super.m_88315_(p_283000_, p_281317_, p_282770_, p_281295_);
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_280537_(p_283000_, creativemodetab, p_281317_, p_282770_)) {
break;
}
@@ -603,13 +_,22 @@
p_283000_.m_280557_(this.f_96547_, f_98506_, p_281317_, p_282770_);
}
+ if (this.pages.size() != 1) {
+ Component page = Component.m_237113_(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size()));
+ p_283000_.m_280168_().m_85836_();
+ p_283000_.m_280168_().m_252880_(0F, 0F, 300F);
+ p_283000_.m_280648_(f_96547_, page.m_7532_(), f_97735_ + (f_97726_ / 2) - (f_96547_.m_92852_(page) / 2), f_97736_ - 44, -1);
+ p_283000_.m_280168_().m_85849_();
+ }
+
+ com.mojang.blaze3d.systems.RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
this.m_280072_(p_283000_, p_281317_, p_282770_);
}
public List<Component> m_280553_(ItemStack p_281769_) {
boolean flag = this.f_97734_ != null && this.f_97734_ instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
boolean flag1 = f_98507_.m_257962_() == CreativeModeTab.Type.CATEGORY;
- boolean flag2 = f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH;
+ boolean flag2 = f_98507_.hasSearchBar();
TooltipFlag.Default tooltipflag$default = this.f_96541_.f_91066_.f_92125_ ? TooltipFlag.Default.f_256730_ : TooltipFlag.Default.f_256752_;
TooltipFlag tooltipflag = flag ? tooltipflag$default.m_257777_() : tooltipflag$default;
List<Component> list = p_281769_.m_41651_(this.f_96541_.f_91074_, tooltipflag);
@@ -629,7 +_,7 @@
int i = 1;
for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
- if (creativemodetab.m_257962_() != CreativeModeTab.Type.SEARCH && creativemodetab.m_257694_(p_281769_)) {
+ if (!creativemodetab.hasSearchBar() && creativemodetab.m_257694_(p_281769_)) {
list1.add(i++, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE));
}
}
@@ -639,21 +_,22 @@
}
protected void m_7286_(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) {
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (creativemodetab != f_98507_) {
this.m_280560_(p_282663_, creativemodetab);
}
}
- p_282663_.m_280218_(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + f_98507_.m_40788_()), this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_);
+ p_282663_.m_280218_(f_98507_.getBackgroundLocation(), this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_);
this.f_98510_.m_88315_(p_282663_, p_282089_, p_282249_, p_282504_);
int j = this.f_97735_ + 175;
int k = this.f_97736_ + 18;
int i = k + 112;
if (f_98507_.m_40791_()) {
- p_282663_.m_280218_(f_98504_, j, k + (int)((float)(i - k - 17) * this.f_98508_), 232 + (this.m_98631_() ? 0 : 12), 0, 12, 15);
+ p_282663_.m_280218_(f_98507_.getTabsImage(), j, k + (int)((float)(i - k - 17) * this.f_98508_), 232 + (this.m_98631_() ? 0 : 12), 0, 12, 15);
}
+ if (currentPage.getVisibleTabs().contains(f_98507_)) //Forge: only display tab selection when the selected tab is on the current page
this.m_280560_(p_282663_, f_98507_);
if (f_98507_.m_257962_() == CreativeModeTab.Type.INVENTORY) {
InventoryScreen.m_274545_(p_282663_, this.f_97735_ + 88, this.f_97736_ + 45, 20, (float)(this.f_97735_ + 88 - p_282089_), (float)(this.f_97736_ + 45 - 30 - p_282249_), this.f_96541_.f_91074_);
@@ -662,7 +_,7 @@
}
private int m_258094_(CreativeModeTab p_260136_) {
- int i = p_260136_.m_257903_();
+ int i = currentPage.getColumn(p_260136_);
int j = 27;
int k = 27 * i;
if (p_260136_.m_6563_()) {
@@ -674,7 +_,7 @@
private int m_257995_(CreativeModeTab p_260181_) {
int i = 0;
- if (p_260181_.m_258064_() == CreativeModeTab.Row.TOP) {
+ if (currentPage.isTop(p_260181_)) {
i -= 32;
} else {
i += this.f_97727_;
@@ -702,8 +_,8 @@
protected void m_280560_(GuiGraphics p_283590_, CreativeModeTab p_283489_) {
boolean flag = p_283489_ == f_98507_;
- boolean flag1 = p_283489_.m_258064_() == CreativeModeTab.Row.TOP;
- int i = p_283489_.m_257903_();
+ boolean flag1 = currentPage.isTop(p_283489_);
+ int i = currentPage.getColumn(p_283489_);
int j = i * 26;
int k = 0;
int l = this.f_97735_ + this.m_258094_(p_283489_);
@@ -720,7 +_,8 @@
i1 += this.f_97727_ - 4;
}
- p_283590_.m_280218_(f_98504_, l, i1, j, k, 26, 32);
+ com.mojang.blaze3d.systems.RenderSystem.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
+ p_283590_.m_280218_(p_283489_.getTabsImage(), l, i1, j, k, 26, 32);
p_283590_.m_280168_().m_85836_();
p_283590_.m_280168_().m_252880_(0.0F, 0.0F, 100.0F);
l += 5;
@@ -763,6 +_,14 @@
}
+ public net.minecraftforge.client.gui.CreativeTabsScreenPage getCurrentPage() {
+ return currentPage;
+ }
+
+ public void setCurrentPage(net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage) {
+ this.currentPage = currentPage;
+ }
+
@OnlyIn(Dist.CLIENT)
static class CustomCreativeSlot extends Slot {
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
@@ -930,6 +_,22 @@
public boolean m_8010_(Player p_98665_) {
return this.f_98655_.m_8010_(p_98665_);
+ }
+
+ @Override
+ public int getSlotIndex() {
+ return this.f_98655_.getSlotIndex();
+ }
+
+ @Override
+ public boolean isSameInventory(Slot other) {
+ return this.f_98655_.isSameInventory(other);
+ }
+
+ @Override
+ public Slot setBackground(ResourceLocation atlas, ResourceLocation sprite) {
+ this.f_98655_.setBackground(atlas, sprite);
+ return this;
}
}
}

View file

@ -0,0 +1,45 @@
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
@@ -41,12 +_,17 @@
Collection<MobEffectInstance> collection = this.f_96541_.f_91074_.m_21220_();
if (!collection.isEmpty() && j >= 32) {
boolean flag = j >= 120;
+ var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this, j, !flag, i);
+ if (event.isCanceled()) return;
+ flag = !event.isCompact();
+ i = event.getHorizontalOffset();
int k = 33;
if (collection.size() > 5) {
k = 132 / (collection.size() - 1);
}
- Iterable<MobEffectInstance> iterable = Ordering.natural().sortedCopy(collection);
+
+ Iterable<MobEffectInstance> iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().collect(java.util.stream.Collectors.toList());
this.m_280172_(p_281945_, i, k, iterable, flag);
this.m_280301_(p_281945_, i, k, iterable, flag);
if (flag) {
@@ -92,6 +_,11 @@
int i = this.f_97736_;
for(MobEffectInstance mobeffectinstance : p_282642_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (renderer.renderInventoryIcon(mobeffectinstance, this, p_282745_, p_282521_ + (p_281536_ ? 6 : 7), i, 0)) {
+ i += p_282291_;
+ continue;
+ }
MobEffect mobeffect = mobeffectinstance.m_19544_();
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
p_282745_.m_280159_(p_282521_ + (p_281536_ ? 6 : 7), i + 7, 0, 18, 18, textureatlassprite);
@@ -104,6 +_,11 @@
int i = this.f_97736_;
for(MobEffectInstance mobeffectinstance : p_281986_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (renderer.renderInventoryText(mobeffectinstance, this, p_281462_, p_283484_, i, 0)) {
+ i += p_282057_;
+ continue;
+ }
Component component = this.m_194000_(mobeffectinstance);
p_281462_.m_280430_(this.f_96547_, component, p_283484_ + 10 + 18, i + 6, 16777215);
Component component1 = MobEffectUtil.m_267641_(mobeffectinstance, 1.0F);

View file

@ -0,0 +1,28 @@
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
@@ -88,7 +_,7 @@
int l1 = 86 - this.f_96547_.m_92895_(s);
FormattedText formattedtext = EnchantmentNames.m_98734_().m_98737_(this.f_96547_, l1);
int i2 = 6839882;
- if ((k < l + 1 || this.f_96541_.f_91074_.f_36078_ < k1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) {
+ if (((k < l + 1 || this.f_96541_.f_91074_.f_36078_ < k1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) || this.f_97732_.f_39447_[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels
p_282430_.m_280218_(f_98747_, i1, j + 14 + 19 * l, 0, 185, 108, 19);
p_282430_.m_280218_(f_98747_, i1 + 1, j + 15 + 19 * l, 16 * l, 239, 16, 16);
p_282430_.m_280554_(this.f_96547_, formattedtext, j1, j + 16 + 19 * l, l1, (i2 & 16711422) >> 1);
@@ -150,10 +_,13 @@
Enchantment enchantment = Enchantment.m_44697_((this.f_97732_).f_39447_[j]);
int l = (this.f_97732_).f_39448_[j];
int i1 = j + 1;
- if (this.m_6774_(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0 && l >= 0 && enchantment != null) {
+ if (this.m_6774_(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
List<Component> list = Lists.newArrayList();
- list.add(Component.m_237110_("container.enchant.clue", enchantment.m_44700_(l)).m_130940_(ChatFormatting.WHITE));
- if (!flag) {
+ list.add((Component.m_237110_("container.enchant.clue", enchantment == null ? "" : enchantment.m_44700_(l))).m_130940_(ChatFormatting.WHITE));
+ if (enchantment == null) {
+ list.add(Component.m_237113_(""));
+ list.add(Component.m_237115_("forge.container.enchant.limitedEnchantability").m_130940_(ChatFormatting.RED));
+ } else if (!flag) {
list.add(CommonComponents.f_237098_);
if (this.f_96541_.f_91074_.f_36078_ < k) {
list.add(Component.m_237110_("container.enchant.level.requirement", (this.f_97732_).f_39446_[j]).m_130940_(ChatFormatting.RED));

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
@@ -15,7 +_,7 @@
private static final Vector3f f_243728_ = new Vector3f(1.0F, 1.0F, 1.0F);
private static final int f_244604_ = 16;
private static final int f_244207_ = 16;
- private final ResourceLocation f_243720_ = new ResourceLocation("textures/gui/hanging_signs/" + this.f_244069_.f_61839_() + ".png");
+ private final ResourceLocation f_243720_ = new ResourceLocation(this.f_244069_.f_61839_() + ".png").m_246208_("textures/gui/hanging_signs/");
public HangingSignEditScreen(SignBlockEntity p_278017_, boolean p_277942_, boolean p_277778_) {
super(p_278017_, p_277942_, p_277778_, Component.m_237115_("hanging_sign.edit"));

View file

@ -0,0 +1,16 @@
--- a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
@@ -93,6 +_,13 @@
public static void m_274545_(GuiGraphics p_282802_, int p_275688_, int p_275245_, int p_275535_, float p_275604_, float p_275546_, LivingEntity p_275689_) {
float f = (float)Math.atan((double)(p_275604_ / 40.0F));
float f1 = (float)Math.atan((double)(p_275546_ / 40.0F));
+ // Forge: Allow passing in direct angle components instead of mouse position
+ renderEntityInInventoryFollowsAngle(p_282802_, p_275688_, p_275245_, p_275535_, f, f1, p_275689_);
+ }
+
+ public static void renderEntityInInventoryFollowsAngle(GuiGraphics p_282802_, int p_275688_, int p_275245_, int p_275535_, float angleXComponent, float angleYComponent, LivingEntity p_275689_) {
+ float f = angleXComponent;
+ float f1 = angleYComponent;
Quaternionf quaternionf = (new Quaternionf()).rotateZ((float)Math.PI);
Quaternionf quaternionf1 = (new Quaternionf()).rotateX(f1 * 20.0F * ((float)Math.PI / 180F));
quaternionf.mul(quaternionf1);

View file

@ -0,0 +1,16 @@
--- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
@@ -229,7 +_,12 @@
p_281357_.m_280370_(this.f_96547_, p_283466_, p_282403_, p_283601_);
} else {
p_281357_.m_280302_(this.f_96547_, p_282046_, p_282403_, p_283601_, p_282046_.m_41613_() == 1 ? "1" : null);
- p_281357_.m_280302_(this.f_96547_, p_283466_, p_282403_ + 14, p_283601_, p_283466_.m_41613_() == 1 ? "1" : null);
+ // Forge: fixes Forge-8806, code for count rendering taken from GuiGraphics#renderGuiItemDecorations
+ p_281357_.m_280168_().m_85836_();
+ p_281357_.m_280168_().m_252880_(0.0F, 0.0F, 200.0F);
+ String count = p_283466_.m_41613_() == 1 ? "1" : String.valueOf(p_283466_.m_41613_());
+ f_96547_.m_272078_(count, (float) (p_282403_ + 14) + 19 - 2 - f_96547_.m_92895_(count), (float)p_283601_ + 6 + 3, 0xFFFFFF, true, p_281357_.m_280168_().m_85850_().m_252922_(), p_281357_.m_280091_(), net.minecraft.client.gui.Font.DisplayMode.NORMAL, 0, 15728880, false);
+ p_281357_.m_280168_().m_85849_();
p_281357_.m_280168_().m_85836_();
p_281357_.m_280168_().m_252880_(0.0F, 0.0F, 300.0F);
p_281357_.m_280398_(f_99113_, p_282403_ + 7, p_283601_ + 12, 0, 0.0F, 176.0F, 9, 2, 512, 256);

View file

@ -0,0 +1,15 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/inventory/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/inventory/</h1><hr><pre><a href="../">../</a>
<a href="tooltip/">tooltip/</a> 07-Oct-2023 14:12 -
<a href="AbstractContainerScreen.java.patch">AbstractContainerScreen.java.patch</a> 07-Oct-2023 14:12 10K
<a href="CreativeModeInventoryScreen.java.patch">CreativeModeInventoryScreen.java.patch</a> 07-Oct-2023 14:12 13K
<a href="EffectRenderingInventoryScreen.java.patch">EffectRenderingInventoryScreen.java.patch</a> 07-Oct-2023 14:12 2451
<a href="EnchantmentScreen.java.patch">EnchantmentScreen.java.patch</a> 07-Oct-2023 14:12 2309
<a href="HangingSignEditScreen.java.patch">HangingSignEditScreen.java.patch</a> 07-Oct-2023 14:12 811
<a href="InventoryScreen.java.patch">InventoryScreen.java.patch</a> 07-Oct-2023 14:12 1131
<a href="MerchantScreen.java.patch">MerchantScreen.java.patch</a> 07-Oct-2023 14:12 1346
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="41c021547df31abc4ab96ddbf009e475" data-cf-beacon='{"rayId":"85f02742cdb91c5c","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
@@ -20,6 +_,8 @@
if (p_169951_ instanceof BundleTooltip) {
return new ClientBundleTooltip((BundleTooltip)p_169951_);
} else {
+ ClientTooltipComponent result = net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_);
+ if (result != null) return result;
throw new IllegalArgumentException("Unknown TooltipComponent");
}
}

View file

@ -0,0 +1,49 @@
--- a/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
@@ -17,16 +_,22 @@
private static final int f_262743_ = 1344798847;
public static void m_280205_(GuiGraphics p_282666_, int p_281901_, int p_281846_, int p_281559_, int p_283336_, int p_283422_) {
+ renderTooltipBackground(p_282666_, p_281901_, p_281846_, p_281559_, p_283336_, p_283422_, f_262744_, f_262744_, f_262725_, f_262743_);
+ }
+
+ // Forge: Allow specifying colors for the inner border gradient and a gradient instead of a single color for the background and outer border
+ public static void renderTooltipBackground(GuiGraphics p_282666_, int p_281901_, int p_281846_, int p_281559_, int p_283336_, int p_283422_, int backgroundTop, int backgroundBottom, int borderTop, int borderBottom)
+ {
int i = p_281901_ - 3;
int j = p_281846_ - 3;
int k = p_281559_ + 3 + 3;
int l = p_283336_ + 3 + 3;
- m_280217_(p_282666_, i, j - 1, k, p_283422_, -267386864);
- m_280217_(p_282666_, i, j + l, k, p_283422_, -267386864);
- m_280538_(p_282666_, i, j, k, l, p_283422_, -267386864);
- m_280387_(p_282666_, i - 1, j, l, p_283422_, -267386864);
- m_280387_(p_282666_, i + k, j, l, p_283422_, -267386864);
- m_280115_(p_282666_, i, j + 1, k, l, p_283422_, 1347420415, 1344798847);
+ m_280217_(p_282666_, i, j - 1, k, p_283422_, backgroundTop);
+ m_280217_(p_282666_, i, j + l, k, p_283422_, backgroundBottom);
+ renderRectangle(p_282666_, i, j, k, l, p_283422_, backgroundTop, backgroundBottom);
+ m_280556_(p_282666_, i - 1, j, l, p_283422_, backgroundTop, backgroundBottom);
+ m_280556_(p_282666_, i + k, j, l, p_283422_, backgroundTop, backgroundBottom);
+ m_280115_(p_282666_, i, j + 1, k, l, p_283422_, borderTop, borderBottom);
}
private static void m_280115_(GuiGraphics p_282000_, int p_282055_, int p_281580_, int p_283284_, int p_282599_, int p_283432_, int p_282907_, int p_283153_) {
@@ -48,7 +_,16 @@
p_282981_.m_280046_(p_282028_, p_282141_, p_282028_ + p_281771_, p_282141_ + 1, p_282734_, p_281979_);
}
+ /**
+ * @deprecated Forge: Use gradient overload instead
+ */
+ @Deprecated
private static void m_280538_(GuiGraphics p_281392_, int p_282294_, int p_283353_, int p_282640_, int p_281964_, int p_283211_, int p_282349_) {
- p_281392_.m_280046_(p_282294_, p_283353_, p_282294_ + p_282640_, p_283353_ + p_281964_, p_283211_, p_282349_);
+ renderRectangle(p_281392_, p_282294_, p_283353_, p_282640_, p_281964_, p_283211_, p_282349_, p_282349_);
+ }
+
+ // Forge: Allow specifying a gradient instead of a single color for the background
+ private static void renderRectangle(GuiGraphics p_281392_, int p_282294_, int p_283353_, int p_282640_, int p_281964_, int p_283211_, int p_282349_, int colorTo) {
+ p_281392_.m_280120_(p_282294_, p_283353_, p_282294_ + p_282640_, p_283353_ + p_281964_, p_283211_, p_282349_, colorTo);
}
}

View file

@ -0,0 +1,9 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/</h1><hr><pre><a href="../">../</a>
<a href="ClientTooltipComponent.java.patch">ClientTooltipComponent.java.patch</a> 07-Oct-2023 14:12 597
<a href="TooltipRenderUtil.java.patch">TooltipRenderUtil.java.patch</a> 07-Oct-2023 14:12 3074
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="c64a01724025a8319e82b108afa54583" data-cf-beacon='{"rayId":"85f03a455de91c4c","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,14 @@
--- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
+++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
@@ -283,6 +_,11 @@
}
+ @Override
+ public void m_7379_() {
+ this.f_96541_.m_91152_(this.f_99676_);
+ }
+
public ServerStatusPinger m_99731_() {
return this.f_99675_;
}

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
@@ -318,6 +_,8 @@
this.f_99855_.m_99707_(list1);
}
+ net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.f_99855_, f_99857_, p_281406_, p_281363_, p_282921_, p_283596_, i1, j1);
+
if (this.f_99856_.f_91066_.m_231828_().m_231551_() || p_282999_) {
p_281406_.m_280509_(p_281363_, p_282921_, p_281363_ + 32, p_282921_ + 32, -1601138544);
int k1 = p_283567_ - p_281363_;

View file

@ -0,0 +1,9 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/</h1><hr><pre><a href="../">../</a>
<a href="JoinMultiplayerScreen.java.patch">JoinMultiplayerScreen.java.patch</a> 07-Oct-2023 14:12 359
<a href="ServerSelectionList.java.patch">ServerSelectionList.java.patch</a> 07-Oct-2023 14:12 602
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="8f325cd0e32c72e587764bc5abfad258" data-cf-beacon='{"rayId":"85f027453a961c5c","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,23 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
@@ -110,6 +_,8 @@
boolean m_7802_();
boolean m_7803_();
+
+ default boolean notHidden() { return true; }
}
@OnlyIn(Dist.CLIENT)
@@ -198,6 +_,11 @@
public void m_7845_() {
this.m_99938_(1);
+ }
+
+ @Override
+ public boolean notHidden() {
+ return !f_99933_.isHidden();
}
}

View file

@ -0,0 +1,16 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
@@ -130,10 +_,10 @@
TransferableSelectionList.PackEntry transferableselectionlist$packentry = p_100014_.m_93511_();
String s = transferableselectionlist$packentry == null ? "" : transferableselectionlist$packentry.m_264411_();
p_100014_.m_6987_((TransferableSelectionList.PackEntry)null);
- p_100015_.forEach((p_280875_) -> {
- TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(this.f_96541_, p_100014_, p_280875_);
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach((p_264692_) -> {
+ TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(this.f_96541_, p_100014_, p_264692_);
p_100014_.m_6702_().add(transferableselectionlist$packentry1);
- if (p_280875_.m_264249_().equals(s)) {
+ if (p_264692_.m_264249_().equals(s)) {
p_100014_.m_6987_(transferableselectionlist$packentry1);
}

View file

@ -0,0 +1,9 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/packs/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/packs/</h1><hr><pre><a href="../">../</a>
<a href="PackSelectionModel.java.patch">PackSelectionModel.java.patch</a> 07-Oct-2023 14:12 498
<a href="PackSelectionScreen.java.patch">PackSelectionScreen.java.patch</a> 07-Oct-2023 14:12 1159
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="e0bb6d06af8775921535b116941d2ef1" data-cf-beacon='{"rayId":"85f027479f0a1c5c","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,20 @@
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
@@ -104,7 +_,7 @@
this.m_5674_();
this.f_100279_.clear();
- for(RecipeBookCategories recipebookcategories : RecipeBookCategories.m_92269_(this.f_100271_.m_5867_())) {
+ for(RecipeBookCategories recipebookcategories : this.f_100271_.getRecipeBookCategories()) {
this.f_100279_.add(new RecipeBookTabButton(recipebookcategories));
}
@@ -294,7 +_,7 @@
}
if (itemstack != null && this.f_100272_.f_91080_ != null) {
- p_282776_.m_280666_(this.f_100272_.f_91062_, Screen.m_280152_(this.f_100272_, itemstack), p_282948_, p_283050_);
+ p_282776_.renderComponentTooltip(this.f_100272_.f_91062_, Screen.m_280152_(this.f_100272_, itemstack), p_282948_, p_283050_, itemstack);
}
}

View file

@ -0,0 +1,8 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/recipebook/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/recipebook/</h1><hr><pre><a href="../">../</a>
<a href="RecipeBookComponent.java.patch">RecipeBookComponent.java.patch</a> 07-Oct-2023 14:12 908
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="511a87e29cab6a2222eb6d490e52769a" data-cf-beacon='{"rayId":"85f0274a0c631c5c","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,78 @@
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
@@ -120,6 +_,7 @@
public static void m_232896_(Minecraft p_232897_, @Nullable Screen p_232898_) {
m_232899_(p_232897_, f_232866_);
PackRepository packrepository = new PackRepository(new ServerPacksSource());
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.event.AddPackFindersEvent(net.minecraft.server.packs.PackType.SERVER_DATA, packrepository::addPackFinder));
WorldLoader.InitConfig worldloader$initconfig = m_245574_(packrepository, WorldDataConfiguration.f_244649_);
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.m_214362_(worldloader$initconfig, (p_247792_) -> {
return new WorldLoader.DataLoadOutput<>(new CreateWorldScreen.DataPackReloadCookie(new WorldGenSettings(WorldOptions.m_247394_(), WorldPresets.m_246552_(p_247792_.f_244104_())), p_247792_.f_244127_()), p_247792_.f_243759_());
@@ -367,7 +_,7 @@
if (p_269627_) {
p_270552_.accept(this.f_267389_.m_267573_().f_243842_());
} else {
- p_270552_.accept(WorldDataConfiguration.f_244649_);
+ p_270552_.accept(new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.f_244332_)); // FORGE: Revert to *actual* vanilla data
}
}, Component.m_237115_("dataPack.validation.failed"), CommonComponents.f_237098_, Component.m_237115_("dataPack.validation.back"), Component.m_237115_("dataPack.validation.reset")));
@@ -416,28 +_,28 @@
private Optional<LevelStorageSource.LevelStorageAccess> m_232868_() {
String s = this.f_267389_.m_275837_();
- try {
- LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = this.f_96541_.m_91392_().m_78260_(s);
- if (this.f_100831_ == null) {
- return Optional.of(levelstoragesource$levelstorageaccess);
- }
-
- try (Stream<Path> stream = Files.walk(this.f_100831_)) {
- Path path = levelstoragesource$levelstorageaccess.m_78283_(LevelResource.f_78180_);
- FileUtil.m_257659_(path);
- stream.filter((p_232921_) -> {
- return !p_232921_.equals(this.f_100831_);
- }).forEach((p_232945_) -> {
- m_100912_(this.f_100831_, path, p_232945_);
- });
- return Optional.of(levelstoragesource$levelstorageaccess);
- } catch (UncheckedIOException | IOException ioexception) {
- f_100848_.warn("Failed to copy datapacks to world {}", s, ioexception);
- levelstoragesource$levelstorageaccess.close();
- }
- } catch (UncheckedIOException | IOException ioexception1) {
- f_100848_.warn("Failed to create access for {}", s, ioexception1);
- }
+// try {
+// LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = this.minecraft.getLevelSource().createAccess(s);
+// if (this.tempDataPackDir == null) {
+// return Optional.of(levelstoragesource$levelstorageaccess);
+// }
+//
+// try (Stream<Path> stream = Files.walk(this.tempDataPackDir)) {
+// Path path = levelstoragesource$levelstorageaccess.getLevelPath(LevelResource.DATAPACK_DIR);
+// FileUtil.createDirectoriesSafe(path);
+// stream.filter((p_232921_) -> {
+// return !p_232921_.equals(this.tempDataPackDir);
+// }).forEach((p_232945_) -> {
+// copyBetweenDirs(this.tempDataPackDir, path, p_232945_);
+// });
+// return Optional.of(levelstoragesource$levelstorageaccess);
+// } catch (UncheckedIOException | IOException ioexception) {
+// LOGGER.warn("Failed to copy datapacks to world {}", s, ioexception);
+// levelstoragesource$levelstorageaccess.close();
+// }
+// } catch (UncheckedIOException | IOException ioexception1) {
+// LOGGER.warn("Failed to create access for {}", s, ioexception1);
+// }
SystemToast.m_94875_(this.f_96541_, s);
this.m_100967_();
@@ -481,6 +_,7 @@
if (path != null) {
if (this.f_100832_ == null) {
this.f_100832_ = ServerPacksSource.m_245786_(path);
+ net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(this.f_100832_, net.minecraftforge.server.ServerLifecycleHooks::buildPackFinder);
this.f_100832_.m_10506_();
}

View file

@ -0,0 +1,13 @@
--- a/net/minecraft/client/gui/screens/worldselection/PresetEditor.java
+++ b/net/minecraft/client/gui/screens/worldselection/PresetEditor.java
@@ -28,6 +_,10 @@
@OnlyIn(Dist.CLIENT)
public interface PresetEditor {
+ /**
+ * @deprecated Forge: Use {@link net.minecraftforge.client.PresetEditorManager#get(ResourceKey)} instead.
+ */
+ @Deprecated
Map<Optional<ResourceKey<WorldPreset>>, PresetEditor> f_232950_ = Map.of(Optional.of(WorldPresets.f_226438_), (p_232974_, p_232975_) -> {
ChunkGenerator chunkgenerator = p_232975_.f_243796_().m_246737_();
RegistryAccess registryaccess = p_232975_.m_246480_();

View file

@ -0,0 +1,13 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java
@@ -38,6 +_,10 @@
return new WorldCreationContext(this.f_244272_, this.f_244375_, p_250676_.apply(this.m_246480_(), this.f_243796_), this.f_243708_, this.f_232990_, this.f_243842_);
}
+ public WorldCreationContext withDataConfiguration(WorldDataConfiguration dataConfiguration) {
+ return new WorldCreationContext(this.f_244272_, this.f_244375_, this.f_243796_, this.f_243708_, this.f_232990_, dataConfiguration);
+ }
+
public RegistryAccess.Frozen m_246480_() {
return this.f_243708_.m_247579_();
}

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
@@ -226,7 +_,7 @@
@Nullable
public PresetEditor m_267744_() {
Holder<WorldPreset> holder = this.m_267828_().f_267398_();
- return holder != null ? PresetEditor.f_232950_.get(holder.m_203543_()) : null;
+ return holder != null ? holder.m_203543_().map(net.minecraftforge.client.PresetEditorManager::get).orElse(null) : null; // FORGE: redirect lookup to expanded map
}
public List<WorldCreationUiState.WorldTypeEntry> m_267815_() {

View file

@ -0,0 +1,70 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
@@ -88,18 +_,8 @@
@Nullable
private LevelStorageSource.LevelStorageAccess m_233155_(String p_233156_) {
- try {
- return this.f_233090_.m_289864_(p_233156_);
- } catch (IOException ioexception) {
- f_233088_.warn("Failed to read level {} data", p_233156_, ioexception);
- SystemToast.m_94852_(this.f_233089_, p_233156_);
- this.f_233089_.m_91152_((Screen)null);
- return null;
- } catch (ContentValidationException contentvalidationexception) {
- f_233088_.warn("{}", (Object)contentvalidationexception.getMessage());
- this.f_233089_.m_91152_(new SymlinkWarningScreen((Screen)null));
- return null;
- }
+ // you dont care we aint a client
+ return null;
}
public void m_245064_(LevelStorageSource.LevelStorageAccess p_250919_, ReloadableServerResources p_248897_, LayeredRegistryAccess<RegistryLayer> p_250801_, WorldData p_251654_) {
@@ -165,13 +_,23 @@
}
private void m_233145_(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_) {
+ // FORGE: Patch in overload to reduce further patching
+ this.doLoadLevel(p_233146_, p_233147_, p_233148_, p_233149_, false);
+ }
+
+ // FORGE: Patch in confirmExperimentalWarning which confirms the experimental warning when true
+ private void doLoadLevel(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_, boolean confirmExperimentalWarning) {
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = this.m_233155_(p_233147_);
if (levelstoragesource$levelstorageaccess != null) {
PackRepository packrepository = ServerPacksSource.m_247728_(levelstoragesource$levelstorageaccess);
WorldStem worldstem;
try {
+ levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); // Read extra (e.g. modded) data from the world before creating it
worldstem = this.m_233122_(levelstoragesource$levelstorageaccess, p_233148_, packrepository);
+ if (confirmExperimentalWarning && worldstem.f_206895_() instanceof PrimaryLevelData pld) {
+ pld.withConfirmedWarning(true);
+ }
} catch (Exception exception) {
f_233088_.warn("Failed to load level data or datapacks, can't proceed with server load", (Throwable)exception);
if (!p_233148_) {
@@ -191,7 +_,9 @@
WorldData worlddata = worldstem.f_206895_();
boolean flag = worlddata.m_246337_().m_247070_();
boolean flag1 = worlddata.m_5754_() != Lifecycle.stable();
- if (!p_233149_ || !flag && !flag1) {
+ // Forge: Skip confirmation if it has been done already for this world
+ boolean skipConfirmation = worlddata instanceof PrimaryLevelData pld && pld.hasConfirmedExperimentalWarning();
+ if (skipConfirmation || !p_233149_ || !flag && !flag1) {
this.f_233089_.m_247489_().m_247400_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> {
return true;
}).exceptionallyComposeAsync((p_233183_) -> {
@@ -213,9 +_,11 @@
return null;
});
} else {
+ if (flag) // Forge: For legacy world options, let vanilla handle it.
this.m_233140_(p_233146_, p_233147_, flag, () -> {
this.m_233145_(p_233146_, p_233147_, p_233148_, false);
});
+ else net.minecraftforge.client.ForgeHooksClient.createWorldConfirmationScreen(() -> this.doLoadLevel(p_233146_, p_233147_, p_233148_, false, true));
worldstem.close();
m_233116_(levelstoragesource$levelstorageaccess, p_233147_);
}

View file

@ -0,0 +1,38 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
@@ -68,6 +_,7 @@
static final DateFormat f_101646_ = new SimpleDateFormat();
private static final ResourceLocation f_101647_ = new ResourceLocation("textures/misc/unknown_server.png");
static final ResourceLocation f_101648_ = new ResourceLocation("textures/gui/world_selection.png");
+ private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = new ResourceLocation("forge","textures/gui/experimental_warning.png");
static final Component f_101649_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion1").m_130940_(ChatFormatting.RED);
static final Component f_101650_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion2").m_130940_(ChatFormatting.RED);
static final Component f_101651_ = Component.m_237115_("selectWorld.tooltip.snapshot1").m_130940_(ChatFormatting.GOLD);
@@ -361,6 +_,7 @@
RenderSystem.enableBlend();
p_281612_.m_280163_(this.f_101698_.m_289196_(), p_282820_, p_283181_, 0.0F, 0.0F, 32, 32, 32, 32);
RenderSystem.disableBlend();
+ renderExperimentalWarning(p_281612_, p_283204_, p_283025_, p_283181_, p_282820_);
if (this.f_101693_.f_91066_.m_231828_().m_231551_() || p_283396_) {
p_281612_.m_280509_(p_282820_, p_283181_, p_282820_ + 32, p_283181_ + 32, -1601138544);
int j = p_283204_ - p_282820_;
@@ -604,6 +_,19 @@
public boolean m_214209_() {
return !this.f_101695_.m_164916_();
+ }
+
+ // FORGE: Patch in experimental warning icon for worlds in the world selection screen
+ private void renderExperimentalWarning(GuiGraphics guiGraphics, int mouseX, int mouseY, int top, int left) {
+ if (this.f_101695_.isLifecycleExperimental()) {
+ int leftStart = left + WorldSelectionList.this.m_5759_();
+ guiGraphics.m_280163_(WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
+ if (WorldSelectionList.this.m_93412_(mouseX, mouseY) == this && mouseX > leftStart - 36 && mouseX < leftStart) {
+ var font = Minecraft.m_91087_().f_91062_;
+ List<net.minecraft.util.FormattedCharSequence> tooltip = font.m_92923_(Component.m_237115_("forge.experimentalsettings.tooltip"), 200);
+ guiGraphics.m_280245_(font, tooltip, mouseX, mouseY);
+ }
+ }
}
}
}

View file

@ -0,0 +1,13 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/worldselection/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/gui/screens/worldselection/</h1><hr><pre><a href="../">../</a>
<a href="CreateWorldScreen.java.patch">CreateWorldScreen.java.patch</a> 07-Oct-2023 14:12 4646
<a href="PresetEditor.java.patch">PresetEditor.java.patch</a> 07-Oct-2023 14:12 639
<a href="WorldCreationContext.java.patch">WorldCreationContext.java.patch</a> 07-Oct-2023 14:12 697
<a href="WorldCreationUiState.java.patch">WorldCreationUiState.java.patch</a> 07-Oct-2023 14:12 626
<a href="WorldOpenFlows.java.patch">WorldOpenFlows.java.patch</a> 07-Oct-2023 14:12 3889
<a href="WorldSelectionList.java.patch">WorldSelectionList.java.patch</a> 07-Oct-2023 14:12 2545
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="ca56426ae213378242c8bf428ffbbcfd" data-cf-beacon='{"rayId":"85f0274c78d01c5c","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/</h1><hr><pre><a href="../">../</a>
<a href="color/">color/</a> 07-Oct-2023 14:12 -
<a href="gui/">gui/</a> 07-Oct-2023 14:12 -
<a href="main/">main/</a> 07-Oct-2023 14:12 -
<a href="model/">model/</a> 07-Oct-2023 14:12 -
<a href="multiplayer/">multiplayer/</a> 03-Nov-2023 06:00 -
<a href="particle/">particle/</a> 07-Oct-2023 14:12 -
<a href="player/">player/</a> 07-Oct-2023 14:12 -
<a href="renderer/">renderer/</a> 07-Oct-2023 14:12 -
<a href="resources/">resources/</a> 07-Oct-2023 14:12 -
<a href="server/">server/</a> 07-Oct-2023 14:12 -
<a href="sounds/">sounds/</a> 07-Oct-2023 14:12 -
<a href="Camera.java.patch">Camera.java.patch</a> 07-Oct-2023 14:12 676
<a href="ClientBrandRetriever.java.patch">ClientBrandRetriever.java.patch</a> 07-Oct-2023 14:12 303
<a href="ClientRecipeBook.java.patch">ClientRecipeBook.java.patch</a> 07-Oct-2023 14:12 1239
<a href="KeyMapping.java.patch">KeyMapping.java.patch</a> 07-Oct-2023 14:12 8521
<a href="KeyboardHandler.java.patch">KeyboardHandler.java.patch</a> 07-Oct-2023 14:12 4136
<a href="Minecraft.java.patch">Minecraft.java.patch</a> 07-Oct-2023 14:12 21K
<a href="MouseHandler.java.patch">MouseHandler.java.patch</a> 07-Oct-2023 14:12 5155
<a href="Options.java.patch">Options.java.patch</a> 07-Oct-2023 14:12 4296
<a href="RecipeBookCategories.java.patch">RecipeBookCategories.java.patch</a> 07-Oct-2023 14:12 2179
<a href="Screenshot.java.patch">Screenshot.java.patch</a> 07-Oct-2023 14:12 1508
<a href="ToggleKeyMapping.java.patch">ToggleKeyMapping.java.patch</a> 07-Oct-2023 14:12 603
<a href="User.java.patch">User.java.patch</a> 07-Oct-2023 14:12 2274
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="2c69307a8978a93ab6c9815910a25a6b" data-cf-beacon='{"rayId":"85f016449f8850c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,12 @@
--- a/net/minecraft/client/main/Main.java
+++ b/net/minecraft/client/main/Main.java
@@ -147,8 +_,8 @@
}
CrashReport.m_127529_();
- Bootstrap.m_135870_();
GameLoadTimesEvent.f_285635_.m_286069_(Bootstrap.f_285608_.get());
+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.m_135870_(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick);
Bootstrap.m_135889_();
Util.m_137584_();
String s13 = optionspec25.value(optionset);

View file

@ -0,0 +1,8 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/main/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/main/</h1><hr><pre><a href="../">../</a>
<a href="Main.java.patch">Main.java.patch</a> 07-Oct-2023 14:12 510
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="d3836d4f004da8e7d9b8e22b96b1c6f8" data-cf-beacon='{"rayId":"85f01707fd2050c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,59 @@
--- a/net/minecraft/client/model/HumanoidModel.java
+++ b/net/minecraft/client/model/HumanoidModel.java
@@ -270,6 +_,8 @@
case TOOT_HORN:
this.f_102811_.f_104203_ = Mth.m_14036_(this.f_102808_.f_104203_, -1.2F, 1.2F) - 1.4835298F;
this.f_102811_.f_104204_ = this.f_102808_.f_104204_ - ((float)Math.PI / 6F);
+ default:
+ this.f_102816_.applyTransform(this, p_102876_, net.minecraft.world.entity.HumanoidArm.RIGHT);
}
}
@@ -314,6 +_,8 @@
case TOOT_HORN:
this.f_102812_.f_104203_ = Mth.m_14036_(this.f_102808_.f_104203_, -1.2F, 1.2F) - 1.4835298F;
this.f_102812_.f_104204_ = this.f_102808_.f_104204_ + ((float)Math.PI / 6F);
+ default:
+ this.f_102815_.applyTransform(this, p_102879_, net.minecraft.world.entity.HumanoidArm.LEFT);
}
}
@@ -406,7 +_,7 @@
}
@OnlyIn(Dist.CLIENT)
- public static enum ArmPose {
+ public static enum ArmPose implements net.minecraftforge.common.IExtensibleEnum {
EMPTY(false),
ITEM(false),
BLOCK(false),
@@ -422,10 +_,29 @@
private ArmPose(boolean p_102896_) {
this.f_102890_ = p_102896_;
+ this.forgeArmPose = null;
}
public boolean m_102897_() {
return this.f_102890_;
}
+ // FORGE START
+ @javax.annotation.Nullable
+ private final net.minecraftforge.client.IArmPoseTransformer forgeArmPose;
+
+ private ArmPose(boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
+ this.f_102890_ = twoHanded;
+ com.google.common.base.Preconditions.checkNotNull(forgeArmPose, "Cannot create new ArmPose with null transformer!");
+ this.forgeArmPose = forgeArmPose;
+ }
+
+ public static ArmPose create(String name, boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
+ throw new IllegalStateException("Enum not extended");
+ }
+
+ public <T extends LivingEntity> void applyTransform(HumanoidModel<T> model, T entity, net.minecraft.world.entity.HumanoidArm arm) {
+ if (this.forgeArmPose != null) this.forgeArmPose.applyTransform(model, entity, arm);
+ }
+ // FORGE END
}
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
@@ -319,6 +_,7 @@
WoodType.m_61843_().forEach((p_247864_) -> {
builder.put(ModelLayers.m_247439_(p_247864_), layerdefinition24);
});
+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder);
ImmutableMap<ModelLayerLocation, LayerDefinition> immutablemap = builder.build();
List<ModelLayerLocation> list = ModelLayers.m_171288_().filter((p_171117_) -> {
return !immutablemap.containsKey(p_171117_);

View file

@ -0,0 +1,18 @@
--- a/net/minecraft/client/model/geom/ModelLayers.java
+++ b/net/minecraft/client/model/geom/ModelLayers.java
@@ -220,11 +_,13 @@
}
public static ModelLayerLocation m_171291_(WoodType p_171292_) {
- return m_171300_("sign/" + p_171292_.f_61839_(), "main");
+ ResourceLocation location = new ResourceLocation(p_171292_.f_61839_());
+ return new ModelLayerLocation(new ResourceLocation(location.m_135827_(), "sign/" + location.m_135815_()), "main");
}
public static ModelLayerLocation m_247439_(WoodType p_252225_) {
- return m_171300_("hanging_sign/" + p_252225_.f_61839_(), "main");
+ ResourceLocation location = new ResourceLocation(p_252225_.f_61839_());
+ return new ModelLayerLocation(new ResourceLocation(location.m_135827_(), "hanging_sign/" + location.m_135815_()), "main");
}
public static Stream<ModelLayerLocation> m_171288_() {

View file

@ -0,0 +1,9 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/model/geom/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/model/geom/</h1><hr><pre><a href="../">../</a>
<a href="LayerDefinitions.java.patch">LayerDefinitions.java.patch</a> 07-Oct-2023 14:12 589
<a href="ModelLayers.java.patch">ModelLayers.java.patch</a> 07-Oct-2023 14:12 899
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="790f3f1f22f828b7f8af56a11e00414e" data-cf-beacon='{"rayId":"85f019f2490f50c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,9 @@
<html>
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/model/</title></head>
<body>
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/client/model/</h1><hr><pre><a href="../">../</a>
<a href="geom/">geom/</a> 07-Oct-2023 14:12 -
<a href="HumanoidModel.java.patch">HumanoidModel.java.patch</a> 07-Oct-2023 14:12 2322
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="f42d332edb42a32f4815f65a846262f2" data-cf-beacon='{"rayId":"85f0170a494950c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java
+++ b/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java
@@ -75,6 +_,8 @@
this.m_253216_(profilekeypair);
return Optional.of(profilekeypair);
} catch (CryptException | MinecraftClientException | IOException ioexception) {
+ // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev
+ if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || this.f_252526_ != UserApiService.OFFLINE)
f_252448_.error("Failed to retrieve profile key pair", (Throwable)ioexception);
this.m_253216_((ProfileKeyPair)null);
return p_254074_;

View file

@ -0,0 +1,18 @@
--- a/net/minecraft/client/multiplayer/ClientChunkCache.java
+++ b/net/minecraft/client/multiplayer/ClientChunkCache.java
@@ -60,6 +_,7 @@
int i = this.f_104410_.m_104481_(p_104456_, p_104457_);
LevelChunk levelchunk = this.f_104410_.m_104479_(i);
if (m_104438_(levelchunk, p_104456_, p_104457_)) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Unload(levelchunk));
this.f_104410_.m_104487_(i, levelchunk, (LevelChunk)null);
}
@@ -115,6 +_,7 @@
}
this.f_104411_.m_171649_(chunkpos);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(levelchunk, false));
return levelchunk;
}
}

View file

@ -0,0 +1,27 @@
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
@@ -129,6 +_,7 @@
this.f_104521_.accept(Component.m_237115_("connect.joining"));
this.f_104523_ = p_104547_.m_134774_();
this.f_104522_.m_129498_(ConnectionProtocol.PLAY);
+ net.minecraftforge.network.NetworkHooks.handleClientLoginSuccess(this.f_104522_);
this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_243717_, this.f_104523_, this.f_104519_.m_261007_().m_285995_(this.f_260722_, this.f_260612_, this.f_285614_)));
}
@@ -136,7 +_,7 @@
if (this.f_104520_ != null && this.f_104520_ instanceof RealmsScreen) {
this.f_104519_.m_91152_(new DisconnectedRealmsScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_));
} else {
- this.f_104519_.m_91152_(new DisconnectedScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_));
+ this.f_104519_.m_91152_(net.minecraftforge.network.NetworkHooks.getModMismatchData(f_104522_) != null ? new net.minecraftforge.client.gui.ModMismatchDisconnectedScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_, net.minecraftforge.network.NetworkHooks.getModMismatchData(f_104522_)) : new DisconnectedScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_));
}
}
@@ -157,6 +_,7 @@
}
public void m_7254_(ClientboundCustomQueryPacket p_104545_) {
+ if (net.minecraftforge.network.NetworkHooks.onCustomPayload(p_104545_, this.f_104522_)) return;
this.f_104521_.accept(Component.m_237115_("connect.negotiating"));
this.f_104522_.m_129512_(new ServerboundCustomQueryPacket(p_104545_.m_134755_(), (FriendlyByteBuf)null));
}

View file

@ -0,0 +1,176 @@
--- a/net/minecraft/client/multiplayer/ClientLevel.java
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
@@ -41,6 +_,7 @@
import net.minecraft.network.protocol.Packet;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.BlockTags;
@@ -70,6 +_,7 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.dimension.DimensionType;
+import net.minecraft.world.level.dimension.LevelStem;
import net.minecraft.world.level.entity.EntityTickList;
import net.minecraft.world.level.entity.LevelCallback;
import net.minecraft.world.level.entity.LevelEntityGetter;
@@ -116,12 +_,15 @@
p_194170_.put(BiomeColors.f_108791_, new BlockTintCache((p_194168_) -> {
return this.m_104762_(p_194168_, BiomeColors.f_108791_);
}));
+ net.minecraftforge.client.ColorResolverManager.registerBlockTintCaches(ClientLevel.this, p_194170_);
});
private final ClientChunkCache f_104559_;
private final Deque<Runnable> f_194122_ = Queues.newArrayDeque();
private int f_194123_;
private final BlockStatePredictionHandler f_233599_ = new BlockStatePredictionHandler();
private static final Set<Item> f_194124_ = Set.of(Items.f_42127_, Items.f_151033_);
+ private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraftforge.entity.PartEntity<?>> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>();
+ private final net.minecraftforge.client.model.data.ModelDataManager modelDataManager = new net.minecraftforge.client.model.data.ModelDataManager(this);
public void m_233651_(int p_233652_) {
this.f_233599_.m_233856_(p_233652_, this);
@@ -150,6 +_,11 @@
return this.f_233599_;
}
+ @Override
+ public ResourceKey<LevelStem> getTypeKey() {
+ return null;
+ }
+
public boolean m_6933_(BlockPos p_233643_, BlockState p_233644_, int p_233645_, int p_233646_) {
if (this.f_233599_.m_233872_()) {
BlockState blockstate = this.m_8055_(p_233643_);
@@ -175,6 +_,8 @@
this.f_194123_ = p_205510_;
this.m_46465_();
this.m_46466_();
+ this.gatherCapabilities();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Load(this));
}
public void m_194171_(Runnable p_194172_) {
@@ -265,6 +_,7 @@
this.m_46473_().m_6521_(() -> {
return BuiltInRegistries.f_256780_.m_7981_(p_104640_.m_6095_()).toString();
});
+ if (p_104640_.canUpdate())
p_104640_.m_8119_();
this.m_46473_().m_7238_();
@@ -327,8 +_,10 @@
}
private void m_104739_(int p_104740_, Entity p_104741_) {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinLevelEvent(p_104741_, this))) return;
this.m_171642_(p_104740_, Entity.RemovalReason.DISCARDED);
this.f_171631_.m_157653_(p_104741_);
+ p_104741_.onAddedToWorld();
}
public void m_171642_(int p_171643_, Entity.RemovalReason p_171644_) {
@@ -455,6 +_,12 @@
}
public void m_262808_(@Nullable Player p_263381_, double p_263372_, double p_263404_, double p_263365_, Holder<SoundEvent> p_263335_, SoundSource p_263417_, float p_263416_, float p_263349_, long p_263408_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtPosition event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_263372_, p_263404_, p_263365_, p_263335_, p_263417_, p_263416_, p_263349_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_263335_ = event.getSound();
+ p_263417_ = event.getSource();
+ p_263416_ = event.getNewVolume();
+ p_263349_ = event.getNewPitch();
if (p_263381_ == this.f_104565_.f_91074_) {
this.m_233602_(p_263372_, p_263404_, p_263365_, p_263335_.m_203334_(), p_263417_, p_263416_, p_263349_, false, p_263408_);
}
@@ -462,6 +_,12 @@
}
public void m_213890_(@Nullable Player p_263514_, Entity p_263536_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_263536_, p_263518_, p_263487_, p_263538_, p_263524_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_263518_ = event.getSound();
+ p_263487_ = event.getSource();
+ p_263538_ = event.getNewVolume();
+ p_263524_ = event.getNewPitch();
if (p_263514_ == this.f_104565_.f_91074_) {
this.f_104565_.m_91106_().m_120367_(new EntityBoundSoundInstance(p_263518_.m_203334_(), p_263487_, p_263538_, p_263524_, p_263536_, p_263509_));
}
@@ -757,6 +_,11 @@
public void m_214171_(GameEvent p_233639_, Vec3 p_233640_, GameEvent.Context p_233641_) {
}
+ @Override
+ public ServerLevel getMinecraftWorld() {
+ return null;
+ }
+
protected Map<String, MapItemSavedData> m_171684_() {
return ImmutableMap.copyOf(this.f_104556_);
}
@@ -765,7 +_,7 @@
this.f_104556_.putAll(p_171673_);
}
- protected LevelEntityGetter<Entity> m_142646_() {
+ public LevelEntityGetter<Entity> m_142646_() {
return this.f_171631_.m_157645_();
}
@@ -899,6 +_,7 @@
}
public void m_104851_(Difficulty p_104852_) {
+ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_104852_, this.f_104840_);
this.f_104840_ = p_104852_;
}
@@ -936,14 +_,46 @@
ClientLevel.this.f_104566_.add((AbstractClientPlayer)p_171712_);
}
+ if (p_171712_.isMultipartEntity()) {
+ for (net.minecraftforge.entity.PartEntity<?> part : p_171712_.getParts()) {
+ ClientLevel.this.partEntities.put(part.m_19879_(), part);
+ }
+ }
}
public void m_141981_(Entity p_171716_) {
p_171716_.m_19877_();
ClientLevel.this.f_104566_.remove(p_171716_);
+
+ p_171716_.onRemovedFromWorld();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityLeaveLevelEvent(p_171716_, ClientLevel.this));
+
+ if (p_171716_.isMultipartEntity()) {
+ for (net.minecraftforge.entity.PartEntity<?> part : p_171716_.getParts()) {
+ ClientLevel.this.partEntities.remove(part.m_19879_());
+ }
+ }
}
public void m_214006_(Entity p_233660_) {
}
+ }
+
+ @Override
+ public java.util.Collection<net.minecraftforge.entity.PartEntity<?>> getPartEntities() {
+ return this.partEntities.values();
+ }
+
+ @Override
+ public net.minecraftforge.client.model.data.ModelDataManager getModelDataManager() {
+ return modelDataManager;
+ }
+
+ @Override
+ public float getShade(float normalX, float normalY, float normalZ, boolean shade) {
+ boolean constantAmbientLight = this.m_104583_().m_108885_();
+ if (!shade)
+ return constantAmbientLight ? 0.9F : 1.0F;
+ return net.minecraftforge.client.model.lighting.QuadLighter.calculateShade(normalX, normalY, normalZ, constantAmbientLight);
}
}

View file

@ -0,0 +1,113 @@
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
@@ -412,6 +_,7 @@
this.f_104888_.f_91064_.m_113434_();
this.f_104888_.f_91074_.m_172530_();
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogin(this.f_104888_.f_91072_, this.f_104888_.f_91074_, this.f_104888_.m_91403_().f_104885_);
int i = p_105030_.f_132360_();
this.f_104888_.f_91074_.m_20234_(i);
this.f_104889_.m_104630_(i, this.f_104888_.f_91074_);
@@ -425,6 +_,7 @@
this.f_104888_.f_91074_.m_287199_(p_105030_.f_286971_());
this.f_104888_.f_91072_.m_171805_(p_105030_.f_132363_(), p_105030_.f_132364_());
this.f_104888_.f_91066_.m_193770_(p_105030_.f_132370_());
+ net.minecraftforge.network.NetworkHooks.sendMCRegistryPackets(f_104885_, "PLAY_TO_SERVER");
this.f_104888_.f_91066_.m_92172_();
this.f_104885_.m_129512_(new ServerboundCustomPayloadPacket(ServerboundCustomPayloadPacket.f_133979_, (new FriendlyByteBuf(Unpooled.buffer())).m_130070_(ClientBrandRetriever.getClientModName())));
this.f_252517_ = null;
@@ -817,7 +_,7 @@
public void m_213990_(ClientboundSystemChatPacket p_233708_) {
PacketUtils.m_131363_(p_233708_, this, this.f_104888_);
- this.f_104888_.m_240442_().m_240494_(p_233708_.f_237849_(), p_233708_.f_240374_());
+ // this.minecraft.getChatListener().handleSystemMessage(p_233708_.content(), p_233708_.overlay());
}
public void m_213629_(ClientboundPlayerChatPacket p_233702_) {
@@ -1069,8 +_,10 @@
localplayer1.m_21204_().m_22159_(localplayer.m_21204_());
}
+ localplayer1.updateSyncFields(localplayer); // Forge: fix MC-10657
localplayer1.m_172530_();
localplayer1.m_108748_(s);
+ net.minecraftforge.client.ForgeHooksClient.firePlayerRespawn(this.f_104888_.f_91072_, localplayer, localplayer1, localplayer1.f_108617_.f_104885_);
this.f_104889_.m_104630_(i, localplayer1);
localplayer1.m_146922_(-180.0F);
localplayer1.f_108618_ = new KeyboardInput(this.f_104888_.f_91066_);
@@ -1180,10 +_,7 @@
PacketUtils.m_131363_(p_104976_, this, this.f_104888_);
BlockPos blockpos = p_104976_.m_131704_();
this.f_104888_.f_91073_.m_141902_(blockpos, p_104976_.m_195645_()).ifPresent((p_205557_) -> {
- CompoundTag compoundtag = p_104976_.m_131708_();
- if (compoundtag != null) {
- p_205557_.m_142466_(compoundtag);
- }
+ p_205557_.onDataPacket(f_104885_, p_104976_);
if (p_205557_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) {
((CommandBlockEditScreen)this.f_104888_.f_91080_).m_98398_();
@@ -1329,7 +_,9 @@
public void m_7443_(ClientboundCommandsPacket p_104990_) {
PacketUtils.m_131363_(p_104990_, this, this.f_104888_);
- this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(CommandBuildContext.m_255418_(this.f_104903_.m_247579_(), this.f_244039_)));
+ var context = CommandBuildContext.m_255418_(this.f_104903_.m_247579_(), this.f_244039_);
+ this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(context));
+ this.f_104899_ = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.f_104899_, context);
}
public void m_7183_(ClientboundStopSoundPacket p_105116_) {
@@ -1348,6 +_,7 @@
ClientRecipeBook clientrecipebook = this.f_104888_.f_91074_.m_108631_();
clientrecipebook.m_266394_(this.f_104900_.m_44051_(), this.f_104888_.f_91073_.m_9598_());
this.f_104888_.m_231374_(SearchRegistry.f_119943_, clientrecipebook.m_90639_());
+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.f_104900_);
}
public void m_7244_(ClientboundPlayerLookAtPacket p_105054_) {
@@ -1443,7 +_,8 @@
Blocks.m_50758_();
}
- CreativeModeTabs.m_258007_().m_257466_();
+ CreativeModeTabs.m_257478_().stream().filter(net.minecraft.world.item.CreativeModeTab::hasSearchBar).forEach(net.minecraft.world.item.CreativeModeTab::m_257466_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.f_104903_.m_247579_(), true, f_104885_.m_129531_()));
}
public void m_241155_(ClientboundUpdateEnabledFeaturesPacket p_251591_) {
@@ -1855,6 +_,7 @@
}
public void m_7413_(ClientboundCustomPayloadPacket p_105004_) {
+ if (net.minecraftforge.network.NetworkHooks.onCustomPayload(p_105004_, this.f_104885_)) return;
PacketUtils.m_131363_(p_105004_, this, this.f_104888_);
ResourceLocation resourcelocation = p_105004_.m_132042_();
FriendlyByteBuf friendlybytebuf = null;
@@ -2052,7 +_,7 @@
int j5 = friendlybytebuf.m_130242_();
this.f_104888_.f_91064_.f_173815_.m_173830_(positionsource, j5);
} else {
- f_104883_.warn("Unknown custom packed identifier: {}", (Object)resourcelocation);
+ f_104883_.warn("Unknown custom packet identifier: {}", (Object)resourcelocation);
}
} finally {
if (friendlybytebuf != null) {
@@ -2399,6 +_,8 @@
}
public void m_246175_(String p_249888_) {
+ p_249888_ = net.minecraftforge.client.ForgeHooksClient.onClientSendMessage(p_249888_);
+ if (p_249888_.isEmpty()) return;
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.m_216113_();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.f_244346_.m_246442_();
@@ -2407,6 +_,7 @@
}
public void m_246623_(String p_250092_) {
+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_250092_)) return;
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.m_216113_();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.f_244346_.m_246442_();

View file

@ -0,0 +1,170 @@
--- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
+++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
@@ -104,6 +_,7 @@
}
public boolean m_105267_(BlockPos p_105268_) {
+ if (f_105189_.f_91074_.m_21205_().onBlockStartBreak(p_105268_, f_105189_.f_91074_)) return false;
if (this.f_105189_.f_91074_.m_36187_(this.f_105189_.f_91073_, p_105268_, this.f_105197_)) {
return false;
} else {
@@ -118,9 +_,8 @@
} else if (blockstate.m_60795_()) {
return false;
} else {
- block.m_5707_(level, p_105268_, blockstate, this.f_105189_.f_91074_);
FluidState fluidstate = level.m_6425_(p_105268_);
- boolean flag = level.m_7731_(p_105268_, fluidstate.m_76188_(), 11);
+ boolean flag = blockstate.onDestroyedByPlayer(level, p_105268_, f_105189_.f_91074_, false, fluidstate);
if (flag) {
block.m_6786_(level, p_105268_, blockstate);
}
@@ -141,6 +_,7 @@
BlockState blockstate = this.f_105189_.f_91073_.m_8055_(p_105270_);
this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105270_, blockstate, 1.0F);
this.m_233729_(this.f_105189_.f_91073_, (p_233757_) -> {
+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105270_, p_105271_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK).isCanceled())
this.m_105267_(p_105270_);
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_);
});
@@ -149,15 +_,19 @@
if (this.f_105196_) {
this.f_105190_.m_104955_(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.f_105191_, p_105271_));
}
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105270_, p_105271_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK);
BlockState blockstate1 = this.f_105189_.f_91073_.m_8055_(p_105270_);
this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105270_, blockstate1, 0.0F);
this.m_233729_(this.f_105189_.f_91073_, (p_233728_) -> {
boolean flag = !blockstate1.m_60795_();
if (flag && this.f_105193_ == 0.0F) {
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY)
blockstate1.m_60686_(this.f_105189_.f_91073_, p_105270_, this.f_105189_.f_91074_);
}
+ ServerboundPlayerActionPacket packet = new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return packet;
if (flag && blockstate1.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.m_9236_(), p_105270_) >= 1.0F) {
this.m_105267_(p_105270_);
} else {
@@ -169,7 +_,7 @@
this.f_105189_.f_91073_.m_6801_(this.f_105189_.f_91074_.m_19879_(), this.f_105191_, this.m_287167_());
}
- return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
+ return packet;
});
}
@@ -200,6 +_,7 @@
BlockState blockstate1 = this.f_105189_.f_91073_.m_8055_(p_105284_);
this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105284_, blockstate1, 1.0F);
this.m_233729_(this.f_105189_.f_91073_, (p_233753_) -> {
+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105284_, p_105285_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK).isCanceled())
this.m_105267_(p_105284_);
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_);
});
@@ -212,12 +_,13 @@
} else {
this.f_105193_ += blockstate.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.m_9236_(), p_105284_);
if (this.f_105194_ % 4.0F == 0.0F) {
- SoundType soundtype = blockstate.m_60827_();
+ SoundType soundtype = blockstate.getSoundType(this.f_105189_.f_91073_, p_105284_, this.f_105189_.f_91074_);
this.f_105189_.m_91106_().m_120367_(new SimpleSoundInstance(soundtype.m_56778_(), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 8.0F, soundtype.m_56774_() * 0.5F, SoundInstance.m_235150_(), p_105284_));
}
++this.f_105194_;
this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105284_, blockstate, Mth.m_14036_(this.f_105193_, 0.0F, 1.0F));
+ if (net.minecraftforge.common.ForgeHooks.onClientMineHold(this.f_105189_.f_91074_, p_105284_, p_105285_).getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true;
if (this.f_105193_ >= 1.0F) {
this.f_105196_ = false;
this.m_233729_(this.f_105189_.f_91073_, (p_233739_) -> {
@@ -247,7 +_,7 @@
}
public float m_105286_() {
- return this.f_105197_.m_46408_() ? 5.0F : 4.5F;
+ return (float) this.f_105189_.f_91074_.getBlockReach();
}
public void m_105287_() {
@@ -262,7 +_,7 @@
private boolean m_105281_(BlockPos p_105282_) {
ItemStack itemstack = this.f_105189_.f_91074_.m_21205_();
- return p_105282_.equals(this.f_105191_) && ItemStack.m_150942_(itemstack, this.f_105192_);
+ return p_105282_.equals(this.f_105191_) && ItemStack.m_150942_(itemstack, this.f_105192_) && !f_105192_.shouldCauseBlockBreakReset(itemstack);
}
private void m_105297_() {
@@ -291,25 +_,38 @@
private InteractionResult m_233746_(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
BlockPos blockpos = p_233749_.m_82425_();
ItemStack itemstack = p_233747_.m_21120_(p_233748_);
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(p_233747_, p_233748_, blockpos, p_233749_);
+ if (event.isCanceled()) {
+ return event.getCancellationResult();
+ }
if (this.f_105197_ == GameType.SPECTATOR) {
return InteractionResult.SUCCESS;
} else {
- boolean flag = !p_233747_.m_21205_().m_41619_() || !p_233747_.m_21206_().m_41619_();
+ UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
+ InteractionResult result = itemstack.onItemUseFirst(useoncontext);
+ if (result != InteractionResult.PASS) {
+ return result;
+ }
+ }
+ boolean flag = !p_233747_.m_21205_().doesSneakBypassUse(p_233747_.m_9236_(), blockpos, p_233747_) || !p_233747_.m_21206_().doesSneakBypassUse(p_233747_.m_9236_(), blockpos, p_233747_);
boolean flag1 = p_233747_.m_36341_() && flag;
- if (!flag1) {
BlockState blockstate = this.f_105189_.f_91073_.m_8055_(blockpos);
if (!this.f_105190_.m_246351_(blockstate.m_60734_().m_245183_())) {
return InteractionResult.FAIL;
}
+ if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) {
InteractionResult interactionresult = blockstate.m_60664_(this.f_105189_.f_91073_, p_233747_, p_233748_, p_233749_);
if (interactionresult.m_19077_()) {
return interactionresult;
}
}
- if (!itemstack.m_41619_() && !p_233747_.m_36335_().m_41519_(itemstack.m_41720_())) {
- UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) {
+ return InteractionResult.PASS;
+ }
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.m_41619_() && !p_233747_.m_36335_().m_41519_(itemstack.m_41720_()))) {
InteractionResult interactionresult1;
if (this.f_105197_.m_46408_()) {
int i = itemstack.m_41613_();
@@ -340,10 +_,17 @@
mutableobject.setValue(InteractionResult.PASS);
return serverbounduseitempacket;
} else {
+ InteractionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_233722_, p_233723_);
+ if (cancelResult != null) {
+ mutableobject.setValue(cancelResult);
+ return serverbounduseitempacket;
+ }
InteractionResultHolder<ItemStack> interactionresultholder = itemstack.m_41682_(this.f_105189_.f_91073_, p_233722_, p_233723_);
ItemStack itemstack1 = interactionresultholder.m_19095_();
if (itemstack1 != itemstack) {
p_233722_.m_21008_(p_233723_, itemstack1);
+ if (itemstack1.m_41619_())
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_);
}
mutableobject.setValue(interactionresultholder.m_19089_());
@@ -382,6 +_,9 @@
this.m_105297_();
Vec3 vec3 = p_105233_.m_82450_().m_82492_(p_105232_.m_20185_(), p_105232_.m_20186_(), p_105232_.m_20189_());
this.f_105190_.m_104955_(ServerboundInteractPacket.m_179612_(p_105232_, p_105231_.m_6144_(), p_105234_, vec3));
+ if (this.f_105197_ == GameType.SPECTATOR) return InteractionResult.PASS; // don't fire for spectators to match non-specific EntityInteract
+ InteractionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_105231_, p_105232_, p_105233_, p_105234_);
+ if(cancelResult != null) return cancelResult;
return this.f_105197_ == GameType.SPECTATOR ? InteractionResult.PASS : p_105232_.m_7111_(p_105231_, vec3, p_105234_);
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/multiplayer/PlayerInfo.java
+++ b/net/minecraft/client/multiplayer/PlayerInfo.java
@@ -74,6 +_,7 @@
}
protected void m_105317_(GameType p_105318_) {
+ net.minecraftforge.client.ForgeHooksClient.onClientChangeGameType(this, this.f_105300_, p_105318_);
this.f_105300_ = p_105318_;
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/multiplayer/ServerData.java
+++ b/net/minecraft/client/multiplayer/ServerData.java
@@ -32,6 +_,7 @@
private byte[] f_271511_;
private boolean f_105373_;
private boolean f_242950_;
+ public net.minecraftforge.client.ExtendedServerListData forgeData = null;
public ServerData(String p_105375_, String p_105376_, boolean p_105377_) {
this.f_105362_ = p_105375_;

Some files were not shown because too many files have changed in this diff Show more