mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
Co-authored-by: sciwhiz12 <[email protected]> Co-authored-by: Marc Hermans <[email protected]> Co-authored-by: LexManos <[email protected]> Co-authored-by: Curle <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
518 lines
26 KiB
Diff
518 lines
26 KiB
Diff
--- a/net/minecraft/client/Minecraft.java
|
|
+++ b/net/minecraft/client/Minecraft.java
|
|
@@ -252,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 {
|
|
private static Minecraft f_90981_;
|
|
private static final Logger f_90982_ = LogUtils.getLogger();
|
|
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
|
|
@@ -394,14 +_,13 @@
|
|
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_());
|
|
- this.f_91038_ = new PackRepository(Minecraft::m_167933_, this.f_91037_, new FolderRepositorySource(this.f_90985_, PackSource.f_10527_));
|
|
+ this.f_91038_ = new PackRepository(Minecraft::createClientPackAdapter, this.f_91037_, new FolderRepositorySource(this.f_90985_, PackSource.f_10527_));
|
|
this.f_91030_ = p_91084_.f_101905_.f_101945_;
|
|
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_);
|
|
this.f_91048_ = yggdrasilauthenticationservice.createMinecraftSessionService();
|
|
this.f_193584_ = this.m_193585_(yggdrasilauthenticationservice, 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_;
|
|
@@ -433,6 +_,7 @@
|
|
}
|
|
|
|
Util.f_137440_ = RenderSystem.m_69576_();
|
|
+ if (net.minecraftforge.common.ForgeConfig.CLIENT.forceSystemNanoTime.get()) Util.f_137440_ = System::nanoTime;
|
|
this.f_90989_ = new VirtualScreen(this);
|
|
this.f_90990_ = this.f_90989_.m_110872_(displaydata, this.f_91066_.f_92123_, this.m_91270_());
|
|
this.m_7440_(true);
|
|
@@ -448,7 +_,6 @@
|
|
|
|
this.f_90990_.m_85380_(this.f_91066_.f_92113_);
|
|
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.m_69580_(this.f_91066_.f_92035_, false);
|
|
@@ -456,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);
|
|
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_, this.f_91037_);
|
|
this.f_91038_.m_10506_();
|
|
this.f_91066_.m_92145_(this.f_91038_);
|
|
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
|
|
@@ -504,6 +_,7 @@
|
|
this.m_91271_();
|
|
this.f_91036_.m_7217_(this.f_90997_);
|
|
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
|
|
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.ParticleFactoryRegisterEvent());
|
|
this.f_91036_.m_7217_(this.f_91061_);
|
|
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
|
|
this.f_91036_.m_7217_(this.f_91053_);
|
|
@@ -512,7 +_,8 @@
|
|
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_91065_ = new net.minecraftforge.client.gui.ForgeIngameGui(this);
|
|
+ this.f_91067_.m_91524_(this.f_90990_.m_85439_()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler.
|
|
this.f_91064_ = new DebugRenderer(this);
|
|
RenderSystem.m_69900_(this::m_91113_);
|
|
if (this.f_91042_.f_83915_ == this.f_90990_.m_85441_() && this.f_91042_.f_83916_ == this.f_90990_.m_85442_()) {
|
|
@@ -530,6 +_,11 @@
|
|
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
|
}
|
|
|
|
+ net.minecraftforge.gametest.ForgeGameTestHooks.registerGametests();
|
|
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterClientReloadListenersEvent(this.f_91036_));
|
|
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterLayerDefinitions());
|
|
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterRenderers());
|
|
+
|
|
this.f_90990_.m_85409_(this.f_91066_.f_92041_);
|
|
this.f_90990_.m_85424_(this.f_91066_.f_92034_);
|
|
this.f_90990_.m_85426_();
|
|
@@ -545,13 +_,16 @@
|
|
}
|
|
|
|
this.f_167847_.m_168556_();
|
|
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
|
|
+ // FORGE: Move opening initial screen to after startup and events are enabled.
|
|
+ // Also Fixes MC-145102
|
|
+ if (s != null) {
|
|
+ ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
|
|
+ } else {
|
|
+ this.m_91152_(new TitleScreen(true));
|
|
+ }
|
|
});
|
|
}, false));
|
|
- if (s != null) {
|
|
- ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
|
|
- } else {
|
|
- this.m_91152_(new TitleScreen(true));
|
|
- }
|
|
|
|
}
|
|
|
|
@@ -594,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);
|
|
@@ -606,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_);
|
|
@@ -763,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);
|
|
}
|
|
|
|
}
|
|
@@ -879,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_()) {
|
|
@@ -893,6 +_,15 @@
|
|
}
|
|
}
|
|
|
|
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
|
+ Screen old = this.f_91080_;
|
|
+ net.minecraftforge.client.event.ScreenOpenEvent event = new net.minecraftforge.client.event.ScreenOpenEvent(p_91153_);
|
|
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
|
+
|
|
+ p_91153_ = event.getScreen();
|
|
+ if (old != null && p_91153_ != old)
|
|
+ old.m_7861_();
|
|
+
|
|
this.f_91080_ = p_91153_;
|
|
BufferUploader.m_166835_();
|
|
if (p_91153_ != null) {
|
|
@@ -1022,11 +_,13 @@
|
|
RenderSystem.m_69481_();
|
|
this.f_91026_.m_7238_();
|
|
if (!this.f_91079_) {
|
|
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
|
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_6182_("toasts");
|
|
this.f_91003_.m_94920_(new PoseStack());
|
|
this.f_91026_.m_7238_();
|
|
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
|
}
|
|
|
|
if (this.f_91056_ != null) {
|
|
@@ -1132,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_();
|
|
}
|
|
@@ -1432,11 +_,21 @@
|
|
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)) {
|
|
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent 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 (inputEvent.shouldSwingHand()) {
|
|
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
|
|
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -1460,6 +_,8 @@
|
|
return false;
|
|
} else {
|
|
boolean flag = false;
|
|
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent 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_());
|
|
@@ -1467,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;
|
|
@@ -1480,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;
|
|
}
|
|
@@ -1496,6 +_,11 @@
|
|
}
|
|
|
|
for(InteractionHand interactionhand : InteractionHand.values()) {
|
|
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent 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 (this.f_91077_ != null) {
|
|
switch(this.f_91077_.m_6662_()) {
|
|
@@ -1513,6 +_,7 @@
|
|
|
|
if (interactionresult.m_19077_()) {
|
|
if (interactionresult.m_19080_()) {
|
|
+ if (inputEvent.shouldSwingHand())
|
|
this.f_91074_.m_6674_(interactionhand);
|
|
}
|
|
|
|
@@ -1525,6 +_,7 @@
|
|
InteractionResult interactionresult1 = this.f_91072_.m_105262_(this.f_91074_, this.f_91073_, interactionhand, blockhitresult);
|
|
if (interactionresult1.m_19077_()) {
|
|
if (interactionresult1.m_19080_()) {
|
|
+ if (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);
|
|
@@ -1540,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_105235_(this.f_91074_, this.f_91073_, interactionhand);
|
|
if (interactionresult2.m_19077_()) {
|
|
@@ -1566,6 +_,8 @@
|
|
--this.f_91011_;
|
|
}
|
|
|
|
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
|
|
+
|
|
this.f_91026_.m_6180_("gui");
|
|
this.f_91065_.m_193832_(this.f_91012_);
|
|
this.f_91026_.m_7238_();
|
|
@@ -1694,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_() {
|
|
@@ -1814,11 +_,11 @@
|
|
}
|
|
|
|
public void m_91200_(String p_91201_) {
|
|
- this.m_205205_(p_91201_, WorldStem.DataPackConfigSupplier::m_206928_, WorldStem.WorldDataSupplier::m_206954_, false, Minecraft.ExperimentalDialogType.BACKUP);
|
|
+ this.doLoadLevel(p_91201_, WorldStem.DataPackConfigSupplier::m_206928_, WorldStem.WorldDataSupplier::m_206954_, false, Minecraft.ExperimentalDialogType.BACKUP, false);
|
|
}
|
|
|
|
public void m_205185_(String p_205186_, LevelSettings p_205187_, RegistryAccess p_205188_, WorldGenSettings p_205189_) {
|
|
- this.m_205205_(p_205186_, (p_210684_) -> {
|
|
+ this.doLoadLevel(p_205186_, (p_210684_) -> {
|
|
return p_205187_::m_46934_;
|
|
}, (p_210718_) -> {
|
|
return (p_210712_, p_210713_) -> {
|
|
@@ -1831,10 +_,10 @@
|
|
WorldGenSettings worldgensettings = dataresult.getOrThrow(false, Util.m_137489_("Error reading worldgen settings after loading data packs: ", f_90982_::error));
|
|
return Pair.of(new PrimaryLevelData(p_205187_, worldgensettings, dataresult.lifecycle()), registryaccess$writable.m_203557_());
|
|
};
|
|
- }, false, Minecraft.ExperimentalDialogType.CREATE);
|
|
+ }, false, Minecraft.ExperimentalDialogType.CREATE, true);
|
|
}
|
|
|
|
- private void m_205205_(String p_205206_, Function<LevelStorageSource.LevelStorageAccess, WorldStem.DataPackConfigSupplier> p_205207_, Function<LevelStorageSource.LevelStorageAccess, WorldStem.WorldDataSupplier> p_205208_, boolean p_205209_, Minecraft.ExperimentalDialogType p_205210_) {
|
|
+ private void doLoadLevel(String p_205206_, Function<LevelStorageSource.LevelStorageAccess, WorldStem.DataPackConfigSupplier> p_205207_, Function<LevelStorageSource.LevelStorageAccess, WorldStem.WorldDataSupplier> p_205208_, boolean p_205209_, Minecraft.ExperimentalDialogType p_205210_, boolean creating) {
|
|
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess;
|
|
try {
|
|
levelstoragesource$levelstorageaccess = this.f_91031_.m_78260_(p_205206_);
|
|
@@ -1849,11 +_,18 @@
|
|
|
|
WorldStem worldstem;
|
|
try {
|
|
+
|
|
+ //TODO-PATCHING: World loading has changed massively. Figure out what calls need to be delayed.
|
|
+ /*if (!creating) levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData();
|
|
+ registryHolder = creating ? p_91221_ : RegistryAccess.m_123086_();
|
|
+ minecraft$serverstem = this.m_91190_(registryHolder, p_91222_, p_91223_, p_91224_, levelstoragesource$levelstorageaccess);
|
|
+*/
|
|
+
|
|
worldstem = this.m_205125_(packrepository, p_205209_, p_205207_.apply(levelstoragesource$levelstorageaccess), p_205208_.apply(levelstoragesource$levelstorageaccess));
|
|
} catch (Exception exception) {
|
|
f_90982_.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception);
|
|
this.m_91152_(new DatapackLoadFailureScreen(() -> {
|
|
- this.m_205205_(p_205206_, p_205207_, p_205208_, true, p_205210_);
|
|
+ this.doLoadLevel(p_205206_, p_205207_, p_205208_, true, p_205210_, creating);
|
|
}));
|
|
|
|
try {
|
|
@@ -1875,7 +_,7 @@
|
|
|
|
try {
|
|
RegistryAccess.Frozen registryaccess$frozen = worldstem.f_206894_();
|
|
- levelstoragesource$levelstorageaccess.m_78287_(registryaccess$frozen, worlddata);
|
|
+ levelstoragesource$levelstorageaccess.m_78287_(registryaccess$frozen, worlddata); //TODO-PATCHING: Figure out what registry access needs to be passed in here.
|
|
worldstem.m_206901_();
|
|
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_);
|
|
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
|
@@ -1885,7 +_,7 @@
|
|
SkullBlockEntity.m_196700_(gameprofilecache, minecraftsessionservice, this);
|
|
GameProfileCache.m_11004_(false);
|
|
this.f_91007_ = MinecraftServer.m_129872_((p_210695_) -> {
|
|
- return new IntegratedServer(p_210695_, this, levelstoragesource$levelstorageaccess, packrepository, worldstem, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_210795_) -> {
|
|
+ return new IntegratedServer(p_210695_, this, levelstoragesource$levelstorageaccess, packrepository, worldstem, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_210795_) -> { //TODO-PATCHING: Handle the registry freeze delay again.
|
|
StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_210795_ + 0);
|
|
this.f_90999_.set(storingchunkprogresslistener);
|
|
return ProcessorChunkProgressListener.m_143583_(storingchunkprogresslistener, this.f_91023_::add);
|
|
@@ -1929,11 +_,16 @@
|
|
connection.m_129505_(new ClientHandshakePacketListenerImpl(connection, this, (Screen)null, (p_210793_) -> {
|
|
}));
|
|
connection.m_129512_(new ClientIntentionPacket(socketaddress.toString(), 0, ConnectionProtocol.LOGIN));
|
|
- connection.m_129512_(new ServerboundHelloPacket(this.m_91094_().m_92548_()));
|
|
+ com.mojang.authlib.GameProfile gameProfile = this.m_91094_().m_92548_();
|
|
+ if (!this.m_91094_().hasCachedProperties()) {
|
|
+ gameProfile = f_91048_.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974.
|
|
+ this.m_91094_().setProperties(gameProfile.getProperties());
|
|
+ }
|
|
+ connection.m_129512_(new ServerboundHelloPacket(gameProfile));
|
|
this.f_91009_ = connection;
|
|
} else {
|
|
this.m_91143_(p_205210_, p_205206_, flag, () -> {
|
|
- this.m_205205_(p_205206_, p_205207_, p_205208_, p_205209_, Minecraft.ExperimentalDialogType.NONE);
|
|
+ this.doLoadLevel(p_205206_, p_205207_, p_205208_, p_205209_, Minecraft.ExperimentalDialogType.NONE, creating);
|
|
});
|
|
worldstem.close();
|
|
|
|
@@ -2026,6 +_,7 @@
|
|
}
|
|
|
|
public void m_91156_(ClientLevel p_91157_) {
|
|
+ if (f_91073_ != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(f_91073_));
|
|
ProgressScreen progressscreen = new ProgressScreen(true);
|
|
progressscreen.m_6309_(new TranslatableComponent("connect.joining"));
|
|
this.m_91362_(progressscreen);
|
|
@@ -2058,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;
|
|
NarratorChatListener.f_93311_.m_93328_();
|
|
this.m_91362_(p_91321_);
|
|
if (this.f_91073_ != null) {
|
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(f_91073_));
|
|
if (integratedserver != null) {
|
|
this.f_91026_.m_6180_("waitForServer");
|
|
|
|
@@ -2076,6 +_,7 @@
|
|
this.f_91065_.m_93089_();
|
|
this.f_91008_ = null;
|
|
this.f_91010_ = false;
|
|
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(f_91073_);
|
|
this.f_91004_.m_90740_();
|
|
}
|
|
|
|
@@ -2162,66 +_,9 @@
|
|
|
|
private void m_91280_() {
|
|
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
|
|
- boolean flag = this.f_91074_.m_150110_().f_35937_;
|
|
- BlockEntity blockentity = null;
|
|
- HitResult.Type hitresult$type = this.f_91077_.m_6662_();
|
|
- ItemStack itemstack;
|
|
- if (hitresult$type == HitResult.Type.BLOCK) {
|
|
- BlockPos blockpos = ((BlockHitResult)this.f_91077_).m_82425_();
|
|
- BlockState blockstate = this.f_91073_.m_8055_(blockpos);
|
|
- if (blockstate.m_60795_()) {
|
|
- return;
|
|
- }
|
|
-
|
|
- Block block = blockstate.m_60734_();
|
|
- itemstack = block.m_7397_(this.f_91073_, blockpos, blockstate);
|
|
- if (itemstack.m_41619_()) {
|
|
- return;
|
|
- }
|
|
-
|
|
- if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
|
|
- blockentity = this.f_91073_.m_7702_(blockpos);
|
|
- }
|
|
- } else {
|
|
- if (hitresult$type != HitResult.Type.ENTITY || !flag) {
|
|
- return;
|
|
- }
|
|
-
|
|
- Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
|
|
- itemstack = entity.m_142340_();
|
|
- if (itemstack == null) {
|
|
- return;
|
|
- }
|
|
- }
|
|
-
|
|
- if (itemstack.m_41619_()) {
|
|
- String s = "";
|
|
- if (hitresult$type == HitResult.Type.BLOCK) {
|
|
- s = Registry.f_122824_.m_7981_(this.f_91073_.m_8055_(((BlockHitResult)this.f_91077_).m_82425_()).m_60734_()).toString();
|
|
- } else if (hitresult$type == HitResult.Type.ENTITY) {
|
|
- s = Registry.f_122826_.m_7981_(((EntityHitResult)this.f_91077_).m_82443_().m_6095_()).toString();
|
|
- }
|
|
-
|
|
- f_90982_.warn("Picking on: [{}] {} gave null item", hitresult$type, s);
|
|
- } else {
|
|
- Inventory inventory = this.f_91074_.m_150109_();
|
|
- if (blockentity != null) {
|
|
- this.m_91122_(itemstack, blockentity);
|
|
- }
|
|
-
|
|
- int i = inventory.m_36030_(itemstack);
|
|
- if (flag) {
|
|
- inventory.m_36012_(itemstack);
|
|
- this.f_91072_.m_105241_(this.f_91074_.m_21120_(InteractionHand.MAIN_HAND), 36 + inventory.f_35977_);
|
|
- } else if (i != -1) {
|
|
- if (Inventory.m_36045_(i)) {
|
|
- inventory.f_35977_ = i;
|
|
- } else {
|
|
- this.f_91072_.m_105206_(i);
|
|
- }
|
|
- }
|
|
-
|
|
- }
|
|
+ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.f_91066_.f_92097_, InteractionHand.MAIN_HAND).isCanceled())
|
|
+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.f_91077_, this.f_91074_, this.f_91073_);
|
|
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
|
|
}
|
|
}
|
|
|
|
@@ -2713,7 +_,7 @@
|
|
return this.f_90993_;
|
|
}
|
|
|
|
- private static Pack m_167933_(String p_167934_, Component p_167935_, boolean p_167936_, Supplier<PackResources> p_167937_, PackMetadataSection p_167938_, Pack.Position p_167939_, PackSource p_167940_) {
|
|
+ private static Pack createClientPackAdapter(String p_167934_, Component p_167935_, boolean p_167936_, Supplier<PackResources> p_167937_, PackMetadataSection p_167938_, Pack.Position p_167939_, PackSource p_167940_, boolean hidden) {
|
|
int i = p_167938_.m_10374_();
|
|
Supplier<PackResources> supplier = p_167937_;
|
|
if (i <= 3) {
|
|
@@ -2724,7 +_,7 @@
|
|
supplier = m_91352_(supplier);
|
|
}
|
|
|
|
- return new Pack(p_167934_, p_167935_, p_167936_, supplier, p_167938_, PackType.CLIENT_RESOURCES, p_167939_, p_167940_);
|
|
+ return new Pack(p_167934_, p_167935_, p_167936_, supplier, p_167938_, PackType.CLIENT_RESOURCES, p_167939_, p_167940_, hidden);
|
|
}
|
|
|
|
private static Supplier<PackResources> m_91330_(Supplier<PackResources> p_91331_) {
|
|
@@ -2741,6 +_,14 @@
|
|
|
|
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_;
|
|
}
|
|
|
|
public EntityModelSet m_167973_() {
|