mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
534 lines
27 KiB
Diff
534 lines
27 KiB
Diff
--- a/net/minecraft/client/Minecraft.java
|
|
+++ b/net/minecraft/client/Minecraft.java
|
|
@@ -257,7 +_,7 @@
|
|
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
-public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements SnooperPopulator, WindowEventHandler {
|
|
+public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements SnooperPopulator, WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft {
|
|
private static Minecraft f_90981_;
|
|
private static final Logger f_90982_ = LogManager.getLogger();
|
|
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
|
|
@@ -397,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_91049_ = this.m_91130_(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_;
|
|
@@ -436,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);
|
|
@@ -450,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);
|
|
@@ -458,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 SimpleReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
|
+ net.minecraftforge.fmlclient.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_);
|
|
@@ -506,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_);
|
|
@@ -513,7 +_,8 @@
|
|
this.f_91036_.m_7217_(this.f_91054_);
|
|
this.f_91047_ = new GpuWarnlistManager();
|
|
this.f_91036_.m_7217_(this.f_91047_);
|
|
- 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_()) {
|
|
@@ -531,6 +_,10 @@
|
|
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
|
}
|
|
|
|
+ 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_();
|
|
@@ -546,13 +_,16 @@
|
|
}
|
|
|
|
this.f_167847_.m_168556_();
|
|
+ if (net.minecraftforge.fmlclient.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));
|
|
- }
|
|
|
|
}
|
|
|
|
@@ -587,6 +_,8 @@
|
|
|
|
private SocialInteractionsService m_91130_(YggdrasilAuthenticationService p_91131_, GameConfig p_91132_) {
|
|
try {
|
|
+ if ("0".equals(p_91132_.f_101905_.f_101942_.m_92547_())) // Forge: We use "0" in dev. Short circuit to stop exception spam.
|
|
+ return new OfflineSocialInteractions();
|
|
return p_91131_.createSocialInteractionsService(p_91132_.f_101905_.f_101942_.m_92547_());
|
|
} catch (AuthenticationException authenticationexception) {
|
|
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
|
|
@@ -599,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.
|
|
Component component;
|
|
if (p_91240_ instanceof SimpleReloadableResourceManager.ResourcePackLoadingFailure) {
|
|
component = new TextComponent(((SimpleReloadableResourceManager.ResourcePackLoadingFailure)p_91240_).m_10921_().m_8017_());
|
|
@@ -690,7 +_,7 @@
|
|
return Stream.of(Registry.f_122827_.m_7981_(p_91317_.m_41720_()));
|
|
});
|
|
ReloadableIdSearchTree<ItemStack> reloadableidsearchtree = new ReloadableIdSearchTree<>((p_91121_) -> {
|
|
- return ItemTags.m_13193_().m_13394_(p_91121_.m_41720_()).stream();
|
|
+ return p_91121_.m_41720_().getTags().stream();
|
|
});
|
|
NonNullList<ItemStack> nonnulllist = NonNullList.m_122779_();
|
|
|
|
@@ -760,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.fmllegacy.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.fmllegacy.server.ServerLifecycleHooks.handleExit(-1);
|
|
} else {
|
|
Bootstrap.m_135875_("#@?@# Game crashed! Crash report could not be saved. #@?@#");
|
|
- System.exit(-2);
|
|
+ net.minecraftforge.fmllegacy.server.ServerLifecycleHooks.handleExit(-2);
|
|
}
|
|
|
|
}
|
|
@@ -876,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_()) {
|
|
@@ -890,6 +_,15 @@
|
|
}
|
|
}
|
|
|
|
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
|
+ Screen old = this.f_91080_;
|
|
+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(p_91153_);
|
|
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
|
+
|
|
+ p_91153_ = event.getGui();
|
|
+ if (old != null && p_91153_ != old)
|
|
+ old.m_7861_();
|
|
+
|
|
this.f_91080_ = p_91153_;
|
|
BufferUploader.m_166835_();
|
|
if (p_91153_ != null) {
|
|
@@ -1018,11 +_,13 @@
|
|
RenderSystem.m_69481_();
|
|
this.f_91026_.m_7238_();
|
|
if (!this.f_91079_) {
|
|
+ net.minecraftforge.fmllegacy.hooks.BasicEventHooks.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.fmllegacy.hooks.BasicEventHooks.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);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -1455,6 +_,8 @@
|
|
}
|
|
|
|
} else if (!this.f_91074_.m_108637_()) {
|
|
+ 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_());
|
|
@@ -1462,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_());
|
|
break;
|
|
}
|
|
@@ -1472,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);
|
|
}
|
|
}
|
|
@@ -1488,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_()) {
|
|
@@ -1501,6 +_,7 @@
|
|
|
|
if (interactionresult.m_19077_()) {
|
|
if (interactionresult.m_19080_()) {
|
|
+ if (inputEvent.shouldSwingHand())
|
|
this.f_91074_.m_6674_(interactionhand);
|
|
}
|
|
|
|
@@ -1513,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);
|
|
@@ -1528,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_()) {
|
|
@@ -1554,6 +_,8 @@
|
|
--this.f_91011_;
|
|
}
|
|
|
|
+ net.minecraftforge.fmllegacy.hooks.BasicEventHooks.onPreClientTick();
|
|
+
|
|
this.f_91026_.m_6180_("gui");
|
|
if (!this.f_91012_) {
|
|
this.f_91065_.m_93066_();
|
|
@@ -1679,6 +_,8 @@
|
|
this.f_91026_.m_6182_("keyboard");
|
|
this.f_91068_.m_90931_();
|
|
this.f_91026_.m_7238_();
|
|
+
|
|
+ net.minecraftforge.fmllegacy.hooks.BasicEventHooks.onPostClientTick();
|
|
}
|
|
|
|
private boolean m_91278_() {
|
|
@@ -1814,11 +_,11 @@
|
|
}
|
|
|
|
public void m_91200_(String p_91201_) {
|
|
- this.m_91219_(p_91201_, RegistryAccess.m_123086_(), Minecraft::m_91133_, Minecraft::m_91135_, false, Minecraft.ExperimentalDialogType.BACKUP);
|
|
+ this.doLoadLevel(p_91201_, RegistryAccess.m_123086_(), Minecraft::m_91133_, Minecraft::m_91135_, false, Minecraft.ExperimentalDialogType.BACKUP, false);
|
|
}
|
|
|
|
public void m_91202_(String p_91203_, LevelSettings p_91204_, RegistryAccess.RegistryHolder p_91205_, WorldGenSettings p_91206_) {
|
|
- this.m_91219_(p_91203_, p_91205_, (p_167869_) -> {
|
|
+ this.doLoadLevel(p_91203_, p_91205_, (p_91129_) -> {
|
|
return p_91204_.m_46934_();
|
|
}, (p_167886_, p_167887_, p_167888_, p_167889_) -> {
|
|
RegistryWriteOps<JsonElement> registrywriteops = RegistryWriteOps.m_135767_(JsonOps.INSTANCE, p_91205_);
|
|
@@ -1828,10 +_,10 @@
|
|
});
|
|
WorldGenSettings worldgensettings = dataresult.resultOrPartial(Util.m_137489_("Error reading worldgen settings after loading data packs: ", f_90982_::error)).orElse(p_91206_);
|
|
return new PrimaryLevelData(p_91204_, worldgensettings, dataresult.lifecycle());
|
|
- }, false, Minecraft.ExperimentalDialogType.CREATE);
|
|
+ }, false, Minecraft.ExperimentalDialogType.CREATE, true);
|
|
}
|
|
|
|
- private void m_91219_(String p_91220_, RegistryAccess.RegistryHolder p_91221_, Function<LevelStorageSource.LevelStorageAccess, DataPackConfig> p_91222_, Function4<LevelStorageSource.LevelStorageAccess, RegistryAccess.RegistryHolder, ResourceManager, DataPackConfig, WorldData> p_91223_, boolean p_91224_, Minecraft.ExperimentalDialogType p_91225_) {
|
|
+ private void doLoadLevel(String p_91220_, RegistryAccess.RegistryHolder p_91221_, Function<LevelStorageSource.LevelStorageAccess, DataPackConfig> p_91222_, Function4<LevelStorageSource.LevelStorageAccess, RegistryAccess.RegistryHolder, ResourceManager, DataPackConfig, WorldData> p_91223_, boolean p_91224_, Minecraft.ExperimentalDialogType p_91225_, boolean creating) {
|
|
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess;
|
|
try {
|
|
levelstoragesource$levelstorageaccess = this.f_91031_.m_78260_(p_91220_);
|
|
@@ -1843,12 +_,17 @@
|
|
}
|
|
|
|
Minecraft.ServerStem minecraft$serverstem;
|
|
+ final RegistryAccess.RegistryHolder dyn_f;
|
|
try {
|
|
- minecraft$serverstem = this.m_91190_(p_91221_, p_91222_, p_91223_, p_91224_, levelstoragesource$levelstorageaccess);
|
|
+ Minecraft.ServerStem mgr = this.m_91190_(p_91221_, p_91222_, p_91223_, p_91224_, levelstoragesource$levelstorageaccess);
|
|
+ // We need to rebuild this if we're loading world, so that it gets all the information from AFTER we inject our mappings from the save.
|
|
+ dyn_f = creating ? p_91221_ : RegistryAccess.m_123086_();
|
|
+ minecraft$serverstem = creating ? mgr : this.m_91190_(dyn_f, p_91222_, p_91223_, p_91224_, levelstoragesource$levelstorageaccess); //Note this runs the injection again... which isn't good.. but hey.. we need a better spot to hook in.
|
|
+
|
|
} 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_91219_(p_91220_, p_91221_, p_91222_, p_91223_, true, p_91225_);
|
|
+ this.doLoadLevel(p_91220_, p_91221_, p_91222_, p_91223_, true, p_91225_, creating);
|
|
}));
|
|
|
|
try {
|
|
@@ -1868,7 +_,7 @@
|
|
this.f_90999_.set((StoringChunkProgressListener)null);
|
|
|
|
try {
|
|
- levelstoragesource$levelstorageaccess.m_78287_(p_91221_, worlddata);
|
|
+ levelstoragesource$levelstorageaccess.m_78287_(dyn_f, worlddata);
|
|
minecraft$serverstem.m_91433_().m_136179_();
|
|
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_);
|
|
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
|
@@ -1880,7 +_,7 @@
|
|
SkullBlockEntity.m_182462_(this);
|
|
GameProfileCache.m_11004_(false);
|
|
this.f_91007_ = MinecraftServer.m_129872_((p_167898_) -> {
|
|
- return new IntegratedServer(p_167898_, this, p_91221_, levelstoragesource$levelstorageaccess, minecraft$serverstem.m_91432_(), minecraft$serverstem.m_91433_(), worlddata, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_168000_) -> {
|
|
+ return new IntegratedServer(p_167898_, this, dyn_f, levelstoragesource$levelstorageaccess, minecraft$serverstem.m_91432_(), minecraft$serverstem.m_91433_(), worlddata, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_168000_) -> {
|
|
StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_168000_ + 0);
|
|
this.f_90999_.set(storingchunkprogresslistener);
|
|
return ProcessorChunkProgressListener.m_143583_(storingchunkprogresslistener, this.f_91023_::add);
|
|
@@ -1924,11 +_,16 @@
|
|
connection.m_129505_(new ClientHandshakePacketListenerImpl(connection, this, (Screen)null, (p_167998_) -> {
|
|
}));
|
|
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_91225_, p_91220_, flag, () -> {
|
|
- this.m_91219_(p_91220_, p_91221_, p_91222_, p_91223_, p_91224_, Minecraft.ExperimentalDialogType.NONE);
|
|
+ this.doLoadLevel(p_91220_, dyn_f, p_91222_, p_91223_, p_91224_, Minecraft.ExperimentalDialogType.NONE, creating);
|
|
});
|
|
minecraft$serverstem.close();
|
|
|
|
@@ -2016,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);
|
|
@@ -2049,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");
|
|
|
|
@@ -2067,6 +_,7 @@
|
|
this.f_91065_.m_93089_();
|
|
this.f_91008_ = null;
|
|
this.f_91010_ = false;
|
|
+ net.minecraftforge.client.ForgeHooksClient.handleClientWorldClosing(f_91073_);
|
|
this.f_91004_.m_90740_();
|
|
}
|
|
|
|
@@ -2097,6 +_,7 @@
|
|
this.f_91061_.m_107342_(p_91325_);
|
|
this.f_167845_.m_112257_(p_91325_);
|
|
this.m_91341_();
|
|
+ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
|
|
}
|
|
|
|
public boolean m_91400_() {
|
|
@@ -2152,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
|
|
}
|
|
}
|
|
|
|
@@ -2768,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) {
|
|
@@ -2779,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_) {
|
|
@@ -2796,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_() {
|