Port to pre4

This commit is contained in:
XFactHD
2026-06-15 12:29:11 +01:00
committed by Apex
parent 484811396c
commit a9675c7e12
38 changed files with 281 additions and 282 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ diffpatch_version=2.1.0.43
java_version=25
minecraft_version=26.2-pre-2
minecraft_version=26.2-pre-4
neoform_version=1
# on snapshot versions, used to prefix the version
# should always have 3 components (major.minor.hotfix)
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/opengl/GlCommandEncoder.java
+++ b/com/mojang/blaze3d/opengl/GlCommandEncoder.java
@@ -255,7 +_,8 @@
@@ -239,7 +_,8 @@
@Override
public void clearDepthTexture(GpuTexture depthTexture, double clearDepth) {
@@ -10,7 +10,7 @@
GL33C.glDrawBuffer(0);
GL33C.glClearDepth(clearDepth);
GlStateManager._depthMask(true);
@@ -267,6 +_,17 @@
@@ -251,6 +_,17 @@
}
@Override
@@ -28,7 +28,7 @@
public void writeToBuffer(GpuBufferSlice slice, ByteBuffer data) {
GlBuffer buffer = (GlBuffer)slice.buffer();
buffer.checkCanBeUsed();
@@ -354,11 +_,22 @@
@@ -364,11 +_,22 @@
boolean isDepth = source.getFormat().hasDepthAspect();
int sourceId = ((GlTexture)source).glId();
int destId = ((GlTexture)destination).glId();
@@ -54,7 +54,7 @@
int error = GlStateManager._getError();
if (error != 0) {
throw new IllegalStateException(
@@ -754,6 +_,26 @@
@@ -763,6 +_,26 @@
GlStateManager._scissorBox(renderPass.getScissorX(), renderPass.getScissorY(), renderPass.getScissorWidth(), renderPass.getScissorHeight());
} else {
GlStateManager._disableScissorTest();
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/opengl/GlConst.java
+++ b/com/mojang/blaze3d/opengl/GlConst.java
@@ -373,4 +_,17 @@
@@ -363,4 +_,17 @@
return 35044;
}
}
@@ -1,9 +1,9 @@
--- a/com/mojang/blaze3d/platform/Window.java
+++ b/com/mojang/blaze3d/platform/Window.java
@@ -91,6 +_,16 @@
@@ -102,6 +_,16 @@
this.windowedWidth = this.width = allowedWindowMinSize(displayData.width());
this.windowedHeight = this.height = allowedWindowMinSize(displayData.height());
this.handle = this.createWindow(backend, this.width, this.height, title, this.fullscreen && initialMonitor != null ? initialMonitor.getMonitor() : 0L);
this.handle = this.createWindow(backend, this.width, this.height, title, this.fullscreen && initialMonitor != null ? initialMonitor.monitor() : 0L);
+ // Neo: If the window was taken over from EarlyLoadingScreen, inherit a potentially resized window size
+ var earlyLoadingScreen = net.neoforged.fml.loading.EarlyLoadingScreenController.current();
+ if (earlyLoadingScreen != null) {
@@ -17,7 +17,7 @@
this.backend = backend;
if (initialMonitor != null) {
VideoMode mode = initialMonitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
@@ -121,6 +_,11 @@
@@ -132,6 +_,11 @@
try (GLFWErrorScope var9 = new GLFWErrorScope(glfwErrors)) {
backend.setWindowHints();
GLFW.glfwWindowHint(131076, 0);
@@ -29,7 +29,7 @@
windowHandle = GLFW.glfwCreateWindow(width, height, title, monitor, 0L);
if (windowHandle == 0L) {
backend.handleWindowCreationErrors(glfwErrors.firstError());
@@ -226,11 +_,11 @@
@@ -237,11 +_,11 @@
}
public void defaultErrorCallback(int errorCode, long description) {
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/systems/CommandEncoder.java
+++ b/com/mojang/blaze3d/systems/CommandEncoder.java
@@ -207,6 +_,15 @@
@@ -249,6 +_,15 @@
this.backend.clearDepthTexture(depthTexture, clearDepth);
}
@@ -16,7 +16,7 @@
public void writeToBuffer(GpuBufferSlice destination, ByteBuffer data) {
if (this.isInRenderPass) {
throw new IllegalStateException("Close the existing render pass before performing additional commands");
@@ -577,6 +_,25 @@
@@ -696,6 +_,25 @@
throw new UnsupportedOperationException("Textures with multiple depths or layers are not yet supported for copying");
}
@@ -42,7 +42,7 @@
this.backend.copyTextureToTexture(source, destination, mipLevel, destX, destY, sourceX, sourceY, width, height);
} else {
throw new IllegalArgumentException(
@@ -642,6 +_,24 @@
@@ -761,6 +_,24 @@
if (depthTexture.getDepthOrLayers() > 1) {
throw new UnsupportedOperationException("Clearing a texture with multiple layers or depths is not yet supported");
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/systems/CommandEncoderBackend.java
+++ b/com/mojang/blaze3d/systems/CommandEncoderBackend.java
@@ -30,6 +_,8 @@
@@ -29,6 +_,8 @@
void clearDepthTexture(GpuTexture depthTexture, double clearDepth);
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/vulkan/VulkanCommandEncoder.java
+++ b/com/mojang/blaze3d/vulkan/VulkanCommandEncoder.java
@@ -309,6 +_,15 @@
@@ -302,6 +_,15 @@
}
renderingInfo.pDepthAttachment(depthAttachmentInfo);
@@ -16,7 +16,7 @@
}
KHRDynamicRendering.vkCmdBeginRenderingKHR(this.commandBuffer(), renderingInfo);
@@ -321,6 +_,7 @@
@@ -314,6 +_,7 @@
width,
height,
depthAttachment != null,
@@ -24,7 +24,7 @@
descriptor.label()
);
}
@@ -425,6 +_,21 @@
@@ -418,6 +_,21 @@
public void clearDepthTexture(GpuTexture depthTexture, double clearDepth) {
try (MemoryStack stack = MemoryStack.stackPush()) {
this.clearDepthTextureUnsynced(stack, depthTexture, clearDepth);
@@ -24,7 +24,7 @@
this.label = label;
try (MemoryStack stack = MemoryStack.stackPush()) {
@@ -124,6 +_,10 @@
@@ -122,6 +_,10 @@
}
this.anyDescriptorDirty = true;
@@ -35,7 +35,7 @@
VK12.vkCmdBindPipeline(this.commandBuffer(), 0, this.hasDepth ? this.pipeline.withDepthPipeline() : this.pipeline.withoutDepthPipeline());
}
@@ -149,6 +_,18 @@
@@ -147,6 +_,18 @@
public void setUniform(String name, GpuBufferSlice value) {
this.uniforms.put(name, value);
this.anyDescriptorDirty = true;
@@ -145,7 +145,7 @@
return this.key.equals(that.key);
}
@@ -177,11 +_,13 @@
@@ -181,11 +_,13 @@
}
public Component getTranslatedKeyMessage() {
@@ -160,7 +160,7 @@
}
public String saveString() {
@@ -193,7 +_,7 @@
@@ -197,7 +_,7 @@
}
private void registerMapping(InputConstants.Key key) {
@@ -169,7 +169,7 @@
}
public static @Nullable KeyMapping get(String name) {
@@ -215,6 +_,10 @@
@@ -219,6 +_,10 @@
return register(Identifier.withDefaultNamespace(name));
}
@@ -1,32 +1,32 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -501,7 +_,11 @@
if (screen != null) {
try {
if (action != 1 && action != 2) {
- if (action == 0 && screen.keyReleased(event)) {
+ if (action == 0 && (
+ net.neoforged.neoforge.client.ClientHooks.onScreenKeyReleasedPre(screen, event) ||
+ screen.keyReleased(event) ||
+ net.neoforged.neoforge.client.ClientHooks.onScreenKeyReleasedPost(screen, event))
+ ) {
if (options.keyDebugModifier.matches(event)) {
this.usedDebugKeyAsModifier = false;
@@ -478,7 +_,11 @@
if (screen != null) {
try {
if (action != 1 && action != 2) {
- if (action == 0 && screen.keyReleased(event)) {
+ if (action == 0 && (
+ net.neoforged.neoforge.client.ClientHooks.onScreenKeyReleasedPre(screen, event) ||
+ screen.keyReleased(event) ||
+ net.neoforged.neoforge.client.ClientHooks.onScreenKeyReleasedPost(screen, event))
+ ) {
if (options.keyDebugModifier.matches(event)) {
this.usedDebugKeyAsModifier = false;
}
@@ -487,7 +_,11 @@
}
@@ -510,7 +_,11 @@
}
} else {
screen.afterKeyboardAction();
- if (screen.keyPressed(event)) {
+ if (
+ net.neoforged.neoforge.client.ClientHooks.onScreenKeyPressedPre(screen, event) ||
+ screen.keyPressed(event) ||
+ net.neoforged.neoforge.client.ClientHooks.onScreenKeyPressedPost(screen, event)
+ ) {
if (this.minecraft.gui.screen() == null) {
InputConstants.Key key = InputConstants.getKey(event);
KeyMapping.set(key, false);
@@ -582,6 +_,7 @@
} else {
screen.afterKeyboardAction();
- if (screen.keyPressed(event)) {
+ if (
+ net.neoforged.neoforge.client.ClientHooks.onScreenKeyPressedPre(screen, event) ||
+ screen.keyPressed(event) ||
+ net.neoforged.neoforge.client.ClientHooks.onScreenKeyPressedPost(screen, event)
+ ) {
if (this.minecraft.gui.screen() == null) {
InputConstants.Key key = InputConstants.getKey(event);
KeyMapping.set(key, false);
@@ -562,6 +_,7 @@
}
}
}
@@ -34,7 +34,7 @@
}
}
@@ -590,7 +_,9 @@
@@ -570,7 +_,9 @@
Screen screen = this.minecraft.gui.screen();
if (screen != null && this.minecraft.gui.overlay() == null) {
try {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -274,6 +_,7 @@
@@ -279,6 +_,7 @@
public final LevelExtractor levelExtractor;
public final LevelRenderer levelRenderer;
private final EntityRenderDispatcher entityRenderDispatcher;
@@ -8,7 +8,7 @@
private final ItemModelResolver itemModelResolver;
private final MapRenderer mapRenderer;
public final ParticleEngine particleEngine;
@@ -404,7 +_,6 @@
@@ -409,7 +_,6 @@
}
}, Util.nonCriticalIoPool());
LOGGER.info("Setting user: {}", this.user.getName());
@@ -16,7 +16,7 @@
this.demo = gameConfig.game.demo;
this.allowsMultiplayer = !gameConfig.game.disableMultiplayer;
this.allowsChat = !gameConfig.game.disableChat;
@@ -436,6 +_,7 @@
@@ -442,6 +_,7 @@
StringBuilder errorMsgBuilder = new StringBuilder("No supported graphics backend was found.");
Window windowCandidate = null;
GpuDevice device = null;
@@ -24,17 +24,16 @@
PreferredGraphicsApi forcedGraphicsApi = gameConfig.game.forcedGraphicsApi;
if (forcedGraphicsApi != null) {
LOGGER.warn(
@@ -446,6 +_,9 @@
PreferredGraphicsApi preferredGraphicsBackend = forcedGraphicsApi == null ? this.options.preferredGraphicsBackend().get() : forcedGraphicsApi;
@@ -456,6 +_,8 @@
}
String initialWindowTitle = this.createTitle();
+ // Neo: Enable GL debug labels and synchronous GL debug output via FML config
+ boolean enableGlDebug = net.neoforged.fml.loading.FMLConfig.getBoolConfigValue(net.neoforged.fml.loading.FMLConfig.ConfigValue.DEBUG_OPENGL);
+
for (GpuBackend backend : preferredGraphicsBackend.getBackendsToTry()) {
try {
GLFW.glfwDefaultWindowHints();
@@ -457,8 +_,8 @@
@@ -476,8 +_,8 @@
(id, type) -> this.getShaderManager().getShader(id, type),
new GpuDebugOptions(
this.options.glDebugVerbosity,
@@ -45,7 +44,7 @@
gameConfig.game.vulkanValidation
),
this::loadCriticalShaders
@@ -522,12 +_,14 @@
@@ -537,12 +_,14 @@
LOGGER.error("Couldn't set icon", e);
}
@@ -62,7 +61,7 @@
this.resourcePackRepository.reload();
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
this.languageManager = new LanguageManager(this.options.languageCode, var1 -> {
@@ -563,11 +_,13 @@
@@ -578,11 +_,13 @@
RenderSystem.setupDefaultState();
this.window.setErrorSection("Post startup");
this.blockColors = BlockColors.createDefault();
@@ -76,7 +75,7 @@
this.itemModelResolver = new ItemModelResolver(this.modelManager);
this.mapTextureManager = new MapTextureManager(this.textureManager);
this.mapRenderer = new MapRenderer(this.atlasManager, this.mapTextureManager);
@@ -606,6 +_,7 @@
@@ -621,6 +_,7 @@
this.resourceManager.registerReloadListener(particleResources);
this.particleEngine = new ParticleEngine(this.level, particleResources);
particleResources.onReload(this.particleEngine::clearParticles);
@@ -84,7 +83,7 @@
this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.modelManager);
WindowRenderState windowRenderState = this.gameRenderer.gameRenderState().windowRenderState;
windowRenderState.width = this.window.getWidth();
@@ -627,6 +_,9 @@
@@ -642,6 +_,9 @@
this.gpuWarnlistManager = new GpuWarnlistManager();
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
this.resourceManager.registerReloadListener(this.regionalCompliancies);
@@ -94,7 +93,7 @@
this.gui = new Gui(this, new Hud(this), this.gameRenderer.gameRenderState().guiRenderState);
this.gui.registerReloadListeners(this.resourceManager);
RealmsClient realmsClient = RealmsClient.getOrCreate(this);
@@ -661,6 +_,7 @@
@@ -676,6 +_,7 @@
}
}
@@ -102,7 +101,7 @@
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
this.window.setAllowCursorChanges(this.options.allowCursorChanges().get());
this.window.setDefaultErrorCallback();
@@ -677,6 +_,7 @@
@@ -692,6 +_,7 @@
TitleScreen.registerTextures(this.textureManager);
LoadingOverlay.registerTextures(this.textureManager);
this.gameRenderer.registerPanoramaTextures(this.textureManager);
@@ -110,7 +109,7 @@
this.timerQuery = new TimerQuery();
this.gui.setScreen(new GenericMessageScreen(Component.translatable("gui.loadingMinecraft")));
List<PackResources> packs = this.resourcePackRepository.openAllSelected();
@@ -686,7 +_,7 @@
@@ -701,7 +_,7 @@
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
GameLoadCookie loadCookie = new GameLoadCookie(realmsClient, gameConfig.quickPlay);
this.gui.setOverlay(new LoadingOverlay(this, reloadInstance, maybeT -> Util.ifElse(maybeT, t -> this.rollbackResourcePacks(t, loadCookie), () -> {
@@ -119,7 +118,7 @@
this.selfTest();
}
@@ -740,6 +_,7 @@
@@ -755,6 +_,7 @@
}
private void onResourceLoadFinished(@Nullable GameLoadCookie loadCookie) {
@@ -127,7 +126,7 @@
if (!this.gameLoadFinished) {
this.gameLoadFinished = true;
this.onGameLoadFinished(loadCookie);
@@ -775,7 +_,7 @@
@@ -790,7 +_,7 @@
private String createTitle() {
StringBuilder builder = new StringBuilder("Minecraft");
if (checkModStatus().shouldReportAsModified()) {
@@ -136,7 +135,7 @@
}
builder.append(" ");
@@ -815,7 +_,7 @@
@@ -830,7 +_,7 @@
}
private void rollbackResourcePacks(Throwable t, @Nullable GameLoadCookie loadCookie) {
@@ -145,7 +144,7 @@
this.clearResourcePacksOnError(t, null, loadCookie);
} else {
Util.throwAsRuntime(t);
@@ -871,6 +_,8 @@
@@ -886,6 +_,8 @@
DiscontinuousFrame tickFrame = TracyClient.createDiscontinuousFrame("Client Tick");
try {
@@ -154,7 +153,7 @@
boolean oomRecovery = false;
while (this.running) {
@@ -932,7 +_,7 @@
@@ -947,7 +_,7 @@
CrashReport finalReport = this.fillReport(partialReport);
int exitCode = saveReportAndShutdownSoundManager(this, this.gameDirectory, finalReport, -1);
this.emergencySave();
@@ -163,7 +162,7 @@
}
public static void saveReport(File gameDirectory, CrashReport crash) {
@@ -969,7 +_,7 @@
@@ -984,7 +_,7 @@
public static void crash(@Nullable Minecraft minecraft, File gameDirectory, CrashReport crash, int exitCode) {
int actualExitCode = saveReportAndShutdownSoundManager(minecraft, gameDirectory, crash, exitCode);
@@ -172,7 +171,7 @@
}
public static int saveReportAndShutdownSoundManager(@Nullable Minecraft minecraft, File gameDirectory, CrashReport crash, int exitCode) {
@@ -1073,6 +_,7 @@
@@ -1088,6 +_,7 @@
public void exitWorldAndClose() {
try {
@@ -180,7 +179,7 @@
LOGGER.info("Stopping!");
if (this.level != null) {
this.level.disconnect(ClientLevel.DEFAULT_QUIT_MESSAGE);
@@ -1114,6 +_,8 @@
@@ -1129,6 +_,8 @@
Util.shutdownExecutors();
this.windowSurface.close();
RenderSystem.shutdownRenderer();
@@ -189,7 +188,7 @@
} catch (Throwable t) {
LOGGER.error("Shutdown failure!", t);
throw t;
@@ -1192,7 +_,11 @@
@@ -1208,7 +_,11 @@
this.window.setErrorSection("Post render");
boolean var28 = this.pause;
@@ -202,7 +201,7 @@
if (!var28 && this.pause) {
this.soundManager.pauseAllExcept(SoundSource.MUSIC, SoundSource.UI);
}
@@ -1273,7 +_,9 @@
@@ -1289,7 +_,9 @@
profiler.popPush("gpuAsync");
RenderSystem.executePendingTasks();
profiler.pop();
@@ -212,7 +211,7 @@
}
profiler.push("present");
@@ -1395,8 +_,10 @@
@@ -1411,8 +_,10 @@
public void resizeGui() {
int guiScale = this.window.calculateScale(this.options.guiScale().get(), this.isEnforceUnicode());
this.window.setGuiScale(guiScale);
@@ -223,7 +222,7 @@
}
this.mouseHandler.setIgnoreFirstMove();
@@ -1548,6 +_,7 @@
@@ -1564,6 +_,7 @@
}
public void stop() {
@@ -231,7 +230,7 @@
this.running = false;
}
@@ -1573,8 +_,16 @@
@@ -1589,8 +_,16 @@
BlockPos pos = blockHit.getBlockPos();
if (!this.level.getBlockState(pos).isAir()) {
Direction direction = blockHit.getDirection();
@@ -250,7 +249,7 @@
this.player.swing(InteractionHand.MAIN_HAND);
}
}
@@ -1621,9 +_,16 @@
@@ -1637,9 +_,16 @@
}
boolean endAttack = false;
@@ -267,7 +266,7 @@
this.player.swing(InteractionHand.MAIN_HAND);
return true;
}
@@ -1651,8 +_,10 @@
@@ -1667,8 +_,10 @@
}
this.player.resetAttackStrengthTicker();
@@ -278,7 +277,7 @@
this.player.swing(InteractionHand.MAIN_HAND);
return endAttack;
}
@@ -1668,6 +_,11 @@
@@ -1684,6 +_,11 @@
}
for (InteractionHand hand : InteractionHand.values()) {
@@ -290,7 +289,7 @@
ItemStack heldItem = this.player.getItemInHand(hand);
if (!heldItem.isItemEnabled(this.level.enabledFeatures())) {
return;
@@ -1684,7 +_,7 @@
@@ -1700,7 +_,7 @@
if (this.player.isWithinEntityInteractionRange(entity, 0.0)
&& this.gameMode.interact(this.player, entity, entityHit, hand) instanceof InteractionResult.Success success) {
@@ -299,7 +298,7 @@
this.player.swing(hand);
}
@@ -1696,7 +_,7 @@
@@ -1712,7 +_,7 @@
int oldCount = heldItem.getCount();
InteractionResult useResult = this.gameMode.useItemOn(this.player, hand, blockHit);
if (useResult instanceof InteractionResult.Success success) {
@@ -308,7 +307,7 @@
this.player.swing(hand);
if (!heldItem.isEmpty() && (heldItem.getCount() != oldCount || this.player.hasInfiniteMaterials())) {
this.gameRenderer.itemInHandRenderer.itemUsed(hand);
@@ -1712,8 +_,11 @@
@@ -1728,8 +_,11 @@
}
}
@@ -321,7 +320,7 @@
this.player.swing(hand);
}
@@ -1731,6 +_,10 @@
@@ -1747,6 +_,10 @@
public void tick() {
this.clientTickCount++;
@@ -332,7 +331,7 @@
if (this.level != null && !this.pause) {
this.level.tickRateManager().tick();
}
@@ -1793,6 +_,7 @@
@@ -1805,6 +_,7 @@
this.tutorial.tick();
@@ -340,7 +339,7 @@
try {
this.level.tick(() -> true);
} catch (Throwable t) {
@@ -1806,6 +_,7 @@
@@ -1818,6 +_,7 @@
throw new ReportedException(report);
}
@@ -348,7 +347,7 @@
}
profiler.popPush("animateTick");
@@ -1830,6 +_,10 @@
@@ -1842,6 +_,10 @@
profiler.popPush("keyboard");
this.keyboardHandler.tick();
profiler.pop();
@@ -359,7 +358,7 @@
}
private boolean isLevelRunningNormally() {
@@ -2035,6 +_,7 @@
@@ -2047,6 +_,7 @@
}
public void setLevel(ClientLevel level) {
@@ -367,7 +366,7 @@
this.level = level;
this.updateLevelInEngines(level);
}
@@ -2096,13 +_,16 @@
@@ -2108,13 +_,16 @@
IntegratedServer server = this.singleplayerServer;
this.singleplayerServer = null;
this.gameRenderer.resetData();
@@ -384,7 +383,7 @@
}
this.level = null;
@@ -2126,6 +_,7 @@
@@ -2138,6 +_,7 @@
} finally {
this.gui.setClientLevelTeardownInProgress(false);
}
@@ -392,7 +391,7 @@
}
public void clearDownloadedResourcePacks() {
@@ -2151,6 +_,7 @@
@@ -2163,6 +_,7 @@
try {
this.setScreenAndShow(screen);
this.gui.hud.onDisconnected();
@@ -400,7 +399,7 @@
this.level = null;
this.updateLevelInEngines(null);
this.player = null;
@@ -2283,6 +_,7 @@
@@ -2333,6 +_,7 @@
private void pickBlockOrEntity() {
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
@@ -408,7 +407,7 @@
boolean includeData = this.hasControlDown();
switch (this.hitResult) {
case BlockHitResult blockHitResult:
@@ -2832,6 +_,10 @@
@@ -2882,6 +_,10 @@
}
return defaultTickTargetMillis;
@@ -8,8 +8,8 @@
+ boolean screenHandled = false;
if (this.minecraft.gui.overlay() == null) {
if (pressed
&& this.minecraft
@@ -105,10 +_,14 @@
&& this.minecraft.handleGlobalKeyPress(InputConstants.Type.MOUSE.getOrCreate(buttonInfo.button()), buttonInfo.hasControlDownWithQuirk())) {
@@ -101,10 +_,14 @@
&& currentTime - this.lastClick.time() < 250L
&& this.lastClick.screen() == screen
&& this.lastClickButton == event.button();
@@ -26,7 +26,7 @@
}
} catch (Throwable t) {
CrashReport report = CrashReport.forThrowable(t, "mouseClicked event handler");
@@ -120,8 +_,10 @@
@@ -116,8 +_,10 @@
}
} else {
try {
@@ -39,7 +39,7 @@
}
} catch (Throwable t) {
CrashReport report = CrashReport.forThrowable(t, "mouseReleased event handler");
@@ -135,6 +_,10 @@
@@ -131,6 +_,10 @@
}
}
@@ -50,7 +50,7 @@
if (this.minecraft.gui.screen() == null && this.minecraft.gui.overlay() == null) {
if (buttonInfo.button() == 0) {
this.isLeftPressed = pressed;
@@ -150,6 +_,8 @@
@@ -146,6 +_,8 @@
KeyMapping.click(mouseKey);
}
}
@@ -59,7 +59,7 @@
}
}
@@ -201,7 +_,11 @@
@@ -197,7 +_,11 @@
if (this.minecraft.gui.screen() != null) {
double xm = this.getScaledXPos(this.minecraft.getWindow());
double ym = this.getScaledYPos(this.minecraft.getWindow());
@@ -72,7 +72,7 @@
this.minecraft.gui.screen().afterMouseAction();
} else if (this.minecraft.player != null) {
Vector2i wheelXY = this.scrollWheelHandler.onMouseScroll(scaledXOffset, scaledYOffset);
@@ -210,6 +_,7 @@
@@ -206,6 +_,7 @@
}
int wheel = wheelXY.y == 0 ? -wheelXY.x : wheelXY.y;
@@ -80,7 +80,7 @@
if (this.minecraft.player.isSpectator()) {
if (this.minecraft.gui.hud.getSpectatorGui().isMenuActive()) {
this.minecraft.gui.hud.getSpectatorGui().onMouseScrolled(-wheel);
@@ -316,7 +_,12 @@
@@ -312,7 +_,12 @@
double dy = getScaledYPos(window, this.accumulatedDY);
try {
@@ -94,7 +94,7 @@
} catch (Throwable t) {
CrashReport report = CrashReport.forThrowable(t, "mouseDragged event handler");
screen.fillCrashDetails(report);
@@ -355,12 +_,13 @@
@@ -351,12 +_,13 @@
}
private void turnPlayer(double mousea) {
@@ -110,7 +110,7 @@
double dx = this.smoothTurnX.getNewDeltaValue(this.accumulatedDX * sens, mousea * sens);
double dy = this.smoothTurnY.getNewDeltaValue(this.accumulatedDY * sens, mousea * sens);
xo = dx;
@@ -401,6 +_,14 @@
@@ -397,6 +_,14 @@
public double ypos() {
return this.ypos;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Options.java
+++ b/net/minecraft/client/Options.java
@@ -1100,7 +_,7 @@
@@ -1095,7 +_,7 @@
this.incompatibleResourcePacks.clear();
for (Pack entry : packRepository.getSelectedPacks()) {
@@ -9,7 +9,7 @@
this.resourcePacks.add(entry.getId());
if (!entry.getCompatibility().isCompatible()) {
this.incompatibleResourcePacks.add(entry.getId());
@@ -1479,6 +_,7 @@
@@ -1474,6 +_,7 @@
}
public Options(Minecraft minecraft, File workingDirectory) {
@@ -17,7 +17,7 @@
this.minecraft = minecraft;
this.optionsFile = new File(workingDirectory, "options.txt");
boolean largeDistances = Runtime.getRuntime().maxMemory() >= 1000000000L;
@@ -1499,6 +_,7 @@
@@ -1494,6 +_,7 @@
var1 -> this.setGraphicsPresetToCustom()
);
this.syncWrites = Util.getPlatform() == Util.OS.WINDOWS;
@@ -25,7 +25,7 @@
this.load();
}
@@ -1631,10 +_,15 @@
@@ -1626,10 +_,15 @@
access.process("musicFrequency", this.musicFrequency);
for (KeyMapping keyMapping : this.keyMappings) {
@@ -43,7 +43,7 @@
}
}
@@ -1929,6 +_,23 @@
@@ -1924,6 +_,23 @@
}
repository.setSelected(selected);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/PauseScreen.java
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
@@ -165,6 +_,7 @@
@@ -166,6 +_,7 @@
);
}
@@ -18,7 +18,7 @@
+ topPos += 24; // Move down Options, Quit, Language, and Accessibility buttons to make room for mods button (in-dev the test world button "handles" this)
}
boolean friendsListEnabled = this.minecraft.getPlayerSocialManager().isFriendListEnabled();
int numberOfButtons = 3;
@@ -310,6 +_,7 @@
this.extractPanorama(graphics, a);
super.extractRenderState(graphics, mouseX, mouseY, a);
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
@@ -40,6 +_,7 @@
private int maxY = Integer.MIN_VALUE;
@@ -41,6 +_,7 @@
private float fade;
private boolean centered;
private @Nullable AdvancementWidget hovered;
+ private int page;
public AdvancementTab(Minecraft minecraft, AdvancementsScreen screen, AdvancementTabType type, int index, AdvancementNode rootNode, DisplayInfo display) {
this.minecraft = minecraft;
@@ -54,6 +_,15 @@
@@ -55,6 +_,15 @@
this.addWidget(this.root, rootNode.holder());
}
@@ -24,7 +24,7 @@
public AdvancementTabType getType() {
return this.type;
}
@@ -149,8 +_,8 @@
@@ -162,8 +_,8 @@
}
for (AdvancementTabType type : AdvancementTabType.values()) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
@@ -50,6 +_,7 @@
@@ -52,6 +_,7 @@
private final Map<AdvancementHolder, AdvancementTab> tabs = Maps.newLinkedHashMap();
private @Nullable AdvancementTab selectedTab;
private boolean isScrolling;
@@ -8,7 +8,7 @@
public AdvancementsScreen(ClientAdvancements advancements) {
this(advancements, null);
@@ -74,6 +_,16 @@
@@ -76,6 +_,16 @@
this.advancements.setSelectedTab(this.selectedTab == null ? null : this.selectedTab.getRootNode().holder(), true);
}
@@ -25,7 +25,7 @@
this.layout.addToFooter(Button.builder(CommonComponents.GUI_DONE, button -> this.onClose()).width(200).build());
this.layout.visitWidgets(x$0 -> this.addRenderableWidget(x$0));
this.repositionElements();
@@ -105,7 +_,7 @@
@@ -119,7 +_,7 @@
int yo = (this.height - 140) / 2;
for (AdvancementTab tab : this.tabs.values()) {
@@ -34,37 +34,37 @@
this.advancements.setSelectedTab(tab.getRootNode().holder(), true);
break;
}
@@ -131,6 +_,11 @@
@@ -143,6 +_,11 @@
@Override
public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
super.extractRenderState(graphics, mouseX, mouseY, a);
int xo = (this.width - 252) / 2;
int yo = (this.height - 140) / 2;
+ if (maxPages != 0) {
+ net.minecraft.network.chat.Component page = Component.literal(String.format("%d / %d", tabPage + 1, maxPages + 1));
+ int width = this.font.width(page);
+ graphics.text(this.font, page.getVisualOrderText(), xo + (252 / 2) - (width / 2), yo - 44, -1);
+ graphics.text(this.font, page.getVisualOrderText(), this.leftPos + (WINDOW_WIDTH / 2) - (width / 2), this.topPos - 44, -1);
+ }
graphics.nextStratum();
this.extractInside(graphics, xo, yo);
this.extractInside(graphics);
graphics.nextStratum();
@@ -196,10 +_,12 @@
graphics.blit(RenderPipelines.GUI_TEXTURED, WINDOW_LOCATION, xo, yo, 0.0F, 0.0F, 252, 140, 256, 256);
@@ -208,10 +_,12 @@
graphics.blit(RenderPipelines.GUI_TEXTURED, WINDOW_LOCATION, this.leftPos, this.topPos, 0.0F, 0.0F, 252, 140, 256, 256);
if (this.tabs.size() > 1) {
for (AdvancementTab tab : this.tabs.values()) {
+ if (tab.getPage() == tabPage)
tab.extractTab(graphics, xo, yo, mouseX, mouseY, tab == this.selectedTab);
tab.extractTab(graphics, this.leftPos, this.topPos, mouseX, mouseY, tab == this.selectedTab);
}
for (AdvancementTab tab : this.tabs.values()) {
+ if (tab.getPage() == tabPage)
tab.extractIcon(graphics, xo, yo);
tab.extractIcon(graphics, this.leftPos, this.topPos);
}
}
@@ -218,7 +_,7 @@
@@ -230,7 +_,7 @@
if (this.tabs.size() > 1) {
for (AdvancementTab tab : this.tabs.values()) {
- if (tab.isMouseOver(xo, yo, mouseX, mouseY)) {
+ if (tab.getPage() == tabPage && tab.isMouseOver(xo, yo, (double)mouseX, (double)mouseY)) {
- if (tab.isMouseOver(this.leftPos, this.topPos, mouseX, mouseY)) {
+ if (tab.getPage() == tabPage && tab.isMouseOver(this.leftPos, this.topPos, mouseX, mouseY)) {
graphics.setTooltipForNextFrame(this.font, tab.getTitle(), mouseX, mouseY);
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/particle/ParticleEngine.java
+++ b/net/minecraft/client/particle/ParticleEngine.java
@@ -34,10 +_,17 @@
@@ -35,10 +_,17 @@
private final Object2IntOpenHashMap<ParticleLimit> trackedParticleCounts = new Object2IntOpenHashMap<>();
private final ParticleResources resourceManager;
private final RandomSource random = RandomSource.create();
@@ -18,7 +18,7 @@
}
public void createTrackingEmitter(Entity entity, ParticleOptions particle) {
@@ -59,7 +_,7 @@
@@ -60,7 +_,7 @@
}
private <T extends ParticleOptions> @Nullable Particle makeParticle(T options, double x, double y, double z, double xa, double ya, double za) {
@@ -27,7 +27,7 @@
return provider == null ? null : provider.createParticle(options, this.level, x, y, z, xa, ya, za, this.random);
}
@@ -107,6 +_,8 @@
@@ -110,6 +_,8 @@
return new ItemPickupParticleGroup(this);
} else if (type == ParticleRenderType.ELDER_GUARDIANS) {
return new ElderGuardianParticleGroup(this);
@@ -36,7 +36,7 @@
} else {
return type == ParticleRenderType.NO_RENDER ? new NoRenderParticleGroup(this) : new QuadParticleGroup(this, type);
}
@@ -117,7 +_,7 @@
@@ -120,7 +_,7 @@
}
public void extract(ParticlesRenderState particlesRenderState, Frustum frustum, Camera camera, float partialTickTime) {
@@ -76,7 +76,7 @@
if (player.isUsingItem() && player.getUseItemRemainingTicks() > 0 && player.getUsedItemHand() == hand) {
ItemUseAnimation useAnimation = itemStack.getUseAnimation();
if (!useAnimation.hasCustomArmTransform()) {
@@ -632,9 +_,18 @@
@@ -629,9 +_,18 @@
this.mainHandHeight = Mth.clamp(this.mainHandHeight - 0.4F, 0.0F, 1.0F);
this.offHandHeight = Mth.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F);
} else {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/RenderPipelines.java
+++ b/net/minecraft/client/renderer/RenderPipelines.java
@@ -818,4 +_,14 @@
@@ -820,4 +_,14 @@
public static List<RenderPipeline> getStaticPipelines() {
return PIPELINES_BY_LOCATION.values().stream().toList();
}
@@ -37,16 +37,16 @@
this.levelRenderState.render3dCrosshair = this.minecraft.debugEntries.isCurrentlyEnabled(DebugScreenEntries.THREE_DIMENSIONAL_CROSSHAIR);
ClientPacketListener connection = this.minecraft.getConnection();
if (connection != null) {
@@ -238,7 +_,7 @@
|| camera.isDetached()
|| camera.entity() instanceof LivingEntity && ((LivingEntity)camera.entity()).isSleeping()
)
- && (!(entity instanceof LocalPlayer) || camera.entity() == entity)) {
+ && (!(entity instanceof LocalPlayer) || camera.entity() == entity || (entity == minecraft.player && !minecraft.player.isSpectator()))) { // Neo: render local player entity when it is not the camera entity
if (entity.tickCount == 0) {
entity.xOld = entity.getX();
entity.yOld = entity.getY();
@@ -259,7 +_,13 @@
@@ -232,7 +_,7 @@
for (Entity entity : this.level.entitiesForRendering()) {
if (this.isEntityVisible(entity, frustum, camX, camY, camZ)
&& (entity != camera.entity() || camera.isDetached() || camera.entity() instanceof LivingEntity && ((LivingEntity)camera.entity()).isSleeping())
- && (!(entity instanceof LocalPlayer) || camera.entity() == entity)) {
+ && (!(entity instanceof LocalPlayer) || camera.entity() == entity || (entity == minecraft.player && !minecraft.player.isSpectator()))) { // Neo: render local player entity when it is not the camera entity
if (entity.tickCount == 0) {
entity.xOld = entity.getX();
entity.yOld = entity.getY();
@@ -264,7 +_,13 @@
return this.levelRenderer.entityRenderDispatcher().extractEntity(entity, partialTickTime);
}
@@ -60,7 +60,7 @@
Vec3 cameraPos = camera.position();
double camX = cameraPos.x();
double camY = cameraPos.y();
@@ -284,7 +_,7 @@
@@ -289,7 +_,7 @@
BlockEntityRenderState state = this.levelRenderer
.blockEntityRenderDispatcher()
@@ -69,7 +69,7 @@
if (state != null) {
levelRenderState.blockEntityRenderStates.add(state);
}
@@ -301,7 +_,7 @@
@@ -306,7 +_,7 @@
} else {
BlockEntityRenderState state = this.levelRenderer
.blockEntityRenderDispatcher()
@@ -78,7 +78,7 @@
if (state != null) {
levelRenderState.blockEntityRenderStates.add(state);
}
@@ -336,19 +_,23 @@
@@ -341,19 +_,23 @@
BlockState state = this.level.getBlockState(pos);
if (!state.isAir() && this.level.getWorldBorder().isWithinBounds(pos)) {
BlockStateModel blockStateModel = this.minecraft.getModelManager().getBlockStateModelSet().get(state);
@@ -105,7 +105,7 @@
}
}
}
@@ -481,6 +_,13 @@
@@ -486,6 +_,13 @@
}
return rendered;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/texture/SpriteContents.java
+++ b/net/minecraft/client/renderer/texture/SpriteContents.java
@@ -84,6 +_,10 @@
@@ -85,6 +_,10 @@
this.transparency = image.computeTransparency();
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/server/IntegratedServer.java
+++ b/net/minecraft/client/server/IntegratedServer.java
@@ -102,11 +_,13 @@
@@ -103,11 +_,13 @@
LOGGER.info("Starting integrated minecraft server version {}", SharedConstants.getCurrentVersion().name());
this.setUsesAuthentication(true);
this.initializeKeyPair();
@@ -14,7 +14,7 @@
return true;
}
@@ -321,6 +_,7 @@
@@ -371,6 +_,7 @@
@Override
public void halt(boolean wait) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/sounds/MusicManager.java
+++ b/net/minecraft/client/sounds/MusicManager.java
@@ -41,7 +_,15 @@
@@ -42,7 +_,15 @@
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -316,6 +_,10 @@
@@ -317,6 +_,10 @@
}
private void broadcastDataValue(AbstractContainerMenu container, int id, int value) {
@@ -11,7 +11,7 @@
ServerPlayer.this.connection.send(new ClientboundContainerSetDataPacket(container.containerId, id, value));
}
@@ -361,10 +_,17 @@
@@ -362,10 +_,17 @@
public void sendSystemMessage(Component message) {
ServerPlayer.this.sendSystemMessage(message);
}
@@ -29,7 +29,7 @@
public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) {
super(level, gameProfile);
@@ -664,7 +_,26 @@
@@ -665,7 +_,26 @@
}
if (!this.isSleeping()) {
@@ -57,7 +57,7 @@
}
}
@@ -719,6 +_,11 @@
@@ -720,6 +_,11 @@
this.connection.send(new ClientboundSetExperiencePacket(this.experienceProgress, this.totalExperience, this.experienceLevel));
}
@@ -69,7 +69,7 @@
if (this.tickCount % 20 == 0) {
CriteriaTriggers.LOCATION.trigger(this);
}
@@ -732,7 +_,7 @@
@@ -733,7 +_,7 @@
private void synchronizeSpecialItemUpdates(ItemStack itemStack) {
MapId mapId = itemStack.get(DataComponents.MAP_ID);
@@ -78,7 +78,7 @@
if (data != null) {
Packet<?> packet = data.getUpdatePacket(mapId, this);
if (packet != null) {
@@ -879,6 +_,7 @@
@@ -882,6 +_,7 @@
@Override
public void die(DamageSource source) {
this.gameEvent(GameEvent.ENTITY_DIE);
@@ -86,7 +86,7 @@
boolean showDeathMessage = this.level().getGameRules().get(GameRules.SHOW_DEATH_MESSAGES);
if (showDeathMessage) {
Component deathMessage = this.getCombatTracker().getDeathMessage();
@@ -1065,7 +_,7 @@
@@ -1068,7 +_,7 @@
}
if (!forced) {
@@ -95,7 +95,7 @@
}
boolean freeBottom = block.isPossibleToRespawnInThis(blockState);
@@ -1088,6 +_,7 @@
@@ -1091,6 +_,7 @@
}
public @Nullable ServerPlayer teleport(TeleportTransition transition) {
@@ -103,7 +103,7 @@
if (this.isRemoved()) {
return null;
}
@@ -1117,7 +_,7 @@
@@ -1120,7 +_,7 @@
PlayerList playerList = this.server.getPlayerList();
playerList.sendPlayerPermissionLevel(this);
oldLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
@@ -112,7 +112,7 @@
ProfilerFiller profiler = Profiler.get();
profiler.push("moving");
if (lastDimension == Level.OVERWORLD && newLevel.dimension() == Level.NETHER) {
@@ -1137,11 +_,15 @@
@@ -1140,11 +_,15 @@
playerList.sendLevelInfo(this, newLevel);
playerList.sendAllPlayerInfo(this);
playerList.sendActivePlayerEffects(this);
@@ -128,7 +128,7 @@
return this;
}
@@ -1181,8 +_,20 @@
@@ -1184,8 +_,20 @@
@Override
public Either<Player.BedSleepingProblem, Unit> startSleepInBed(BlockPos pos) {
@@ -150,7 +150,7 @@
BedRule rule = this.level().environmentAttributes().getValue(EnvironmentAttributes.BED_RULE, pos);
boolean canSleep = rule.canSleep(this.level());
boolean canSetSpawn = rule.canSetSpawn(this.level());
@@ -1222,7 +_,13 @@
@@ -1225,7 +_,13 @@
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
}
}
@@ -164,7 +164,7 @@
Either<Player.BedSleepingProblem, Unit> result = super.startSleepInBed(pos).ifRight(unit -> {
this.awardStat(Stats.SLEEP_IN_BED);
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
@@ -1233,8 +_,6 @@
@@ -1236,8 +_,6 @@
this.level().updateSleepingPlayerList();
return result;
@@ -173,7 +173,7 @@
}
}
@@ -1245,6 +_,7 @@
@@ -1248,6 +_,7 @@
}
private boolean bedInRange(BlockPos pos, Direction direction) {
@@ -181,7 +181,7 @@
return this.isReachableBedBlock(pos) || this.isReachableBedBlock(pos.relative(direction.getOpposite()));
}
@@ -1329,12 +_,20 @@
@@ -1332,12 +_,20 @@
@Override
public OptionalInt openMenu(@Nullable MenuProvider provider) {
@@ -202,7 +202,7 @@
}
this.nextContainerCounter();
@@ -1346,9 +_,31 @@
@@ -1349,9 +_,31 @@
return OptionalInt.empty();
} else {
@@ -234,7 +234,7 @@
return OptionalInt.of(this.containerCounter);
}
}
@@ -1369,6 +_,7 @@
@@ -1372,6 +_,7 @@
this.connection.send(new ClientboundMountScreenOpenPacket(this.containerCounter, inventoryColumns, horse.getId()));
this.containerMenu = new HorseInventoryMenu(this.containerCounter, this.getInventory(), container, horse, inventoryColumns);
this.initMenu(this.containerMenu);
@@ -242,7 +242,7 @@
}
@Override
@@ -1410,6 +_,7 @@
@@ -1413,6 +_,7 @@
public void doCloseContainer() {
this.containerMenu.removed(this);
this.inventoryMenu.transferState(this.containerMenu);
@@ -250,7 +250,7 @@
this.containerMenu = this.inventoryMenu;
}
@@ -1629,6 +_,15 @@
@@ -1632,6 +_,15 @@
this.setShoulderEntityRight(oldPlayer.getShoulderEntityRight());
this.setLastDeathLocation(oldPlayer.getLastDeathLocation());
this.waypointIcon().copyFrom(oldPlayer.waypointIcon());
@@ -266,7 +266,7 @@
}
private void transferInventoryXpAndScore(Player oldPlayer) {
@@ -1731,6 +_,8 @@
@@ -1734,6 +_,8 @@
public boolean setGameMode(GameType mode) {
boolean wasSpectator = this.isSpectator();
@@ -275,7 +275,7 @@
if (!this.gameMode.changeGameModeForPlayer(mode)) {
return false;
}
@@ -1914,6 +_,7 @@
@@ -1917,6 +_,7 @@
public void setCamera(@Nullable Entity newCamera) {
Entity oldCamera = this.getCamera();
this.camera = newCamera == null ? this : newCamera;
@@ -283,7 +283,7 @@
if (oldCamera != this.camera) {
if (this.camera.level() instanceof ServerLevel level) {
this.teleportTo(level, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), false);
@@ -1940,7 +_,11 @@
@@ -1943,7 +_,11 @@
}
public @Nullable Component getTabListDisplayName() {
@@ -296,7 +296,7 @@
}
public int getTabListOrder() {
@@ -1974,6 +_,7 @@
@@ -1977,6 +_,7 @@
}
public void setRespawnPosition(ServerPlayer.@Nullable RespawnConfig respawnConfig, boolean showMessage) {
@@ -304,7 +304,7 @@
if (showMessage && respawnConfig != null && !respawnConfig.isSamePosition(this.respawnConfig)) {
this.sendSystemMessage(SPAWN_SET_MESSAGE);
}
@@ -2011,6 +_,75 @@
@@ -2014,6 +_,75 @@
return entity;
}
@@ -380,7 +380,7 @@
public TextFilter getTextFilter() {
return this.textFilter;
}
@@ -2025,6 +_,7 @@
@@ -2028,6 +_,7 @@
}
private GameType calculateGameModeForNewPlayer(@Nullable GameType loadedGameType) {
@@ -388,7 +388,7 @@
GameType forcedGameType = this.server.getForcedGameType();
if (forcedGameType != null) {
return forcedGameType;
@@ -2061,6 +_,8 @@
@@ -2064,6 +_,8 @@
public void drop(boolean all) {
Inventory inventory = this.getInventory();
@@ -397,7 +397,7 @@
ItemStack removed = inventory.removeFromSelected(all);
this.containerMenu
.findSlot(inventory, inventory.getSelectedSlot())
@@ -2069,7 +_,7 @@
@@ -2072,7 +_,7 @@
this.stopUsingItem();
}
@@ -103,7 +103,7 @@
if (this.ops.remove(nameAndId)) {
ServerPlayer player = this.getPlayer(nameAndId.id());
if (player != null) {
@@ -652,6 +_,7 @@
@@ -654,6 +_,7 @@
player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F));
this.server.tickRateManager().updateJoiningPlayer(player);
@@ -111,7 +111,7 @@
}
public void sendAllPlayerInfo(ServerPlayer player) {
@@ -792,6 +_,8 @@
@@ -794,6 +_,8 @@
this.advancements.put(uuid, result);
}
@@ -120,7 +120,7 @@
result.setPlayer(player);
return result;
}
@@ -815,7 +_,7 @@
@@ -817,7 +_,7 @@
}
public List<ServerPlayer> getPlayers() {
@@ -129,7 +129,7 @@
}
public Map<UUID, ServerPlayer> getPlayersByUUID() {
@@ -845,6 +_,7 @@
@@ -847,6 +_,7 @@
advancements.reload(this.server.getAdvancements());
}
@@ -137,7 +137,7 @@
this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries)));
RecipeManager recipeManager = this.server.getRecipeManager();
ClientboundUpdateRecipesPacket recipes = new ClientboundUpdateRecipesPacket(
@@ -854,10 +_,15 @@
@@ -856,10 +_,15 @@
for (ServerPlayer player : this.players) {
player.connection.send(recipes);
player.getRecipeBook().sendInitialRecipeBook(player);
@@ -208,7 +208,7 @@
}
public boolean isInvulnerable() {
@@ -3028,6 +_,7 @@
@@ -3032,6 +_,7 @@
}
public @Nullable Entity teleport(TeleportTransition transition) {
@@ -216,7 +216,7 @@
if (this.level() instanceof ServerLevel serverLevel && !this.isRemoved()) {
ServerLevel newLevel = transition.newLevel();
boolean otherDimension = newLevel.dimension() != serverLevel.dimension();
@@ -3250,6 +_,7 @@
@@ -3254,6 +_,7 @@
return this.stringUUID;
}
@@ -224,7 +224,7 @@
public boolean isPushedByFluid() {
return true;
}
@@ -3361,6 +_,8 @@
@@ -3365,6 +_,8 @@
EntityDimensions oldDim = this.dimensions;
Pose pose = this.getPose();
EntityDimensions newDim = this.getDimensions(pose);
@@ -233,7 +233,7 @@
this.dimensions = newDim;
this.eyeHeight = newDim.eyeHeight();
this.reapplyPosition();
@@ -3802,6 +_,10 @@
@@ -3806,6 +_,10 @@
}
}
}
@@ -244,7 +244,7 @@
}
public void checkDespawn() {
@@ -3942,6 +_,90 @@
@@ -3946,6 +_,90 @@
public boolean mayInteract(ServerLevel level, BlockPos pos) {
return true;
@@ -68,7 +68,7 @@
}
if (postSpawnConfig != null) {
@@ -400,14 +_,23 @@
@@ -408,14 +_,23 @@
}
public int clientTrackingRange() {
@@ -92,7 +92,7 @@
return this != EntityTypes.PLAYER
&& this != EntityTypes.LLAMA_SPIT
&& this != EntityTypes.WITHER
@@ -439,9 +_,12 @@
@@ -447,9 +_,12 @@
}
public boolean onlyOpCanSetNbt() {
@@ -105,7 +105,7 @@
public static class Builder<T extends Entity> {
private final EntityType.EntityFactory<T> factory;
private final MobCategory category;
@@ -461,6 +_,10 @@
@@ -469,6 +_,10 @@
);
private final DependantName<EntityType<?>, String> descriptionId = id -> Util.makeDescriptionId("entity", id.identifier());
private boolean allowedInPeaceful = true;
@@ -116,7 +116,7 @@
private Builder(EntityType.EntityFactory<T> factory, MobCategory category) {
this.factory = factory;
@@ -579,6 +_,26 @@
@@ -587,6 +_,26 @@
return this;
}
@@ -143,7 +143,7 @@
public EntityType<T> build(ResourceKey<EntityType<?>> name) {
if (this.serialize) {
Util.fetchChoiceType(References.ENTITY_TREE, name.identifier().toString());
@@ -599,7 +_,11 @@
@@ -607,7 +_,11 @@
this.descriptionId.get(name),
this.lootTable.get(name),
this.requiredFeatures,
@@ -356,7 +356,7 @@
@@ -1628,6 +_,12 @@
}
public void knockback(double power, double xd, double zd, DamageSource source, float damage) {
public void knockback(double power, double xd, double zd, DamageSource source, float damage, boolean comesFromEffect) {
+ net.neoforged.neoforge.event.entity.living.LivingKnockBackEvent event = net.neoforged.neoforge.common.CommonHooks.onLivingKnockBack(this, (float) power, xd, zd);
+ if (event.isCanceled()) return;
+ power = event.getStrength();
@@ -366,7 +366,7 @@
power *= 1.0 - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
if (!(power <= 0.0)) {
this.needsSync = true;
@@ -1709,17 +_,11 @@
@@ -1713,17 +_,11 @@
} else {
BlockPos ladderCheckPos = this.blockPosition();
BlockState state = this.getInBlockState();
@@ -389,7 +389,7 @@
}
}
@@ -1780,6 +_,11 @@
@@ -1784,6 +_,11 @@
effectiveFallDistance = fallDistance;
}
@@ -401,7 +401,7 @@
boolean damaged = super.causeFallDamage(effectiveFallDistance, damageModifier, damageSource);
int dmg = this.calculateFallDamage(effectiveFallDistance, damageModifier);
if (dmg > 0) {
@@ -1843,10 +_,10 @@
@@ -1847,10 +_,10 @@
int xx = Mth.floor(this.getX());
int yy = Mth.floor(this.getY() - 0.2F);
int zz = Mth.floor(this.getZ());
@@ -415,7 +415,7 @@
}
}
}
@@ -1871,6 +_,8 @@
@@ -1875,6 +_,8 @@
if (!(damage <= 0.0F)) {
int durabilityDamage = (int)Math.max(1.0F, damage / 4.0F);
@@ -424,7 +424,7 @@
for (EquipmentSlot slot : slots) {
ItemStack itemStack = this.getItemBySlot(slot);
Equippable equippable = itemStack.get(DataComponents.EQUIPPABLE);
@@ -1905,6 +_,7 @@
@@ -1909,6 +_,7 @@
damage = Math.max(v / 25.0F, 0.0F);
float damageResisted = oldDamage - damage;
if (damageResisted > 0.0F && damageResisted < 3.4028235E37F) {
@@ -432,7 +432,7 @@
if (this instanceof ServerPlayer serverPlayer) {
serverPlayer.awardStat(Stats.DAMAGE_RESISTED, Math.round(damageResisted * 10.0F));
} else if (damageSource.getEntity() instanceof ServerPlayer) {
@@ -1930,6 +_,7 @@
@@ -1934,6 +_,7 @@
if (enchantmentArmor > 0.0F) {
damage = CombatRules.getDamageAfterMagicAbsorb(damage, enchantmentArmor);
@@ -440,7 +440,7 @@
}
return damage;
@@ -1937,22 +_,37 @@
@@ -1941,22 +_,37 @@
protected void actuallyHurt(ServerLevel level, DamageSource source, float dmg) {
if (!this.isInvulnerableTo(level, source)) {
@@ -485,7 +485,7 @@
}
}
@@ -2010,6 +_,8 @@
@@ -2014,6 +_,8 @@
}
public void swing(InteractionHand hand, boolean sendToSwingingEntity) {
@@ -494,7 +494,7 @@
if (!this.swinging || this.swingTime >= this.getCurrentSwingDuration() / 2 || this.swingTime < 0) {
this.swingTime = -1;
this.swinging = true;
@@ -2152,8 +_,10 @@
@@ -2156,8 +_,10 @@
private void swapHandItems() {
ItemStack tmp = this.getItemBySlot(EquipmentSlot.OFFHAND);
@@ -507,7 +507,7 @@
}
@Override
@@ -2270,7 +_,13 @@
@@ -2274,7 +_,13 @@
}
public void setItemSlot(EquipmentSlot slot, ItemStack itemStack) {
@@ -522,7 +522,7 @@
}
public float getArmorCoverPercentage() {
@@ -2375,15 +_,18 @@
@@ -2379,15 +_,18 @@
}
this.needsSync = true;
@@ -543,7 +543,7 @@
}
protected float getWaterSlowDown() {
@@ -2447,7 +_,7 @@
@@ -2451,7 +_,7 @@
BlockPos posBelow = this.getBlockPosBelowThatAffectsMyMovement();
float blockFriction = this.onGround()
? computeModifiedFriction(
@@ -552,7 +552,7 @@
)
: 1.0F;
Vec3 movement = this.handleRelativeFrictionAndCalculateMovement(input, blockFriction);
@@ -2479,7 +_,15 @@
@@ -2483,7 +_,15 @@
return computeModifiedFriction(this.omnidirectionalAirMover() ? 0.91F : 0.98F, (float)this.getAttributeValue(Attributes.AIR_DRAG_MODIFIER));
}
@@ -568,7 +568,7 @@
boolean isFalling = this.getDeltaMovement().y <= 0.0;
double oldY = this.getY();
double baseGravity = this.getEffectiveGravity();
@@ -2508,6 +_,7 @@
@@ -2512,6 +_,7 @@
slowDown = 0.96F;
}
@@ -576,7 +576,7 @@
this.moveRelative(speed, input);
this.move(MoverType.SELF, this.getDeltaMovement());
Vec3 movement = this.getDeltaMovement();
@@ -2685,7 +_,7 @@
@@ -2689,7 +_,7 @@
double xd = Mth.clamp(delta.x, -0.15F, 0.15F);
double zd = Mth.clamp(delta.z, -0.15F, 0.15F);
double yd = Math.max(delta.y, -0.15F);
@@ -585,7 +585,7 @@
yd = 0.0;
}
@@ -2926,6 +_,7 @@
@@ -2936,6 +_,7 @@
ItemStack previous = lastEquipmentItems.get(slot);
ItemStack current = this.getItemBySlot(slot);
if (this.equipmentHasChanged(previous, current)) {
@@ -593,7 +593,7 @@
if (changedItems == null) {
changedItems = Maps.newEnumMap(EquipmentSlot.class);
}
@@ -3076,10 +_,10 @@
@@ -3086,10 +_,10 @@
this.noJumpDelay = 10;
}
} else {
@@ -606,7 +606,7 @@
}
} else {
this.noJumpDelay = 0;
@@ -3396,8 +_,11 @@
@@ -3406,8 +_,11 @@
private void updatingUsingItem() {
if (this.isUsingItem()) {
@@ -620,7 +620,7 @@
this.updateUsingItem(this.useItem);
} else {
this.stopUsingItem();
@@ -3440,8 +_,11 @@
@@ -3450,8 +_,11 @@
}
protected void updateUsingItem(ItemStack useItem) {
@@ -633,7 +633,7 @@
this.completeUsingItem();
}
}
@@ -3469,8 +_,10 @@
@@ -3479,8 +_,10 @@
public void startUsingItem(InteractionHand hand) {
ItemStack itemStack = this.getItemInHand(hand);
if (!itemStack.isEmpty() && !this.isUsingItem()) {
@@ -645,7 +645,7 @@
if (!this.level().isClientSide()) {
this.setLivingEntityFlag(1, true);
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
@@ -3540,7 +_,8 @@
@@ -3550,7 +_,8 @@
this.releaseUsingItem();
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
@@ -655,7 +655,7 @@
if (result != this.useItem) {
this.setItemInHand(hand, result);
}
@@ -3574,7 +_,11 @@
@@ -3584,7 +_,11 @@
ItemStack itemInUsedHand = this.getItemInHand(this.getUsedItemHand());
if (!this.useItem.isEmpty() && ItemStack.isSameItem(itemInUsedHand, this.useItem)) {
this.useItem = itemInUsedHand;
@@ -667,7 +667,7 @@
if (this.useItem.useOnRelease()) {
this.updatingUsingItem();
}
@@ -3584,6 +_,7 @@
@@ -3594,6 +_,7 @@
}
public void stopUsingItem() {
@@ -675,7 +675,7 @@
if (!this.level().isClientSide()) {
boolean wasUsingItem = this.isUsingItem();
this.recentKineticEnemies = null;
@@ -3635,6 +_,11 @@
@@ -3645,6 +_,11 @@
}
public boolean randomTeleport(double xx, double yy, double zz, boolean showParticles) {
@@ -687,7 +687,7 @@
double xo = this.getX();
double yo = this.getY();
double zo = this.getZ();
@@ -3642,6 +_,8 @@
@@ -3652,6 +_,8 @@
boolean ok = false;
BlockPos pos = BlockPos.containing(xx, y, zz);
Level level = this.level();
@@ -696,7 +696,7 @@
if (level.hasChunkAt(pos)) {
boolean landed = false;
@@ -3657,14 +_,30 @@
@@ -3667,14 +_,30 @@
}
if (landed) {
@@ -727,7 +727,7 @@
this.teleportTo(xo, yo, zo);
return false;
}
@@ -3745,8 +_,8 @@
@@ -3755,8 +_,8 @@
}
BlockState blockState = this.level().getBlockState(bedPosition);
@@ -738,7 +738,7 @@
}
this.setPose(Pose.SLEEPING);
@@ -3761,15 +_,17 @@
@@ -3771,15 +_,17 @@
}
private boolean checkBedExists() {
@@ -759,7 +759,7 @@
Vec3 standUp = BedBlock.findStandUpPosition(this.getType(), this.level(), bedPosition, facing, this.getYRot()).orElseGet(() -> {
BlockPos above = bedPosition.above();
return new Vec3(above.getX() + 0.5, above.getY() + 0.1, above.getZ() + 0.5);
@@ -3789,7 +_,9 @@
@@ -3799,7 +_,9 @@
public @Nullable Direction getBedOrientation() {
BlockPos bedPos = this.getSleepingPos().orElse(null);
@@ -770,7 +770,7 @@
}
@Override
@@ -3798,7 +_,7 @@
@@ -3808,7 +_,7 @@
}
public ItemStack getProjectile(ItemStack heldWeapon) {
@@ -779,7 +779,7 @@
}
private static byte entityEventForEquipmentBreak(EquipmentSlot equipmentSlot) {
@@ -3850,6 +_,8 @@
@@ -3860,6 +_,8 @@
}
public EquipmentSlot getEquipmentSlotForItem(ItemStack itemStack) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/Inventory.java
+++ b/net/minecraft/world/entity/player/Inventory.java
@@ -311,6 +_,8 @@
@@ -293,6 +_,8 @@
} catch (Throwable t) {
CrashReport report = CrashReport.forThrowable(t, "Adding item to inventory");
CrashReportCategory category = report.addCategory("Item being added");
@@ -65,7 +65,7 @@
if (this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.SWIMMING)) {
Pose desiredPose = this.getDesiredPose();
Pose actualPose;
@@ -527,6 +_,7 @@
@@ -526,6 +_,7 @@
@Override
public void die(DamageSource source) {
@@ -73,7 +73,7 @@
super.die(source);
this.reapplyPosition();
if (!this.isSpectator() && this.level() instanceof ServerLevel level) {
@@ -583,10 +_,18 @@
@@ -582,10 +_,18 @@
}
public @Nullable ItemEntity drop(ItemStack itemStack, boolean thrownFromHand) {
@@ -93,7 +93,7 @@
float speed = this.inventory.getSelectedItem().getDestroySpeed(state);
if (speed > 1.0F) {
speed += (float)this.getAttributeValue(Attributes.MINING_EFFICIENCY);
@@ -615,13 +_,19 @@
@@ -614,13 +_,19 @@
speed /= 5.0F;
}
@@ -113,7 +113,7 @@
@Override
protected void readAdditionalSaveData(ValueInput input) {
super.readAdditionalSaveData(input);
@@ -694,6 +_,8 @@
@@ -693,6 +_,8 @@
}
this.removeEntitiesOnShoulder();
@@ -122,7 +122,7 @@
if (source.scalesWithDifficulty()) {
if (level.getDifficulty() == Difficulty.PEACEFUL) {
damage = 0.0F;
@@ -750,16 +_,31 @@
@@ -749,16 +_,31 @@
@Override
protected void actuallyHurt(ServerLevel level, DamageSource source, float dmg) {
if (!this.isInvulnerableTo(level, source)) {
@@ -160,7 +160,7 @@
if (dmg != 0.0F) {
this.causeFoodExhaustion(source.getFoodExhaustion());
this.getCombatTracker().recordDamage(source, dmg);
@@ -770,6 +_,8 @@
@@ -769,6 +_,8 @@
this.gameEvent(GameEvent.ENTITY_DAMAGE);
}
@@ -169,7 +169,7 @@
}
}
@@ -825,6 +_,8 @@
@@ -824,6 +_,8 @@
return InteractionResult.PASS;
} else {
@@ -178,7 +178,7 @@
ItemStack itemStack = this.getItemInHand(hand);
ItemStack itemStackClone = itemStack.copy();
InteractionResult interact = entity.interact(this, hand, location);
@@ -833,6 +_,10 @@
@@ -832,6 +_,10 @@
itemStack.setCount(itemStackClone.getCount());
}
@@ -189,7 +189,7 @@
return interact;
} else {
if (!itemStack.isEmpty() && entity instanceof LivingEntity livingEntity) {
@@ -844,6 +_,7 @@
@@ -843,6 +_,7 @@
if (interactionResult.consumesAction()) {
this.level().gameEvent(GameEvent.ENTITY_INTERACT, entity.position(), GameEvent.Context.of(this));
if (itemStack.isEmpty() && !this.hasInfiniteMaterials()) {
@@ -197,7 +197,7 @@
this.setItemInHand(hand, ItemStack.EMPTY);
}
@@ -873,6 +_,7 @@
@@ -872,6 +_,7 @@
}
@Override
@@ -205,7 +205,7 @@
protected Vec3 maybeBackOffFromEdge(Vec3 delta, MoverType moverType) {
float maxDownStep = this.maxUpStep();
if (!this.abilities.flying
@@ -924,6 +_,7 @@
@@ -923,6 +_,7 @@
}
}
@@ -213,7 +213,7 @@
private boolean isAboveGround(float maxDownStep) {
return this.onGround() || this.fallDistance < maxDownStep && !this.canFallAtLeast(0.0, 0.0, maxDownStep - this.fallDistance);
}
@@ -945,6 +_,7 @@
@@ -944,6 +_,7 @@
}
public void attack(Entity entity) {
@@ -221,7 +221,7 @@
if (!this.cannotAttack(entity)) {
float baseDamage = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE);
ItemStack attackingItemStack = this.getWeaponItem();
@@ -952,7 +_,6 @@
@@ -951,7 +_,6 @@
float attackStrengthScale = this.getAttackStrengthScale(0.5F);
float magicBoost = attackStrengthScale * (this.getEnchantedDamage(entity, baseDamage, damageSource) - baseDamage);
baseDamage *= this.baseDamageScaleFactor();
@@ -229,7 +229,7 @@
if (!this.deflectProjectile(entity)) {
if (baseDamage > 0.0F || magicBoost > 0.0F) {
boolean fullStrengthAttack = attackStrengthScale > 0.9F;
@@ -966,12 +_,22 @@
@@ -965,12 +_,22 @@
baseDamage += attackingItemStack.getItem().getAttackDamageBonus(entity, baseDamage, damageSource);
boolean criticalAttack = fullStrengthAttack && this.canCriticalAttack(entity);
@@ -254,8 +254,8 @@
float oldLivingEntityHealth = 0.0F;
if (entity instanceof LivingEntity livingTarget) {
oldLivingEntityHealth = livingTarget.getHealth();
@@ -984,7 +_,8 @@
entity, this.getKnockback(entity, damageSource) + (knockbackAttack ? 0.5F : 0.0F), oldMovement, damageSource, totalDamage
@@ -983,7 +_,8 @@
entity, this.getKnockback(entity, damageSource) + (knockbackAttack ? 0.5F : 0.0F), oldMovement, damageSource, totalDamage, true
);
if (sweepAttack) {
- this.doSweepAttack(entity, baseDamage, damageSource, attackStrengthScale);
@@ -264,7 +264,7 @@
}
this.attackVisualEffects(entity, criticalAttack, sweepAttack, fullStrengthAttack, false, magicBoost);
@@ -999,6 +_,8 @@
@@ -998,6 +_,8 @@
this.postPiercingAttack();
}
@@ -273,7 +273,7 @@
}
}
@@ -1041,7 +_,8 @@
@@ -1040,7 +_,8 @@
double approximateSpeedSq = this.getKnownMovement().horizontalDistanceSqr();
double maxSpeedForSweepAttack = this.getSpeed() * 2.5;
if (approximateSpeedSq < Mth.square(maxSpeedForSweepAttack)) {
@@ -283,7 +283,7 @@
}
}
@@ -1079,11 +_,12 @@
@@ -1078,11 +_,12 @@
private void itemAttackInteraction(Entity entity, ItemStack attackingItemStack, DamageSource damageSource, boolean applyToTarget) {
Entity hurtTarget = entity;
@@ -298,7 +298,7 @@
if (this.level() instanceof ServerLevel serverLevel) {
if (hurtTarget instanceof LivingEntity livingTarget) {
itemHurtEnemy = attackingItemStack.hurtEnemy(livingTarget, this);
@@ -1100,6 +_,7 @@
@@ -1099,6 +_,7 @@
}
if (attackingItemStack.isEmpty()) {
@@ -333,7 +333,7 @@
float enchantedDamage = this.getEnchantedDamage(nearby, var12, damageSource) * attackStrengthScale;
if (nearby.hurtServer(serverLevel, damageSource, enchantedDamage)) {
nearby.knockback(
@@ -1319,6 +_,7 @@
@@ -1320,6 +_,7 @@
}
public void stopSleepInBed(boolean forcefulWakeUp, boolean updateLevelList) {
@@ -341,7 +341,7 @@
super.stopSleeping();
if (this.level() instanceof ServerLevel && updateLevelList) {
((ServerLevel)this.level()).updateSleepingPlayerList();
@@ -1429,7 +_,8 @@
@@ -1430,7 +_,8 @@
@Override
public boolean causeFallDamage(double fallDistance, float damageModifier, DamageSource damageSource) {
@@ -351,7 +351,7 @@
return false;
}
@@ -1464,13 +_,13 @@
@@ -1465,13 +_,13 @@
protected void playStepSound(BlockPos onPos, BlockState onState) {
if (this.isInWater()) {
this.waterSwimSound();
@@ -367,7 +367,7 @@
} else {
super.playStepSound(primaryStepSoundPos, primaryStepState);
}
@@ -1501,6 +_,10 @@
@@ -1502,6 +_,10 @@
}
public void giveExperiencePoints(int i) {
@@ -378,7 +378,7 @@
this.increaseScore(i);
this.experienceProgress = this.experienceProgress + (float)i / this.getXpNeededForNextLevel();
this.totalExperience = Mth.clamp(this.totalExperience + i, 0, Integer.MAX_VALUE);
@@ -1528,7 +_,7 @@
@@ -1529,7 +_,7 @@
}
public void onEnchantmentPerformed(ItemStack itemStack, int enchantmentCost) {
@@ -387,7 +387,7 @@
if (this.experienceLevel < 0) {
this.experienceLevel = 0;
this.experienceProgress = 0.0F;
@@ -1539,6 +_,10 @@
@@ -1540,6 +_,10 @@
}
public void giveExperienceLevels(int amount) {
@@ -398,7 +398,7 @@
this.experienceLevel = IntMath.saturatedAdd(this.experienceLevel, amount);
if (this.experienceLevel < 0) {
this.experienceLevel = 0;
@@ -1570,7 +_,7 @@
@@ -1571,7 +_,7 @@
}
protected boolean hasEnoughFoodToDoExhaustiveManoeuvres() {
@@ -407,7 +407,7 @@
}
public Optional<WardenSpawnTracker> getWardenSpawnTracker() {
@@ -1677,7 +_,11 @@
@@ -1678,7 +_,11 @@
@Override
public Component getDisplayName() {
@@ -420,7 +420,7 @@
return this.decorateDisplayNameComponent(result);
}
@@ -1859,22 +_,22 @@
@@ -1860,22 +_,22 @@
return ItemStack.EMPTY;
}
@@ -448,7 +448,7 @@
}
@Override
@@ -1914,7 +_,7 @@
@@ -1915,7 +_,7 @@
}
public boolean isScoping() {
@@ -457,7 +457,7 @@
}
@Override
@@ -2042,5 +_,41 @@
@@ -2043,5 +_,41 @@
public static final Player.BedSleepingProblem OBSTRUCTED = new Player.BedSleepingProblem(Component.translatable("block.minecraft.bed.obstructed"));
public static final Player.BedSleepingProblem OTHER_PROBLEM = new Player.BedSleepingProblem(null);
public static final Player.BedSleepingProblem NOT_SAFE = new Player.BedSleepingProblem(Component.translatable("block.minecraft.bed.not_safe"));
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/BaseSpawner.java
+++ b/net/minecraft/world/level/BaseSpawner.java
@@ -153,16 +_,15 @@
@@ -154,16 +_,15 @@
entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F);
if (entity instanceof Mob mob) {
@@ -21,7 +21,7 @@
nextSpawnData.getEquipment().ifPresent(mob::equip);
}
@@ -278,5 +_,11 @@
@@ -281,5 +_,11 @@
public double getOSpin() {
return this.oSpin;
@@ -30,8 +30,8 @@
+ return new LevelSettings(this.levelName, gameType, this.difficultySettings, this.allowCommands, this.dataConfiguration, this.lifecycle);
}
public LevelSettings withDifficulty(Difficulty difficulty) {
@@ -29,7 +_,8 @@
public LevelSettings withAllowCommands(boolean allowCommands) {
@@ -33,7 +_,8 @@
this.gameType,
new LevelSettings.DifficultySettings(difficulty, this.difficultySettings.hardcore(), this.difficultySettings.locked()),
this.allowCommands,
@@ -41,7 +41,7 @@
);
}
@@ -39,16 +_,26 @@
@@ -43,16 +_,26 @@
this.gameType,
new LevelSettings.DifficultySettings(this.difficultySettings.difficulty(), this.difficultySettings.hardcore(), locked),
this.allowCommands,
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
@@ -208,7 +_,7 @@
@@ -209,7 +_,7 @@
result.add(
jigsaw.withInfo(
new StructureTemplate.StructureBlockInfo(
@@ -9,7 +9,7 @@
)
)
);
@@ -227,7 +_,7 @@
@@ -228,7 +_,7 @@
for (StructureTemplate.StructureBlockInfo blockInfo : settings.getRandomPalette(this.palettes, position).blocks(block)) {
BlockPos blockPos = absolute ? calculateRelativePosition(settings, blockInfo.pos).offset(position) : blockInfo.pos;
if (boundingBox == null || boundingBox.isInside(blockPos)) {
@@ -18,7 +18,7 @@
}
}
@@ -244,6 +_,10 @@
@@ -245,6 +_,10 @@
return transform(pos, settings.getMirror(), settings.getRotation(), settings.getRotationPivot());
}
@@ -29,7 +29,7 @@
public boolean placeInWorld(
ServerLevelAccessor level,
BlockPos position,
@@ -271,7 +_,7 @@
@@ -272,7 +_,7 @@
int maxX = Integer.MIN_VALUE;
int maxY = Integer.MIN_VALUE;
int maxZ = Integer.MIN_VALUE;
@@ -38,7 +38,7 @@
try (ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(LOGGER)) {
for (StructureTemplate.StructureBlockInfo blockInfo : processedBlockInfoList) {
@@ -301,6 +_,7 @@
@@ -302,6 +_,7 @@
blockEntity.loadWithComponents(
TagValueInput.create(reporter.forChild(blockEntity.problemPath()), level.registryAccess(), blockInfo.nbt)
);
@@ -46,7 +46,7 @@
}
}
@@ -385,16 +_,7 @@
@@ -386,16 +_,7 @@
}
if (!settings.isIgnoreEntities()) {
@@ -64,7 +64,7 @@
}
}
@@ -428,6 +_,10 @@
@@ -429,6 +_,10 @@
});
}
@@ -75,7 +75,7 @@
public static List<StructureTemplate.StructureBlockInfo> processBlockInfos(
ServerLevelAccessor level,
BlockPos position,
@@ -435,6 +_,10 @@
@@ -436,6 +_,10 @@
StructurePlaceSettings settings,
List<StructureTemplate.StructureBlockInfo> blockInfoList
) {
@@ -86,7 +86,7 @@
List<StructureTemplate.StructureBlockInfo> originalBlockInfoList = new ArrayList<>();
List<StructureTemplate.StructureBlockInfo> processedBlockInfoList = new ArrayList<>();
boolean processOnlyInCurrentChunk = true;
@@ -457,7 +_,7 @@
@@ -458,7 +_,7 @@
Iterator<StructureProcessor> iterator = settings.getProcessors().iterator();
while (processedBlockInfo != null && iterator.hasNext()) {
@@ -95,7 +95,7 @@
}
if (processedBlockInfo != null) {
@@ -474,22 +_,30 @@
@@ -475,22 +_,30 @@
return processedBlockInfoList;
}
@@ -141,7 +141,7 @@
ListTag posTag = new ListTag();
posTag.add(DoubleTag.valueOf(pos.x));
posTag.add(DoubleTag.valueOf(pos.y));
@@ -497,12 +_,12 @@
@@ -498,12 +_,12 @@
tag.put("Pos", posTag);
tag.remove("UUID");
createEntityIgnoreException(problemReporter, level, tag).ifPresent(entity -> {
@@ -157,7 +157,7 @@
mob.finalizeSpawn(level, level.getCurrentDifficultyAt(BlockPos.containing(pos)), EntitySpawnReason.STRUCTURE, null);
}
@@ -814,7 +_,7 @@
@@ -817,7 +_,7 @@
public static final class Palette {
private final List<StructureTemplate.StructureBlockInfo> blocks;
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/storage/DerivedLevelData.java
+++ b/net/minecraft/world/level/storage/DerivedLevelData.java
@@ -81,4 +_,26 @@
@@ -85,4 +_,26 @@
category.setDetail("Derived", true);
this.wrapped.fillCrashReportCategory(category, levelHeightAccessor);
}
@@ -49,7 +49,7 @@
}
public static void writeLastPlayed(CompoundTag tag) {
@@ -320,10 +_,58 @@
@@ -325,10 +_,58 @@
return this.settings.copy();
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/storage/ServerLevelData.java
+++ b/net/minecraft/world/level/storage/ServerLevelData.java
@@ -36,4 +_,11 @@
@@ -38,4 +_,11 @@
void setGameType(GameType gameType);
void setGameTime(final long time);
@@ -28,8 +28,8 @@ public class CustomParticleTypeTest {
@EventBusSubscriber(modid = CustomParticleTypeTest.MOD_ID, value = Dist.CLIENT)
public static class ClientEvents {
private static final ParticleRenderType CUSTOM_TYPE = new ParticleRenderType("CUSTOM_TYPE");
private static final ParticleRenderType CUSTOM_TYPE_TWO = new ParticleRenderType("CUSTOM_TYPE_TWO");
private static final ParticleRenderType CUSTOM_TYPE = new ParticleRenderType("CUSTOM_TYPE", "CT1");
private static final ParticleRenderType CUSTOM_TYPE_TWO = new ParticleRenderType("CUSTOM_TYPE_TWO", "CT2");
private static class CustomParticle extends TerrainParticle {
public CustomParticle(ClientLevel level, double x, double y, double z) {