mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
484 lines
23 KiB
Diff
484 lines
23 KiB
Diff
--- a/net/minecraft/client/Minecraft.java
|
|
+++ b/net/minecraft/client/Minecraft.java
|
|
@@ -236,7 +_,7 @@
|
|
import org.slf4j.Logger;
|
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
-public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler {
|
|
+public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft {
|
|
static Minecraft f_90981_;
|
|
private static final Logger f_90982_ = LogUtils.getLogger();
|
|
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
|
|
@@ -385,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_());
|
|
- 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_;
|
|
this.f_231338_ = new YggdrasilAuthenticationService(this.f_91030_);
|
|
this.f_91048_ = this.f_231338_.createMinecraftSessionService();
|
|
@@ -393,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_());
|
|
- 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_;
|
|
@@ -445,7 +_,6 @@
|
|
|
|
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
|
|
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);
|
|
@@ -453,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_);
|
|
@@ -500,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.client.ForgeHooksClient.onRegisterParticleProviders(f_91061_);
|
|
this.f_91036_.m_7217_(this.f_91061_);
|
|
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
|
|
this.f_91036_.m_7217_(this.f_91053_);
|
|
@@ -508,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_90995_);
|
|
+ this.f_91065_ = new net.minecraftforge.client.gui.overlay.ForgeGui(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_()) {
|
|
@@ -526,6 +_,19 @@
|
|
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());
|
|
+ net.minecraftforge.client.textures.TextureAtlasSpriteLoaderManager.init();
|
|
+ net.minecraftforge.client.gui.ClientTooltipComponentManager.init();
|
|
+ net.minecraftforge.client.EntitySpectatorShaderManager.init();
|
|
+ net.minecraftforge.client.ForgeHooksClient.onRegisterKeyMappings(f_91066_);
|
|
+ net.minecraftforge.client.RecipeBookManager.init();
|
|
+ net.minecraftforge.client.gui.overlay.GuiOverlayManager.init();
|
|
+ net.minecraftforge.client.DimensionSpecialEffectsManager.init();
|
|
+ net.minecraftforge.client.NamedRenderTypeManager.init();
|
|
+
|
|
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_();
|
|
@@ -543,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));
|
|
- }
|
|
|
|
}
|
|
|
|
@@ -592,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);
|
|
@@ -604,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_);
|
|
@@ -762,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);
|
|
}
|
|
|
|
}
|
|
@@ -892,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_()) {
|
|
@@ -906,6 +_,19 @@
|
|
}
|
|
}
|
|
|
|
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
|
+ Screen old = this.f_91080_;
|
|
+ if (p_91153_ != null) {
|
|
+ var event = new net.minecraftforge.client.event.ScreenEvent.Opening(old, p_91153_);
|
|
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
|
+ p_91153_ = event.getNewScreen();
|
|
+ }
|
|
+
|
|
+ if (old != null && p_91153_ != old) {
|
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Closing(old));
|
|
+ old.m_7861_();
|
|
+ }
|
|
+
|
|
this.f_91080_ = p_91153_;
|
|
BufferUploader.m_166835_();
|
|
if (p_91153_ != null) {
|
|
@@ -1049,11 +_,14 @@
|
|
RenderSystem.m_69481_();
|
|
this.f_91026_.m_7238_();
|
|
if (!this.f_91079_) {
|
|
+ this.realPartialTick = this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_; // Cache this since pause is volatile
|
|
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick);
|
|
this.f_91026_.m_6182_("gameRenderer");
|
|
this.f_91063_.m_109093_(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_, i, p_91384_);
|
|
this.f_91026_.m_6182_("toasts");
|
|
this.f_91003_.m_94920_(new PoseStack());
|
|
this.f_91026_.m_7238_();
|
|
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
|
|
}
|
|
|
|
if (this.f_91056_ != null) {
|
|
@@ -1180,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_();
|
|
}
|
|
@@ -1461,6 +_,7 @@
|
|
}
|
|
|
|
public void m_91395_() {
|
|
+ if (this.m_91396_()) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.GameShuttingDownEvent());
|
|
this.f_91019_ = false;
|
|
}
|
|
|
|
@@ -1490,10 +_,18 @@
|
|
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) {
|
|
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
|
BlockPos blockpos = blockhitresult.m_82425_();
|
|
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
|
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
|
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
|
+ if (inputEvent.isCanceled()) {
|
|
+ if (inputEvent.shouldSwingHand()) {
|
|
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
|
|
+ this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
|
+ }
|
|
+ return;
|
|
+ }
|
|
Direction direction = blockhitresult.m_82434_();
|
|
- if (this.f_91072_.m_105283_(blockpos, direction)) {
|
|
- this.f_91061_.m_107367_(blockpos, direction);
|
|
+ if (this.f_91072_.m_105283_(blockpos, direction) && inputEvent.shouldSwingHand()) {
|
|
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
|
|
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
|
}
|
|
}
|
|
@@ -1518,14 +_,20 @@
|
|
return false;
|
|
} else {
|
|
boolean flag = false;
|
|
- switch (this.f_91077_.m_6662_()) {
|
|
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
|
+ HitResult.Type hitType = this.f_91077_.m_6662_();
|
|
+ if(this.f_91077_ instanceof EntityHitResult entityHit) { // Forge: Perform attack range checks here, instead of in GameRenderer#pick, so extended-reach interactions work.
|
|
+ if(!f_91074_.canHit(entityHit.m_82443_(), 0)) hitType = HitResult.Type.MISS; // No padding in client code.
|
|
+ }
|
|
+ if (!inputEvent.isCanceled())
|
|
+ switch(hitType) {
|
|
case ENTITY:
|
|
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
|
|
break;
|
|
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;
|
|
@@ -1538,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;
|
|
}
|
|
@@ -1554,6 +_,11 @@
|
|
}
|
|
|
|
for(InteractionHand interactionhand : InteractionHand.values()) {
|
|
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.f_91066_.f_92095_, interactionhand);
|
|
+ if (inputEvent.isCanceled()) {
|
|
+ if (inputEvent.shouldSwingHand()) this.f_91074_.m_6674_(interactionhand);
|
|
+ return;
|
|
+ }
|
|
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
|
|
if (this.f_91077_ != null) {
|
|
switch (this.f_91077_.m_6662_()) {
|
|
@@ -1564,6 +_,7 @@
|
|
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.
|
|
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);
|
|
@@ -1571,6 +_,7 @@
|
|
|
|
if (interactionresult.m_19077_()) {
|
|
if (interactionresult.m_19080_()) {
|
|
+ if (inputEvent.shouldSwingHand())
|
|
this.f_91074_.m_6674_(interactionhand);
|
|
}
|
|
|
|
@@ -1583,6 +_,7 @@
|
|
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, 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);
|
|
@@ -1598,6 +_,9 @@
|
|
}
|
|
}
|
|
|
|
+ if (itemstack.m_41619_() && (this.f_91077_ == null || this.f_91077_.m_6662_() == HitResult.Type.MISS))
|
|
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.f_91074_, interactionhand);
|
|
+
|
|
if (!itemstack.m_41619_()) {
|
|
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
|
|
if (interactionresult2.m_19077_()) {
|
|
@@ -1624,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_();
|
|
@@ -1752,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_() {
|
|
@@ -1894,8 +_,8 @@
|
|
SkullBlockEntity.m_222885_(services, this);
|
|
GameProfileCache.m_11004_(false);
|
|
this.f_91007_ = MinecraftServer.m_129872_((p_231361_) -> {
|
|
- return new IntegratedServer(p_231361_, this, p_231382_, p_231383_, p_231384_, services, (p_231447_) -> {
|
|
- StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_231447_ + 0);
|
|
+ return new IntegratedServer(p_231361_, this, p_231382_, p_231383_, p_231384_, services, (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);
|
|
});
|
|
@@ -1945,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_(Component.m_237115_("connect.joining"));
|
|
this.m_91362_(progressscreen);
|
|
@@ -1978,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");
|
|
|
|
@@ -1996,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_();
|
|
}
|
|
|
|
@@ -2082,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
|
|
}
|
|
}
|
|
|
|
@@ -2632,8 +_,8 @@
|
|
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_) {
|
|
- int i = p_167938_.m_10374_();
|
|
+ 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_.getPackFormat(PackType.CLIENT_RESOURCES);
|
|
Supplier<PackResources> supplier = p_167937_;
|
|
if (i <= 3) {
|
|
supplier = m_91330_(p_167937_);
|
|
@@ -2643,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_) {
|
|
@@ -2662,6 +_,14 @@
|
|
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_() {
|
|
return this.f_167844_;
|
|
}
|
|
@@ -2719,4 +_,11 @@
|
|
|
|
public abstract boolean m_142594_(boolean p_168035_);
|
|
}
|
|
+
|
|
+ // FORGE START
|
|
+ private float realPartialTick;
|
|
+ public float getPartialTick() {
|
|
+ return realPartialTick;
|
|
+ }
|
|
+ // FORGE END
|
|
}
|