Compare commits

..
10 Commits
44 changed files with 645 additions and 119 deletions

No files matched your search

+7 -5
View File
@@ -36,10 +36,10 @@ ext {
]
}
MAPPING_CHANNEL = 'official'
MAPPING_VERSION = '1.19.1'
MC_VERSION = '1.19.1'
MAPPING_VERSION = '1.19.2'
MC_VERSION = '1.19.2'
MC_NEXT_VERSION = '1.20'
MCP_VERSION = '20220727.212338'
MCP_VERSION = '20220805.130853'
SPI_VERSION = '6.0.0'
ACCESSTRANSFORMERS_VERSION = '8.0.4'
COREMODS_VERSION = '5.0.1'
@@ -66,7 +66,7 @@ ext {
APACHE_COMMONS_LANG3_VERSION = '3.12.0'
JOPT_SIMPLE_VERSION = '5.0.4'
COMMONS_IO_VERSION = '2.11.0'
JARJAR_VERSION = '0.3.9'
JARJAR_VERSION = '0.3.16'
GIT_INFO = gradleutils.gitInfo
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
@@ -262,6 +262,7 @@ def sharedDeps = {
moduleonly "org.ow2.asm:asm-util:${ASM_VERSION}"
moduleonly "org.ow2.asm:asm-analysis:${ASM_VERSION}"
moduleonly "cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}"
moduleonly "net.minecraftforge:JarJarFileSystems:${JARJAR_VERSION}"
installer "cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}"
installer "org.ow2.asm:asm:${ASM_VERSION}"
@@ -285,7 +286,8 @@ def sharedDeps = {
installer "org.jline:jline-terminal:${JLINE_VERSION}" // Dep of TerminalConsoleAppender
installer "org.spongepowered:mixin:${MIXIN_VERSION}"
installer 'org.openjdk.nashorn:nashorn-core:15.3'
installer "net.minecraftforge:JarJar:${JARJAR_VERSION}"
installer "net.minecraftforge:JarJarSelector:${JARJAR_VERSION}"
installer "net.minecraftforge:JarJarMetadata:${JARJAR_VERSION}"
/*
installer 'org.lwjgl:lwjgl:3.2.2'
+1 -1
View File
@@ -3,7 +3,7 @@
MinecraftForge
=============
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.19-&query=$.promos["1.19-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)](https://files.minecraftforge.net)
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.19-&query=$.promos["1.19-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.19.2-&query=$.promos["1.19.2-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
)](https://files.minecraftforge.net) [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=Discord&logo=discord&logoColor=%237289da)](https://discord.gg/UvedJ9m) [![Support](https://img.shields.io/badge/Patreon-Support-orange.svg?logo=Patreon)](https://www.patreon.com/LexManos)
Forge is a free, open-source modding API all of your favourite mods use!
+2 -1
View File
@@ -28,7 +28,8 @@ dependencies {
api("cpw.mods:modlauncher:${MODLAUNCHER_VERSION}")
api("net.minecraftforge:coremods:${COREMODS_VERSION}")
api("com.mojang:logging:${MOJANG_LOGGING_VERSION}")
api "net.minecraftforge:JarJar:${JARJAR_VERSION}"
api "net.minecraftforge:JarJarSelector:${JARJAR_VERSION}"
api "net.minecraftforge:JarJarMetadata:${JARJAR_VERSION}"
implementation("net.sf.jopt-simple:jopt-simple:${JOPT_SIMPLE_VERSION}")
implementation("cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}")
@@ -46,7 +46,6 @@ public class JarInJarDependencyLocator extends AbstractJarFileDependencyLocator
final List<IModFile> sources = Lists.newArrayList();
loadedMods.forEach(sources::add);
final List<IModFile> dependenciesToLoad = JarSelector.detectAndSelect(sources, this::loadResourceFromModFile, this::loadModFileFrom, this::identifyMod, this::exception);
if (dependenciesToLoad.isEmpty())
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -243,7 +_,7 @@
@@ -244,7 +_,7 @@
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
@@ -9,7 +9,7 @@
static Minecraft f_90981_;
private static final Logger f_90982_ = LogUtils.getLogger();
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
@@ -397,7 +_,7 @@
@@ -398,7 +_,7 @@
this.f_91029_ = p_91084_.f_101908_.f_101928_;
this.f_90986_ = p_91084_.f_101905_.f_101944_;
this.f_91037_ = new ClientPackSource(new File(this.f_91069_, "server-resource-packs"), p_91084_.f_101907_.m_101925_());
@@ -18,7 +18,7 @@
this.f_91030_ = p_91084_.f_101905_.f_101945_;
this.f_231338_ = new YggdrasilAuthenticationService(this.f_91030_);
this.f_91048_ = this.f_231338_.createMinecraftSessionService();
@@ -405,7 +_,6 @@
@@ -406,7 +_,6 @@
this.f_231339_ = SignatureValidator.m_216358_(this.f_231338_.getServicesKey());
this.f_90998_ = p_91084_.f_101905_.f_101942_;
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_());
@@ -26,7 +26,7 @@
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_;
@@ -457,7 +_,7 @@
@@ -458,7 +_,7 @@
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
this.f_91067_ = new MouseHandler(this);
@@ -35,7 +35,7 @@
this.f_91068_ = new KeyboardHandler(this);
this.f_91068_.m_90887_(this.f_90990_.m_85439_());
RenderSystem.m_69580_(this.f_91066_.f_92035_, false);
@@ -465,6 +_,7 @@
@@ -466,6 +_,7 @@
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);
@@ -43,7 +43,7 @@
this.f_91038_.m_10506_();
this.f_91066_.m_92145_(this.f_91038_);
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
@@ -509,10 +_,12 @@
@@ -510,10 +_,12 @@
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_);
this.f_91060_ = new LevelRenderer(this, this.f_90994_, this.f_167845_, this.f_90993_);
@@ -56,7 +56,7 @@
this.f_91036_.m_7217_(this.f_91061_);
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
this.f_91036_.m_7217_(this.f_91053_);
@@ -521,7 +_,9 @@
@@ -522,7 +_,9 @@
this.f_91047_ = new GpuWarnlistManager();
this.f_91036_.m_7217_(this.f_91047_);
this.f_91036_.m_7217_(this.f_205120_);
@@ -67,7 +67,7 @@
this.f_91064_ = new DebugRenderer(this);
this.f_238717_ = new RealmsDataFetcher(RealmsClient.m_239151_(this));
RenderSystem.m_69900_(this::m_91113_);
@@ -540,6 +_,19 @@
@@ -541,6 +_,19 @@
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
}
@@ -87,7 +87,7 @@
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_();
@@ -562,23 +_,23 @@
@@ -563,23 +_,23 @@
}
this.f_167847_.m_168556_();
@@ -126,7 +126,7 @@
}
@@ -621,6 +_,8 @@
@@ -622,6 +_,8 @@
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
try {
@@ -135,7 +135,7 @@
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_());
} catch (AuthenticationException authenticationexception) {
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
@@ -633,7 +_,7 @@
@@ -634,7 +_,7 @@
}
private void m_91239_(Throwable p_91240_) {
@@ -144,7 +144,7 @@
this.m_91241_(p_91240_, (Component)null);
} else {
Util.m_137559_(p_91240_);
@@ -791,13 +_,13 @@
@@ -792,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_());
@@ -161,7 +161,7 @@
}
}
@@ -921,10 +_,6 @@
@@ -922,10 +_,6 @@
f_90982_.error("setScreen called from non-game thread");
}
@@ -172,7 +172,7 @@
if (p_91153_ == null && this.f_91073_ == null) {
p_91153_ = new TitleScreen();
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
@@ -935,6 +_,19 @@
@@ -936,6 +_,19 @@
}
}
@@ -192,7 +192,7 @@
this.f_91080_ = p_91153_;
BufferUploader.m_166835_();
if (p_91153_ != null) {
@@ -1078,11 +_,14 @@
@@ -1079,11 +_,14 @@
RenderSystem.m_69481_();
this.f_91026_.m_7238_();
if (!this.f_91079_) {
@@ -207,7 +207,7 @@
}
if (this.f_91056_ != null) {
@@ -1209,10 +_,12 @@
@@ -1210,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_());
@@ -220,7 +220,7 @@
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
this.f_91067_.m_91599_();
}
@@ -1490,6 +_,7 @@
@@ -1491,6 +_,7 @@
}
public void m_91395_() {
@@ -228,7 +228,7 @@
this.f_91019_ = false;
}
@@ -1519,10 +_,18 @@
@@ -1520,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_();
@@ -250,7 +250,7 @@
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
}
}
@@ -1547,14 +_,20 @@
@@ -1548,14 +_,20 @@
return false;
} else {
boolean flag = false;
@@ -269,22 +269,22 @@
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)) {
+ 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;
@@ -1567,8 +_,10 @@
@@ -1568,8 +_,10 @@
}
this.f_91074_.m_36334_();
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
}
+ if (inputEvent.shouldSwingHand())
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
return flag;
}
@@ -1583,6 +_,11 @@
@@ -1584,6 +_,11 @@
}
for(InteractionHand interactionhand : InteractionHand.values()) {
@@ -296,31 +296,32 @@
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
if (this.f_91077_ != null) {
switch (this.f_91077_.m_6662_()) {
@@ -1593,6 +_,7 @@
@@ -1594,13 +_,14 @@
return;
}
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) return; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) return; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
InteractionResult interactionresult = this.f_91072_.m_105230_(this.f_91074_, entity, entityhitresult, interactionhand);
if (!interactionresult.m_19077_()) {
interactionresult = this.f_91072_.m_105226_(this.f_91074_, entity, interactionhand);
@@ -1600,6 +_,7 @@
}
if (interactionresult.m_19077_()) {
if (interactionresult.m_19080_()) {
+ if (inputEvent.shouldSwingHand())
- if (interactionresult.m_19080_()) {
+ if (interactionresult.m_19080_() && inputEvent.shouldSwingHand()) {
this.f_91074_.m_6674_(interactionhand);
}
@@ -1612,6 +_,7 @@
@@ -1612,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 (inputEvent.shouldSwingHand())
- 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);
@@ -1627,6 +_,9 @@
@@ -1628,6 +_,9 @@
}
}
@@ -330,7 +331,7 @@
if (!itemstack.m_41619_()) {
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
if (interactionresult2.m_19077_()) {
@@ -1653,6 +_,8 @@
@@ -1654,6 +_,8 @@
--this.f_91011_;
}
@@ -339,7 +340,7 @@
this.f_91026_.m_6180_("gui");
this.f_240378_.m_240688_();
this.f_91065_.m_193832_(this.f_91012_);
@@ -1782,6 +_,8 @@
@@ -1783,6 +_,8 @@
this.f_91026_.m_6182_("keyboard");
this.f_91068_.m_90931_();
this.f_91026_.m_7238_();
@@ -348,7 +349,7 @@
}
private boolean m_91278_() {
@@ -1976,6 +_,7 @@
@@ -1978,6 +_,7 @@
}
public void m_91156_(ClientLevel p_91157_) {
@@ -356,7 +357,7 @@
ProgressScreen progressscreen = new ProgressScreen(true);
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
this.m_91362_(progressscreen);
@@ -2009,10 +_,12 @@
@@ -2011,10 +_,12 @@
IntegratedServer integratedserver = this.f_91007_;
this.f_91007_ = null;
this.f_91063_.m_109150_();
@@ -369,7 +370,7 @@
if (integratedserver != null) {
this.f_91026_.m_6180_("waitForServer");
@@ -2027,6 +_,7 @@
@@ -2029,6 +_,7 @@
this.f_91065_.m_93089_();
this.f_91008_ = null;
this.f_91010_ = false;
@@ -377,7 +378,7 @@
this.f_91004_.m_90740_();
}
@@ -2122,6 +_,7 @@
@@ -2124,6 +_,7 @@
private void m_91280_() {
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
@@ -385,7 +386,7 @@
boolean flag = this.f_91074_.m_150110_().f_35937_;
BlockEntity blockentity = null;
HitResult.Type hitresult$type = this.f_91077_.m_6662_();
@@ -2134,10 +_,7 @@
@@ -2136,10 +_,7 @@
}
Block block = blockstate.m_60734_();
@@ -397,7 +398,7 @@
if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
blockentity = this.f_91073_.m_7702_(blockpos);
@@ -2148,7 +_,7 @@
@@ -2150,7 +_,7 @@
}
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
@@ -406,7 +407,7 @@
if (itemstack == null) {
return;
}
@@ -2686,8 +_,8 @@
@@ -2688,8 +_,8 @@
return this.f_90993_;
}
@@ -417,7 +418,7 @@
Supplier<PackResources> supplier = p_167937_;
if (i <= 3) {
supplier = m_91330_(p_167937_);
@@ -2697,7 +_,7 @@
@@ -2699,7 +_,7 @@
supplier = m_91352_(supplier);
}
@@ -426,10 +427,12 @@
}
private static Supplier<PackResources> m_91330_(Supplier<PackResources> p_91331_) {
@@ -2716,6 +_,14 @@
this.f_91051_.m_119410_(p_91313_);
}
@@ -2716,6 +_,19 @@
public void m_91312_(int p_91313_) {
this.f_91051_.m_119410_(p_91313_);
+ }
+
+ public ItemColors getItemColors() {
+ return this.f_91041_;
+ }
@@ -438,18 +441,9 @@
+ return this.f_90997_;
+ }
+
public EntityModelSet m_167973_() {
return this.f_167844_;
}
@@ -2789,4 +_,11 @@
public abstract boolean m_142594_(boolean p_168035_);
}
+
+ // FORGE START
+ private float realPartialTick;
+ public float getPartialTick() {
+ return realPartialTick;
+ }
+ // FORGE END
}
}
public EntityModelSet m_167973_() {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/PlayerInfo.java
+++ b/net/minecraft/client/multiplayer/PlayerInfo.java
@@ -84,6 +_,7 @@
@@ -82,6 +_,7 @@
}
protected void m_105317_(GameType p_105318_) {
@@ -1,11 +1,11 @@
--- a/net/minecraft/client/multiplayer/ProfileKeyPairManager.java
+++ b/net/minecraft/client/multiplayer/ProfileKeyPairManager.java
@@ -70,6 +_,8 @@
@@ -76,6 +_,8 @@
this.m_233776_(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() || p_233781_ != UserApiService.OFFLINE)
+ if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || this.f_243348_ != UserApiService.OFFLINE)
f_233765_.error("Failed to retrieve profile key pair", (Throwable)ioexception);
this.m_233776_((ProfileKeyPair)null);
return optional;
return p_243401_;
@@ -1,11 +1,12 @@
--- a/net/minecraft/client/renderer/entity/ItemEntityRenderer.java
+++ b/net/minecraft/client/renderer/entity/ItemEntityRenderer.java
@@ -62,17 +_,14 @@
@@ -61,18 +_,15 @@
boolean flag = bakedmodel.m_7539_();
int j = this.m_115042_(itemstack);
float f = 0.25F;
float f1 = Mth.m_14031_(((float)p_115036_.m_32059_() + p_115038_) / 10.0F + p_115036_.f_31983_) * 0.1F + 0.1F;
- float f2 = bakedmodel.m_7442_().m_111808_(ItemTransforms.TransformType.GROUND).f_111757_.m_122260_();
+ float f2 = shouldBob() ? bakedmodel.m_7442_().m_111808_(ItemTransforms.TransformType.GROUND).f_111757_.m_122260_() : 0;
- float f1 = Mth.m_14031_(((float)p_115036_.m_32059_() + p_115038_) / 10.0F + p_115036_.f_31983_) * 0.1F + 0.1F;
+ float f1 = shouldBob() ? Mth.m_14031_(((float)p_115036_.m_32059_() + p_115038_) / 10.0F + p_115036_.f_31983_) * 0.1F + 0.1F : 0;
float f2 = bakedmodel.m_7442_().m_111808_(ItemTransforms.TransformType.GROUND).f_111757_.m_122260_();
p_115039_.m_85837_(0.0D, (double)(f1 + 0.25F * f2), 0.0D);
float f3 = p_115036_.m_32008_(p_115038_);
p_115039_.m_85845_(Vector3f.f_122225_.m_122270_(f3));
@@ -1,5 +1,13 @@
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -385,6 +_,7 @@
this.f_140140_ = true;
}
+ net.minecraftforge.event.ForgeEventFactory.fireChunkTicketLevelUpdated(this.f_140133_, p_140177_, p_140180_, p_140178_, p_140179_);
return p_140179_;
}
}
@@ -490,6 +_,7 @@
if (this.f_140131_.remove(p_140182_, p_140183_) && p_203002_ != null) {
if (p_203002_ instanceof LevelChunk) {
@@ -67,7 +67,7 @@
this.m_243086_(playerchatmessage1);
}, this.f_9745_);
});
@@ -1375,7 +_,7 @@
@@ -1383,7 +_,7 @@
private CompletableFuture<Component> m_215246_(String p_215247_) {
Component component = Component.m_237113_(p_215247_);
@@ -76,7 +76,7 @@
return !component.equals(p_238202_) ? p_238202_ : null;
});
completablefuture.thenAcceptAsync((p_242747_) -> {
@@ -1524,11 +_,13 @@
@@ -1532,11 +_,13 @@
return;
}
@@ -91,16 +91,16 @@
if (interactionresult.m_19077_()) {
CriteriaTriggers.f_10565_.m_61494_(ServerGamePacketListenerImpl.this.f_9743_, itemstack, entity);
if (interactionresult.m_19080_()) {
@@ -1550,7 +_,7 @@
@@ -1558,6 +_,8 @@
public void m_141994_() {
if (!(entity instanceof ItemEntity) && !(entity instanceof ExperienceOrb) && !(entity instanceof AbstractArrow) && entity != ServerGamePacketListenerImpl.this.f_9743_) {
- ServerGamePacketListenerImpl.this.f_9743_.m_5706_(entity);
+ if(ServerGamePacketListenerImpl.this.f_9743_.canHit(entity, 3)) ServerGamePacketListenerImpl.this.f_9743_.m_5706_(entity); //Forge: Perform attack range check. Original check was dist < 6, range is 3, so vanilla used padding=3
+ //Forge: Perform attack range check. Original check was dist < 6, range is 3, so vanilla used padding=3
+ if(ServerGamePacketListenerImpl.this.f_9743_.canHit(entity, 3))
ServerGamePacketListenerImpl.this.f_9743_.m_5706_(entity);
} else {
ServerGamePacketListenerImpl.this.m_9942_(Component.m_237115_("multiplayer.disconnect.invalid_entity_attacked"));
ServerGamePacketListenerImpl.f_9744_.warn("Player {} tried to attack an invalid entity", (Object)ServerGamePacketListenerImpl.this.f_9743_.m_7755_().getString());
@@ -1749,6 +_,7 @@
@@ -1757,6 +_,7 @@
}
public void m_7423_(ServerboundCustomPayloadPacket p_9860_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -69,7 +_,13 @@
@@ -65,7 +_,13 @@
}
public void m_9933_() {
@@ -15,7 +15,7 @@
this.m_10055_();
} else if (this.f_10019_ == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) {
ServerPlayer serverplayer = this.f_10018_.m_6846_().m_11259_(this.f_10021_.getId());
@@ -194,14 +_,14 @@
@@ -178,14 +_,14 @@
GameProfile gameprofile = this.f_10018_.m_236731_();
if (gameprofile != null && p_10047_.f_238040_().equalsIgnoreCase(gameprofile.getName())) {
this.f_10021_ = gameprofile;
@@ -32,7 +32,7 @@
}
}
@@ -238,7 +_,7 @@
@@ -222,7 +_,7 @@
throw new IllegalStateException("Protocol error", cryptexception);
}
@@ -41,7 +41,7 @@
public void run() {
GameProfile gameprofile = ServerLoginPacketListenerImpl.this.f_10021_;
@@ -246,11 +_,11 @@
@@ -230,11 +_,11 @@
ServerLoginPacketListenerImpl.this.f_10021_ = ServerLoginPacketListenerImpl.this.f_10018_.m_129925_().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.m_10064_());
if (ServerLoginPacketListenerImpl.this.f_10021_ != null) {
ServerLoginPacketListenerImpl.f_10015_.info("UUID of player {} is {}", ServerLoginPacketListenerImpl.this.f_10021_.getName(), ServerLoginPacketListenerImpl.this.f_10021_.getId());
@@ -55,7 +55,7 @@
} else {
ServerLoginPacketListenerImpl.this.m_10053_(Component.m_237115_("multiplayer.disconnect.unverified_username"));
ServerLoginPacketListenerImpl.f_10015_.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName());
@@ -259,7 +_,7 @@
@@ -243,7 +_,7 @@
if (ServerLoginPacketListenerImpl.this.f_10018_.m_129792_()) {
ServerLoginPacketListenerImpl.f_10015_.warn("Authentication servers are down but will let them in anyway!");
ServerLoginPacketListenerImpl.this.f_10021_ = gameprofile;
@@ -64,7 +64,7 @@
} else {
ServerLoginPacketListenerImpl.this.m_10053_(Component.m_237115_("multiplayer.disconnect.authservers_down"));
ServerLoginPacketListenerImpl.f_10015_.error("Couldn't verify username because servers are unavailable");
@@ -279,6 +_,7 @@
@@ -263,6 +_,7 @@
}
public void m_7223_(ServerboundCustomQueryPacket p_10045_) {
@@ -194,33 +194,14 @@
this.m_21008_(p_36159_, ItemStack.f_41583_);
}
@@ -1020,7 +_,7 @@
double d1 = p_36201_.f_82481_;
double d2 = 0.05D;
@@ -1014,6 +_,7 @@
return !this.f_36077_.f_35935_;
}
- while(d0 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(d0, (double)(-this.f_19793_), 0.0D))) {
+ while(d0 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(d0, (double)(-this.getStepHeight()), 0.0D))) {
if (d0 < 0.05D && d0 >= -0.05D) {
d0 = 0.0D;
} else if (d0 > 0.0D) {
@@ -1030,7 +_,7 @@
}
}
- while(d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(0.0D, (double)(-this.f_19793_), d1))) {
+ while(d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(0.0D, (double)(-this.getStepHeight()), d1))) {
if (d1 < 0.05D && d1 >= -0.05D) {
d1 = 0.0D;
} else if (d1 > 0.0D) {
@@ -1040,7 +_,7 @@
}
}
- while(d0 != 0.0D && d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(d0, (double)(-this.f_19793_), d1))) {
+ while(d0 != 0.0D && d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(d0, (double)(-this.getStepHeight()), d1))) {
if (d0 < 0.05D && d0 >= -0.05D) {
d0 = 0.0D;
} else if (d0 > 0.0D) {
+ // Forge: Don't update this method to use IForgeEntity#getStepHeight() - https://github.com/MinecraftForge/MinecraftForge/issues/8922
protected Vec3 m_5763_(Vec3 p_36201_, MoverType p_36202_) {
if (!this.f_36077_.f_35935_ && p_36201_.f_82480_ <= 0.0D && (p_36202_ == MoverType.SELF || p_36202_ == MoverType.PLAYER) && this.m_36343_() && this.m_36386_()) {
double d0 = p_36201_.f_82479_;
@@ -1065,10 +_,11 @@
}
@@ -4,7 +4,7 @@
import net.minecraft.world.phys.Vec3;
import org.slf4j.Logger;
+// TODO: ForgeEventFactory.getPotentialSpawns, ForgeHooks.canEntitySpawn
+// TODO: ForgeHooks.canEntitySpawn
public final class NaturalSpawner {
private static final Logger f_46977_ = LogUtils.getLogger();
private static final int f_151589_ = 24;
@@ -35,12 +35,13 @@
return;
}
@@ -266,7 +_,7 @@
@@ -266,7 +_,8 @@
}
private static WeightedRandomList<MobSpawnSettings.SpawnerData> m_220443_(ServerLevel p_220444_, StructureManager p_220445_, ChunkGenerator p_220446_, MobCategory p_220447_, BlockPos p_220448_, @Nullable Holder<Biome> p_220449_) {
- return m_220455_(p_220448_, p_220444_, p_220447_, p_220445_) ? NetherFortressStructure.f_228517_ : p_220446_.m_223133_(p_220449_ != null ? p_220449_ : p_220444_.m_204166_(p_220448_), p_220445_, p_220447_, p_220448_);
+ return m_220455_(p_220448_, p_220444_, p_220447_, p_220445_) ? p_220445_.m_220521_().m_175515_(Registry.f_235725_).m_123013_(BuiltinStructures.f_209859_).m_226612_().get(MobCategory.MONSTER).f_210044_() : p_220446_.m_223133_(p_220449_ != null ? p_220449_ : p_220444_.m_204166_(p_220448_), p_220445_, p_220447_, p_220448_);
+ // Forge: Add in potential spawns, and replace hardcoded nether fortress mob list
+ return net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(p_220444_, p_220447_, p_220448_, m_220455_(p_220448_, p_220444_, p_220447_, p_220445_) ? p_220445_.m_220521_().m_175515_(Registry.f_235725_).m_123013_(BuiltinStructures.f_209859_).m_226612_().get(MobCategory.MONSTER).f_210044_() : p_220446_.m_223133_(p_220449_ != null ? p_220449_ : p_220444_.m_204166_(p_220448_), p_220445_, p_220447_, p_220448_));
}
public static boolean m_220455_(BlockPos p_220456_, ServerLevel p_220457_, MobCategory p_220458_, StructureManager p_220459_) {
@@ -0,0 +1,8 @@
{
"values": [
"#forge:armors/helmets",
"#forge:armors/chestplates",
"#forge:armors/leggings",
"#forge:armors/boots"
]
}
@@ -0,0 +1,10 @@
{
"values": [
"minecraft:leather_boots",
"minecraft:chainmail_boots",
"minecraft:iron_boots",
"minecraft:golden_boots",
"minecraft:diamond_boots",
"minecraft:netherite_boots"
]
}
@@ -0,0 +1,10 @@
{
"values": [
"minecraft:leather_chestplate",
"minecraft:chainmail_chestplate",
"minecraft:iron_chestplate",
"minecraft:golden_chestplate",
"minecraft:diamond_chestplate",
"minecraft:netherite_chestplate"
]
}
@@ -0,0 +1,11 @@
{
"values": [
"minecraft:leather_helmet",
"minecraft:turtle_helmet",
"minecraft:chainmail_helmet",
"minecraft:iron_helmet",
"minecraft:golden_helmet",
"minecraft:diamond_helmet",
"minecraft:netherite_helmet"
]
}
@@ -0,0 +1,10 @@
{
"values": [
"minecraft:leather_leggings",
"minecraft:chainmail_leggings",
"minecraft:iron_leggings",
"minecraft:golden_leggings",
"minecraft:diamond_leggings",
"minecraft:netherite_leggings"
]
}
@@ -0,0 +1,14 @@
{
"values": [
"#forge:tools/swords",
"#forge:tools/axes",
"#forge:tools/pickaxes",
"#forge:tools/shovels",
"#forge:tools/hoes",
"#forge:tools/shields",
"#forge:tools/bows",
"#forge:tools/crossbows",
"#forge:tools/fishing_rods",
"#forge:tools/tridents"
]
}
@@ -0,0 +1,10 @@
{
"values": [
"minecraft:wooden_axe",
"minecraft:stone_axe",
"minecraft:iron_axe",
"minecraft:golden_axe",
"minecraft:diamond_axe",
"minecraft:netherite_axe"
]
}
@@ -0,0 +1,5 @@
{
"values": [
"minecraft:bow"
]
}
@@ -0,0 +1,5 @@
{
"values": [
"minecraft:crossbow"
]
}
@@ -0,0 +1,5 @@
{
"values": [
"minecraft:fishing_rod"
]
}
@@ -0,0 +1,10 @@
{
"values": [
"minecraft:wooden_hoe",
"minecraft:stone_hoe",
"minecraft:iron_hoe",
"minecraft:golden_hoe",
"minecraft:diamond_hoe",
"minecraft:netherite_hoe"
]
}
@@ -0,0 +1,10 @@
{
"values": [
"minecraft:wooden_pickaxe",
"minecraft:stone_pickaxe",
"minecraft:iron_pickaxe",
"minecraft:golden_pickaxe",
"minecraft:diamond_pickaxe",
"minecraft:netherite_pickaxe"
]
}
@@ -0,0 +1,5 @@
{
"values": [
"minecraft:shield"
]
}
@@ -0,0 +1,10 @@
{
"values": [
"minecraft:wooden_shovel",
"minecraft:stone_shovel",
"minecraft:iron_shovel",
"minecraft:golden_shovel",
"minecraft:diamond_shovel",
"minecraft:netherite_shovel"
]
}
@@ -0,0 +1,10 @@
{
"values": [
"minecraft:wooden_sword",
"minecraft:stone_sword",
"minecraft:iron_sword",
"minecraft:golden_sword",
"minecraft:diamond_sword",
"minecraft:netherite_sword"
]
}
@@ -0,0 +1,5 @@
{
"values": [
"minecraft:trident"
]
}
@@ -1,6 +1,7 @@
{
"values": [
"minecraft:desert",
"minecraft:beach",
"minecraft:badlands",
"minecraft:wooded_badlands"
]
@@ -3,6 +3,7 @@
"minecraft:swamp",
"minecraft:jungle",
"minecraft:sparse_jungle",
"minecraft:beach",
"minecraft:bamboo_jungle",
"minecraft:lush_caves",
"minecraft:mangrove_swamp"
@@ -516,7 +516,7 @@ public class ForgeGui extends Gui
RenderSystem.defaultBlendFunc();
int color = (animateOverlayMessageColor ? Mth.hsvToRgb(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
drawBackdrop(pStack, font, -4, font.width(overlayMessageString), 16777215 | (opacity << 24));
font.draw(pStack, overlayMessageString.getVisualOrderText(), -font.width(overlayMessageString) / 2, -4, color | (opacity << 24));
font.drawShadow(pStack, overlayMessageString.getVisualOrderText(), -font.width(overlayMessageString) / 2, -4, color | (opacity << 24));
RenderSystem.disableBlend();
pStack.popPose();
}
@@ -394,6 +394,125 @@ public class Tags
public static final TagKey<Item> STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron");
public static final TagKey<Item> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
public static final TagKey<Item> STRING = tag("string");
/**
* A tag containing all existing tools.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS = tag("tools");
/**
* A tag containing all existing swords.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS_SWORDS = tag("tools/swords");
/**
* A tag containing all existing axes.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS_AXES = tag("tools/axes");
/**
* A tag containing all existing pickaxes.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS_PICKAXES = tag("tools/pickaxes");
/**
* A tag containing all existing shovels.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS_SHOVELS = tag("tools/shovels");
/**
* A tag containing all existing hoes.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS_HOES = tag("tools/hoes");
/**
* A tag containing all existing shields.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS_SHIELDS = tag("tools/shields");
/**
* A tag containing all existing bows.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS_BOWS = tag("tools/bows");
/**
* A tag containing all existing crossbows.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS_CROSSBOWS = tag("tools/crossbows");
/**
* A tag containing all existing fishing rods.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS_FISHING_RODS = tag("tools/fishing_rods");
/**
* A tag containing all existing tridents.
*
* Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}.
*
* @see net.minecraftforge.common.ToolAction
* @see net.minecraftforge.common.ToolActions
*/
public static final TagKey<Item> TOOLS_TRIDENTS = tag("tools/tridents");
/**
* A tag containing all existing armors.
*/
public static final TagKey<Item> ARMORS = tag("armors");
/**
* A tag containing all existing helmets.
*/
public static final TagKey<Item> ARMORS_HELMETS = tag("armors/helmets");
/**
* A tag containing all chestplates.
*/
public static final TagKey<Item> ARMORS_CHESTPLATES = tag("armors/chestplates");
/**
* A tag containing all existing leggings.
*/
public static final TagKey<Item> ARMORS_LEGGINGS = tag("armors/leggings");
/**
* A tag containing all existing boots.
*/
public static final TagKey<Item> ARMORS_BOOTS = tag("armors/boots");
private static TagKey<Item> tag(String name)
{
@@ -37,6 +37,7 @@ public final class ForgeBiomeTagsProvider extends BiomeTagsProvider
tag(Biomes.MUSHROOM_FIELDS, Tags.Biomes.IS_MUSHROOM, Tags.Biomes.IS_RARE);
tag(Biomes.JUNGLE, Tags.Biomes.IS_HOT_OVERWORLD, Tags.Biomes.IS_WET_OVERWORLD, Tags.Biomes.IS_DENSE_OVERWORLD);
tag(Biomes.SPARSE_JUNGLE, Tags.Biomes.IS_HOT_OVERWORLD, Tags.Biomes.IS_WET_OVERWORLD, Tags.Biomes.IS_RARE);
tag(Biomes.BEACH, Tags.Biomes.IS_WET_OVERWORLD, Tags.Biomes.IS_SANDY);
tag(Biomes.SNOWY_BEACH, Tags.Biomes.IS_COLD_OVERWORLD, Tags.Biomes.IS_SNOWY);
tag(Biomes.DARK_FOREST, Tags.Biomes.IS_SPOOKY, Tags.Biomes.IS_DENSE_OVERWORLD);
tag(Biomes.SNOWY_TAIGA, Tags.Biomes.IS_COLD_OVERWORLD, Tags.Biomes.IS_CONIFEROUS, Tags.Biomes.IS_SNOWY);
@@ -153,6 +153,22 @@ public final class ForgeItemTagsProvider extends ItemTagsProvider
copy(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, Tags.Items.STORAGE_BLOCKS_RAW_IRON);
copy(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Tags.Items.STORAGE_BLOCKS_NETHERITE);
tag(Tags.Items.STRING).add(Items.STRING);
tag(Tags.Items.TOOLS_SWORDS).add(Items.WOODEN_SWORD, Items.STONE_SWORD, Items.IRON_SWORD, Items.GOLDEN_SWORD, Items.DIAMOND_SWORD, Items.NETHERITE_SWORD);
tag(Tags.Items.TOOLS_AXES).add(Items.WOODEN_AXE, Items.STONE_AXE, Items.IRON_AXE, Items.GOLDEN_AXE, Items.DIAMOND_AXE, Items.NETHERITE_AXE);
tag(Tags.Items.TOOLS_PICKAXES).add(Items.WOODEN_PICKAXE, Items.STONE_PICKAXE, Items.IRON_PICKAXE, Items.GOLDEN_PICKAXE, Items.DIAMOND_PICKAXE, Items.NETHERITE_PICKAXE);
tag(Tags.Items.TOOLS_SHOVELS).add(Items.WOODEN_SHOVEL, Items.STONE_SHOVEL, Items.IRON_SHOVEL, Items.GOLDEN_SHOVEL, Items.DIAMOND_SHOVEL, Items.NETHERITE_SHOVEL);
tag(Tags.Items.TOOLS_HOES).add(Items.WOODEN_HOE, Items.STONE_HOE, Items.IRON_HOE, Items.GOLDEN_HOE, Items.DIAMOND_HOE, Items.NETHERITE_HOE);
tag(Tags.Items.TOOLS_SHIELDS).add(Items.SHIELD);
tag(Tags.Items.TOOLS_BOWS).add(Items.BOW);
tag(Tags.Items.TOOLS_CROSSBOWS).add(Items.CROSSBOW);
tag(Tags.Items.TOOLS_FISHING_RODS).add(Items.FISHING_ROD);
tag(Tags.Items.TOOLS_TRIDENTS).add(Items.TRIDENT);
tag(Tags.Items.TOOLS).addTags(Tags.Items.TOOLS_SWORDS, Tags.Items.TOOLS_AXES, Tags.Items.TOOLS_PICKAXES, Tags.Items.TOOLS_SHOVELS, Tags.Items.TOOLS_HOES, Tags.Items.TOOLS_SHIELDS, Tags.Items.TOOLS_BOWS, Tags.Items.TOOLS_CROSSBOWS, Tags.Items.TOOLS_FISHING_RODS, Tags.Items.TOOLS_TRIDENTS);
tag(Tags.Items.ARMORS_HELMETS).add(Items.LEATHER_HELMET, Items.TURTLE_HELMET, Items.CHAINMAIL_HELMET, Items.IRON_HELMET, Items.GOLDEN_HELMET, Items.DIAMOND_HELMET, Items.NETHERITE_HELMET);
tag(Tags.Items.ARMORS_CHESTPLATES).add(Items.LEATHER_CHESTPLATE, Items.CHAINMAIL_CHESTPLATE, Items.IRON_CHESTPLATE, Items.GOLDEN_CHESTPLATE, Items.DIAMOND_CHESTPLATE, Items.NETHERITE_CHESTPLATE);
tag(Tags.Items.ARMORS_LEGGINGS).add(Items.LEATHER_LEGGINGS, Items.CHAINMAIL_LEGGINGS, Items.IRON_LEGGINGS, Items.GOLDEN_LEGGINGS, Items.DIAMOND_LEGGINGS, Items.NETHERITE_LEGGINGS);
tag(Tags.Items.ARMORS_BOOTS).add(Items.LEATHER_BOOTS, Items.CHAINMAIL_BOOTS, Items.IRON_BOOTS, Items.GOLDEN_BOOTS, Items.DIAMOND_BOOTS, Items.NETHERITE_BOOTS);
tag(Tags.Items.ARMORS).addTags(Tags.Items.ARMORS_HELMETS, Tags.Items.ARMORS_CHESTPLATES, Tags.Items.ARMORS_LEGGINGS, Tags.Items.ARMORS_BOOTS);
}
private void addColored(Consumer<TagKey<Item>> consumer, TagKey<Item> group, String pattern)
@@ -16,11 +16,15 @@ import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.commands.CommandBuildContext;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ReloadableServerResources;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.players.PlayerList;
import net.minecraft.util.RandomSource;
import net.minecraft.util.random.WeightedRandomList;
import net.minecraft.world.Container;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.entity.projectile.ThrownEnderpearl;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.portal.PortalShape;
import net.minecraft.world.level.block.state.BlockState;
@@ -115,6 +119,7 @@ import net.minecraftforge.event.level.BlockEvent.CreateFluidSourceEvent;
import net.minecraftforge.event.level.BlockEvent.EntityMultiPlaceEvent;
import net.minecraftforge.event.level.BlockEvent.EntityPlaceEvent;
import net.minecraftforge.event.level.BlockEvent.NeighborNotifyEvent;
import net.minecraftforge.event.level.ChunkTicketLevelUpdatedEvent;
import net.minecraftforge.event.level.ChunkWatchEvent;
import net.minecraftforge.event.level.ExplosionEvent;
import net.minecraftforge.event.level.PistonEvent;
@@ -607,6 +612,12 @@ public class ForgeEventFactory
return event.getResult() != Result.DENY;
}
public static void fireChunkTicketLevelUpdated(ServerLevel level, long chunkPos, int oldTicketLevel, int newTicketLevel, @Nullable ChunkHolder chunkHolder)
{
if (oldTicketLevel != newTicketLevel)
MinecraftForge.EVENT_BUS.post(new ChunkTicketLevelUpdatedEvent(level, chunkPos, oldTicketLevel, newTicketLevel, chunkHolder));
}
public static void fireChunkWatch(ServerPlayer entity, LevelChunk chunk, ServerLevel level)
{
MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(entity, chunk, level));
@@ -801,4 +812,12 @@ public class ForgeEventFactory
{
MinecraftForge.EVENT_BUS.post(new TickEvent.ServerTickEvent(TickEvent.Phase.END, haveTime, server));
}
public static WeightedRandomList<MobSpawnSettings.SpawnerData> getPotentialSpawns(LevelAccessor level, MobCategory category, BlockPos pos, WeightedRandomList<MobSpawnSettings.SpawnerData> oldList)
{
LevelEvent.PotentialSpawns event = new LevelEvent.PotentialSpawns(level, category, pos, oldList);
if (MinecraftForge.EVENT_BUS.post(event))
return WeightedRandomList.create();
return WeightedRandomList.create(event.getSpawnerDataList());
}
}
@@ -0,0 +1,90 @@
/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.event.level;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ServerLevel;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.LogicalSide;
import org.jetbrains.annotations.Nullable;
/**
* This event is fired whenever a chunk has its ticket level changed via the server's ChunkMap.
* <p>
* This event does not fire if the new ticket level is the same as the old level, or if both the
* new <strong>AND</strong> old ticket levels represent values past the max chunk distance.
* <p>
* Due to how vanilla processes ticket level changes this event may be fired "twice" in one tick for the same chunk.
* The scenario where this happens is when increasing the level from say 31 (ticking) to 32, the way vanilla does it
* is by first changing it from 31 to 46, and then queuing the update from 46 to 32. However, when going from 32 to 31,
* vanilla is able to go directly.
* <p>
* This event is not {@linkplain Cancelable cancellable} and does not {@linkplain HasResult have a result}.
* <p>
* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}
* only on the {@linkplain LogicalSide#SERVER logical server}.
**/
public class ChunkTicketLevelUpdatedEvent extends Event
{
private final ServerLevel level;
private final long chunkPos;
private final int oldTicketLevel;
private final int newTicketLevel;
@Nullable
private final ChunkHolder chunkHolder;
public ChunkTicketLevelUpdatedEvent(ServerLevel level, long chunkPos, int oldTicketLevel, int newTicketLevel, @Nullable ChunkHolder chunkHolder)
{
this.level = level;
this.chunkPos = chunkPos;
this.oldTicketLevel = oldTicketLevel;
this.newTicketLevel = newTicketLevel;
this.chunkHolder = chunkHolder;
}
/**
* {@return the server level containing the chunk}
*/
public ServerLevel getLevel()
{
return this.level;
}
/**
* {@return the long representation of the chunk position the ticket level changed for}
*/
public long getChunkPos()
{
return this.chunkPos;
}
/**
* {@return the previous ticket level the chunk had}
*/
public int getOldTicketLevel()
{
return this.oldTicketLevel;
}
/**
* {@return the new ticket level for the chunk}
*/
public int getNewTicketLevel()
{
return this.newTicketLevel;
}
/**
* {@return chunk that had its ticket level updated}
*/
@Nullable
public ChunkHolder getChunkHolder()
{
return this.chunkHolder;
}
}
@@ -5,13 +5,21 @@
package net.minecraftforge.event.level;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.ProgressListener;
import net.minecraft.util.random.WeightedRandomList;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraftforge.common.ForgeInternalHandler;
import net.minecraftforge.common.MinecraftForge;
@@ -117,4 +125,83 @@ public class LevelEvent extends Event
return settings;
}
}
/**
* Fired when building a list of all possible entities that can spawn at the specified location.
*
* <p>If an entry is added to the list, it needs to be a globally unique instance.</p>
*
* The event is called in {@link net.minecraft.world.level.NaturalSpawner#getRandomSpawnMobAt(ServerLevel,
* StructureManager, ChunkGenerator, MobCategory, RandomSource, BlockPos)}.</p>
*
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
* Canceling the event will result in an empty list, meaning no entity will be spawned.</p>
*/
@Cancelable
public static class PotentialSpawns extends LevelEvent
{
private final MobCategory mobcategory;
private final BlockPos pos;
private final List<MobSpawnSettings.SpawnerData> list;
private final List<MobSpawnSettings.SpawnerData> view;
public PotentialSpawns(LevelAccessor level, MobCategory category, BlockPos pos, WeightedRandomList<MobSpawnSettings.SpawnerData> oldList)
{
super(level);
this.pos = pos;
this.mobcategory = category;
if (!oldList.isEmpty())
this.list = new ArrayList<>(oldList.unwrap());
else
this.list = new ArrayList<>();
this.view = Collections.unmodifiableList(list);
}
/**
* {@return the category of the mobs in the spawn list.}
*/
public MobCategory getMobCategory()
{
return mobcategory;
}
/**
* {@return the block position where the chosen mob will be spawned.}
*/
public BlockPos getPos()
{
return pos;
}
/**
* {@return the list of mobs that can potentially be spawned.}
*/
public List<MobSpawnSettings.SpawnerData> getSpawnerDataList()
{
return view;
}
/**
* Appends a SpawnerData entry to the spawn list.
*
* @param data SpawnerData entry to be appended to the spawn list.
*/
public void addSpawnerData(MobSpawnSettings.SpawnerData data)
{
list.add(data);
}
/**
* Removes a SpawnerData entry from the spawn list.
*
* @param data SpawnerData entry to be removed from the spawn list.
*
* {@return {@code true} if the spawn list contained the specified element.}
*/
public boolean removeSpawnerData(MobSpawnSettings.SpawnerData data)
{
return list.remove(data);
}
}
}
@@ -32,12 +32,14 @@ public class MCRegisterPacketHandler
public static class ChannelList {
private Set<ResourceLocation> locations = new HashSet<>();
private Set<ResourceLocation> remoteLocations = Set.of();
public void updateFrom(final Supplier<NetworkEvent.Context> source, FriendlyByteBuf buffer, final NetworkEvent.RegistrationChangeType changeType) {
byte[] data = new byte[Math.max(buffer.readableBytes(), 0)];
buffer.readBytes(data);
Set<ResourceLocation> oldLocations = this.locations;
this.locations = bytesToResLocation(data);
this.remoteLocations = Set.copyOf(this.locations);
// ensure all locations receive updates, old and new.
oldLocations.addAll(this.locations);
oldLocations.stream()
@@ -76,6 +78,14 @@ public class MCRegisterPacketHandler
}
return rl;
}
/**
* {@return the unmodifiable set of channel locations sent by the remote side}
* This is useful for interacting with other modloaders via the network to inspect registered network channel IDs.
*/
public Set<ResourceLocation> getRemoteLocations() {
return this.remoteLocations;
}
}
public void addChannels(Set<ResourceLocation> locations, Connection manager) {
@@ -231,4 +231,10 @@ public class NetworkHooks
{
return mgr.channel().attr(NetworkConstants.FML_MOD_MISMATCH_DATA).get();
}
@Nullable
public static MCRegisterPacketHandler.ChannelList getChannelList(Connection mgr)
{
return mgr.channel().attr(NetworkConstants.FML_MC_REGISTRY).get();
}
}
@@ -95,6 +95,9 @@ public class NetworkInstance
public boolean isRemotePresent(Connection manager) {
ConnectionData connectionData = NetworkHooks.getConnectionData(manager);
return connectionData != null && connectionData.getChannels().containsKey(channelName);
MCRegisterPacketHandler.ChannelList channelList = NetworkHooks.getChannelList(manager);
return (connectionData != null && connectionData.getChannels().containsKey(channelName))
// if it's not in the fml connection data, let's check if it's sent by another modloader.
|| (channelList != null && channelList.getRemoteLocations().contains(channelName));
}
}
@@ -18,7 +18,7 @@ public class ClientChatEventTest
{
if (event.getMessage().equals("Cancel"))
event.setCanceled(true);
else if (event.getMessage().equals("Replace this text"))
event.setMessage("Text replaced.");
// else if (event.getMessage().equals("Replace this text"))
// event.setMessage("Text replaced.");
}
}
@@ -0,0 +1,46 @@
/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.debug.world;
import net.minecraft.core.BlockPos;
import net.minecraft.world.Difficulty;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.LevelAccessor;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.level.LevelEvent;
import net.minecraftforge.fml.common.Mod;
/**
* <p>This tests net.minecraftforge.event.world.World.WorldEvent.PotentialSpawns. If ENABLED is set to true,
* this test mod uses the PotentialSpawns event to prevent mobs in the MONSTER mob category from spawning if the
* game difficulty is set to anything other than hard.</p>
*/
@Mod("potentialspawnsevent_test")
public class PotentialSpawnsEventTest
{
public static final boolean ENABLED = false;
public PotentialSpawnsEventTest()
{
if (ENABLED)
{
MinecraftForge.EVENT_BUS.addListener(PotentialSpawnsEventTest::onlySpawnHostileMobs);
}
}
public static void onlySpawnHostileMobs(LevelEvent.PotentialSpawns event)
{
LevelAccessor level = event.getLevel();
BlockPos pos = event.getPos();
Difficulty difficulty = level.getCurrentDifficultyAt(pos).getDifficulty();
MobCategory category = event.getMobCategory();
if (category == MobCategory.MONSTER && difficulty != Difficulty.HARD)
{
event.setCanceled(true);
}
}
}
+2
View File
@@ -12,6 +12,8 @@ license="LGPL v2.1"
modId="structure_modifiers_test"
[[mods]]
modId="fluid_type_test"
[[mods]]
modId="potentialspawnsevent_test"
# LEGACY TEST CASES