mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e154cbe3e | ||
|
|
d5c5df1b64 | ||
|
|
5e75de5eb7 | ||
|
|
ddb1e52e99 | ||
|
|
9e55363e2c | ||
|
|
219abfed22 | ||
|
|
6915753b5a | ||
|
|
1527738ddc | ||
|
|
18c806f1d0 | ||
|
|
47f7c68ed5 | ||
|
|
5e8942e0a7 | ||
|
|
a02f3f9841 | ||
|
|
c5e462f7d2 | ||
|
|
d1f79d6655 | ||
|
|
9d5e81b1a9 | ||
|
|
a1c275df46 | ||
|
|
4ef7fe8bd8 | ||
|
|
ce8838e721 | ||
|
|
b7e2593d48 | ||
|
|
33d177f02e | ||
|
|
5d2186df63 | ||
|
|
77af36b807 | ||
|
|
54eeca0aed | ||
|
|
3de0566425 | ||
|
|
a5ebf3b645 | ||
|
|
63d0496cc4 | ||
|
|
31f623e794 | ||
|
|
eb001a6382 | ||
|
|
504dcad849 | ||
|
|
81f7f029c3 | ||
|
|
207c1997c9 | ||
|
|
e348ae5b84 | ||
|
|
0f3b8ee830 | ||
|
|
b4b6e48a7a |
No files matched your search
@@ -4,8 +4,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.ow2.asm:asm:9.7'
|
implementation 'org.ow2.asm:asm:9.8'
|
||||||
implementation 'org.ow2.asm:asm-tree:9.7'
|
implementation 'org.ow2.asm:asm-tree:9.8'
|
||||||
implementation 'net.minecraftforge:srgutils:0.5.10'
|
implementation 'net.minecraftforge:srgutils:0.5.10'
|
||||||
implementation 'commons-io:commons-io:2.13.0'
|
implementation 'commons-io:commons-io:2.13.0'
|
||||||
implementation 'com.google.code.gson:gson:2.10.1'
|
implementation 'com.google.code.gson:gson:2.10.1'
|
||||||
|
|||||||
+4
-3
@@ -124,7 +124,7 @@ dependencies {
|
|||||||
installer(libs.bootstrap.api) // Needed by securemodules
|
installer(libs.bootstrap.api) // Needed by securemodules
|
||||||
installer(libs.accesstransformers)
|
installer(libs.accesstransformers)
|
||||||
installer(libs.eventbus)
|
installer(libs.eventbus)
|
||||||
installer(libs.typetools) // Dep of EventBus
|
installer(libs.jspecify) // Dep of EventBus
|
||||||
installer(libs.forgespi)
|
installer(libs.forgespi)
|
||||||
installer(libs.coremods)
|
installer(libs.coremods)
|
||||||
installer(libs.nashorn) // Dep of Coremods
|
installer(libs.nashorn) // Dep of Coremods
|
||||||
@@ -147,6 +147,8 @@ dependencies {
|
|||||||
|
|
||||||
runtimeOnly(libs.bootstrap)
|
runtimeOnly(libs.bootstrap)
|
||||||
runtimeOnly(libs.bootstrap.dev)
|
runtimeOnly(libs.bootstrap.dev)
|
||||||
|
|
||||||
|
annotationProcessor(libs.eventbus.validator)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('extractRangeMap').configure {
|
tasks.named('extractRangeMap').configure {
|
||||||
@@ -166,7 +168,7 @@ patcher {
|
|||||||
|
|
||||||
runs {
|
runs {
|
||||||
forge_client {
|
forge_client {
|
||||||
property 'eventbus.checkTypesOnDispatch', 'true'
|
property 'eventbus.api.strictRuntimeChecks', 'true'
|
||||||
property 'org.lwjgl.system.SharedLibraryExtractDirectory', 'lwjgl_dll'
|
property 'org.lwjgl.system.SharedLibraryExtractDirectory', 'lwjgl_dll'
|
||||||
|
|
||||||
args '--launchTarget', 'forge_dev_client',
|
args '--launchTarget', 'forge_dev_client',
|
||||||
@@ -231,7 +233,6 @@ patcher {
|
|||||||
args '--launchTarget', 'forge_dev_client_data',
|
args '--launchTarget', 'forge_dev_client_data',
|
||||||
'--mod', 'forge',
|
'--mod', 'forge',
|
||||||
'--all',
|
'--all',
|
||||||
'--validate',
|
|
||||||
'--output', rootProject.file('src/main/generated/'),
|
'--output', rootProject.file('src/main/generated/'),
|
||||||
'--existing', sourceSets.main.resources.srcDirs[0],
|
'--existing', sourceSets.main.resources.srcDirs[0],
|
||||||
'--assetsDir', downloadAssets.output,
|
'--assetsDir', downloadAssets.output,
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ Please ensure you have a valid email address associated with your GitHub account
|
|||||||
to use and modify. However, it costs money to run such a large project as this, so please consider
|
to use and modify. However, it costs money to run such a large project as this, so please consider
|
||||||
[becoming a patron][Patreon].*
|
[becoming a patron][Patreon].*
|
||||||
|
|
||||||
|
### Thanks
|
||||||
|
[](https://www.yourkit.com/)
|
||||||
|
|
||||||
|
YourKit for providing us accesss to their [YourKit Java Profiler] which helps identify bottlenecks and places for improvment.
|
||||||
|
|
||||||
[Contributing]: ./CONTRIBUTING.md
|
[Contributing]: ./CONTRIBUTING.md
|
||||||
[CLA]: https://cla-assistant.io/MinecraftForge/MinecraftForge
|
[CLA]: https://cla-assistant.io/MinecraftForge/MinecraftForge
|
||||||
|
|
||||||
@@ -93,3 +98,4 @@ Please ensure you have a valid email address associated with your GitHub account
|
|||||||
[Pull-Requests]: https://docs.minecraftforge.net/en/latest/forgedev/#making-changes-and-pull-requests
|
[Pull-Requests]: https://docs.minecraftforge.net/en/latest/forgedev/#making-changes-and-pull-requests
|
||||||
|
|
||||||
[Patreon]: https://www.patreon.com/LexManos
|
[Patreon]: https://www.patreon.com/LexManos
|
||||||
|
[YourKit Java Profiler]: https://www.yourkit.com/java/profiler/
|
||||||
@@ -10,9 +10,10 @@ plugins {
|
|||||||
apply from: rootProject.file('build_shared.gradle')
|
apply from: rootProject.file('build_shared.gradle')
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.nulls)
|
compileOnly(libs.jetbrains.annotations)
|
||||||
|
|
||||||
api(libs.eventbus)
|
api(libs.eventbus)
|
||||||
|
annotationProcessor(libs.eventbus.validator)
|
||||||
|
|
||||||
implementation(project(':fmlloader'))
|
implementation(project(':fmlloader'))
|
||||||
implementation(libs.commons.io)
|
implementation(libs.commons.io)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml;
|
package net.minecraftforge.fml;
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||||
import net.minecraftforge.fml.config.IConfigEvent;
|
import net.minecraftforge.fml.config.IConfigEvent;
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ public class Bindings {
|
|||||||
/**
|
/**
|
||||||
* @return A supplier of net.minecraftforge.common.MinecraftForge#EVENT_BUS
|
* @return A supplier of net.minecraftforge.common.MinecraftForge#EVENT_BUS
|
||||||
*/
|
*/
|
||||||
public static Supplier<IEventBus> getForgeBus() {
|
public static Supplier<BusGroup> getForgeBus() {
|
||||||
return PROVIDER.getForgeBusSupplier();
|
return PROVIDER.getForgeBusSupplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,18 @@ import java.util.function.Supplier;
|
|||||||
* <li>When you want to call one thing on one side, another thing on the other and return a result {@link #safeRunForDist(Supplier, Supplier)}</li>
|
* <li>When you want to call one thing on one side, another thing on the other and return a result {@link #safeRunForDist(Supplier, Supplier)}</li>
|
||||||
* <li>When you want to run something on one side {@link #safeRunWhenOn(Dist, Supplier)}</li>
|
* <li>When you want to run something on one side {@link #safeRunWhenOn(Dist, Supplier)}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
*
|
||||||
|
* @deprecated Historically, this allowed for safe execution of code on the correct side by exploiting a low-level
|
||||||
|
* detail in Java 8, but in newer versions a simple if check is enough.
|
||||||
|
* <br>
|
||||||
|
* For example:
|
||||||
|
* <pre>{@code
|
||||||
|
* if (FMLEnvironment.dist.isClient()) {
|
||||||
|
* // client code here
|
||||||
|
* }
|
||||||
|
* }</pre>
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since = "1.21.5", forRemoval = true)
|
||||||
public final class DistExecutor
|
public final class DistExecutor
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml;
|
package net.minecraftforge.fml;
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||||
import net.minecraftforge.fml.config.IConfigEvent;
|
import net.minecraftforge.fml.config.IConfigEvent;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public interface IBindingsProvider {
|
public interface IBindingsProvider {
|
||||||
Supplier<IEventBus> getForgeBusSupplier();
|
Supplier<BusGroup> getForgeBusSupplier();
|
||||||
Supplier<I18NParser> getMessageParser();
|
Supplier<I18NParser> getMessageParser();
|
||||||
Supplier<IConfigEvent.ConfigConfig> getConfigConfiguration();
|
Supplier<IConfigEvent.ConfigConfig> getConfigConfiguration();
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml;
|
package net.minecraftforge.fml;
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
|
||||||
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -61,14 +59,13 @@ public interface IModLoadingState {
|
|||||||
/**
|
/**
|
||||||
* Builds the transition task for this state with a blank pre-sync and post-sync task.
|
* Builds the transition task for this state with a blank pre-sync and post-sync task.
|
||||||
*
|
*
|
||||||
* @param <T> a type of event fired on the mod-specific event bus
|
|
||||||
* @param syncExecutor a synchronous executor
|
* @param syncExecutor a synchronous executor
|
||||||
* @param parallelExecutor a parallel executor
|
* @param parallelExecutor a parallel executor
|
||||||
* @param progressBar a progress meter for tracking progress
|
* @param progressBar a progress meter for tracking progress
|
||||||
* @return a transition task for this state
|
* @return a transition task for this state
|
||||||
* @see #buildTransition(Executor, Executor, ProgressMeter, Function, Function)
|
* @see #buildTransition(Executor, Executor, ProgressMeter, Function, Function)
|
||||||
*/
|
*/
|
||||||
default <T extends Event & IModBusEvent> Optional<CompletableFuture<Void>> buildTransition(
|
default Optional<CompletableFuture<Void>> buildTransition(
|
||||||
final Executor syncExecutor,
|
final Executor syncExecutor,
|
||||||
final Executor parallelExecutor,
|
final Executor parallelExecutor,
|
||||||
final ProgressMeter progressBar
|
final ProgressMeter progressBar
|
||||||
@@ -83,7 +80,6 @@ public interface IModLoadingState {
|
|||||||
* Builds the transition task for this state. The pre-sync and post-sync task functions allow the transition builder
|
* Builds the transition task for this state. The pre-sync and post-sync task functions allow the transition builder
|
||||||
* to run these tasks on the same executor as the actual event dispatch and pre/post hooks.
|
* to run these tasks on the same executor as the actual event dispatch and pre/post hooks.
|
||||||
*
|
*
|
||||||
* @param <T> a type of event fired on the mod-specific event bus
|
|
||||||
* @param syncExecutor a synchronous executor
|
* @param syncExecutor a synchronous executor
|
||||||
* @param parallelExecutor a parallel executor
|
* @param parallelExecutor a parallel executor
|
||||||
* @param progressBar a progress meter for tracking progress
|
* @param progressBar a progress meter for tracking progress
|
||||||
@@ -91,7 +87,6 @@ public interface IModLoadingState {
|
|||||||
* @param postSyncTask a function which returns a task to run after event post-dispatch hook
|
* @param postSyncTask a function which returns a task to run after event post-dispatch hook
|
||||||
* @return a transition task for this state
|
* @return a transition task for this state
|
||||||
*/
|
*/
|
||||||
<T extends Event & IModBusEvent>
|
|
||||||
Optional<CompletableFuture<Void>> buildTransition(final Executor syncExecutor,
|
Optional<CompletableFuture<Void>> buildTransition(final Executor syncExecutor,
|
||||||
final Executor parallelExecutor,
|
final Executor parallelExecutor,
|
||||||
final ProgressMeter progressBar,
|
final ProgressMeter progressBar,
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml;
|
package net.minecraftforge.fml;
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
import net.minecraftforge.fml.event.IModBusEvent;
|
||||||
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
public interface IModStateTransition {
|
public interface IModStateTransition {
|
||||||
/** Magic value to allow me to optimize the futures list by ignoring the default value without making old methods nullable. */
|
/** Magic value to allow me to optimize the futures list by ignoring the default value without making old methods nullable. */
|
||||||
public static final BiFunction<Executor, ? extends EventGenerator<?>, CompletableFuture<Void>> NULL_HOOK = (e, g) -> CompletableFuture.completedFuture(null);
|
BiFunction<Executor, ? extends EventGenerator<?>, CompletableFuture<Void>> NULL_HOOK = (e, g) -> CompletableFuture.completedFuture(null);
|
||||||
|
|
||||||
static IModStateTransition buildNoopTransition() {
|
static IModStateTransition buildNoopTransition() {
|
||||||
return ModStateTransitionHelper.NOOP;
|
return ModStateTransitionHelper.NOOP;
|
||||||
@@ -51,7 +50,7 @@ public interface IModStateTransition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
default <T extends Event & IModBusEvent> EventGenerator<T> eventFunction() {
|
default <T extends IModBusEvent> EventGenerator<T> eventFunction() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,8 +73,8 @@ public interface IModStateTransition {
|
|||||||
@Deprecated(since = "1.21.3", forRemoval = true)
|
@Deprecated(since = "1.21.3", forRemoval = true)
|
||||||
default BiFunction<Executor, ? extends EventGenerator<?>, CompletableFuture<Void>> postDispatchHook() { return NULL_HOOK; }
|
default BiFunction<Executor, ? extends EventGenerator<?>, CompletableFuture<Void>> postDispatchHook() { return NULL_HOOK; }
|
||||||
|
|
||||||
interface EventGenerator<T extends Event & IModBusEvent> extends Function<ModContainer, T> {
|
interface EventGenerator<T extends IModBusEvent> extends Function<ModContainer, T> {
|
||||||
static <FN extends Event & IModBusEvent> EventGenerator<FN> fromFunction(Function<ModContainer, FN> fn) {
|
static <FN extends IModBusEvent> EventGenerator<FN> fromFunction(Function<ModContainer, FN> fn) {
|
||||||
return fn::apply;
|
return fn::apply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml;
|
package net.minecraftforge.fml;
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import net.minecraftforge.fml.config.IConfigEvent;
|
import net.minecraftforge.fml.config.IConfigEvent;
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
import net.minecraftforge.fml.event.IModBusEvent;
|
||||||
@@ -162,5 +161,5 @@ public abstract class ModContainer {
|
|||||||
* Accept an arbitrary event for processing by the mod. Probably posted to an event bus in the lower level container.
|
* Accept an arbitrary event for processing by the mod. Probably posted to an event bus in the lower level container.
|
||||||
* @param e Event to accept
|
* @param e Event to accept
|
||||||
*/
|
*/
|
||||||
protected <T extends Event & IModBusEvent> void acceptEvent(T e) {}
|
protected <T extends IModBusEvent> void acceptEvent(T e) {}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,6 @@
|
|||||||
package net.minecraftforge.fml;
|
package net.minecraftforge.fml;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
import net.minecraftforge.fml.event.IModBusEvent;
|
||||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
@@ -88,7 +87,7 @@ public class ModLoader {
|
|||||||
this.loadingModList = FMLLoader.getLoadingModList();
|
this.loadingModList = FMLLoader.getLoadingModList();
|
||||||
this.loadingExceptions = this.loadingModList.getErrors().stream()
|
this.loadingExceptions = this.loadingModList.getErrors().stream()
|
||||||
.flatMap(ModLoadingException::fromEarlyException)
|
.flatMap(ModLoadingException::fromEarlyException)
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
this.loadingWarnings = this.loadingModList.getBrokenFiles().stream()
|
this.loadingWarnings = this.loadingModList.getBrokenFiles().stream()
|
||||||
.map(file -> new ModLoadingWarning(null, ModLoadingStage.VALIDATE, InvalidModIdentifier.identifyJarProblem(file.getFilePath()).orElse("fml.modloading.brokenfile"), file.getFileName()))
|
.map(file -> new ModLoadingWarning(null, ModLoadingStage.VALIDATE, InvalidModIdentifier.identifyJarProblem(file.getFilePath()).orElse("fml.modloading.brokenfile"), file.getFileName()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -155,11 +154,13 @@ public class ModLoader {
|
|||||||
loadingStateValid = false;
|
loadingStateValid = false;
|
||||||
throw new LoadingFailedException(loadingExceptions);
|
throw new LoadingFailedException(loadingExceptions);
|
||||||
}
|
}
|
||||||
List<? extends ForgeFeature.Bound> failedBounds = loadingModList.getMods().stream()
|
var failedBounds = new ArrayList<ForgeFeature.Bound>();
|
||||||
.map(ModInfo::getForgeFeatures)
|
for (var mod : loadingModList.getMods()) {
|
||||||
.flatMap(List::stream)
|
for (var feature : mod.getForgeFeatures()) {
|
||||||
.filter(bound -> !ForgeFeature.testFeature(FMLEnvironment.dist, bound))
|
if (!ForgeFeature.testFeature(FMLEnvironment.dist, feature))
|
||||||
.toList();
|
failedBounds.add(feature);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!failedBounds.isEmpty()) {
|
if (!failedBounds.isEmpty()) {
|
||||||
LOGGER.fatal(CORE, "Failed to validate feature bounds for mods: {}", failedBounds);
|
LOGGER.fatal(CORE, "Failed to validate feature bounds for mods: {}", failedBounds);
|
||||||
@@ -357,49 +358,53 @@ public class ModLoader {
|
|||||||
return completedStates.contains(state);
|
return completedStates.contains(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Event & IModBusEvent> void runEventGenerator(Function<ModContainer, T> generator) {
|
public <T extends IModBusEvent> void runEventGenerator(Function<ModContainer, T> generator) {
|
||||||
if (!loadingStateValid) {
|
if (!loadingStateValid) {
|
||||||
LOGGER.error("Cowardly refusing to send event generator to a broken mod state");
|
LOGGER.error("Cowardly refusing to send event generator to a broken mod state");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ModList.get().forEachModInOrder(mc -> mc.acceptEvent(generator.apply(mc)));
|
for (var mod : ModList.get().getLoadedMods())
|
||||||
|
mod.acceptEvent(generator.apply(mod));
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Event & IModBusEvent> void postEvent(T e) {
|
public <T extends IModBusEvent> void postEvent(T e) {
|
||||||
|
var cls = e.getClass();
|
||||||
if (!loadingStateValid) {
|
if (!loadingStateValid) {
|
||||||
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ModList.get().forEachModInOrder(mc -> mc.acceptEvent(e));
|
for (var mod : ModList.get().getLoadedMods())
|
||||||
|
mod.acceptEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Event & IModBusEvent> T postEventWithReturn(T e) {
|
public <T extends IModBusEvent> T postEventWithReturn(T e) {
|
||||||
if (!loadingStateValid) {
|
if (!loadingStateValid) {
|
||||||
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
ModList.get().forEachModInOrder(mc -> mc.acceptEvent(e));
|
for (var mod : ModList.get().getLoadedMods())
|
||||||
|
mod.acceptEvent(e);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
@SuppressWarnings("removal")
|
||||||
public <T extends Event & IModBusEvent> void postEventWrapContainerInModOrder(T event) {
|
public <T extends IModBusEvent> void postEventWrapContainerInModOrder(T event) {
|
||||||
postEventWithWrapInModOrder(event,
|
postEventWithWrapInModOrder(event,
|
||||||
(mc, e) -> ModLoadingContext.get().setActiveContainer(mc),
|
(mc, e) -> ModLoadingContext.get().setActiveContainer(mc),
|
||||||
(mc, e) -> ModLoadingContext.get().setActiveContainer(null)
|
(mc, e) -> ModLoadingContext.get().setActiveContainer(null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Event & IModBusEvent> void postEventWithWrapInModOrder(T e, BiConsumer<ModContainer, T> pre, BiConsumer<ModContainer, T> post) {
|
public <T extends IModBusEvent> void postEventWithWrapInModOrder(T e, BiConsumer<ModContainer, T> pre, BiConsumer<ModContainer, T> post) {
|
||||||
if (!loadingStateValid) {
|
if (!loadingStateValid) {
|
||||||
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ModList.get().forEachModInOrder(mc -> {
|
for (var mod : ModList.get().getLoadedMods()) {
|
||||||
pre.accept(mc, e);
|
pre.accept(mod, e);
|
||||||
mc.acceptEvent(e);
|
mod.acceptEvent(e);
|
||||||
post.accept(mc, e);
|
post.accept(mod, e);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ModLoadingWarning> getWarnings() {
|
public List<ModLoadingWarning> getWarnings() {
|
||||||
@@ -416,7 +421,7 @@ public class ModLoader {
|
|||||||
return runningDataGen;
|
return runningDataGen;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ErroredModContainer extends ModContainer {
|
private static final class ErroredModContainer extends ModContainer {
|
||||||
public ErroredModContainer() {
|
public ErroredModContainer() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml;
|
package net.minecraftforge.fml;
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
|
||||||
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -36,7 +34,7 @@ public record ModLoadingState(
|
|||||||
Optional<IModStateTransition> transition
|
Optional<IModStateTransition> transition
|
||||||
) implements IModLoadingState {
|
) implements IModLoadingState {
|
||||||
@Override
|
@Override
|
||||||
public <T extends Event & IModBusEvent> Optional<CompletableFuture<Void>> buildTransition(
|
public Optional<CompletableFuture<Void>> buildTransition(
|
||||||
final Executor syncExecutor,
|
final Executor syncExecutor,
|
||||||
final Executor parallelExecutor,
|
final Executor parallelExecutor,
|
||||||
final ProgressMeter progressBar,
|
final ProgressMeter progressBar,
|
||||||
|
|||||||
@@ -9,15 +9,16 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CompletionException;
|
import java.util.concurrent.CompletionException;
|
||||||
import java.util.concurrent.CompletionStage;
|
import java.util.concurrent.CompletionStage;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import net.minecraftforge.fml.IModStateTransition.EventGenerator;
|
import net.minecraftforge.fml.IModStateTransition.EventGenerator;
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
import net.minecraftforge.fml.event.IModBusEvent;
|
||||||
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
||||||
@@ -41,7 +42,7 @@ class ModStateTransitionHelper {
|
|||||||
if (t.stream().noneMatch(e -> e.exception() != null)) {
|
if (t.stream().noneMatch(e -> e.exception() != null)) {
|
||||||
return CompletableFuture.completedFuture(null);
|
return CompletableFuture.completedFuture(null);
|
||||||
} else {
|
} else {
|
||||||
final var throwables = t.stream().map(FutureResult::exception).filter(e -> e != null).toList();
|
final var throwables = t.stream().map(FutureResult::exception).filter(Objects::nonNull).toList();
|
||||||
CompletableFuture<Void> cf = new CompletableFuture<>();
|
CompletableFuture<Void> cf = new CompletableFuture<>();
|
||||||
final RuntimeException accumulator = new RuntimeException();
|
final RuntimeException accumulator = new RuntimeException();
|
||||||
cf.completeExceptionally(accumulator);
|
cf.completeExceptionally(accumulator);
|
||||||
@@ -70,13 +71,15 @@ class ModStateTransitionHelper {
|
|||||||
for (var future : futures) {
|
for (var future : futures) {
|
||||||
int i = list.size();
|
int i = list.size();
|
||||||
list.add(null);
|
list.add(null);
|
||||||
results[i] = future.whenComplete((result, exception) -> list.set(i, new FutureResult<>(result, exception)));
|
@SuppressWarnings("unchecked") // Bypass a weird javac error with generic by forcing it to be the exact type we want.
|
||||||
|
var raw = ((CompletableFuture<V>)future);
|
||||||
|
results[i] = raw.whenComplete((result, exception) -> list.set(i, new FutureResult<>(result, exception)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return CompletableFuture.allOf(results).handle((r, th)->null).thenApply(res -> list);
|
return CompletableFuture.allOf(results).handle((r, th)->null).thenApply(res -> list);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T extends Event & IModBusEvent> void addCompletableFutureTaskForModDispatch(
|
private static <T extends IModBusEvent> void addCompletableFutureTaskForModDispatch(
|
||||||
final IModStateTransition transition,
|
final IModStateTransition transition,
|
||||||
final Executor executor,
|
final Executor executor,
|
||||||
final List<CompletableFuture<Void>> completableFutures,
|
final List<CompletableFuture<Void>> completableFutures,
|
||||||
@@ -135,14 +138,14 @@ class ModStateTransitionHelper {
|
|||||||
completableFutures.add(postDispatchHook);
|
completableFutures.add(postDispatchHook);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T extends Event & IModBusEvent> CompletableFuture<Void> getHook(BiFunction<Executor, ? extends EventGenerator<?>, CompletableFuture<Void>> hook, Executor executor, EventGenerator<T> eventGenerator) {
|
private static <T extends IModBusEvent> CompletableFuture<Void> getHook(BiFunction<Executor, ? extends EventGenerator<?>, CompletableFuture<Void>> hook, Executor executor, EventGenerator<T> eventGenerator) {
|
||||||
if (hook == null || hook == IModStateTransition.NULL_HOOK) return null;
|
if (hook == null || hook == IModStateTransition.NULL_HOOK) return null;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
var hookTyped = (BiFunction<Executor, EventGenerator<T>, CompletableFuture<Void>>)hook;
|
var hookTyped = (BiFunction<Executor, EventGenerator<T>, CompletableFuture<Void>>)hook;
|
||||||
return hookTyped.apply(executor, eventGenerator);
|
return hookTyped.apply(executor, eventGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
static <T extends Event & IModBusEvent> CompletableFuture<Void> build(
|
static <T extends IModBusEvent> CompletableFuture<Void> build(
|
||||||
final IModStateTransition transition,
|
final IModStateTransition transition,
|
||||||
final String name,
|
final String name,
|
||||||
final Executor syncExecutor,
|
final Executor syncExecutor,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.config;
|
package net.minecraftforge.fml.config;
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||||
import net.minecraftforge.fml.Bindings;
|
import net.minecraftforge.fml.Bindings;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -29,7 +29,7 @@ public interface IConfigEvent {
|
|||||||
ModConfig getConfig();
|
ModConfig getConfig();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
default <T extends Event & IConfigEvent> T self() {
|
default <T extends InheritableEvent & IConfigEvent> T self() {
|
||||||
return (T) this;
|
return (T) this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,27 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.event;
|
package net.minecraftforge.fml.event;
|
||||||
|
|
||||||
|
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||||
|
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||||
|
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marker interface for events dispatched on the ModLifecycle event bus instead of the primary event bus
|
* Marker interface for events dispatched on the ModLifecycle event bus instead of the primary event bus
|
||||||
*/
|
*/
|
||||||
public interface IModBusEvent {
|
public interface IModBusEvent extends InheritableEvent {
|
||||||
|
/**
|
||||||
|
* @param modEventBusGroup Obtained from {@link net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext#getModBusGroup()} or your language provider's equivalent.
|
||||||
|
* @param eventClass The event type you want to get the associated bus for.
|
||||||
|
*/
|
||||||
|
static <T extends IModBusEvent> EventBus<T> getBus(BusGroup modEventBusGroup, Class<T> eventClass) {
|
||||||
|
// Do not copy! Temporary solution until the FML rewrite is complete. May throw in future
|
||||||
|
// without prior notice.
|
||||||
|
//
|
||||||
|
// Mods creating their own events should directly assign the result of the create method to a
|
||||||
|
// static final field in their event class, without wrapping or calling multiple times.
|
||||||
|
//
|
||||||
|
// Mods using existing events should instead use the existing static final BUS field in the
|
||||||
|
// event class (for most events) or getBus(BusGroup) method (for mod bus events).
|
||||||
|
return EventBus.create(modEventBusGroup, eventClass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ java {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.nulls)
|
compileOnly(libs.jetbrains.annotations)
|
||||||
implementation(project(':fmlloader'))
|
implementation(project(':fmlloader'))
|
||||||
implementation(project(':fmlcore'))
|
implementation(project(':fmlcore'))
|
||||||
implementation(libs.bundles.lwjgl)
|
implementation(libs.bundles.lwjgl)
|
||||||
|
|||||||
+11
-12
@@ -90,7 +90,12 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
// The GL ID of the window. Used for all operations
|
// The GL ID of the window. Used for all operations
|
||||||
private long window;
|
private long window;
|
||||||
// The thread that contains and ticks the window while Forge is loading mods
|
// The thread that contains and ticks the window while Forge is loading mods
|
||||||
private ScheduledExecutorService renderScheduler;
|
private static final ScheduledExecutorService renderScheduler = Executors.newSingleThreadScheduledExecutor(r -> {
|
||||||
|
final var thread = Executors.defaultThreadFactory().newThread(r);
|
||||||
|
thread.setName("EarlyDisplay");
|
||||||
|
thread.setDaemon(true);
|
||||||
|
return thread;
|
||||||
|
});
|
||||||
private int fbWidth;
|
private int fbWidth;
|
||||||
private int fbHeight;
|
private int fbHeight;
|
||||||
private int fbScale;
|
private int fbScale;
|
||||||
@@ -149,7 +154,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
}
|
}
|
||||||
this.maximized = parsed.has(maximizedopt) || FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_MAXIMIZED);
|
this.maximized = parsed.has(maximizedopt) || FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_MAXIMIZED);
|
||||||
|
|
||||||
StartupNotificationManager.modLoaderConsumer().ifPresent(c->c.accept("Forge loading " + forgeVersion));
|
StartupNotificationManager.modLoaderConsumer().ifPresent(c->c.accept("Forge loading " + FMLLoader.versionInfo().forgeVersion()));
|
||||||
performanceInfo = new PerformanceInfo();
|
performanceInfo = new PerformanceInfo();
|
||||||
return start(mcVersion, forgeVersion);
|
return start(mcVersion, forgeVersion);
|
||||||
}
|
}
|
||||||
@@ -238,7 +243,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
|
|
||||||
var date = Calendar.getInstance();
|
var date = Calendar.getInstance();
|
||||||
if (FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_SQUIR) || (date.get(Calendar.MONTH) == Calendar.APRIL && date.get(Calendar.DAY_OF_MONTH) == 1))
|
if (FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_SQUIR) || (date.get(Calendar.MONTH) == Calendar.APRIL && date.get(Calendar.DAY_OF_MONTH) == 1))
|
||||||
this.elements.add(0, RenderElement.squir());
|
this.elements.addFirst(RenderElement.squir());
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
@@ -287,12 +292,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
* Start the window and Render Thread; we're ready to go.
|
* Start the window and Render Thread; we're ready to go.
|
||||||
*/
|
*/
|
||||||
public Runnable start(@Nullable String mcVersion, final String forgeVersion) {
|
public Runnable start(@Nullable String mcVersion, final String forgeVersion) {
|
||||||
renderScheduler = Executors.newSingleThreadScheduledExecutor(r -> {
|
|
||||||
final var thread = Executors.defaultThreadFactory().newThread(r);
|
|
||||||
thread.setName("EarlyDisplay");
|
|
||||||
thread.setDaemon(true);
|
|
||||||
return thread;
|
|
||||||
});
|
|
||||||
initWindow(mcVersion);
|
initWindow(mcVersion);
|
||||||
this.initializationFuture = renderScheduler.schedule(() -> initRender(mcVersion, forgeVersion), 1, TimeUnit.MILLISECONDS);
|
this.initializationFuture = renderScheduler.schedule(() -> initRender(mcVersion, forgeVersion), 1, TimeUnit.MILLISECONDS);
|
||||||
return this::periodicTick;
|
return this::periodicTick;
|
||||||
@@ -304,7 +303,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
return this.glVersion;
|
return this.glVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void crashElegantly(String errorDetails) {
|
private static void crashElegantly(String errorDetails) {
|
||||||
StringBuilder msgBuilder = new StringBuilder(2000);
|
StringBuilder msgBuilder = new StringBuilder(2000);
|
||||||
msgBuilder.append("Failed to initialize graphics window with current settings.\n");
|
msgBuilder.append("Failed to initialize graphics window with current settings.\n");
|
||||||
msgBuilder.append("\n\n");
|
msgBuilder.append("\n\n");
|
||||||
@@ -512,7 +511,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
this.winY = y;
|
this.winY = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void handleLastGLFWError(BiConsumer<Integer, String> handler) {
|
private static void handleLastGLFWError(BiConsumer<Integer, String> handler) {
|
||||||
try (MemoryStack memorystack = MemoryStack.stackPush()) {
|
try (MemoryStack memorystack = MemoryStack.stackPush()) {
|
||||||
PointerBuffer pointerbuffer = memorystack.mallocPointer(1);
|
PointerBuffer pointerbuffer = memorystack.mallocPointer(1);
|
||||||
int error = glfwGetError(pointerbuffer);
|
int error = glfwGetError(pointerbuffer);
|
||||||
@@ -640,7 +639,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addMojangTexture(final int textureId) {
|
public void addMojangTexture(final int textureId) {
|
||||||
this.elements.add(0, RenderElement.mojang(textureId, framecount));
|
this.elements.addFirst(RenderElement.mojang(textureId, framecount));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|||||||
+30
-29
@@ -22,8 +22,8 @@ public class RenderElement {
|
|||||||
static int globalAlpha = 255;
|
static int globalAlpha = 255;
|
||||||
private int retireCount;
|
private int retireCount;
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
interface Renderer {
|
interface Renderer {
|
||||||
|
|
||||||
void accept(SimpleBufferBuilder bb, DisplayContext context, int frame);
|
void accept(SimpleBufferBuilder bb, DisplayContext context, int frame);
|
||||||
|
|
||||||
default Renderer then(Renderer r) {
|
default Renderer then(Renderer r) {
|
||||||
@@ -38,6 +38,9 @@ public class RenderElement {
|
|||||||
interface TextureRenderer {
|
interface TextureRenderer {
|
||||||
void accept(SimpleBufferBuilder bb, DisplayContext context, int[] size, int frame);
|
void accept(SimpleBufferBuilder bb, DisplayContext context, int[] size, int frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @deprecated Use {@link Renderer} directly. This was always eagerly resolved, making it an unnecessary wrapper. */
|
||||||
|
@Deprecated(since = "1.21.5", forRemoval = true)
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
interface Initializer extends Supplier<Renderer> {}
|
interface Initializer extends Supplier<Renderer> {}
|
||||||
|
|
||||||
@@ -56,11 +59,18 @@ public class RenderElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @deprecated Use {@link RenderElement#RenderElement(Renderer)} instead */
|
||||||
|
@Deprecated(since = "1.21.5", forRemoval = true)
|
||||||
public RenderElement(final Initializer rendererInitializer) {
|
public RenderElement(final Initializer rendererInitializer) {
|
||||||
this.bb = new SimpleBufferBuilder(1);
|
this.bb = new SimpleBufferBuilder(1);
|
||||||
this.renderer = rendererInitializer.get();
|
this.renderer = rendererInitializer.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RenderElement(Renderer renderer) {
|
||||||
|
this.bb = new SimpleBufferBuilder(1);
|
||||||
|
this.renderer = renderer;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean render(DisplayContext ctx, int count) {
|
public boolean render(DisplayContext ctx, int count) {
|
||||||
this.renderer.accept(bb, ctx, count);
|
this.renderer.accept(bb, ctx, count);
|
||||||
return this.retireCount == 0 || this.retireCount < count;
|
return this.retireCount == 0 || this.retireCount < count;
|
||||||
@@ -75,7 +85,7 @@ public class RenderElement {
|
|||||||
List<SimpleFont.DisplayText> texts = new ArrayList<>();
|
List<SimpleFont.DisplayText> texts = new ArrayList<>();
|
||||||
for (int i = messages.size() - 1; i >= 0; i--) {
|
for (int i = messages.size() - 1; i >= 0; i--) {
|
||||||
final StartupNotificationManager.AgeMessage pair = messages.get(i);
|
final StartupNotificationManager.AgeMessage pair = messages.get(i);
|
||||||
final float fade = clamp((4000.0f - (float) pair.age() - ( i - 4 ) * 1000.0f) / 5000.0f, 0.0f, 1.0f);
|
final float fade = Math.clamp((4000.0f - (float) pair.age() - ( i - 4 ) * 1000.0f) / 5000.0f, 0.0f, 1.0f);
|
||||||
if (fade <0.01f) continue;
|
if (fade <0.01f) continue;
|
||||||
Message msg = pair.message();
|
Message msg = pair.message();
|
||||||
int colour = Math.min((int)(fade * 255f), globalAlpha) << 24 | 0xFFFFFF;
|
int colour = Math.min((int)(fade * 255f), globalAlpha) << 24 | 0xFFFFFF;
|
||||||
@@ -86,7 +96,7 @@ public class RenderElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static RenderElement mojang(final int textureId, final int frameStart) {
|
public static RenderElement mojang(final int textureId, final int frameStart) {
|
||||||
return new RenderElement(()->(bb, ctx, frame) -> {
|
return new RenderElement((bb, ctx, frame) -> {
|
||||||
var size = 256 * ctx.scale();
|
var size = 256 * ctx.scale();
|
||||||
var x0 = (ctx.scaledWidth() - 2 * size) / 2;
|
var x0 = (ctx.scaledWidth() - 2 * size) / 2;
|
||||||
var y0 = 64 * ctx.scale() + 32;
|
var y0 = 64 * ctx.scale() + 32;
|
||||||
@@ -138,11 +148,11 @@ public class RenderElement {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
public static RenderElement progressBars(SimpleFont font) {
|
public static RenderElement progressBars(SimpleFont font) {
|
||||||
return new RenderElement(() -> (bb, ctx, frame) -> RenderElement.startupProgressBars(font, bb, ctx, frame));
|
return new RenderElement((bb, ctx, frame) -> RenderElement.startupProgressBars(font, bb, ctx, frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RenderElement performanceBar(SimpleFont font) {
|
public static RenderElement performanceBar(SimpleFont font) {
|
||||||
return new RenderElement(() -> (bb, ctx, frame) -> RenderElement.memoryInfo(font, bb, ctx, frame));
|
return new RenderElement((bb, ctx, frame) -> RenderElement.memoryInfo(font, bb, ctx, frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void startupProgressBars(SimpleFont font, final SimpleBufferBuilder buffer, final DisplayContext context, final int frameNumber) {
|
public static void startupProgressBars(SimpleFont font, final SimpleBufferBuilder buffer, final DisplayContext context, final int frameNumber) {
|
||||||
@@ -177,10 +187,10 @@ public class RenderElement {
|
|||||||
}
|
}
|
||||||
private static float[] indeterminateBar(int frame, boolean isActive) {
|
private static float[] indeterminateBar(int frame, boolean isActive) {
|
||||||
if (RenderElement.globalAlpha != 0xFF || !isActive) {
|
if (RenderElement.globalAlpha != 0xFF || !isActive) {
|
||||||
return new float[] {0f,1f};
|
return new float[] { 0f, 1f };
|
||||||
} else {
|
} else {
|
||||||
var progress = frame % 100;
|
int progress = frame % 100;
|
||||||
return new float[]{clamp((progress - 2) / 100f, 0f, 1f), clamp((progress + 2) / 100f, 0f, 1f)};
|
return new float[] { Math.clamp((progress - 2) / 100f, 0f, 1f), Math.clamp((progress + 2) / 100f, 0f, 1f) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,8 +249,8 @@ public class RenderElement {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Initializer initializeText(SimpleFont font, TextGenerator textGenerator) {
|
private static Renderer initializeText(SimpleFont font, TextGenerator textGenerator) {
|
||||||
return () -> (bb, context, frame) -> renderText(font, textGenerator, bb, context);
|
return (bb, context, frame) -> renderText(font, textGenerator, bb, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void renderText(final SimpleFont font, final TextGenerator textGenerator, final SimpleBufferBuilder bb, final DisplayContext context) {
|
private static void renderText(final SimpleFont font, final TextGenerator textGenerator, final SimpleBufferBuilder bb, final DisplayContext context) {
|
||||||
@@ -254,14 +264,13 @@ public class RenderElement {
|
|||||||
private static TextGenerator text(int x, int y, String text, int colour) {
|
private static TextGenerator text(int x, int y, String text, int colour) {
|
||||||
return (bb, font, context) -> font.generateVerticesForTexts(x, y, bb, new SimpleFont.DisplayText(text, colour));
|
return (bb, font, context) -> font.generateVerticesForTexts(x, y, bb, new SimpleFont.DisplayText(text, colour));
|
||||||
}
|
}
|
||||||
private static Initializer initializeTexture(final String textureFileName, int size, int textureNumber, TextureRenderer positionAndColour) {
|
|
||||||
return ()->{
|
private static Renderer initializeTexture(final String textureFileName, int size, int textureNumber, TextureRenderer positionAndColour) {
|
||||||
int[] imgSize = STBHelper.loadTextureFromClasspath(textureFileName, size, GL_TEXTURE0 + textureNumber + INDEX_TEXTURE_OFFSET);
|
int[] imgSize = STBHelper.loadTextureFromClasspath(textureFileName, size, GL_TEXTURE0 + textureNumber + INDEX_TEXTURE_OFFSET);
|
||||||
return (bb, ctx, frame) -> {
|
return (bb, ctx, frame) -> {
|
||||||
ctx.elementShader().updateTextureUniform(textureNumber + INDEX_TEXTURE_OFFSET);
|
ctx.elementShader().updateTextureUniform(textureNumber + INDEX_TEXTURE_OFFSET);
|
||||||
ctx.elementShader().updateRenderTypeUniform(ElementShader.RenderType.TEXTURE);
|
ctx.elementShader().updateRenderTypeUniform(ElementShader.RenderType.TEXTURE);
|
||||||
renderTexture(bb, ctx, frame, imgSize, positionAndColour);
|
renderTexture(bb, ctx, frame, imgSize, positionAndColour);
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,21 +280,13 @@ public class RenderElement {
|
|||||||
bb.draw();
|
bb.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated(since = "1.21.5", forRemoval = true)
|
||||||
public static float clamp(float num, float min, float max) {
|
public static float clamp(float num, float min, float max) {
|
||||||
if (num < min) {
|
return Math.clamp(num, min, max);
|
||||||
return min;
|
|
||||||
} else {
|
|
||||||
return Math.min(num, max);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int clamp(int num, int min, int max) {
|
public static int clamp(int num, int min, int max) {
|
||||||
if (num < min) {
|
return Math.min(max, Math.max(num, min));
|
||||||
return min;
|
|
||||||
} else {
|
|
||||||
return Math.min(num, max);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int hsvToRGB(float hue, float saturation, float value) {
|
public static int hsvToRGB(float hue, float saturation, float value) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class SimpleFont {
|
|||||||
private final int textureNumber;
|
private final int textureNumber;
|
||||||
private final int lineSpacing;
|
private final int lineSpacing;
|
||||||
private final int descent;
|
private final int descent;
|
||||||
private final int GLYPH_COUNT = 127-32;
|
private static final int GLYPH_COUNT = 127 - 32;
|
||||||
private final Glyph[] glyphs;
|
private final Glyph[] glyphs;
|
||||||
|
|
||||||
private record Glyph(char c, int charwidth, int[] pos, float[] uv) {
|
private record Glyph(char c, int charwidth, int[] pos, float[] uv) {
|
||||||
@@ -120,7 +120,7 @@ public class SimpleFont {
|
|||||||
case '\n', '\t' -> 0;
|
case '\n', '\t' -> 0;
|
||||||
case ' ' -> glyphs[0].charwidth();
|
case ' ' -> glyphs[0].charwidth();
|
||||||
default -> {
|
default -> {
|
||||||
if (c - 32 < this.GLYPH_COUNT && c > 32) {
|
if (c - 32 < GLYPH_COUNT && c > 32) {
|
||||||
yield this.glyphs[c - 32].charwidth();
|
yield this.glyphs[c - 32].charwidth();
|
||||||
} else {
|
} else {
|
||||||
yield 0;
|
yield 0;
|
||||||
@@ -151,7 +151,7 @@ public class SimpleFont {
|
|||||||
case '\t' -> new Pos(pos.x()+font.glyphs[0].charwidth() * 4, pos.y(), pos.minx());
|
case '\t' -> new Pos(pos.x()+font.glyphs[0].charwidth() * 4, pos.y(), pos.minx());
|
||||||
case ' ' -> new Pos(pos.x()+font.glyphs[0].charwidth(), pos.y(), pos.minx());
|
case ' ' -> new Pos(pos.x()+font.glyphs[0].charwidth(), pos.y(), pos.minx());
|
||||||
default -> {
|
default -> {
|
||||||
if (c-32 < font.GLYPH_COUNT && c > 32) {
|
if (c-32 < GLYPH_COUNT && c > 32) {
|
||||||
pos = font.glyphs[c - 32].loadQuad(pos, colour(), bb);
|
pos = font.glyphs[c - 32].loadQuad(pos, colour(), bb);
|
||||||
}
|
}
|
||||||
yield pos;
|
yield pos;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ apply from: rootProject.file('build_shared.gradle')
|
|||||||
configurations.forEach{ it.transitive = false }
|
configurations.forEach{ it.transitive = false }
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.nulls)
|
compileOnly(libs.jetbrains.annotations)
|
||||||
|
|
||||||
api(libs.bundles.asm) // Needed by all the black magic
|
api(libs.bundles.asm) // Needed by all the black magic
|
||||||
api(libs.forgespi)
|
api(libs.forgespi)
|
||||||
@@ -41,7 +41,7 @@ dependencies {
|
|||||||
implementation(libs.log4j.core)
|
implementation(libs.log4j.core)
|
||||||
annotationProcessor(libs.bundles.log4j)
|
annotationProcessor(libs.bundles.log4j)
|
||||||
|
|
||||||
testCompileOnly(libs.nulls)
|
testCompileOnly(libs.jetbrains.annotations)
|
||||||
testRuntimeOnly(libs.bootstrap)
|
testRuntimeOnly(libs.bootstrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public class FMLLoader {
|
|||||||
|
|
||||||
checkPackage(ITransformationService.class, "4.0", "ModLauncher");
|
checkPackage(ITransformationService.class, "4.0", "ModLauncher");
|
||||||
accessTransformer = getPlugin(env, "accesstransformer", "1.0", "AccessTransformer");
|
accessTransformer = getPlugin(env, "accesstransformer", "1.0", "AccessTransformer");
|
||||||
/*eventBus =*/ getPlugin(env, "eventbus", "1.0", "EventBus");
|
|
||||||
runtimeDistCleaner = getPlugin(env, "runtimedistcleaner", "1.0", "RuntimeDistCleaner");
|
runtimeDistCleaner = getPlugin(env, "runtimedistcleaner", "1.0", "RuntimeDistCleaner");
|
||||||
coreModProvider = getSingleService(ICoreModProvider.class, "CoreMod");
|
coreModProvider = getSingleService(ICoreModProvider.class, "CoreMod");
|
||||||
LOGGER.debug(CORE, "FML found CoreMod version : {}", JarVersionLookupHandler.getInfo(coreModProvider.getClass()).impl().version().orElse("MISSING"));
|
LOGGER.debug(CORE, "FML found CoreMod version : {}", JarVersionLookupHandler.getInfo(coreModProvider.getClass()).impl().version().orElse("MISSING"));
|
||||||
|
|||||||
+4
-4
@@ -43,10 +43,10 @@ public final class MinecraftLocator extends AbstractModProvider implements IModL
|
|||||||
mods.set("modId", "minecraft");
|
mods.set("modId", "minecraft");
|
||||||
mods.set("version", FMLLoader.versionInfo().mcVersion());
|
mods.set("version", FMLLoader.versionInfo().mcVersion());
|
||||||
mods.set("displayName", "Minecraft");
|
mods.set("displayName", "Minecraft");
|
||||||
mods.set("logoFile", "mcplogo.png");
|
//mods.set("logoFile", "mcplogo.png");
|
||||||
mods.set("credits", "Mojang, deobfuscated by MCP");
|
//mods.set("credits", "Mojang, deobfuscated by MCP");
|
||||||
mods.set("authors", "MCP: Searge,ProfMobius,IngisKahn,Fesh0r,ZeuX,R4wk,LexManos,Bspkrs");
|
//mods.set("authors", "MCP: Searge,ProfMobius,IngisKahn,Fesh0r,ZeuX,R4wk,LexManos,Bspkrs");
|
||||||
mods.set("description", "Minecraft, decompiled and deobfuscated with MCP technology");
|
mods.set("description", "The base Minecraft game, published by Mojang decompiled and deobfuscated by Forge");
|
||||||
conf.set("mods", List.of(mods));
|
conf.set("mods", List.of(mods));
|
||||||
|
|
||||||
var configWrapper = new NightConfigWrapper(conf);
|
var configWrapper = new NightConfigWrapper(conf);
|
||||||
|
|||||||
+3
-3
@@ -5,11 +5,11 @@ org.gradle.daemon=false
|
|||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
JAVA_VERSION=21
|
JAVA_VERSION=21
|
||||||
MC_VERSION=1.21.5
|
MC_VERSION=1.21.7
|
||||||
MC_NEXT_VERSION=1.22
|
MC_NEXT_VERSION=1.22
|
||||||
MCP_VERSION=20250325.155543
|
MCP_VERSION=20250630.104312
|
||||||
MAPPING_CHANNEL=official
|
MAPPING_CHANNEL=official
|
||||||
MAPPING_VERSION=1.21.5
|
MAPPING_VERSION=1.21.7
|
||||||
|
|
||||||
# Set to true before the first build of a new MC version, so we don't do compatibility checks
|
# Set to true before the first build of a new MC version, so we don't do compatibility checks
|
||||||
CHECK_COMPATIBILITY=false
|
CHECK_COMPATIBILITY=false
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ plugins {
|
|||||||
apply from: rootProject.file('build_shared.gradle')
|
apply from: rootProject.file('build_shared.gradle')
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.nulls)
|
compileOnly(libs.jetbrains.annotations)
|
||||||
implementation(project(':fmlloader'))
|
implementation(project(':fmlloader'))
|
||||||
implementation(project(':fmlcore'))
|
implementation(project(':fmlcore'))
|
||||||
implementation(libs.unsafe)
|
implementation(libs.unsafe)
|
||||||
|
|||||||
@@ -12,9 +12,10 @@ import java.lang.annotation.Target;
|
|||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||||
import net.minecraftforge.fml.Bindings;
|
import net.minecraftforge.fml.Bindings;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This defines a Mod to FML.
|
* This defines a Mod to FML.
|
||||||
@@ -24,12 +25,11 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
|||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
public @interface Mod
|
public @interface Mod {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* The unique mod identifier for this mod.
|
* The unique mod identifier for this mod.
|
||||||
* <b>Required to be lowercased in the english locale for compatibility. Will be truncated to 64 characters long.</b>
|
* <b>Required to be lowercased in the English locale for compatibility. Will be truncated to 64 characters long.</b>
|
||||||
*
|
* <br>
|
||||||
* This will be used to identify your mod for third parties (other mods), it will be used to identify your mod for registries such as block and item registries.
|
* This will be used to identify your mod for third parties (other mods), it will be used to identify your mod for registries such as block and item registries.
|
||||||
* By default, you will have a resource domain that matches the modid. All these uses require that constraints are imposed on the format of the modid.
|
* By default, you will have a resource domain that matches the modid. All these uses require that constraints are imposed on the format of the modid.
|
||||||
*/
|
*/
|
||||||
@@ -61,32 +61,40 @@ public @interface Mod
|
|||||||
String modid() default "";
|
String modid() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify an alternative bus to listen to
|
* Specify an alternative bus to listen to.
|
||||||
|
* <br>
|
||||||
|
* If you know all listeners in this class are for a specific bus, you can set it here to speed up registration.
|
||||||
*
|
*
|
||||||
* @return the bus you wish to listen to
|
* @return the bus you wish to listen to
|
||||||
*/
|
*/
|
||||||
Bus bus() default Bus.FORGE;
|
Bus bus() default Bus.BOTH;
|
||||||
|
|
||||||
enum Bus {
|
enum Bus {
|
||||||
/**
|
/**
|
||||||
* The main Forge Event Bus.
|
* The main BusGroup that most game events are fired on.
|
||||||
*
|
|
||||||
* <p>See {@code MinecraftForge#EVENT_BUS}</p>
|
|
||||||
*/
|
*/
|
||||||
FORGE(Bindings.getForgeBus()),
|
FORGE(Bindings.getForgeBus()),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mod specific Event bus.
|
* The mod-specific event BusGroup, usually for mod lifecycle events.
|
||||||
* @see FMLJavaModLoadingContext#getModEventBus()
|
* @see FMLJavaModLoadingContext#getModBusGroup()
|
||||||
*/
|
*/
|
||||||
MOD(()-> FMLJavaModLoadingContext.get().getModEventBus());
|
MOD(()-> FMLJavaModLoadingContext.get().getModBusGroup()),
|
||||||
|
|
||||||
private final Supplier<IEventBus> busSupplier;
|
/**
|
||||||
|
* Both the {@link #FORGE} and {@link #MOD} buses. This is slower to register events in your class but
|
||||||
|
* allows you to listen to events from different BusGroup types without needing separate classes annotated
|
||||||
|
* with {@link EventBusSubscriber}.
|
||||||
|
*/
|
||||||
|
BOTH(() -> null);
|
||||||
|
|
||||||
Bus(final Supplier<IEventBus> eventBusSupplier) {
|
private final Supplier<@Nullable BusGroup> busSupplier;
|
||||||
|
|
||||||
|
Bus(Supplier<@Nullable BusGroup> eventBusSupplier) {
|
||||||
this.busSupplier = eventBusSupplier;
|
this.busSupplier = eventBusSupplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Supplier<IEventBus> bus() {
|
public Supplier<@Nullable BusGroup> bus() {
|
||||||
return busSupplier;
|
return busSupplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+338
-4
@@ -7,22 +7,40 @@ package net.minecraftforge.fml.javafmlmod;
|
|||||||
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||||
|
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||||
|
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||||
|
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||||
|
import net.minecraftforge.eventbus.api.listener.EventListener;
|
||||||
|
import net.minecraftforge.eventbus.api.listener.ObjBooleanBiConsumer;
|
||||||
|
import net.minecraftforge.eventbus.api.listener.Priority;
|
||||||
|
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
||||||
|
import net.minecraftforge.eventbus.internal.Event;
|
||||||
import net.minecraftforge.fml.Logging;
|
import net.minecraftforge.fml.Logging;
|
||||||
import net.minecraftforge.fml.ModContainer;
|
import net.minecraftforge.fml.ModContainer;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||||
|
import net.minecraftforge.fml.event.IModBusEvent;
|
||||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||||
import net.minecraftforge.forgespi.language.ModFileScanData.AnnotationData;
|
import net.minecraftforge.forgespi.language.ModFileScanData.AnnotationData;
|
||||||
import net.minecraftforge.forgespi.language.ModFileScanData.EnumData;
|
import net.minecraftforge.forgespi.language.ModFileScanData.EnumData;
|
||||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||||
|
import net.minecraftforge.unsafe.UnsafeHacks;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
import org.objectweb.asm.Type;
|
import org.objectweb.asm.Type;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.lang.invoke.LambdaMetafactory;
|
||||||
import java.util.List;
|
import java.lang.invoke.MethodHandle;
|
||||||
import java.util.Objects;
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import java.lang.invoke.MethodType;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +93,7 @@ public class AutomaticEventSubscriber {
|
|||||||
if (Objects.equals(mod.getModId(), modId) && sides.contains(FMLEnvironment.dist)) {
|
if (Objects.equals(mod.getModId(), modId) && sides.contains(FMLEnvironment.dist)) {
|
||||||
try {
|
try {
|
||||||
LOGGER.debug(Logging.LOADING, "Auto-subscribing {} to {}", data.clazz().getClassName(), busTarget);
|
LOGGER.debug(Logging.LOADING, "Auto-subscribing {} to {}", data.clazz().getClassName(), busTarget);
|
||||||
busTarget.bus().get().register(Class.forName(data.clazz().getClassName(), true, loader));
|
EventBusSubscriberLogic.register(busTarget.bus().get(), Class.forName(data.clazz().getClassName(), true, loader));
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
LOGGER.fatal(Logging.LOADING, "Failed to load mod class {} for @EventBusSubscriber annotation", data.clazz(), e);
|
LOGGER.fatal(Logging.LOADING, "Failed to load mod class {} for @EventBusSubscriber annotation", data.clazz(), e);
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -88,4 +106,320 @@ public class AutomaticEventSubscriber {
|
|||||||
private static <R> R value(AnnotationData data, String key, R value) {
|
private static <R> R value(AnnotationData data, String key, R value) {
|
||||||
return (R)data.annotationData().getOrDefault(key, value);
|
return (R)data.annotationData().getOrDefault(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is mostly a carbon copy of EventBus 7's internal EventListenerFactory, with some changes to support adding
|
||||||
|
* to different BusGroups based on the event type, among other things.
|
||||||
|
*/
|
||||||
|
private static final class EventBusSubscriberLogic {
|
||||||
|
private EventBusSubscriberLogic() {}
|
||||||
|
|
||||||
|
private static final boolean STRICT_RUNTIME_CHECKS = Boolean.getBoolean("eventbus.api.strictRuntimeChecks");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, performs exhaustive validation on bulk registration to aid debugging.
|
||||||
|
*/
|
||||||
|
private static final boolean STRICT_REGISTRATION_CHECKS = STRICT_RUNTIME_CHECKS || Boolean.getBoolean("eventbus.api.strictRegistrationChecks");
|
||||||
|
|
||||||
|
private static final MethodType RETURNS_CONSUMER = MethodType.methodType(Consumer.class);
|
||||||
|
private static final MethodType RETURNS_PREDICATE = MethodType.methodType(Predicate.class);
|
||||||
|
private static final MethodType RETURNS_MONITOR = MethodType.methodType(ObjBooleanBiConsumer.class);
|
||||||
|
|
||||||
|
/** The method type of the {@link Consumer} functional interface ({@code void accept(Object)}) */
|
||||||
|
private static final MethodType CONSUMER_FI_TYPE = MethodType.methodType(void.class, Object.class);
|
||||||
|
|
||||||
|
/** The method type of the {@link Predicate} functional interface ({@code boolean test(Object)}) */
|
||||||
|
private static final MethodType PREDICATE_FI_TYPE = CONSUMER_FI_TYPE.changeReturnType(boolean.class);
|
||||||
|
|
||||||
|
/** The method type of the {@link ObjBooleanBiConsumer} functional interface ({@code void accept(Object, boolean)}) */
|
||||||
|
private static final MethodType MONITOR_FI_TYPE = MethodType.methodType(void.class, Object.class, boolean.class);
|
||||||
|
|
||||||
|
public static void register(@Nullable BusGroup busGroup, Class<?> listenerClass) {
|
||||||
|
if (STRICT_REGISTRATION_CHECKS) registerStrict(busGroup, listenerClass);
|
||||||
|
else registerLenient(busGroup, listenerClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
|
public static void registerLenient(@Nullable BusGroup busGroup, Class<?> listenerClass) {
|
||||||
|
Method[] declaredMethods = listenerClass.getDeclaredMethods();
|
||||||
|
if (declaredMethods.length == 0)
|
||||||
|
throw new IllegalArgumentException("No declared methods found in " + listenerClass);
|
||||||
|
|
||||||
|
Class<?> firstValidListenerEventType = null;
|
||||||
|
|
||||||
|
int listenersCount = 0;
|
||||||
|
for (var method : declaredMethods) {
|
||||||
|
if (!Modifier.isStatic(method.getModifiers()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (method.isSynthetic())
|
||||||
|
continue; // EventBus#89
|
||||||
|
|
||||||
|
int paramCount = method.getParameterCount();
|
||||||
|
if (paramCount == 0 || paramCount > 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Class<?> returnType = method.getReturnType();
|
||||||
|
if (returnType != void.class && returnType != boolean.class)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!method.isAnnotationPresent(SubscribeEvent.class))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Class<?>[] parameterTypes = method.getParameterTypes();
|
||||||
|
if (!Event.class.isAssignableFrom(parameterTypes[0]))
|
||||||
|
throw new IllegalArgumentException("First parameter of a @SubscribeEvent method must be an event");
|
||||||
|
|
||||||
|
Class<? extends Event> eventType = (Class<? extends Event>) parameterTypes[0];
|
||||||
|
var subscribeEventAnnotation = method.getAnnotation(SubscribeEvent.class);
|
||||||
|
|
||||||
|
registerListener(busGroup, paramCount, returnType, eventType, subscribeEventAnnotation, method);
|
||||||
|
listenersCount++;
|
||||||
|
|
||||||
|
if (firstValidListenerEventType == null)
|
||||||
|
firstValidListenerEventType = eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listenersCount == 0)
|
||||||
|
throw new IllegalArgumentException("No listeners found in " + listenerClass);
|
||||||
|
else if (firstValidListenerEventType == null)
|
||||||
|
throw new IllegalArgumentException("No valid listeners found in " + listenerClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
|
public static void registerStrict(BusGroup busGroup, Class<?> listenerClass) {
|
||||||
|
Class<? extends Event> firstValidListenerEventType = null;
|
||||||
|
|
||||||
|
List<Method> declaredMethods = Arrays.stream(listenerClass.getDeclaredMethods())
|
||||||
|
.filter(Predicate.not(Method::isSynthetic)) // EventBus#89
|
||||||
|
.toList();
|
||||||
|
if (declaredMethods.isEmpty()) {
|
||||||
|
var errMsg = "No declared methods found in " + listenerClass.getName();
|
||||||
|
var superClass = listenerClass.getSuperclass();
|
||||||
|
if (superClass != null && superClass != Record.class && superClass != Enum.class) {
|
||||||
|
errMsg += ". Note that listener inheritance is not supported. " +
|
||||||
|
"If you are trying to inherit listeners, please use @Override and @SubscribeEvent on the method in the subclass.";
|
||||||
|
}
|
||||||
|
throw fail(listenerClass, errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
int listenersCount = 0;
|
||||||
|
for (var method : declaredMethods) {
|
||||||
|
var hasSubscribeEvent = method.isAnnotationPresent(SubscribeEvent.class);
|
||||||
|
int paramCount = method.getParameterCount();
|
||||||
|
|
||||||
|
if (hasSubscribeEvent && (paramCount == 0 || paramCount > 2))
|
||||||
|
throw fail(method, "Invalid number of parameters: " + paramCount + " (expected 1 or 2)");
|
||||||
|
|
||||||
|
if (paramCount == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Class<?> returnType = method.getReturnType();
|
||||||
|
Class<?>[] parameterTypes = method.getParameterTypes();
|
||||||
|
var firstParamExtendsEvent = Event.class.isAssignableFrom(parameterTypes[0]);
|
||||||
|
|
||||||
|
if (!hasSubscribeEvent && firstParamExtendsEvent)
|
||||||
|
throw fail(method, "Missing @SubscribeEvent annotation");
|
||||||
|
|
||||||
|
if (hasSubscribeEvent) {
|
||||||
|
var firstParamExtendsCancellable = Cancellable.class.isAssignableFrom(parameterTypes[0]);
|
||||||
|
var subscribeEventAnnotation = method.getAnnotation(SubscribeEvent.class);
|
||||||
|
var isMonitoringPriority = subscribeEventAnnotation.priority() == Priority.MONITOR;
|
||||||
|
|
||||||
|
if (!firstParamExtendsEvent)
|
||||||
|
throw fail(method, "First parameter of a @SubscribeEvent method must be an event");
|
||||||
|
|
||||||
|
var eventType = (Class<? extends Event>) parameterTypes[0];
|
||||||
|
|
||||||
|
if (returnType != void.class && returnType != boolean.class)
|
||||||
|
throw fail(method, "Invalid return type: " + returnType.getName() + " (expected void or boolean)");
|
||||||
|
|
||||||
|
if (!Modifier.isStatic(method.getModifiers()))
|
||||||
|
throw fail(method, "Listener method needs to be static");
|
||||||
|
|
||||||
|
if (isMonitoringPriority && (returnType == boolean.class || subscribeEventAnnotation.alwaysCancelling()))
|
||||||
|
throw fail(method, "Monitoring listeners cannot cancel events");
|
||||||
|
|
||||||
|
if (paramCount == 2) {
|
||||||
|
if (!firstParamExtendsCancellable)
|
||||||
|
throw fail(method, "Cancellation-aware monitoring listeners are only valid for cancellable events");
|
||||||
|
|
||||||
|
if (!boolean.class.isAssignableFrom(parameterTypes[1]))
|
||||||
|
throw fail(method, "Second parameter of a cancellation-aware monitoring listener must be a boolean");
|
||||||
|
|
||||||
|
if (!isMonitoringPriority)
|
||||||
|
throw fail(method, "Cancellation-aware monitoring listeners must have a priority of MONITOR");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!firstParamExtendsCancellable) {
|
||||||
|
if (subscribeEventAnnotation.alwaysCancelling())
|
||||||
|
throw fail(method, "Always cancelling listeners are only valid for cancellable events");
|
||||||
|
|
||||||
|
if (returnType == boolean.class)
|
||||||
|
throw fail(method, "Return type boolean is only valid for cancellable events");
|
||||||
|
}
|
||||||
|
|
||||||
|
registerListener(busGroup, paramCount, returnType, eventType, subscribeEventAnnotation, method);
|
||||||
|
listenersCount++;
|
||||||
|
|
||||||
|
if (firstValidListenerEventType == null)
|
||||||
|
firstValidListenerEventType = eventType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listenersCount == 0)
|
||||||
|
throw fail(listenerClass, "No listeners found");
|
||||||
|
else if (firstValidListenerEventType == null)
|
||||||
|
throw fail(listenerClass, "No valid listeners found");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
|
private static EventListener registerListener(@Nullable BusGroup busGroup,
|
||||||
|
int paramCount, Class<?> returnType, Class<? extends Event> eventType,
|
||||||
|
SubscribeEvent subscribeEventAnnotation, Method method) {
|
||||||
|
if (busGroup == null) {
|
||||||
|
busGroup = IModBusEvent.class.isAssignableFrom(eventType)
|
||||||
|
? FMLJavaModLoadingContext.get().getModBusGroup()
|
||||||
|
: BusGroup.DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine the listener type from its parameters and return type
|
||||||
|
if (paramCount == 1) {
|
||||||
|
var priority = subscribeEventAnnotation.priority();
|
||||||
|
if (returnType == void.class) {
|
||||||
|
if (Cancellable.class.isAssignableFrom(eventType)) {
|
||||||
|
// Consumer<Event & Cancellable>
|
||||||
|
var eventBus = CancellableEventBus.create(busGroup, (Class) eventType);
|
||||||
|
if (subscribeEventAnnotation.alwaysCancelling()) {
|
||||||
|
return eventBus.addListener(priority, true, createConsumer(method));
|
||||||
|
} else {
|
||||||
|
return eventBus.addListener(priority, createConsumer(method));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Consumer<Event>
|
||||||
|
return EventBus.create(busGroup, eventType)
|
||||||
|
.addListener(priority, createConsumer(method));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Predicate<Event & EventCharacteristic.Cancellable>
|
||||||
|
if (!Cancellable.class.isAssignableFrom(eventType))
|
||||||
|
throw fail(method, "Return type boolean is only valid for cancellable events");
|
||||||
|
|
||||||
|
if (subscribeEventAnnotation.alwaysCancelling())
|
||||||
|
throw new IllegalArgumentException("Always cancelling listeners must have a void return type");
|
||||||
|
|
||||||
|
return CancellableEventBus.create(busGroup, (Class) eventType)
|
||||||
|
.addListener(priority, createPredicate(method));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// ObjBooleanBiConsumer<Event & Cancellable>
|
||||||
|
if (returnType != void.class)
|
||||||
|
throw new IllegalArgumentException("Cancellation-aware monitoring listeners must have a void return type");
|
||||||
|
|
||||||
|
if (subscribeEventAnnotation.alwaysCancelling())
|
||||||
|
throw new IllegalArgumentException("Monitoring listeners cannot cancel events");
|
||||||
|
|
||||||
|
return CancellableEventBus.create(busGroup, (Class) eventType).addListener(createMonitor(method));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IllegalArgumentException fail(Class<?> listenerClass, String reason) {
|
||||||
|
return new IllegalArgumentException("Failed to register " + listenerClass.getName() + ": " + reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IllegalArgumentException fail(Method mtd, String reason) {
|
||||||
|
return new IllegalArgumentException("Failed to register " + mtd.getDeclaringClass().getName() + "." + mtd.getName() + ": " + reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private static <T extends Event> Consumer<T> createConsumer(Method callback) {
|
||||||
|
var factoryMH = getOrMakeFactory(callback, RETURNS_CONSUMER, CONSUMER_FI_TYPE, "accept");
|
||||||
|
|
||||||
|
try {
|
||||||
|
return (Consumer<T>) factoryMH.invokeExact();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw makeRuntimeException(callback, e);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new RuntimeException(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private static <T extends Event> Predicate<T> createPredicate(Method callback) {
|
||||||
|
var factoryMH = getOrMakeFactory(callback, RETURNS_PREDICATE, PREDICATE_FI_TYPE, "test");
|
||||||
|
|
||||||
|
try {
|
||||||
|
return (Predicate<T>) factoryMH.invokeExact();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw makeRuntimeException(callback, e);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new RuntimeException(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private static <T extends Event> ObjBooleanBiConsumer<T> createMonitor(Method callback) {
|
||||||
|
var factoryMH = getOrMakeFactory(callback, RETURNS_MONITOR, MONITOR_FI_TYPE, "accept");
|
||||||
|
|
||||||
|
try {
|
||||||
|
return (ObjBooleanBiConsumer<T>) factoryMH.invokeExact();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw makeRuntimeException(callback, e);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new RuntimeException(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MethodHandle getOrMakeFactory(Method callback, MethodType factoryReturnType,
|
||||||
|
MethodType fiMethodType, String fiMethodName) {
|
||||||
|
return makeFactory(callback, factoryReturnType, fiMethodType, fiMethodName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MethodHandle makeFactory(Method callback,
|
||||||
|
MethodType factoryReturnType,
|
||||||
|
MethodType fiMethodType, String fiMethodName) {
|
||||||
|
final class DodgyLookup {
|
||||||
|
private DodgyLookup() {}
|
||||||
|
private static final MethodHandles.Lookup INSTANCE;
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
var lookupField = MethodHandles.Lookup.class.getDeclaredField("IMPL_LOOKUP");
|
||||||
|
UnsafeHacks.setAccessible(lookupField);
|
||||||
|
INSTANCE = (MethodHandles.Lookup) lookupField.get(null);
|
||||||
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var callbackDeclaredClass = callback.getDeclaringClass();
|
||||||
|
var lookup = DodgyLookup.INSTANCE.in(callbackDeclaredClass);
|
||||||
|
var mh = lookup.unreflect(callback);
|
||||||
|
|
||||||
|
return LambdaMetafactory.metafactory(
|
||||||
|
lookup, fiMethodName, factoryReturnType, fiMethodType, mh, mh.type()
|
||||||
|
).getTarget();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw makeRuntimeException(callback, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RuntimeException makeRuntimeException(Method callback, Exception e) {
|
||||||
|
return switch (e) {
|
||||||
|
case IllegalAccessException iae -> {
|
||||||
|
var errMsg = "Failed to create listener";
|
||||||
|
if (!Modifier.isPublic(callback.getModifiers()))
|
||||||
|
errMsg += " - is it public?";
|
||||||
|
|
||||||
|
yield new RuntimeException(errMsg, iae);
|
||||||
|
}
|
||||||
|
case NullPointerException npe -> new RuntimeException(
|
||||||
|
"Failed to create listener - was given a non-static method without an instance to invoke it with",
|
||||||
|
npe
|
||||||
|
);
|
||||||
|
default -> new RuntimeException("Failed to create listener", e);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+13
-9
@@ -5,14 +5,13 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.javafmlmod;
|
package net.minecraftforge.fml.javafmlmod;
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||||
import net.minecraftforge.fml.ModLoadingContext;
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the context provided by your language loader in your mod's constructor
|
* Use the context provided by your language loader in your mod's constructor
|
||||||
*/
|
*/
|
||||||
public class FMLJavaModLoadingContext extends ModLoadingContext
|
public class FMLJavaModLoadingContext extends ModLoadingContext {
|
||||||
{
|
|
||||||
private final FMLModContainer container;
|
private final FMLModContainer container;
|
||||||
|
|
||||||
FMLJavaModLoadingContext(FMLModContainer container) {
|
FMLJavaModLoadingContext(FMLModContainer container) {
|
||||||
@@ -20,11 +19,10 @@ public class FMLJavaModLoadingContext extends ModLoadingContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The mod's event bus, to allow subscription to Mod specific events
|
* @return The mod's event bus group, to allow subscription to Mod specific events
|
||||||
*/
|
*/
|
||||||
public IEventBus getModEventBus()
|
public BusGroup getModBusGroup() {
|
||||||
{
|
return container.getModBusGroup();
|
||||||
return container.getEventBus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,9 +37,15 @@ public class FMLJavaModLoadingContext extends ModLoadingContext
|
|||||||
* Helper to get the right instance from the {@link ModLoadingContext} correctly.
|
* Helper to get the right instance from the {@link ModLoadingContext} correctly.
|
||||||
* @return The FMLJavaMod language specific extension from the ModLoadingContext
|
* @return The FMLJavaMod language specific extension from the ModLoadingContext
|
||||||
*
|
*
|
||||||
* @deprecated use {@link FMLJavaModLoadingContext} in your mod constructor
|
* @deprecated use {@link FMLJavaModLoadingContext} in your mod constructor. For example: {@snippet :
|
||||||
|
* @Mod("examplemod")
|
||||||
|
* public final class ExampleMod {
|
||||||
|
* public ExampleMod(FMLJavaModLoadingContext context) {
|
||||||
|
* // Use context from the param instead of FMLJavaModLoadingContext.get() or ModLoadingContext.get()
|
||||||
|
* }
|
||||||
|
* }}
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since="1.21.1")
|
@Deprecated(forRemoval = true, since = "1.21.1")
|
||||||
public static FMLJavaModLoadingContext get() {
|
public static FMLJavaModLoadingContext get() {
|
||||||
return ModLoadingContext.get().extension();
|
return ModLoadingContext.get().extension();
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-16
@@ -5,11 +5,8 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.javafmlmod;
|
package net.minecraftforge.fml.javafmlmod;
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.EventBusErrorMessage;
|
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||||
import net.minecraftforge.eventbus.api.BusBuilder;
|
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
|
||||||
import net.minecraftforge.eventbus.api.IEventListener;
|
|
||||||
import net.minecraftforge.fml.ModContainer;
|
import net.minecraftforge.fml.ModContainer;
|
||||||
import net.minecraftforge.fml.ModLoadingException;
|
import net.minecraftforge.fml.ModLoadingException;
|
||||||
import net.minecraftforge.fml.ModLoadingStage;
|
import net.minecraftforge.fml.ModLoadingStage;
|
||||||
@@ -36,7 +33,7 @@ public class FMLModContainer extends ModContainer {
|
|||||||
private static final Logger LOGGER = LogManager.getLogger();
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
private static final Marker LOADING = MarkerManager.getMarker("LOADING");
|
private static final Marker LOADING = MarkerManager.getMarker("LOADING");
|
||||||
private final ModFileScanData scanResults;
|
private final ModFileScanData scanResults;
|
||||||
private final IEventBus eventBus;
|
private final BusGroup eventBusGroup;
|
||||||
private Object modInstance;
|
private Object modInstance;
|
||||||
private final Class<?> modClass;
|
private final Class<?> modClass;
|
||||||
private final FMLJavaModLoadingContext context = new FMLJavaModLoadingContext(this);
|
private final FMLJavaModLoadingContext context = new FMLJavaModLoadingContext(this);
|
||||||
@@ -46,7 +43,7 @@ public class FMLModContainer extends ModContainer {
|
|||||||
LOGGER.debug(LOADING,"Creating FMLModContainer instance for {}", className);
|
LOGGER.debug(LOADING,"Creating FMLModContainer instance for {}", className);
|
||||||
this.scanResults = modFileScanResults;
|
this.scanResults = modFileScanResults;
|
||||||
activityMap.put(ModLoadingStage.CONSTRUCT, this::constructMod);
|
activityMap.put(ModLoadingStage.CONSTRUCT, this::constructMod);
|
||||||
this.eventBus = BusBuilder.builder().setExceptionHandler(FMLModContainer::onEventFailed).setTrackPhases(false).markerType(IModBusEvent.class).useModLauncher().build();
|
this.eventBusGroup = BusGroup.create("modBusFor" + info.getModId());
|
||||||
this.contextExtension = () -> context;
|
this.contextExtension = () -> context;
|
||||||
try {
|
try {
|
||||||
var moduleName = info.getOwningFile().moduleName();
|
var moduleName = info.getOwningFile().moduleName();
|
||||||
@@ -128,10 +125,6 @@ public class FMLModContainer extends ModContainer {
|
|||||||
implAddExportsOrOpens.invoke(target, pkg, reader, open, /*syncVM*/true);
|
implAddExportsOrOpens.invoke(target, pkg, reader, open, /*syncVM*/true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void onEventFailed(IEventBus iEventBus, Event event, IEventListener[] iEventListeners, int i, Throwable throwable) {
|
|
||||||
LOGGER.error(new EventBusErrorMessage(event, i, iEventListeners, throwable));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void constructMod() {
|
private void constructMod() {
|
||||||
try {
|
try {
|
||||||
LOGGER.trace(LOADING, "Loading mod instance {} of type {}", getModId(), modClass.getName());
|
LOGGER.trace(LOADING, "Loading mod instance {} of type {}", getModId(), modClass.getName());
|
||||||
@@ -173,15 +166,17 @@ public class FMLModContainer extends ModContainer {
|
|||||||
return modInstance;
|
return modInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEventBus getEventBus() {
|
public BusGroup getModBusGroup() {
|
||||||
return this.eventBus;
|
return this.eventBusGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T extends Event & IModBusEvent> void acceptEvent(final T e) {
|
protected <T extends IModBusEvent> void acceptEvent(final T e) {
|
||||||
try {
|
try {
|
||||||
LOGGER.trace(LOADING, "Firing event for modid {} : {}", this.getModId(), e);
|
LOGGER.trace(LOADING, "Firing event for modid {} : {}", this.getModId(), e);
|
||||||
this.eventBus.post(e);
|
@SuppressWarnings("unchecked")
|
||||||
|
var eventBus = (EventBus<T>) IModBusEvent.getBus(eventBusGroup, e.getClass());
|
||||||
|
eventBus.post(e);
|
||||||
LOGGER.trace(LOADING, "Fired event for modid {} : {}", this.getModId(), e);
|
LOGGER.trace(LOADING, "Fired event for modid {} : {}", this.getModId(), e);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
LOGGER.error(LOADING,"Caught exception during event {} dispatch for modid {}", e, this.getModId(), t);
|
LOGGER.error(LOADING,"Caught exception during event {} dispatch for modid {}", e, this.getModId(), t);
|
||||||
@@ -190,8 +185,10 @@ public class FMLModContainer extends ModContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public void dispatchConfigEvent(IConfigEvent event) {
|
public void dispatchConfigEvent(IConfigEvent event) {
|
||||||
this.eventBus.post(event.self());
|
var eventBus = (EventBus) EventBus.create(eventBusGroup, event.self().getClass());
|
||||||
|
eventBus.post(event.self());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ java {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.nulls)
|
compileOnly(libs.jetbrains.annotations)
|
||||||
|
|
||||||
implementation(project(':fmlloader'))
|
implementation(project(':fmlloader'))
|
||||||
implementation(project(':fmlcore'))
|
implementation(project(':fmlcore'))
|
||||||
|
|||||||
+6
-15
@@ -6,41 +6,32 @@
|
|||||||
package net.minecraftforge.fml.lowcodemod;
|
package net.minecraftforge.fml.lowcodemod;
|
||||||
|
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
|
||||||
import net.minecraftforge.fml.IExtensionPoint;
|
import net.minecraftforge.fml.IExtensionPoint;
|
||||||
import net.minecraftforge.fml.ModContainer;
|
import net.minecraftforge.fml.ModContainer;
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
import net.minecraftforge.fml.loading.LogMarkers;
|
||||||
import net.minecraftforge.forgespi.language.IModInfo;
|
import net.minecraftforge.forgespi.language.IModInfo;
|
||||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.util.Objects;
|
public class LowCodeModContainer extends ModContainer {
|
||||||
|
|
||||||
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
|
|
||||||
|
|
||||||
public class LowCodeModContainer extends ModContainer
|
|
||||||
{
|
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
private final Object modInstance;
|
private final Object modInstance;
|
||||||
|
|
||||||
public LowCodeModContainer(IModInfo info, ModFileScanData modFileScanResults, ModuleLayer gameLayer)
|
public LowCodeModContainer(IModInfo info, ModFileScanData modFileScanResults, ModuleLayer gameLayer) {
|
||||||
{
|
|
||||||
super(info);
|
super(info);
|
||||||
LOGGER.debug(LOADING, "Creating LowCodeModContainer for {}", info.getModId());
|
LOGGER.debug(LogMarkers.LOADING, "Creating LowCodeModContainer for {}", info.getModId());
|
||||||
this.modInstance = new Object();
|
this.modInstance = new Object();
|
||||||
this.contextExtension = () -> null;
|
this.contextExtension = () -> null;
|
||||||
this.extensionPoints.remove(IExtensionPoint.DisplayTest.class);
|
this.extensionPoints.remove(IExtensionPoint.DisplayTest.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(Object mod)
|
public boolean matches(Object mod) {
|
||||||
{
|
|
||||||
return mod == modInstance;
|
return mod == modInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getMod()
|
public Object getMod() {
|
||||||
{
|
|
||||||
return modInstance;
|
return modInstance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ plugins {
|
|||||||
apply from: rootProject.file('build_shared.gradle')
|
apply from: rootProject.file('build_shared.gradle')
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.nulls)
|
compileOnly(libs.jetbrains.annotations)
|
||||||
implementation(project(':fmlloader'))
|
implementation(project(':fmlloader'))
|
||||||
implementation(project(':fmlcore'))
|
implementation(project(':fmlcore'))
|
||||||
}
|
}
|
||||||
|
|||||||
+41
-22
@@ -2,7 +2,7 @@ plugins {
|
|||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
id 'idea'
|
id 'idea'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'net.minecraftforge.gradle' version '[6.0.24,6.2)'
|
id 'net.minecraftforge.gradle' version '[6.0.36,6.2)'
|
||||||
}
|
}
|
||||||
|
|
||||||
version = mod_version
|
version = mod_version
|
||||||
@@ -22,17 +22,13 @@ minecraft {
|
|||||||
// official MCVersion Official field/method names from Mojang mapping files
|
// official MCVersion Official field/method names from Mojang mapping files
|
||||||
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
|
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
|
||||||
//
|
//
|
||||||
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
|
||||||
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
|
||||||
//
|
|
||||||
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
|
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
|
||||||
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
|
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
|
||||||
//
|
//
|
||||||
// Use non-default mappings at your own risk. They may not always work.
|
|
||||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||||
mappings channel: mapping_channel, version: mapping_version
|
mappings channel: mapping_channel, version: mapping_version
|
||||||
|
|
||||||
// Tell FG to not automtically create the reobf tasks, as we now use Official mappings at runtime, If you don't use them at dev time then you'll have to fix your reobf yourself.
|
// Forge 1.20.6 and newer use official mappings at runtime, so we shouldn't reobf from official to SRG
|
||||||
reobf = false
|
reobf = false
|
||||||
|
|
||||||
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
|
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
|
||||||
@@ -50,8 +46,7 @@ minecraft {
|
|||||||
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
|
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
|
||||||
// generateRunFolders = true
|
// generateRunFolders = true
|
||||||
|
|
||||||
// This property enables access transformers for use in development.
|
// This property enables access transformers for use in development, applied to the Minecraft artifact.
|
||||||
// They will be applied to the Minecraft artifact.
|
|
||||||
// The access transformer file can be anywhere in the project.
|
// The access transformer file can be anywhere in the project.
|
||||||
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
|
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
|
||||||
// This default location is a best practice to automatically put the file in the right place in the final jar.
|
// This default location is a best practice to automatically put the file in the right place in the final jar.
|
||||||
@@ -65,17 +60,18 @@ minecraft {
|
|||||||
configureEach {
|
configureEach {
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
|
|
||||||
// Recommended logging data for a userdev environment
|
// Optional additional logging. The markers can be added/remove as needed, separated by commas.
|
||||||
// The markers can be added/remove as needed separated by commas.
|
|
||||||
// "SCAN": For mods scan.
|
// "SCAN": For mods scan.
|
||||||
// "REGISTRIES": For firing of registry events.
|
// "REGISTRIES": For firing of registry events.
|
||||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||||
property 'forge.logging.markers', 'REGISTRIES'
|
// property 'forge.logging.markers', 'REGISTRIES'
|
||||||
|
|
||||||
// Recommended logging level for the console
|
|
||||||
// You can set various levels here.
|
|
||||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
|
||||||
property 'forge.logging.console.level', 'debug'
|
property 'forge.logging.console.level', 'debug'
|
||||||
|
|
||||||
|
// Recommended for development - enables more descriptive errors at the cost of slower startup and registration.
|
||||||
|
property 'eventbus.api.strictRuntimeChecks', 'true'
|
||||||
|
|
||||||
|
// arg "-mixin.config=${mod_id}.mixins.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
client {
|
client {
|
||||||
@@ -110,7 +106,26 @@ sourceSets.main.resources { srcDir 'src/generated/resources' }
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Put repositories for dependencies here
|
// Put repositories for dependencies here
|
||||||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
name = 'Forge'
|
||||||
|
url = 'https://maven.minecraftforge.net'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = 'Minecraft libraries'
|
||||||
|
url = 'https://libraries.minecraft.net'
|
||||||
|
}
|
||||||
|
exclusiveContent {
|
||||||
|
forRepository {
|
||||||
|
maven {
|
||||||
|
name = 'Sponge'
|
||||||
|
url = 'https://repo.spongepowered.org/repository/maven-public'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter {
|
||||||
|
includeGroupAndSubgroups('org.spongepowered')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
|
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
|
||||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
|
||||||
@@ -127,6 +142,11 @@ dependencies {
|
|||||||
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
|
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
|
||||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||||
|
|
||||||
|
// Forge 1.21.6+ uses EventBus 7, which shifts most of its runtime validation to compile-time via an annotation processor
|
||||||
|
// to improve performance in production environments. This line is required to enable said compile-time validation
|
||||||
|
// in your development environment, helping you catch issues early.
|
||||||
|
annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.10'
|
||||||
|
|
||||||
// Example mod dependency with JEI
|
// Example mod dependency with JEI
|
||||||
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
||||||
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
|
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
|
||||||
@@ -147,7 +167,7 @@ dependencies {
|
|||||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||||
tasks.named('processResources', ProcessResources).configure {
|
tasks.named('processResources', ProcessResources) {
|
||||||
var replaceProperties = [
|
var replaceProperties = [
|
||||||
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||||
forge_version: forge_version, forge_version_range: forge_version_range,
|
forge_version: forge_version, forge_version_range: forge_version_range,
|
||||||
@@ -163,7 +183,7 @@ tasks.named('processResources', ProcessResources).configure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Example for how to get properties into the manifest for reading at runtime.
|
// Example for how to get properties into the manifest for reading at runtime.
|
||||||
tasks.named('jar', Jar).configure {
|
tasks.named('jar', Jar) {
|
||||||
manifest {
|
manifest {
|
||||||
attributes([
|
attributes([
|
||||||
'Specification-Title' : mod_id,
|
'Specification-Title' : mod_id,
|
||||||
@@ -173,6 +193,7 @@ tasks.named('jar', Jar).configure {
|
|||||||
'Implementation-Version' : project.jar.archiveVersion,
|
'Implementation-Version' : project.jar.archiveVersion,
|
||||||
'Implementation-Vendor' : mod_authors
|
'Implementation-Vendor' : mod_authors
|
||||||
])
|
])
|
||||||
|
// attributes['MixinConfigs'] = "${mod_id}.mixins.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,8 +215,7 @@ tasks.withType(JavaCompile).configureEach {
|
|||||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||||
}
|
}
|
||||||
|
|
||||||
// IntelliJ no longer downloads javadocs and sources by default.
|
// IntelliJ no longer downloads javadocs and sources by default, this tells Gradle to force IntelliJ to do it.
|
||||||
// This tells Gradle to force IDEA to do it.
|
|
||||||
idea.module { downloadJavadoc = downloadSources = true }
|
idea.module { downloadJavadoc = downloadSources = true }
|
||||||
|
|
||||||
eclipse {
|
eclipse {
|
||||||
@@ -205,8 +225,7 @@ eclipse {
|
|||||||
synchronizationTasks 'genEclipseRuns'
|
synchronizationTasks 'genEclipseRuns'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge the resources and classes into the same directory.
|
// Merge the resources and classes into the same directory, because Java expects modules to be in a single directory.
|
||||||
// This is done because java expects modules to be in a single directory.
|
|
||||||
// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem
|
// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem
|
||||||
// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later.
|
// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later.
|
||||||
sourceSets.each {
|
sourceSets.each {
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
# Sets default memory used for Gradle commands. Can be overridden by user or command line properties.
|
||||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||||
org.gradle.jvmargs=-Xmx3G
|
org.gradle.jvmargs=-Xmx5G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
|
|
||||||
|
# In the case that Gradle needs to fork to recompile, this will set the memory for that process.
|
||||||
|
systemProp.net.minecraftforge.gradle.repo.recompile.fork=true
|
||||||
|
systemProp.net.minecraftforge.gradle.repo.recompile.fork.args=-Xmx5G
|
||||||
|
|
||||||
|
# Opts-out of ForgeGradle automatically adding mavenCentral(), Forge's maven and MC libs maven to the repositories block
|
||||||
|
systemProp.net.minecraftforge.gradle.repo.attach=false
|
||||||
|
|
||||||
|
|
||||||
## Environment Properties
|
## Environment Properties
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -9,5 +9,5 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.10.0'
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/com/mojang/blaze3d/opengl/GlCommandEncoder.java
|
--- a/com/mojang/blaze3d/opengl/GlCommandEncoder.java
|
||||||
+++ b/com/mojang/blaze3d/opengl/GlCommandEncoder.java
|
+++ b/com/mojang/blaze3d/opengl/GlCommandEncoder.java
|
||||||
@@ -109,6 +_,9 @@
|
@@ -132,6 +_,9 @@
|
||||||
GlStateManager._colorMask(true, true, true, true);
|
GlStateManager._colorMask(true, true, true, true);
|
||||||
GlStateManager._clear(16384);
|
GlStateManager._clear(16384);
|
||||||
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, 0, 0);
|
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, 0, 0);
|
||||||
|
|||||||
@@ -1,53 +1,74 @@
|
|||||||
--- a/com/mojang/blaze3d/opengl/GlDevice.java
|
--- a/com/mojang/blaze3d/opengl/GlDevice.java
|
||||||
+++ b/com/mojang/blaze3d/opengl/GlDevice.java
|
+++ b/com/mojang/blaze3d/opengl/GlDevice.java
|
||||||
@@ -80,11 +_,25 @@
|
@@ -89,8 +_,15 @@
|
||||||
|
public GpuTexture createTexture(
|
||||||
@Override
|
@Nullable Supplier<String> p_397830_, int p_394481_, TextureFormat p_394839_, int p_391831_, int p_395609_, int p_407582_, int p_408928_
|
||||||
public GpuTexture createTexture(@Nullable Supplier<String> p_397830_, TextureFormat p_394839_, int p_394481_, int p_391831_, int p_395609_) {
|
) {
|
||||||
- return this.createTexture(this.debugLabels.exists() && p_397830_ != null ? p_397830_.get() : null, p_394839_, p_394481_, p_391831_, p_395609_);
|
+ return createTexture(p_397830_, p_394481_, p_394839_, p_391831_, p_395609_, p_407582_, p_408928_, false);
|
||||||
+ return this.createTexture(p_397830_, p_394839_, p_394481_, p_391831_, p_395609_, false);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /** @see GpuDevice#createTexture(Supplier, TextureFormat, int, int, int, boolean) */
|
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public GpuTexture createTexture(@Nullable Supplier<String> p_397830_, TextureFormat p_394839_, int p_394481_, int p_391831_, int p_395609_, boolean stencil) {
|
+ public GpuTexture createTexture(
|
||||||
+ return this.createTexture(this.debugLabels.exists() && p_397830_ != null ? p_397830_.get() : null, p_394839_, p_394481_, p_391831_, p_395609_, stencil);
|
+ @Nullable Supplier<String> p_397830_, int p_394481_, TextureFormat p_394839_, int p_391831_, int p_395609_, int p_407582_, int p_408928_, boolean stencil
|
||||||
|
+ ) {
|
||||||
|
return this.createTexture(
|
||||||
|
- this.debugLabels.exists() && p_397830_ != null ? p_397830_.get() : null, p_394481_, p_394839_, p_391831_, p_395609_, p_407582_, p_408928_
|
||||||
|
+ this.debugLabels.exists() && p_397830_ != null ? p_397830_.get() : null, p_394481_, p_394839_, p_391831_, p_395609_, p_407582_, p_408928_, stencil
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@@ -98,6 +_,15 @@
|
||||||
public GpuTexture createTexture(@Nullable String p_394142_, TextureFormat p_394951_, int p_395535_, int p_393944_, int p_392329_) {
|
public GpuTexture createTexture(
|
||||||
+ return this.createTexture(p_394142_, p_394951_, p_395535_, p_393944_, p_392329_, false);
|
@Nullable String p_394142_, int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_
|
||||||
|
) {
|
||||||
|
+ return createTexture(p_394142_, p_395535_, p_394951_, p_393944_, p_392329_, p_408015_, p_406483_, false);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /** @see GpuDevice#createTexture(String, TextureFormat, int, int, int, boolean) */
|
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public GpuTexture createTexture(@Nullable String p_394142_, TextureFormat p_394951_, int p_395535_, int p_393944_, int p_392329_, boolean stencil) {
|
+ public GpuTexture createTexture(
|
||||||
|
+ @Nullable String p_394142_, int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_, boolean stencil
|
||||||
|
+ ) {
|
||||||
+ // Forge: stencil rendering is only for depth
|
+ // Forge: stencil rendering is only for depth
|
||||||
+ stencil &= p_394951_.hasDepthAspect();
|
+ stencil &= p_394951_.hasDepthAspect();
|
||||||
if (p_392329_ < 1) {
|
if (p_406483_ < 1) {
|
||||||
throw new IllegalArgumentException("mipLevels must be at least 1");
|
throw new IllegalArgumentException("mipLevels must be at least 1");
|
||||||
} else {
|
} else if (p_408015_ < 1) {
|
||||||
@@ -106,11 +_,14 @@
|
@@ -148,11 +_,14 @@
|
||||||
GlStateManager._texImage2D(
|
GlStateManager._texImage2D(
|
||||||
3553,
|
k,
|
||||||
j,
|
l,
|
||||||
+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8 :
|
+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8 :
|
||||||
GlConst.toGlInternalId(p_394951_),
|
GlConst.toGlInternalId(p_394951_),
|
||||||
p_395535_ >> j,
|
p_393944_ >> l,
|
||||||
p_393944_ >> j,
|
p_392329_ >> l,
|
||||||
0,
|
0,
|
||||||
+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL :
|
+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL :
|
||||||
GlConst.toGlExternalId(p_394951_),
|
GlConst.toGlExternalId(p_394951_),
|
||||||
+ stencil ? org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV :
|
+ stencil ? org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV :
|
||||||
GlConst.toGlType(p_394951_),
|
GlConst.toGlType(p_394951_),
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
@@ -122,7 +_,7 @@
|
@@ -163,11 +_,14 @@
|
||||||
} else if (k != 0) {
|
GlStateManager._texImage2D(
|
||||||
throw new IllegalStateException("OpenGL error " + k);
|
j,
|
||||||
|
i1,
|
||||||
|
+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8 :
|
||||||
|
GlConst.toGlInternalId(p_394951_),
|
||||||
|
p_393944_ >> i1,
|
||||||
|
p_392329_ >> i1,
|
||||||
|
0,
|
||||||
|
+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL :
|
||||||
|
GlConst.toGlExternalId(p_394951_),
|
||||||
|
+ stencil ? org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV :
|
||||||
|
GlConst.toGlType(p_394951_),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
@@ -180,7 +_,7 @@
|
||||||
|
} else if (j1 != 0) {
|
||||||
|
throw new IllegalStateException("OpenGL error " + j1);
|
||||||
} else {
|
} else {
|
||||||
- GlTexture gltexture = new GlTexture(p_394142_, p_394951_, p_395535_, p_393944_, p_392329_, i);
|
- GlTexture gltexture = new GlTexture(p_395535_, p_394142_, p_394951_, p_393944_, p_392329_, p_408015_, p_406483_, i);
|
||||||
+ GlTexture gltexture = new GlTexture(p_394142_, p_394951_, p_395535_, p_393944_, p_392329_, i, stencil);
|
+ GlTexture gltexture = new GlTexture(p_395535_, p_394142_, p_394951_, p_393944_, p_392329_, p_408015_, p_406483_, i, stencil);
|
||||||
this.debugLabels.applyLabel(gltexture);
|
this.debugLabels.applyLabel(gltexture);
|
||||||
return gltexture;
|
return gltexture;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/com/mojang/blaze3d/opengl/GlStateManager.java
|
--- a/com/mojang/blaze3d/opengl/GlStateManager.java
|
||||||
+++ b/com/mojang/blaze3d/opengl/GlStateManager.java
|
+++ b/com/mojang/blaze3d/opengl/GlStateManager.java
|
||||||
@@ -90,6 +_,11 @@
|
@@ -89,6 +_,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
public static void _disableBlend() {
|
public static void _disableBlend() {
|
||||||
RenderSystem.assertOnRenderThread();
|
RenderSystem.assertOnRenderThread();
|
||||||
BLEND.mode.disable();
|
BLEND.mode.disable();
|
||||||
@@ -411,9 +_,17 @@
|
@@ -404,9 +_,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
--- a/com/mojang/blaze3d/opengl/GlTexture.java
|
--- a/com/mojang/blaze3d/opengl/GlTexture.java
|
||||||
+++ b/com/mojang/blaze3d/opengl/GlTexture.java
|
+++ b/com/mojang/blaze3d/opengl/GlTexture.java
|
||||||
@@ -18,8 +_,13 @@
|
@@ -19,8 +_,13 @@
|
||||||
protected boolean modesDirty = true;
|
private int views;
|
||||||
|
|
||||||
protected GlTexture(String p_393950_, TextureFormat p_392837_, int p_394590_, int p_391379_, int p_391947_, int p_396659_) {
|
protected GlTexture(int p_394590_, String p_393950_, TextureFormat p_392837_, int p_391379_, int p_391947_, int p_396659_, int p_408255_, int p_408889_) {
|
||||||
+ this(p_393950_, p_392837_, p_394590_, p_391379_, p_391947_, p_396659_, false);
|
+ this(p_394590_, p_393950_, p_392837_, p_391379_, p_391947_, p_396659_, p_408255_, p_408889_, false);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ protected GlTexture(String p_393950_, TextureFormat p_392837_, int p_394590_, int p_391379_, int p_391947_, int p_396659_, boolean stencil) {
|
+ protected GlTexture(int p_394590_, String p_393950_, TextureFormat p_392837_, int p_391379_, int p_391947_, int p_396659_, int p_408255_, int p_408889_, boolean stencil) {
|
||||||
super(p_393950_, p_392837_, p_394590_, p_391379_, p_391947_);
|
super(p_394590_, p_393950_, p_392837_, p_391379_, p_391947_, p_396659_, p_408255_);
|
||||||
this.id = p_396659_;
|
this.id = p_408889_;
|
||||||
+ this.stencilEnabled = stencil;
|
+ this.stencilEnabled = stencil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -86,5 +_,15 @@
|
@@ -93,6 +_,16 @@
|
||||||
public void setTextureFilter(FilterMode p_394977_, FilterMode p_397175_, boolean p_393558_) {
|
public void setTextureFilter(FilterMode p_394977_, FilterMode p_397175_, boolean p_393558_) {
|
||||||
super.setTextureFilter(p_394977_, p_397175_, p_393558_);
|
super.setTextureFilter(p_394977_, p_397175_, p_393558_);
|
||||||
this.modesDirty = true;
|
this.modesDirty = true;
|
||||||
@@ -29,4 +29,5 @@
|
|||||||
+ public boolean isStencilEnabled() {
|
+ public boolean isStencilEnabled() {
|
||||||
+ return this.stencilEnabled;
|
+ return this.stencilEnabled;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
|
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
|
||||||
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
|
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
|
||||||
@@ -75,7 +_,7 @@
|
@@ -92,7 +_,7 @@
|
||||||
this.width = p_83951_;
|
this.width = p_83951_;
|
||||||
this.height = p_83952_;
|
this.height = p_83952_;
|
||||||
if (this.useDepth) {
|
if (this.useDepth) {
|
||||||
- this.depthTexture = RenderSystem.getDevice().createTexture(() -> this.label + " / Depth", TextureFormat.DEPTH32, p_83951_, p_83952_, 1);
|
- this.depthTexture = gpudevice.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, p_83951_, p_83952_, 1, 1);
|
||||||
+ this.depthTexture = RenderSystem.getDevice().createTexture(() -> this.label + " / Depth", TextureFormat.DEPTH32, p_83951_, p_83952_, 1, this.stencilEnabled);
|
+ this.depthTexture = gpudevice.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, p_83951_, p_83952_, 1, 1, this.stencilEnabled);
|
||||||
|
this.depthTextureView = gpudevice.createTextureView(this.depthTexture);
|
||||||
this.depthTexture.setTextureFilter(FilterMode.NEAREST, false);
|
this.depthTexture.setTextureFilter(FilterMode.NEAREST, false);
|
||||||
this.depthTexture.setAddressMode(AddressMode.CLAMP_TO_EDGE);
|
this.depthTexture.setAddressMode(AddressMode.CLAMP_TO_EDGE);
|
||||||
}
|
@@ -166,5 +_,26 @@
|
||||||
@@ -134,5 +_,26 @@
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public GpuTexture getDepthTexture() {
|
public GpuTextureView getDepthTextureView() {
|
||||||
return this.depthTexture;
|
return this.depthTextureView;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private boolean stencilEnabled = false;
|
+ private boolean stencilEnabled = false;
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
--- a/com/mojang/blaze3d/systems/GpuDevice.java
|
--- a/com/mojang/blaze3d/systems/GpuDevice.java
|
||||||
+++ b/com/mojang/blaze3d/systems/GpuDevice.java
|
+++ b/com/mojang/blaze3d/systems/GpuDevice.java
|
||||||
@@ -25,7 +_,17 @@
|
@@ -26,7 +_,17 @@
|
||||||
|
@Nullable Supplier<String> p_394357_, int p_395623_, TextureFormat p_395807_, int p_395802_, int p_396157_, int p_408810_, int p_407070_
|
||||||
|
);
|
||||||
|
|
||||||
GpuTexture createTexture(@Nullable Supplier<String> p_394357_, TextureFormat p_395807_, int p_395623_, int p_395802_, int p_396157_);
|
+ /** Forge: same as {@link #createTexture(Supplier, int, TextureFormat, int, int, int)} but with stencil support */
|
||||||
|
+ default GpuTexture createTexture(@Nullable Supplier<String> p_394357_, int p_395623_, TextureFormat p_395807_, int p_395802_, int p_396157_, int p_408810_, int p_407070_, boolean stencil) {
|
||||||
+ /** Forge: same as {@link #createTexture(Supplier, TextureFormat, int, int, int)} but with stencil support */
|
+ return this.createTexture(p_394357_, p_395623_, p_395807_, p_395802_, p_396157_, p_408810_, p_407070_);
|
||||||
+ default GpuTexture createTexture(@Nullable Supplier<String> p_394357_, TextureFormat p_395807_, int p_395623_, int p_395802_, int p_396157_, boolean stencil) {
|
|
||||||
+ return this.createTexture(p_394357_, p_395807_, p_395623_, p_395802_, p_396157_);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
GpuTexture createTexture(@Nullable String p_391798_, TextureFormat p_393333_, int p_391800_, int p_395600_, int p_394065_);
|
GpuTexture createTexture(@Nullable String p_391798_, int p_391800_, TextureFormat p_393333_, int p_395600_, int p_394065_, int p_408732_, int p_407125_);
|
||||||
+
|
+
|
||||||
+ /** Forge: same as {@link #createTexture(String, TextureFormat, int, int, int)} but with stencil support */
|
+ /** Forge: same as {@link #createTexture(String, int, TextureFormat, int, int, int)} but with stencil support */
|
||||||
+ default GpuTexture createTexture(@Nullable String p_391798_, TextureFormat p_393333_, int p_391800_, int p_395600_, int p_394065_, boolean stencil) {
|
+ default GpuTexture createTexture(@Nullable String p_391798_, int p_391800_, TextureFormat p_393333_, int p_395600_, int p_394065_, int p_408732_, int p_407125_, boolean stencil) {
|
||||||
+ return this.createTexture(p_391798_, p_393333_, p_391800_, p_395600_, p_394065_);
|
+ return this.createTexture(p_391798_, p_391800_, p_393333_, p_395600_, p_394065_, p_408732_, p_407125_);
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
GpuBuffer createBuffer(@Nullable Supplier<String> p_395215_, BufferType p_392847_, BufferUsage p_391478_, int p_397054_);
|
GpuTextureView createTextureView(GpuTexture p_409045_);
|
||||||
|
|
||||||
@@ -6,6 +6,6 @@
|
|||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
-public abstract class GpuTexture implements AutoCloseable {
|
-public abstract class GpuTexture implements AutoCloseable {
|
||||||
+public abstract class GpuTexture implements AutoCloseable, net.minecraftforge.client.extensions.IForgeGpuTexture {
|
+public abstract class GpuTexture implements AutoCloseable, net.minecraftforge.client.extensions.IForgeGpuTexture {
|
||||||
private final TextureFormat format;
|
public static final int USAGE_COPY_DST = 1;
|
||||||
private final int width;
|
public static final int USAGE_COPY_SRC = 2;
|
||||||
private final int height;
|
public static final int USAGE_TEXTURE_BINDING = 4;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/com/mojang/blaze3d/vertex/VertexConsumer.java
|
--- a/com/mojang/blaze3d/vertex/VertexConsumer.java
|
||||||
+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java
|
+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java
|
||||||
@@ -13,7 +_,7 @@
|
@@ -15,7 +_,7 @@
|
||||||
import org.lwjgl.system.MemoryStack;
|
import org.lwjgl.system.MemoryStack;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
VertexConsumer addVertex(float p_344294_, float p_342213_, float p_344859_);
|
VertexConsumer addVertex(float p_344294_, float p_342213_, float p_344859_);
|
||||||
|
|
||||||
VertexConsumer setColor(int p_342749_, int p_344324_, int p_343336_, int p_342831_);
|
VertexConsumer setColor(int p_342749_, int p_344324_, int p_343336_, int p_342831_);
|
||||||
@@ -133,9 +_,11 @@
|
@@ -135,9 +_,11 @@
|
||||||
|
|
||||||
int j1 = ARGB.color(k, (int)f3, (int)f4, (int)f5);
|
int j1 = ARGB.color(k, (int)f3, (int)f4, (int)f5);
|
||||||
int k1 = LightTexture.lightCoordsWithEmission(p_331444_[i1], l);
|
int k1 = LightTexture.lightCoordsWithEmission(p_331444_[i1], l);
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
-public class VertexFormat {
|
-public class VertexFormat {
|
||||||
+public class VertexFormat implements net.minecraftforge.client.extensions.IForgeVertexFormat {
|
+public class VertexFormat implements net.minecraftforge.client.extensions.IForgeVertexFormat {
|
||||||
public static final int UNKNOWN_ELEMENT = -1;
|
public static final int UNKNOWN_ELEMENT = -1;
|
||||||
private final List<VertexFormatElement> elements;
|
private static final boolean USE_STAGING_BUFFER_WORKAROUND = Util.getPlatform() == Util.OS.WINDOWS && Util.isAarch64();
|
||||||
private final List<String> names;
|
@Nullable
|
||||||
@@ -31,6 +_,7 @@
|
@@ -34,6 +_,7 @@
|
||||||
private GpuBuffer immediateDrawVertexBuffer;
|
private GpuBuffer immediateDrawVertexBuffer;
|
||||||
@Nullable
|
@Nullable
|
||||||
private GpuBuffer immediateDrawIndexBuffer;
|
private GpuBuffer immediateDrawIndexBuffer;
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
VertexFormat(List<VertexFormatElement> p_343616_, List<String> p_345241_, IntList p_345522_, int p_344162_) {
|
VertexFormat(List<VertexFormatElement> p_343616_, List<String> p_345241_, IntList p_345522_, int p_344162_) {
|
||||||
this.elements = p_343616_;
|
this.elements = p_343616_;
|
||||||
@@ -43,6 +_,11 @@
|
@@ -46,6 +_,11 @@
|
||||||
int j = vertexformatelement != null ? p_343616_.indexOf(vertexformatelement) : -1;
|
int j = vertexformatelement != null ? p_343616_.indexOf(vertexformatelement) : -1;
|
||||||
this.offsetsByElement[i] = j != -1 ? p_345522_.getInt(j) : -1;
|
this.offsetsByElement[i] = j != -1 ? p_345522_.getInt(j) : -1;
|
||||||
}
|
}
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static VertexFormat.Builder builder() {
|
public static VertexFormat.Builder builder() {
|
||||||
@@ -146,6 +_,9 @@
|
@@ -162,6 +_,9 @@
|
||||||
|
);
|
||||||
return this.immediateDrawIndexBuffer;
|
return this.immediateDrawIndexBuffer;
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/SharedConstants.java
|
--- a/net/minecraft/SharedConstants.java
|
||||||
+++ b/net/minecraft/SharedConstants.java
|
+++ b/net/minecraft/SharedConstants.java
|
||||||
@@ -171,6 +_,7 @@
|
@@ -175,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
--- a/net/minecraft/Util.java
|
--- a/net/minecraft/Util.java
|
||||||
+++ b/net/minecraft/Util.java
|
+++ b/net/minecraft/Util.java
|
||||||
@@ -268,7 +_,7 @@
|
@@ -268,7 +_,7 @@
|
||||||
.getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion()))
|
.getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().dataVersion().version()))
|
||||||
.getChoiceType(p_137552_, p_137553_);
|
.getChoiceType(p_137552_, p_137553_);
|
||||||
} catch (IllegalArgumentException illegalargumentexception) {
|
} catch (IllegalArgumentException illegalargumentexception) {
|
||||||
- LOGGER.error("No data fixer registered for {}", p_137553_);
|
- LOGGER.error("No data fixer registered for {}", p_137553_);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
--- a/net/minecraft/advancements/AdvancementRewards.java
|
--- a/net/minecraft/advancements/AdvancementRewards.java
|
||||||
+++ b/net/minecraft/advancements/AdvancementRewards.java
|
+++ b/net/minecraft/advancements/AdvancementRewards.java
|
||||||
@@ -40,6 +_,7 @@
|
@@ -43,6 +_,7 @@
|
||||||
LootParams lootparams = new LootParams.Builder(p_9990_.serverLevel())
|
LootParams lootparams = new LootParams.Builder(serverlevel)
|
||||||
.withParameter(LootContextParams.THIS_ENTITY, p_9990_)
|
.withParameter(LootContextParams.THIS_ENTITY, p_9990_)
|
||||||
.withParameter(LootContextParams.ORIGIN, p_9990_.position())
|
.withParameter(LootContextParams.ORIGIN, p_9990_.position())
|
||||||
+ .withLuck(p_9990_.getLuck())
|
+ .withLuck(p_9990_.getLuck())
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/Camera.java
|
--- a/net/minecraft/client/Camera.java
|
||||||
+++ b/net/minecraft/client/Camera.java
|
+++ b/net/minecraft/client/Camera.java
|
||||||
@@ -118,9 +_,13 @@
|
@@ -133,9 +_,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setRotation(float p_90573_, float p_90574_) {
|
protected void setRotation(float p_90573_, float p_90574_) {
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
FORWARDS.rotate(this.rotation, this.forwards);
|
FORWARDS.rotate(this.rotation, this.forwards);
|
||||||
UP.rotate(this.rotation, this.up);
|
UP.rotate(this.rotation, this.up);
|
||||||
LEFT.rotate(this.rotation, this.left);
|
LEFT.rotate(this.rotation, this.left);
|
||||||
@@ -236,6 +_,13 @@
|
@@ -251,6 +_,13 @@
|
||||||
|
|
||||||
public float getPartialTickTime() {
|
public float getPartialTickTime() {
|
||||||
return this.partialTickTime;
|
return this.partialTickTime;
|
||||||
@@ -28,4 +28,4 @@
|
|||||||
+ return this.level.getBlockState(this.blockPosition).getStateAtViewpoint(this.level, this.blockPosition, this.position);
|
+ return this.level.getBlockState(this.blockPosition).getStateAtViewpoint(this.level, this.blockPosition, this.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@Override
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/KeyboardHandler.java
|
--- a/net/minecraft/client/KeyboardHandler.java
|
||||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||||
@@ -431,12 +_,12 @@
|
@@ -440,12 +_,12 @@
|
||||||
if (screen != null) {
|
if (screen != null) {
|
||||||
try {
|
try {
|
||||||
if (p_90897_ != 1 && p_90897_ != 2) {
|
if (p_90897_ != 1 && p_90897_ != 2) {
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,6 +_,7 @@
|
@@ -504,6 +_,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,10 +_,10 @@
|
@@ -513,10 +_,10 @@
|
||||||
if (screen != null && this.minecraft.getOverlay() == null) {
|
if (screen != null && this.minecraft.getOverlay() == null) {
|
||||||
try {
|
try {
|
||||||
if (Character.isBmpCodePoint(p_90891_)) {
|
if (Character.isBmpCodePoint(p_90891_)) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/Minecraft.java
|
--- a/net/minecraft/client/Minecraft.java
|
||||||
+++ b/net/minecraft/client/Minecraft.java
|
+++ b/net/minecraft/client/Minecraft.java
|
||||||
@@ -248,7 +_,7 @@
|
@@ -256,7 +_,7 @@
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
static Minecraft instance;
|
static Minecraft instance;
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX;
|
public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX;
|
||||||
@@ -426,7 +_,6 @@
|
@@ -435,7 +_,6 @@
|
||||||
}
|
}
|
||||||
}, Util.nonCriticalIoPool());
|
}, Util.nonCriticalIoPool());
|
||||||
LOGGER.info("Setting user: {}", this.user.getName());
|
LOGGER.info("Setting user: {}", this.user.getName());
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
this.demo = p_91084_.game.demo;
|
this.demo = p_91084_.game.demo;
|
||||||
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
|
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
|
||||||
this.allowsChat = !p_91084_.game.disableChat;
|
this.allowsChat = !p_91084_.game.disableChat;
|
||||||
@@ -478,10 +_,9 @@
|
@@ -486,10 +_,9 @@
|
||||||
LOGGER.error("Couldn't set icon", (Throwable)ioexception);
|
LOGGER.error("Couldn't set icon", (Throwable)ioexception);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
RenderSystem.initRenderer(
|
RenderSystem.initRenderer(
|
||||||
this.window.getWindow(),
|
this.window.getWindow(),
|
||||||
this.options.glDebugVerbosity,
|
this.options.glDebugVerbosity,
|
||||||
@@ -492,6 +_,7 @@
|
@@ -500,6 +_,7 @@
|
||||||
LOGGER.info("Using optional rendering extensions: {}", String.join(", ", RenderSystem.getDevice().getEnabledExtensions()));
|
LOGGER.info("Using optional rendering extensions: {}", String.join(", ", RenderSystem.getDevice().getEnabledExtensions()));
|
||||||
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
|
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
|
||||||
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
this.resourcePackRepository.reload();
|
this.resourcePackRepository.reload();
|
||||||
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
||||||
this.languageManager = new LanguageManager(this.options.languageCode, p_340763_ -> {
|
this.languageManager = new LanguageManager(this.options.languageCode, p_340763_ -> {
|
||||||
@@ -570,6 +_,7 @@
|
@@ -578,6 +_,7 @@
|
||||||
this.blockEntityRenderDispatcher = new BlockEntityRenderDispatcher(this.font, this.modelManager.entityModels(), this.blockRenderer, this.itemModelResolver, this.itemRenderer, this.entityRenderDispatcher);
|
this.blockEntityRenderDispatcher = new BlockEntityRenderDispatcher(this.font, this.modelManager.entityModels(), this.blockRenderer, this.itemModelResolver, this.itemRenderer, this.entityRenderDispatcher);
|
||||||
this.resourceManager.registerReloadListener(this.blockEntityRenderDispatcher);
|
this.resourceManager.registerReloadListener(this.blockEntityRenderDispatcher);
|
||||||
this.particleEngine = new ParticleEngine(this.level, this.textureManager);
|
this.particleEngine = new ParticleEngine(this.level, this.textureManager);
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
this.resourceManager.registerReloadListener(this.particleEngine);
|
this.resourceManager.registerReloadListener(this.particleEngine);
|
||||||
this.paintingTextures = new PaintingTextureManager(this.textureManager);
|
this.paintingTextures = new PaintingTextureManager(this.textureManager);
|
||||||
this.resourceManager.registerReloadListener(this.paintingTextures);
|
this.resourceManager.registerReloadListener(this.paintingTextures);
|
||||||
@@ -585,6 +_,9 @@
|
@@ -593,6 +_,9 @@
|
||||||
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
|
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
|
||||||
this.resourceManager.registerReloadListener(this.regionalCompliancies);
|
this.resourceManager.registerReloadListener(this.regionalCompliancies);
|
||||||
this.gui = new Gui(this);
|
this.gui = new Gui(this);
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
this.debugRenderer = new DebugRenderer(this);
|
this.debugRenderer = new DebugRenderer(this);
|
||||||
RealmsClient realmsclient = RealmsClient.getOrCreate(this);
|
RealmsClient realmsclient = RealmsClient.getOrCreate(this);
|
||||||
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
|
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
|
||||||
@@ -618,6 +_,7 @@
|
@@ -626,6 +_,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
this.window.updateVsync(this.options.enableVsync().get());
|
this.window.updateVsync(this.options.enableVsync().get());
|
||||||
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
|
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
|
||||||
this.window.setDefaultErrorCallback();
|
this.window.setDefaultErrorCallback();
|
||||||
@@ -639,16 +_,17 @@
|
@@ -648,16 +_,17 @@
|
||||||
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
||||||
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
|
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
|
||||||
this.setOverlay(
|
this.setOverlay(
|
||||||
@@ -82,9 +82,9 @@
|
|||||||
- )
|
- )
|
||||||
+ ).get()
|
+ ).get()
|
||||||
);
|
);
|
||||||
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path());
|
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.logPath());
|
||||||
this.framerateLimitTracker = new FramerateLimitTracker(this.options, this);
|
this.framerateLimitTracker = new FramerateLimitTracker(this.options, this);
|
||||||
@@ -746,6 +_,7 @@
|
@@ -759,6 +_,7 @@
|
||||||
StringBuilder stringbuilder = new StringBuilder("Minecraft");
|
StringBuilder stringbuilder = new StringBuilder("Minecraft");
|
||||||
if (checkModStatus().shouldReportAsModified()) {
|
if (checkModStatus().shouldReportAsModified()) {
|
||||||
stringbuilder.append("*");
|
stringbuilder.append("*");
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
stringbuilder.append(" ");
|
stringbuilder.append(" ");
|
||||||
@@ -769,6 +_,8 @@
|
@@ -782,6 +_,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
return p_193587_.user.user.getType() != User.Type.MSA
|
return p_193587_.user.user.getType() != User.Type.MSA
|
||||||
? UserApiService.OFFLINE
|
? UserApiService.OFFLINE
|
||||||
: p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
|
: p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
|
||||||
@@ -779,7 +_,7 @@
|
@@ -792,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
|
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
this.clearResourcePacksOnError(p_91240_, null, p_299515_);
|
this.clearResourcePacksOnError(p_91240_, null, p_299515_);
|
||||||
} else {
|
} else {
|
||||||
Util.throwAsRuntime(p_91240_);
|
Util.throwAsRuntime(p_91240_);
|
||||||
@@ -1065,12 +_,6 @@
|
@@ -1078,12 +_,6 @@
|
||||||
LOGGER.error("setScreen called from non-game thread");
|
LOGGER.error("setScreen called from non-game thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
if (p_91153_ == null && this.clientLevelTeardownInProgress) {
|
if (p_91153_ == null && this.clientLevelTeardownInProgress) {
|
||||||
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
|
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
|
||||||
} else {
|
} else {
|
||||||
@@ -1084,6 +_,23 @@
|
@@ -1097,6 +_,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
this.screen = p_91153_;
|
this.screen = p_91153_;
|
||||||
if (this.screen != null) {
|
if (this.screen != null) {
|
||||||
this.screen.added();
|
this.screen.added();
|
||||||
@@ -1168,6 +_,7 @@
|
@@ -1180,6 +_,7 @@
|
||||||
FreeTypeUtil.destroy();
|
FreeTypeUtil.destroy();
|
||||||
Util.shutdownExecutors();
|
Util.shutdownExecutors();
|
||||||
RenderSystem.getDevice().close();
|
RenderSystem.getDevice().close();
|
||||||
@@ -155,7 +155,7 @@
|
|||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
LOGGER.error("Shutdown failure!", throwable);
|
LOGGER.error("Shutdown failure!", throwable);
|
||||||
throw throwable;
|
throw throwable;
|
||||||
@@ -1237,9 +_,11 @@
|
@@ -1248,9 +_,11 @@
|
||||||
this.mouseHandler.handleAccumulatedMovement();
|
this.mouseHandler.handleAccumulatedMovement();
|
||||||
profilerfiller.pop();
|
profilerfiller.pop();
|
||||||
if (!this.noRender) {
|
if (!this.noRender) {
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
profilerfiller.push("blit");
|
profilerfiller.push("blit");
|
||||||
@@ -1363,10 +_,12 @@
|
@@ -1379,10 +_,12 @@
|
||||||
this.window.setGuiScale(i);
|
this.window.setGuiScale(i);
|
||||||
if (this.screen != null) {
|
if (this.screen != null) {
|
||||||
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||||
@@ -180,7 +180,7 @@
|
|||||||
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
|
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
|
||||||
this.mouseHandler.setIgnoreFirstMove();
|
this.mouseHandler.setIgnoreFirstMove();
|
||||||
}
|
}
|
||||||
@@ -1504,6 +_,7 @@
|
@@ -1520,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
@@ -188,14 +188,14 @@
|
|||||||
this.running = false;
|
this.running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1532,10 +_,18 @@
|
@@ -1547,10 +_,18 @@
|
||||||
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
||||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||||
+ var inputEvent = net.minecraftforge.client.event.ForgeEventFactoryClient.onClickInput(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
||||||
+ if (inputEvent.isCanceled()) {
|
+ if (net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) {
|
||||||
+ if (inputEvent.shouldSwingHand()) {
|
+ if (inputEvent.shouldSwingHand()) {
|
||||||
+ this.particleEngine.addBlockHitEffects(blockpos, blockhitresult);
|
+ this.particleEngine.addBlockHitEffects(blockpos, blockhitresult);
|
||||||
+ this.player.swing(InteractionHand.MAIN_HAND);
|
+ this.player.swing(InteractionHand.MAIN_HAND);
|
||||||
@@ -210,16 +210,16 @@
|
|||||||
this.player.swing(InteractionHand.MAIN_HAND);
|
this.player.swing(InteractionHand.MAIN_HAND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1563,6 +_,8 @@
|
@@ -1578,6 +_,8 @@
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
+ var inputEvent = net.minecraftforge.client.event.ForgeEventFactoryClient.onClickInput(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
||||||
+ if (!inputEvent.isCanceled())
|
+ if (!net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent))
|
||||||
switch (this.hitResult.getType()) {
|
switch (this.hitResult.getType()) {
|
||||||
case ENTITY:
|
case ENTITY:
|
||||||
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
|
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
|
||||||
@@ -1570,7 +_,7 @@
|
@@ -1585,7 +_,7 @@
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||||
@@ -228,7 +228,7 @@
|
|||||||
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
|
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
|
||||||
if (this.level.getBlockState(blockpos).isAir()) {
|
if (this.level.getBlockState(blockpos).isAir()) {
|
||||||
flag = true;
|
flag = true;
|
||||||
@@ -1583,8 +_,10 @@
|
@@ -1598,8 +_,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.player.resetAttackStrengthTicker();
|
this.player.resetAttackStrengthTicker();
|
||||||
@@ -239,12 +239,12 @@
|
|||||||
this.player.swing(InteractionHand.MAIN_HAND);
|
this.player.swing(InteractionHand.MAIN_HAND);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
@@ -1600,6 +_,12 @@
|
@@ -1615,6 +_,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
for (InteractionHand interactionhand : InteractionHand.values()) {
|
for (InteractionHand interactionhand : InteractionHand.values()) {
|
||||||
+ var inputEvent = net.minecraftforge.client.event.ForgeEventFactoryClient.onClickInput(1, this.options.keyUse, interactionhand);
|
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(1, this.options.keyUse, interactionhand);
|
||||||
+ if (inputEvent.isCanceled()) {
|
+ if (net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) {
|
||||||
+ if (inputEvent.shouldSwingHand()) this.player.swing(interactionhand);
|
+ if (inputEvent.shouldSwingHand()) this.player.swing(interactionhand);
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
@@ -252,7 +252,7 @@
|
|||||||
ItemStack itemstack = this.player.getItemInHand(interactionhand);
|
ItemStack itemstack = this.player.getItemInHand(interactionhand);
|
||||||
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
|
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
|
||||||
return;
|
return;
|
||||||
@@ -1620,7 +_,7 @@
|
@@ -1635,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interactionresult instanceof InteractionResult.Success interactionresult$success2) {
|
if (interactionresult instanceof InteractionResult.Success interactionresult$success2) {
|
||||||
@@ -261,7 +261,7 @@
|
|||||||
this.player.swing(interactionhand);
|
this.player.swing(interactionhand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1632,7 +_,7 @@
|
@@ -1647,7 +_,7 @@
|
||||||
int i = itemstack.getCount();
|
int i = itemstack.getCount();
|
||||||
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
|
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
|
||||||
if (interactionresult1 instanceof InteractionResult.Success interactionresult$success) {
|
if (interactionresult1 instanceof InteractionResult.Success interactionresult$success) {
|
||||||
@@ -270,7 +270,7 @@
|
|||||||
this.player.swing(interactionhand);
|
this.player.swing(interactionhand);
|
||||||
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.player.hasInfiniteMaterials())) {
|
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.player.hasInfiniteMaterials())) {
|
||||||
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
|
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
|
||||||
@@ -1648,6 +_,9 @@
|
@@ -1663,6 +_,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@
|
|||||||
if (!itemstack.isEmpty()
|
if (!itemstack.isEmpty()
|
||||||
&& this.gameMode.useItem(this.player, interactionhand) instanceof InteractionResult.Success interactionresult$success1) {
|
&& this.gameMode.useItem(this.player, interactionhand) instanceof InteractionResult.Success interactionresult$success1) {
|
||||||
if (interactionresult$success1.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
if (interactionresult$success1.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||||
@@ -1677,6 +_,8 @@
|
@@ -1692,6 +_,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfilerFiller profilerfiller = Profiler.get();
|
ProfilerFiller profilerfiller = Profiler.get();
|
||||||
@@ -289,7 +289,7 @@
|
|||||||
profilerfiller.push("gui");
|
profilerfiller.push("gui");
|
||||||
this.chatListener.tick();
|
this.chatListener.tick();
|
||||||
this.gui.tick(this.pause);
|
this.gui.tick(this.pause);
|
||||||
@@ -1766,6 +_,7 @@
|
@@ -1778,6 +_,7 @@
|
||||||
|
|
||||||
this.tutorial.tick();
|
this.tutorial.tick();
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@
|
|||||||
try {
|
try {
|
||||||
this.level.tick(() -> true);
|
this.level.tick(() -> true);
|
||||||
} catch (Throwable throwable1) {
|
} catch (Throwable throwable1) {
|
||||||
@@ -1779,6 +_,7 @@
|
@@ -1791,6 +_,7 @@
|
||||||
|
|
||||||
throw new ReportedException(crashreport1);
|
throw new ReportedException(crashreport1);
|
||||||
}
|
}
|
||||||
@@ -305,7 +305,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
profilerfiller.popPush("animateTick");
|
profilerfiller.popPush("animateTick");
|
||||||
@@ -1803,6 +_,7 @@
|
@@ -1815,6 +_,7 @@
|
||||||
profilerfiller.popPush("keyboard");
|
profilerfiller.popPush("keyboard");
|
||||||
this.keyboardHandler.tick();
|
this.keyboardHandler.tick();
|
||||||
profilerfiller.pop();
|
profilerfiller.pop();
|
||||||
@@ -313,7 +313,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isLevelRunningNormally() {
|
private boolean isLevelRunningNormally() {
|
||||||
@@ -2003,6 +_,7 @@
|
@@ -2031,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLevel(ClientLevel p_91157_, ReceivingLevelScreen.Reason p_335893_) {
|
public void setLevel(ClientLevel p_91157_, ReceivingLevelScreen.Reason p_335893_) {
|
||||||
@@ -321,7 +321,7 @@
|
|||||||
this.updateScreenAndTick(new ReceivingLevelScreen(() -> false, p_335893_));
|
this.updateScreenAndTick(new ReceivingLevelScreen(() -> false, p_335893_));
|
||||||
this.level = p_91157_;
|
this.level = p_91157_;
|
||||||
this.updateLevelInEngines(p_91157_);
|
this.updateLevelInEngines(p_91157_);
|
||||||
@@ -2040,6 +_,7 @@
|
@@ -2068,6 +_,7 @@
|
||||||
IntegratedServer integratedserver = this.singleplayerServer;
|
IntegratedServer integratedserver = this.singleplayerServer;
|
||||||
this.singleplayerServer = null;
|
this.singleplayerServer = null;
|
||||||
this.gameRenderer.resetData();
|
this.gameRenderer.resetData();
|
||||||
@@ -329,7 +329,7 @@
|
|||||||
this.gameMode = null;
|
this.gameMode = null;
|
||||||
this.narrator.clear();
|
this.narrator.clear();
|
||||||
this.clientLevelTeardownInProgress = true;
|
this.clientLevelTeardownInProgress = true;
|
||||||
@@ -2047,6 +_,7 @@
|
@@ -2075,6 +_,7 @@
|
||||||
try {
|
try {
|
||||||
this.updateScreenAndTick(p_335030_);
|
this.updateScreenAndTick(p_335030_);
|
||||||
if (this.level != null) {
|
if (this.level != null) {
|
||||||
@@ -337,7 +337,7 @@
|
|||||||
if (integratedserver != null) {
|
if (integratedserver != null) {
|
||||||
ProfilerFiller profilerfiller = Profiler.get();
|
ProfilerFiller profilerfiller = Profiler.get();
|
||||||
profilerfiller.push("waitForServer");
|
profilerfiller.push("waitForServer");
|
||||||
@@ -2060,6 +_,7 @@
|
@@ -2088,6 +_,7 @@
|
||||||
|
|
||||||
this.gui.onDisconnected();
|
this.gui.onDisconnected();
|
||||||
this.isLocalServer = false;
|
this.isLocalServer = false;
|
||||||
@@ -345,11 +345,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.level = null;
|
this.level = null;
|
||||||
@@ -2207,6 +_,7 @@
|
@@ -2236,6 +_,7 @@
|
||||||
|
|
||||||
private void pickBlock() {
|
private void pickBlock() {
|
||||||
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
|
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
|
||||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onClickInput(2, this.options.keyPickItem, InteractionHand.MAIN_HAND).isCanceled()) return;
|
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onClickInputPickBlock(this.options.keyPickItem)) return;
|
||||||
boolean flag = Screen.hasControlDown();
|
boolean flag = Screen.hasControlDown();
|
||||||
switch (this.hitResult) {
|
switch (this.hitResult) {
|
||||||
case BlockHitResult blockhitresult:
|
case BlockHitResult blockhitresult:
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/Options.java
|
--- a/net/minecraft/client/Options.java
|
||||||
+++ b/net/minecraft/client/Options.java
|
+++ b/net/minecraft/client/Options.java
|
||||||
@@ -668,7 +_,8 @@
|
@@ -671,7 +_,8 @@
|
||||||
},
|
},
|
||||||
new OptionInstance.LazyEnum<>(
|
new OptionInstance.LazyEnum<>(
|
||||||
() -> Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList(),
|
() -> Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList(),
|
||||||
@@ -10,7 +10,15 @@
|
|||||||
? Optional.empty()
|
? Optional.empty()
|
||||||
: Optional.of(p_232011_),
|
: Optional.of(p_232011_),
|
||||||
Codec.STRING
|
Codec.STRING
|
||||||
@@ -1050,6 +_,7 @@
|
@@ -705,6 +_,7 @@
|
||||||
|
);
|
||||||
|
public boolean syncWrites;
|
||||||
|
public boolean startedCleanly = true;
|
||||||
|
+ private final Map<String, String> unknownKeys = new java.util.HashMap<>();
|
||||||
|
|
||||||
|
public OptionInstance<Boolean> darkMojangStudiosBackground() {
|
||||||
|
return this.darkMojangStudiosBackground;
|
||||||
|
@@ -1088,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public Options(Minecraft p_92138_, File p_92139_) {
|
public Options(Minecraft p_92138_, File p_92139_) {
|
||||||
@@ -18,15 +26,16 @@
|
|||||||
this.minecraft = p_92138_;
|
this.minecraft = p_92138_;
|
||||||
this.optionsFile = new File(p_92139_, "options.txt");
|
this.optionsFile = new File(p_92139_, "options.txt");
|
||||||
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
|
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
|
||||||
@@ -1181,12 +_,22 @@
|
@@ -1222,15 +_,28 @@
|
||||||
this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility);
|
|
||||||
p_168428_.process("menuBackgroundBlurriness", this.menuBackgroundBlurriness);
|
|
||||||
this.startedCleanly = p_168428_.process("startedCleanly", this.startedCleanly);
|
this.startedCleanly = p_168428_.process("startedCleanly", this.startedCleanly);
|
||||||
+ processOptionsForge(p_168428_);
|
p_168428_.process("showNowPlayingToast", this.showNowPlayingToast);
|
||||||
|
p_168428_.process("musicFrequency", this.musicFrequency);
|
||||||
|
+ processOptionsKeysOnly(p_168428_);
|
||||||
|
+ processOptionsEnd(p_168428_);
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
+ // FORGE: split off to allow reloading options after mod loading is done
|
+ // FORGE: split off to allow reloading keys after mod loading is done
|
||||||
+ private void processOptionsForge(Options.FieldAccess p_168428_) {
|
+ private void processOptionsKeysOnly(Options.FieldAccess p_168428_) {
|
||||||
for (KeyMapping keymapping : this.keyMappings) {
|
for (KeyMapping keymapping : this.keyMappings) {
|
||||||
- String s = keymapping.saveString();
|
- String s = keymapping.saveString();
|
||||||
+ String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
|
+ String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
|
||||||
@@ -41,8 +50,13 @@
|
|||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
+ }
|
||||||
|
|
||||||
@@ -1204,6 +_,10 @@
|
+ private void processOptionsEnd(Options.FieldAccess p_168428_) {
|
||||||
|
for (SoundSource soundsource : SoundSource.values()) {
|
||||||
|
p_168428_.process("soundCategory_" + soundsource.getName(), this.soundSourceVolumes.get(soundsource));
|
||||||
|
}
|
||||||
|
@@ -1245,6 +_,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
@@ -53,17 +67,60 @@
|
|||||||
try {
|
try {
|
||||||
if (!this.optionsFile.exists()) {
|
if (!this.optionsFile.exists()) {
|
||||||
return;
|
return;
|
||||||
@@ -1228,7 +_,8 @@
|
@@ -1269,7 +_,8 @@
|
||||||
this.graphicsMode.set(isTrue(optional.get()) ? GraphicsStatus.FANCY : GraphicsStatus.FAST);
|
this.graphicsMode.set(isTrue(optional.get()) ? GraphicsStatus.FANCY : GraphicsStatus.FAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
- this.processOptions(
|
- this.processOptions(
|
||||||
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsForge : this::processOptions;
|
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsKeysOnly : this::processOptions;
|
||||||
+ processor.accept(
|
+ processor.accept(
|
||||||
new Options.FieldAccess() {
|
new Options.FieldAccess() {
|
||||||
@Nullable
|
@Nullable
|
||||||
private String getValue(String p_394210_) {
|
private String getValue(String p_394210_) {
|
||||||
@@ -1433,6 +_,7 @@
|
@@ -1350,6 +_,17 @@
|
||||||
|
);
|
||||||
|
compoundtag1.getString("fullscreenResolution").ifPresent(p_389133_ -> this.fullscreenVideoModeString = p_389133_);
|
||||||
|
KeyMapping.resetMapping();
|
||||||
|
+
|
||||||
|
+ if (limited) {
|
||||||
|
+ this.unknownKeys.clear();
|
||||||
|
+ } else {
|
||||||
|
+ var knownKeys = Arrays.stream(this.keyMappings).map(k -> "key_" + k.getName()).collect(Collectors.toSet());
|
||||||
|
+ for (var entry : compoundtag1.entrySet()) {
|
||||||
|
+ if (entry.getKey().startsWith("key_") && entry.getValue().asString().isPresent() && !knownKeys.contains(entry.getKey()))
|
||||||
|
+ this.unknownKeys.put(entry.getKey(), entry.getValue().asString().get());
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
} catch (Exception exception) {
|
||||||
|
LOGGER.error("Failed to load options", (Throwable)exception);
|
||||||
|
}
|
||||||
|
@@ -1377,9 +_,11 @@
|
||||||
|
public void save() {
|
||||||
|
try (final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) {
|
||||||
|
printwriter.println("version:" + SharedConstants.getCurrentVersion().dataVersion().version());
|
||||||
|
+ var seen = new java.util.HashSet<String>();
|
||||||
|
this.processOptions(
|
||||||
|
new Options.FieldAccess() {
|
||||||
|
public void writePrefix(String p_168491_) {
|
||||||
|
+ seen.add(p_168491_);
|
||||||
|
printwriter.print(p_168491_);
|
||||||
|
printwriter.print(':');
|
||||||
|
}
|
||||||
|
@@ -1435,6 +_,12 @@
|
||||||
|
if (s != null) {
|
||||||
|
printwriter.println("fullscreenResolution:" + s);
|
||||||
|
}
|
||||||
|
+ // Forge add any unknown keys so that Mods can add keybindings between vanilla loading/saving its config.
|
||||||
|
+ for (var entry : this.unknownKeys.entrySet()) {
|
||||||
|
+ if (!seen.contains(entry.getKey()))
|
||||||
|
+ printwriter.println(entry.getKey() + ":" + entry.getValue());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
} catch (Exception exception) {
|
||||||
|
LOGGER.error("Failed to save options", (Throwable)exception);
|
||||||
|
}
|
||||||
|
@@ -1473,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastOptions() {
|
public void broadcastOptions() {
|
||||||
@@ -71,7 +128,7 @@
|
|||||||
if (this.minecraft.player != null) {
|
if (this.minecraft.player != null) {
|
||||||
this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation());
|
this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation());
|
||||||
}
|
}
|
||||||
@@ -1546,6 +_,23 @@
|
@@ -1586,6 +_,23 @@
|
||||||
|
|
||||||
public static Component genericValueLabel(Component p_231901_, int p_231902_) {
|
public static Component genericValueLabel(Component p_231901_, int p_231902_) {
|
||||||
return genericValueLabel(p_231901_, Component.literal(Integer.toString(p_231902_)));
|
return genericValueLabel(p_231901_, Component.literal(Integer.toString(p_231902_)));
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
file2 = new File(file1, p_92297_);
|
file2 = new File(file1, p_92297_);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenshot(p_389141_, file2);
|
+ var event = new net.minecraftforge.client.event.ScreenshotEvent(p_389141_, file2);
|
||||||
+ if (event.isCanceled()) {
|
+ if (net.minecraftforge.client.event.ScreenshotEvent.BUS.post(event)) {
|
||||||
+ p_92301_.accept(event.getCancelMessage());
|
+ p_92301_.accept(event.getCancelMessage());
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/data/Main.java
|
--- a/net/minecraft/client/data/Main.java
|
||||||
+++ b/net/minecraft/client/data/Main.java
|
+++ b/net/minecraft/client/data/Main.java
|
||||||
@@ -30,13 +_,18 @@
|
@@ -31,13 +_,18 @@
|
||||||
OptionSpec<Void> optionspec1 = optionparser.accepts("client", "Include client generators");
|
OptionSpec<Void> optionspec1 = optionparser.accepts("client", "Include client generators");
|
||||||
OptionSpec<Void> optionspec2 = optionparser.accepts("all", "Include all generators");
|
OptionSpec<Void> optionspec2 = optionparser.accepts("all", "Include all generators");
|
||||||
OptionSpec<String> optionspec3 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated");
|
OptionSpec<String> optionspec3 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated");
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
boolean flag1 = flag || optionset.has(optionspec1);
|
boolean flag1 = flag || optionset.has(optionspec1);
|
||||||
Bootstrap.bootStrap();
|
Bootstrap.bootStrap();
|
||||||
ClientBootstrap.bootstrap();
|
ClientBootstrap.bootstrap();
|
||||||
+ if (!loader.run(optionset, path, input, flag, flag1, flag, flag, false))
|
+ if (!loader.run(optionset, path, input, flag, flag1, flag, flag, true))
|
||||||
+ return;
|
+ return;
|
||||||
DataGenerator datagenerator = new DataGenerator(path, SharedConstants.getCurrentVersion(), true);
|
DataGenerator datagenerator = new DataGenerator(path, SharedConstants.getCurrentVersion(), true);
|
||||||
addClientProviders(datagenerator, flag1);
|
addClientProviders(datagenerator, flag1);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/data/models/ItemModelGenerators.java
|
--- a/net/minecraft/client/data/models/ItemModelGenerators.java
|
||||||
+++ b/net/minecraft/client/data/models/ItemModelGenerators.java
|
+++ b/net/minecraft/client/data/models/ItemModelGenerators.java
|
||||||
@@ -852,6 +_,9 @@
|
@@ -871,6 +_,9 @@
|
||||||
this.declareCustomModelItem(Items.COD);
|
this.declareCustomModelItem(Items.COD);
|
||||||
this.declareCustomModelItem(Items.FEATHER);
|
this.declareCustomModelItem(Items.FEATHER);
|
||||||
this.declareCustomModelItem(Items.LEAD);
|
this.declareCustomModelItem(Items.LEAD);
|
||||||
|
|||||||
@@ -7,5 +7,5 @@
|
|||||||
-public class Font {
|
-public class Font {
|
||||||
+public class Font implements net.minecraftforge.client.extensions.IForgeFont {
|
+public class Font implements net.minecraftforge.client.extensions.IForgeFont {
|
||||||
private static final float EFFECT_DEPTH = 0.01F;
|
private static final float EFFECT_DEPTH = 0.01F;
|
||||||
public static final float SHADOW_DEPTH = 0.03F;
|
private static final float OVER_EFFECT_DEPTH = 0.01F;
|
||||||
public static final int NO_SHADOW = 0;
|
private static final float UNDER_EFFECT_DEPTH = -0.01F;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/Gui.java
|
--- a/net/minecraft/client/gui/Gui.java
|
||||||
+++ b/net/minecraft/client/gui/Gui.java
|
+++ b/net/minecraft/client/gui/Gui.java
|
||||||
@@ -148,7 +_,7 @@
|
@@ -151,7 +_,7 @@
|
||||||
public float vignetteBrightness = 1.0F;
|
public float vignetteBrightness = 1.0F;
|
||||||
private int toolHighlightTimer;
|
private int toolHighlightTimer;
|
||||||
private ItemStack lastToolHighlight = ItemStack.EMPTY;
|
private ItemStack lastToolHighlight = ItemStack.EMPTY;
|
||||||
@@ -9,16 +9,16 @@
|
|||||||
private final SubtitleOverlay subtitleOverlay;
|
private final SubtitleOverlay subtitleOverlay;
|
||||||
private final SpectatorGui spectatorGui;
|
private final SpectatorGui spectatorGui;
|
||||||
private final PlayerTabOverlay tabList;
|
private final PlayerTabOverlay tabList;
|
||||||
@@ -347,7 +_,7 @@
|
@@ -377,7 +_,7 @@
|
||||||
Window window = this.minecraft.getWindow();
|
|
||||||
int i = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window));
|
int i = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window));
|
||||||
int j = Mth.floor(this.minecraft.mouseHandler.getScaledYPos(window));
|
int j = Mth.floor(this.minecraft.mouseHandler.getScaledYPos(window));
|
||||||
|
p_329202_.nextStratum();
|
||||||
- this.chat.render(p_329202_, this.tickCount, i, j, false);
|
- this.chat.render(p_329202_, this.tickCount, i, j, false);
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(p_329202_, this.chat, window, i, j, this.tickCount);
|
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(p_329202_, this.chat, window, i, j, this.tickCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,6 +_,8 @@
|
@@ -472,6 +_,8 @@
|
||||||
|
|
||||||
for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
||||||
Holder<MobEffect> holder = mobeffectinstance.getEffect();
|
Holder<MobEffect> holder = mobeffectinstance.getEffect();
|
||||||
@@ -27,15 +27,15 @@
|
|||||||
if (mobeffectinstance.showIcon()) {
|
if (mobeffectinstance.showIcon()) {
|
||||||
int k = p_282812_.guiWidth();
|
int k = p_282812_.guiWidth();
|
||||||
int l = 1;
|
int l = 1;
|
||||||
@@ -475,6 +_,7 @@
|
@@ -502,6 +_,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, k, l, 0, f)) continue;
|
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, k, l, 0, f)) continue;
|
||||||
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder);
|
p_282812_.blitSprite(RenderPipelines.GUI_TEXTURED, getMobEffectSprite(holder), k + 3, l + 3, 18, 18, ARGB.white(f));
|
||||||
int l1 = k;
|
}
|
||||||
int k1 = l;
|
}
|
||||||
@@ -625,6 +_,10 @@
|
@@ -598,6 +_,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderSelectedItemName(GuiGraphics p_283501_) {
|
private void renderSelectedItemName(GuiGraphics p_283501_) {
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
Profiler.get().push("selectedItemName");
|
Profiler.get().push("selectedItemName");
|
||||||
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
|
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
|
||||||
MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
|
MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
|
||||||
@@ -632,9 +_,13 @@
|
@@ -605,9 +_,13 @@
|
||||||
mutablecomponent.withStyle(ChatFormatting.ITALIC);
|
mutablecomponent.withStyle(ChatFormatting.ITALIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
if (!this.minecraft.gameMode.canHurtPlayer()) {
|
if (!this.minecraft.gameMode.canHurtPlayer()) {
|
||||||
k += 14;
|
k += 14;
|
||||||
}
|
}
|
||||||
@@ -645,7 +_,7 @@
|
@@ -618,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l > 0) {
|
if (l > 0) {
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1154,7 +_,7 @@
|
@@ -1148,7 +_,7 @@
|
||||||
ItemStack itemstack = this.minecraft.player.getInventory().getSelectedItem();
|
ItemStack itemstack = this.minecraft.player.getInventory().getSelectedItem();
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
this.toolHighlightTimer = 0;
|
this.toolHighlightTimer = 0;
|
||||||
|
|||||||
@@ -1,160 +1,144 @@
|
|||||||
--- a/net/minecraft/client/gui/GuiGraphics.java
|
--- a/net/minecraft/client/gui/GuiGraphics.java
|
||||||
+++ b/net/minecraft/client/gui/GuiGraphics.java
|
+++ b/net/minecraft/client/gui/GuiGraphics.java
|
||||||
@@ -52,7 +_,7 @@
|
@@ -72,7 +_,7 @@
|
||||||
import org.joml.Vector2ic;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
-public class GuiGraphics {
|
-public class GuiGraphics {
|
||||||
+public class GuiGraphics implements net.minecraftforge.client.extensions.IForgeGuiGraphics {
|
+public class GuiGraphics implements net.minecraftforge.client.extensions.IForgeGuiGraphics {
|
||||||
public static final float MAX_GUI_Z = 10000.0F;
|
|
||||||
public static final float MIN_GUI_Z = -10000.0F;
|
|
||||||
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
|
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
|
||||||
@@ -229,6 +_,11 @@
|
private final Minecraft minecraft;
|
||||||
}
|
private final Matrix3x2fStack pose;
|
||||||
|
@@ -875,6 +_,7 @@
|
||||||
public int drawString(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) {
|
|
||||||
+ return this.drawString(p_283343_, p_281896_, (float)p_283569_, (float)p_283418_, p_281560_, p_282130_);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Forge: Add float variant for x,y coordinates
|
|
||||||
+ public int drawString(Font p_283343_, @Nullable String p_281896_, float p_283569_, float p_283418_, int p_281560_, boolean p_282130_) {
|
|
||||||
return p_281896_ == null
|
|
||||||
? 0
|
|
||||||
: p_283343_.drawInBatch(
|
|
||||||
@@ -250,6 +_,11 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
public int drawString(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) {
|
|
||||||
+ return this.drawString(p_282636_, p_281596_, (float)p_281586_, (float)p_282816_, p_281743_, p_282394_);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Forge: Add float variant for x,y coordinates
|
|
||||||
+ public int drawString(Font p_282636_, FormattedCharSequence p_281596_, float p_281586_, float p_282816_, int p_281743_, boolean p_282394_) {
|
|
||||||
return p_282636_.drawInBatch(
|
|
||||||
p_281596_, p_281586_, p_282816_, p_281743_, p_282394_, this.pose.last().pose(), this.bufferSource, Font.DisplayMode.NORMAL, 0, 15728880
|
|
||||||
);
|
|
||||||
@@ -850,6 +_,7 @@
|
|
||||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item");
|
CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item");
|
||||||
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered");
|
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered");
|
||||||
crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_281675_.getItem()));
|
crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_283653_.getItem()));
|
||||||
+ crashreportcategory.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_281675_.getItem())));
|
+ crashreportcategory.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_283653_.getItem())));
|
||||||
crashreportcategory.setDetail("Item Components", () -> String.valueOf(p_281675_.getComponents()));
|
crashreportcategory.setDetail("Item Components", () -> String.valueOf(p_283653_.getComponents()));
|
||||||
crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_281675_.hasFoil()));
|
crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_283653_.hasFoil()));
|
||||||
throw new ReportedException(crashreport);
|
throw new ReportedException(crashreport);
|
||||||
@@ -870,13 +_,24 @@
|
@@ -893,6 +_,7 @@
|
||||||
this.renderItemCount(p_282005_, p_283349_, p_282641_, p_282146_, p_282803_);
|
|
||||||
this.renderItemCooldown(p_283349_, p_282641_, p_282146_);
|
this.renderItemCooldown(p_283349_, p_282641_, p_282146_);
|
||||||
this.pose.popPose();
|
this.renderItemCount(p_282005_, p_283349_, p_282641_, p_282146_, p_282803_);
|
||||||
|
this.pose.popMatrix();
|
||||||
+ net.minecraftforge.client.ItemDecoratorHandler.of(p_283349_).render(this, p_282005_, p_283349_, p_282641_, p_282146_);
|
+ net.minecraftforge.client.ItemDecoratorHandler.of(p_283349_).render(this, p_282005_, p_283349_, p_282641_, p_282146_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
|
||||||
+ private ItemStack tooltipStack = ItemStack.EMPTY;
|
|
||||||
|
|
||||||
public void renderTooltip(Font p_282308_, ItemStack p_282781_, int p_282687_, int p_282292_) {
|
@@ -904,21 +_,30 @@
|
||||||
+ this.tooltipStack = p_282781_;
|
this.setTooltipForNextFrame(this.minecraft.font, p_407686_, DefaultTooltipPositioner.INSTANCE, p_410475_, p_407139_, false);
|
||||||
this.renderTooltip(
|
}
|
||||||
p_282308_, Screen.getTooltipFromItem(this.minecraft, p_282781_), p_282781_.getTooltipImage(), p_282687_, p_282292_, p_282781_.get(DataComponents.TOOLTIP_STYLE)
|
|
||||||
|
+ private ItemStack tooltipStack = ItemStack.EMPTY;
|
||||||
|
+
|
||||||
|
public void setTooltipForNextFrame(Font p_408152_, ItemStack p_410145_, int p_410585_, int p_408354_) {
|
||||||
|
+ this.tooltipStack = p_410145_;
|
||||||
|
this.setTooltipForNextFrame(
|
||||||
|
p_408152_, Screen.getTooltipFromItem(this.minecraft, p_410145_), p_410145_.getTooltipImage(), p_410585_, p_408354_, p_410145_.get(DataComponents.TOOLTIP_STYLE)
|
||||||
);
|
);
|
||||||
+ this.tooltipStack = ItemStack.EMPTY;
|
+ this.tooltipStack = ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTooltipForNextFrame(Font p_407170_, List<Component> p_407123_, Optional<TooltipComponent> p_409349_, int p_406573_, int p_409911_) {
|
||||||
|
this.setTooltipForNextFrame(p_407170_, p_407123_, p_409349_, p_406573_, p_409911_, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public void setTooltipForNextFrame(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY) {
|
||||||
|
+ this.tooltipStack = stack;
|
||||||
|
+ this.setTooltipForNextFrame(font, textComponents, tooltipComponent, mouseX, mouseY, stack.get(DataComponents.TOOLTIP_STYLE));
|
||||||
|
+ this.tooltipStack = ItemStack.EMPTY;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void renderTooltip(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY) {
|
public void setTooltipForNextFrame(
|
||||||
+ this.tooltipStack = stack;
|
Font p_407847_, List<Component> p_408847_, Optional<TooltipComponent> p_410489_, int p_409369_, int p_407472_, @Nullable ResourceLocation p_410303_
|
||||||
+ this.renderTooltip(font, textComponents, tooltipComponent, mouseX, mouseY, stack.get(DataComponents.TOOLTIP_STYLE));
|
|
||||||
+ this.tooltipStack = ItemStack.EMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void renderTooltip(Font p_283128_, List<Component> p_282716_, Optional<TooltipComponent> p_281682_, int p_283678_, int p_281696_) {
|
|
||||||
@@ -886,8 +_,7 @@
|
|
||||||
public void renderTooltip(
|
|
||||||
Font p_362491_, List<Component> p_368544_, Optional<TooltipComponent> p_362815_, int p_366300_, int p_368952_, @Nullable ResourceLocation p_368469_
|
|
||||||
) {
|
) {
|
||||||
- List<ClientTooltipComponent> list = p_368544_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Util.toMutableList());
|
- List<ClientTooltipComponent> list = p_408847_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Util.toMutableList());
|
||||||
- p_362815_.ifPresent(p_325321_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_325321_)));
|
- p_410489_.ifPresent(p_325321_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_325321_)));
|
||||||
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_368544_, p_362815_, p_366300_, guiWidth(), guiHeight(), p_362491_);
|
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_408847_, p_410489_, p_409369_, guiWidth(), guiHeight(), p_407847_);
|
||||||
this.renderTooltipInternal(p_362491_, list, p_366300_, p_368952_, DefaultTooltipPositioner.INSTANCE, p_368469_);
|
this.setTooltipForNextFrameInternal(p_407847_, list, p_409369_, p_407472_, DefaultTooltipPositioner.INSTANCE, p_410303_, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,7 +_,22 @@
|
@@ -931,7 +_,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderComponentTooltip(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
|
public void setComponentTooltipForNextFrame(Font p_406239_, List<Component> p_410275_, int p_410594_, int p_409343_) {
|
||||||
- this.renderComponentTooltip(p_282739_, p_281832_, p_282191_, p_282446_, null);
|
- this.setComponentTooltipForNextFrame(p_406239_, p_410275_, p_410594_, p_409343_, null);
|
||||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_281832_, p_282191_, guiWidth(), guiHeight(), p_282739_);
|
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_410275_, p_410594_, guiWidth(), guiHeight(), p_406239_);
|
||||||
+ this.renderTooltipInternal(p_282739_, components, p_282191_, p_282446_, DefaultTooltipPositioner.INSTANCE, null);
|
+ this.setTooltipForNextFrameInternal(p_406239_, components, p_410594_, p_409343_, DefaultTooltipPositioner.INSTANCE, null, false);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void renderComponentTooltip(Font font, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
|
+ public void renderComponentTooltip(Font font, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
|
||||||
+ this.tooltipStack = stack;
|
+ this.tooltipStack = stack;
|
||||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, guiWidth(), guiHeight(), font);
|
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, guiWidth(), guiHeight(), font);
|
||||||
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE, null);
|
+ this.setTooltipForNextFrameInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE, null, false);
|
||||||
+ this.tooltipStack = ItemStack.EMPTY;
|
+ this.tooltipStack = ItemStack.EMPTY;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void renderComponentTooltipFromElements(Font font, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack) {
|
+ public void renderComponentTooltipFromElements(Font font, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack) {
|
||||||
+ this.tooltipStack = stack;
|
+ this.tooltipStack = stack;
|
||||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponentsFromElements(stack, elements, mouseX, guiWidth(), guiHeight(), font);
|
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponentsFromElements(stack, elements, mouseX, guiWidth(), guiHeight(), font);
|
||||||
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE, null);
|
+ this.setTooltipForNextFrameInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE, null, false);
|
||||||
+ this.tooltipStack = ItemStack.EMPTY;
|
+ this.tooltipStack = ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderComponentTooltip(Font p_369090_, List<Component> p_365405_, int p_368143_, int p_366244_, @Nullable ResourceLocation p_364763_) {
|
public void setComponentTooltipForNextFrame(Font p_408650_, List<Component> p_407512_, int p_406019_, int p_408123_, @Nullable ResourceLocation p_409993_) {
|
||||||
@@ -942,11 +_,13 @@
|
@@ -994,11 +_,13 @@
|
||||||
@Nullable ResourceLocation p_368234_
|
ClientTooltipPositioner p_409451_,
|
||||||
|
@Nullable ResourceLocation p_409298_
|
||||||
) {
|
) {
|
||||||
if (!p_282615_.isEmpty()) {
|
+ var preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, this, p_283678_, p_281696_, guiWidth(), guiHeight(), p_282716_, p_283128_, p_409451_);
|
||||||
+ var preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, this, p_283230_, p_283417_, guiWidth(), guiHeight(), p_282615_, p_282675_, p_282442_);
|
+ if (preEvent == null) return;
|
||||||
+ if (preEvent.isCanceled()) return;
|
int i = 0;
|
||||||
int i = 0;
|
int j = p_282716_.size() == 1 ? -2 : 0;
|
||||||
int j = p_282615_.size() == 1 ? -2 : 0;
|
|
||||||
|
|
||||||
for (ClientTooltipComponent clienttooltipcomponent : p_282615_) {
|
for (ClientTooltipComponent clienttooltipcomponent : p_282716_) {
|
||||||
- int k = clienttooltipcomponent.getWidth(p_282675_);
|
- int k = clienttooltipcomponent.getWidth(p_283128_);
|
||||||
+ int k = clienttooltipcomponent.getWidth(preEvent.getFont());
|
+ int k = clienttooltipcomponent.getWidth(preEvent.getFont());
|
||||||
if (k > i) {
|
if (k > i) {
|
||||||
i = k;
|
i = k;
|
||||||
}
|
|
||||||
@@ -956,18 +_,19 @@
|
|
||||||
|
|
||||||
int i2 = i;
|
|
||||||
int j2 = j;
|
|
||||||
- Vector2ic vector2ic = p_282442_.positionTooltip(this.guiWidth(), this.guiHeight(), p_283230_, p_283417_, i, j);
|
|
||||||
+ Vector2ic vector2ic = p_282442_.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), i2, j2);
|
|
||||||
int l = vector2ic.x();
|
|
||||||
int i1 = vector2ic.y();
|
|
||||||
this.pose.pushPose();
|
|
||||||
int j1 = 400;
|
|
||||||
- TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, 400, p_368234_);
|
|
||||||
+ var background_event = net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTooltipBackground(this.tooltipStack, this, l, i1, preEvent.getFont(), p_282615_, p_368234_);
|
|
||||||
+ TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, 400, background_event.getBackground());
|
|
||||||
this.pose.translate(0.0F, 0.0F, 400.0F);
|
|
||||||
int k1 = i1;
|
|
||||||
|
|
||||||
for (int l1 = 0; l1 < p_282615_.size(); l1++) {
|
|
||||||
ClientTooltipComponent clienttooltipcomponent1 = p_282615_.get(l1);
|
|
||||||
- clienttooltipcomponent1.renderText(p_282675_, l, k1, this.pose.last().pose(), this.bufferSource);
|
|
||||||
+ clienttooltipcomponent1.renderText(preEvent.getFont(), l, k1, this.pose.last().pose(), this.bufferSource);
|
|
||||||
k1 += clienttooltipcomponent1.getHeight(p_282675_) + (l1 == 0 ? 2 : 0);
|
|
||||||
}
|
}
|
||||||
|
@@ -1008,16 +_,17 @@
|
||||||
|
|
||||||
@@ -975,7 +_,7 @@
|
int l1 = i;
|
||||||
|
int i2 = j;
|
||||||
|
- Vector2ic vector2ic = p_409451_.positionTooltip(this.guiWidth(), this.guiHeight(), p_283678_, p_281696_, i, j);
|
||||||
|
+ Vector2ic vector2ic = p_409451_.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), i, j);
|
||||||
|
int l = vector2ic.x();
|
||||||
|
int i1 = vector2ic.y();
|
||||||
|
this.pose.pushMatrix();
|
||||||
|
- TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, p_409298_);
|
||||||
|
+ var background_event = net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTooltipBackground(this.tooltipStack, this, l, i1, preEvent.getFont(), p_282716_, p_409298_);
|
||||||
|
+ TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, background_event.getBackground());
|
||||||
|
int j1 = i1;
|
||||||
|
|
||||||
for (int k2 = 0; k2 < p_282615_.size(); k2++) {
|
for (int k1 = 0; k1 < p_282716_.size(); k1++) {
|
||||||
ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2);
|
ClientTooltipComponent clienttooltipcomponent1 = p_282716_.get(k1);
|
||||||
- clienttooltipcomponent2.renderImage(p_282675_, l, k1, i2, j2, this);
|
- clienttooltipcomponent1.renderText(this, p_283128_, l, j1);
|
||||||
+ clienttooltipcomponent2.renderImage(preEvent.getFont(), l, k1, i2, j2, this);
|
+ clienttooltipcomponent1.renderText(this, preEvent.getFont(), l, j1);
|
||||||
k1 += clienttooltipcomponent2.getHeight(p_282675_) + (k2 == 0 ? 2 : 0);
|
j1 += clienttooltipcomponent1.getHeight(p_283128_) + (k1 == 0 ? 2 : 0);
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1030,6 +_,10 @@
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1025,7 +_,7 @@
|
||||||
|
|
||||||
|
for (int j2 = 0; j2 < p_282716_.size(); j2++) {
|
||||||
|
ClientTooltipComponent clienttooltipcomponent2 = p_282716_.get(j2);
|
||||||
|
- clienttooltipcomponent2.renderImage(p_283128_, l, j1, l1, i2, this);
|
||||||
|
+ clienttooltipcomponent2.renderImage(preEvent.getFont(), l, j1, l1, i2, this);
|
||||||
|
j1 += clienttooltipcomponent2.getHeight(p_283128_) + (j2 == 0 ? 2 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1222,6 +_,14 @@
|
||||||
|
|
||||||
|
public void submitProfilerChartRenderState(List<ResultField> p_408565_, int p_410147_, int p_406156_, int p_407365_, int p_408180_) {
|
||||||
|
this.guiRenderState.submitPicturesInPictureState(new GuiProfilerChartRenderState(p_408565_, p_410147_, p_406156_, p_407365_, p_408180_, this.scissorStack.peek()));
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public MultiBufferSource.BufferSource getBufferSource() {
|
+ public GuiRenderState getRenderState() {
|
||||||
+ return this.bufferSource;
|
+ return this.guiRenderState;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public GuiGraphics.ScissorStack getScissorStack() {
|
||||||
|
+ return this.scissorStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawSpecial(Consumer<MultiBufferSource> p_367429_) {
|
@OnlyIn(Dist.CLIENT)
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
--- a/net/minecraft/client/gui/components/AbstractButton.java
|
--- a/net/minecraft/client/gui/components/AbstractButton.java
|
||||||
+++ b/net/minecraft/client/gui/components/AbstractButton.java
|
+++ b/net/minecraft/client/gui/components/AbstractButton.java
|
||||||
@@ -39,7 +_,7 @@
|
@@ -38,7 +_,7 @@
|
||||||
this.getHeight(),
|
this.getHeight(),
|
||||||
ARGB.white(this.alpha)
|
ARGB.white(this.alpha)
|
||||||
);
|
);
|
||||||
- int i = this.active ? 16777215 : 10526880;
|
- int i = ARGB.color(this.alpha, this.active ? -1 : -6250336);
|
||||||
+ int i = getFGColor();
|
+ int i = getFGColor();
|
||||||
this.renderString(p_281670_, minecraft.font, i | Mth.ceil(this.alpha * 255.0F) << 24);
|
this.renderString(p_281670_, minecraft.font, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/components/AbstractWidget.java
|
--- a/net/minecraft/client/gui/components/AbstractWidget.java
|
||||||
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
|
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
|
||||||
@@ -250,6 +_,25 @@
|
@@ -236,6 +_,25 @@
|
||||||
this.focused = p_93693_;
|
this.focused = p_93693_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
+
|
+
|
||||||
+ public int getFGColor() {
|
+ public int getFGColor() {
|
||||||
+ if (packedFGColor != UNSET_FG_COLOR) return packedFGColor;
|
+ if (packedFGColor != UNSET_FG_COLOR) return packedFGColor;
|
||||||
+ return this.active ? 16777215 : 10526880; // White : Light Grey
|
+ return net.minecraft.util.ARGB.color(this.alpha, this.active ? -1 : -6250336); // White : Light Grey
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void setFGColor(int color) {
|
+ public void setFGColor(int color) {
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
|
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||||
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
|
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||||
@@ -66,13 +_,16 @@
|
@@ -67,13 +_,16 @@
|
||||||
|
|
||||||
for (LerpingBossEvent lerpingbossevent : this.events.values()) {
|
for (LerpingBossEvent lerpingbossevent : this.events.values()) {
|
||||||
int k = i / 2 - 91;
|
int k = i / 2 - 91;
|
||||||
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_283175_, this.minecraft.getWindow(), lerpingbossevent, k, j, 10 + this.minecraft.font.lineHeight);
|
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_283175_, this.minecraft.getWindow(), lerpingbossevent, k, j, 10 + this.minecraft.font.lineHeight);
|
||||||
+ if (!event.isCanceled()) {
|
+ if (event != null) {
|
||||||
this.drawBar(p_283175_, k, j, lerpingbossevent);
|
this.drawBar(p_283175_, k, j, lerpingbossevent);
|
||||||
Component component = lerpingbossevent.getName();
|
Component component = lerpingbossevent.getName();
|
||||||
int l = this.minecraft.font.width(component);
|
int l = this.minecraft.font.width(component);
|
||||||
int i1 = i / 2 - l / 2;
|
int i1 = i / 2 - l / 2;
|
||||||
int j1 = j - 9;
|
int j1 = j - 9;
|
||||||
p_283175_.drawString(this.minecraft.font, component, i1, j1, 16777215);
|
p_283175_.drawString(this.minecraft.font, component, i1, j1, -1);
|
||||||
- j += 10 + 9;
|
- j += 10 + 9;
|
||||||
+ }
|
+ }
|
||||||
+ j += event.getIncrement();
|
+ j += event.getIncrement();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
--- a/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
||||||
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
||||||
@@ -134,9 +_,9 @@
|
@@ -139,9 +_,9 @@
|
||||||
@Nullable
|
@Nullable
|
||||||
private CompletableFuture<LevelChunk> serverChunk;
|
private CompletableFuture<LevelChunk> serverChunk;
|
||||||
private boolean renderDebug;
|
private boolean renderDebug;
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
private final LocalSampleLogger frameTimeLogger = new LocalSampleLogger(1);
|
private final LocalSampleLogger frameTimeLogger = new LocalSampleLogger(1);
|
||||||
private final LocalSampleLogger tickTimeLogger = new LocalSampleLogger(TpsDebugDimensions.values().length);
|
private final LocalSampleLogger tickTimeLogger = new LocalSampleLogger(TpsDebugDimensions.values().length);
|
||||||
private final LocalSampleLogger pingLogger = new LocalSampleLogger(1);
|
private final LocalSampleLogger pingLogger = new LocalSampleLogger(1);
|
||||||
@@ -179,14 +_,18 @@
|
@@ -183,15 +_,19 @@
|
||||||
this.clientChunk = null;
|
this.clientChunk = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,13 +29,14 @@
|
|||||||
+ protected void drawText(ProfilerFiller profilerfiller, GuiGraphics p_281427_) {
|
+ protected void drawText(ProfilerFiller profilerfiller, GuiGraphics p_281427_) {
|
||||||
this.drawGameInformation(p_281427_);
|
this.drawGameInformation(p_281427_);
|
||||||
this.drawSystemInformation(p_281427_);
|
this.drawSystemInformation(p_281427_);
|
||||||
|
p_281427_.nextStratum();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ protected void drawFPSCharts(ProfilerFiller profilerfiller, GuiGraphics p_281427_) {
|
+ protected void drawFPSCharts(ProfilerFiller profilerfiller, GuiGraphics p_281427_) {
|
||||||
this.profilerPieChart.setBottomOffset(10);
|
this.profilerPieChart.setBottomOffset(10);
|
||||||
if (this.renderFpsCharts) {
|
if (this.renderFpsCharts) {
|
||||||
int i = p_281427_.guiWidth();
|
int i = p_281427_.guiWidth();
|
||||||
@@ -199,7 +_,9 @@
|
@@ -204,7 +_,9 @@
|
||||||
|
|
||||||
this.profilerPieChart.setBottomOffset(this.tpsChart.getFullHeight());
|
this.profilerPieChart.setBottomOffset(this.tpsChart.getFullHeight());
|
||||||
}
|
}
|
||||||
@@ -45,7 +46,7 @@
|
|||||||
if (this.renderNetworkCharts) {
|
if (this.renderNetworkCharts) {
|
||||||
int l = p_281427_.guiWidth();
|
int l = p_281427_.guiWidth();
|
||||||
int i1 = l / 2;
|
int i1 = l / 2;
|
||||||
@@ -215,12 +_,22 @@
|
@@ -220,12 +_,22 @@
|
||||||
try (Zone zone = profilerfiller.zone("profilerPie")) {
|
try (Zone zone = profilerfiller.zone("profilerPie")) {
|
||||||
this.profilerPieChart.render(p_281427_);
|
this.profilerPieChart.render(p_281427_);
|
||||||
}
|
}
|
||||||
@@ -70,7 +71,7 @@
|
|||||||
list.add("");
|
list.add("");
|
||||||
boolean flag = this.minecraft.getSingleplayerServer() != null;
|
boolean flag = this.minecraft.getSingleplayerServer() != null;
|
||||||
list.add(
|
list.add(
|
||||||
@@ -234,11 +_,18 @@
|
@@ -239,11 +_,18 @@
|
||||||
+ (this.renderNetworkCharts ? " visible" : " hidden")
|
+ (this.renderNetworkCharts ? " visible" : " hidden")
|
||||||
);
|
);
|
||||||
list.add("For help: press F3 + Q");
|
list.add("For help: press F3 + Q");
|
||||||
@@ -90,7 +91,7 @@
|
|||||||
this.renderLines(p_281261_, list, false);
|
this.renderLines(p_281261_, list, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,6 +_,7 @@
|
@@ -597,6 +_,7 @@
|
||||||
list.add("");
|
list.add("");
|
||||||
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
||||||
list.add(String.valueOf(BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType())));
|
list.add(String.valueOf(BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType())));
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/components/toasts/ToastManager.java
|
--- a/net/minecraft/client/gui/components/toasts/ToastManager.java
|
||||||
+++ b/net/minecraft/client/gui/components/toasts/ToastManager.java
|
+++ b/net/minecraft/client/gui/components/toasts/ToastManager.java
|
||||||
@@ -127,6 +_,7 @@
|
@@ -146,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToast(Toast p_360768_) {
|
public void addToast(Toast p_360768_) {
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
--- a/net/minecraft/client/gui/render/GuiRenderer.java
|
||||||
|
+++ b/net/minecraft/client/gui/render/GuiRenderer.java
|
||||||
|
@@ -134,6 +_,7 @@
|
||||||
|
builder.put((Class<? extends PictureInPictureRenderState>)pictureinpicturerenderer.getRenderStateClass(), pictureinpicturerenderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ net.minecraftforge.client.ForgeHooksClient.onRegisterPictureInPictureRenderers(p_410565_, p_410441_, builder);
|
||||||
|
this.pictureInPictureRenderers = builder.buildOrThrow();
|
||||||
|
}
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
@Override
|
@Override
|
||||||
public void render(GuiGraphics p_281839_, int p_282704_, int p_283650_, float p_283394_) {
|
public void render(GuiGraphics p_281839_, int p_282704_, int p_283650_, float p_283394_) {
|
||||||
int i = p_281839_.guiWidth();
|
int i = p_281839_.guiWidth();
|
||||||
@@ -95,6 +_,7 @@
|
@@ -97,6 +_,7 @@
|
||||||
f2 = 1.0F;
|
f2 = 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
int l2 = (int)(p_281839_.guiWidth() * 0.5);
|
int l2 = (int)(p_281839_.guiWidth() * 0.5);
|
||||||
int i1 = (int)(p_281839_.guiHeight() * 0.5);
|
int i1 = (int)(p_281839_.guiHeight() * 0.5);
|
||||||
double d0 = Math.min(p_281839_.guiWidth() * 0.75, (double)p_281839_.guiHeight()) * 0.25;
|
double d0 = Math.min(p_281839_.guiWidth() * 0.75, (double)p_281839_.guiHeight()) * 0.25;
|
||||||
@@ -110,12 +_,14 @@
|
@@ -112,12 +_,14 @@
|
||||||
if (f < 1.0F) {
|
if (f < 1.0F) {
|
||||||
this.drawProgressBar(p_281839_, i / 2 - k1, i2 - 5, i / 2 + k1, i2 + 5, 1.0F - Mth.clamp(f, 0.0F, 1.0F));
|
this.drawProgressBar(p_281839_, i / 2 - k1, i2 - 5, i / 2 + k1, i2 + 5, 1.0F - Mth.clamp(f, 0.0F, 1.0F));
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
try {
|
try {
|
||||||
this.reload.checkExceptions();
|
this.reload.checkExceptions();
|
||||||
this.onFinish.accept(Optional.empty());
|
this.onFinish.accept(Optional.empty());
|
||||||
@@ -123,7 +_,6 @@
|
@@ -125,7 +_,6 @@
|
||||||
this.onFinish.accept(Optional.of(throwable));
|
this.onFinish.accept(Optional.of(throwable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/PauseScreen.java
|
--- a/net/minecraft/client/gui/screens/PauseScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
|
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
|
||||||
@@ -95,6 +_,7 @@
|
@@ -105,6 +_,7 @@
|
||||||
} else {
|
} else {
|
||||||
gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this)));
|
gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this)));
|
||||||
}
|
}
|
||||||
+ gridlayout$rowhelper.addChild(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this))).width(BUTTON_WIDTH_FULL).build(), 2);
|
+ gridlayout$rowhelper.addChild(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this))).width(BUTTON_WIDTH_FULL).build(), 2);
|
||||||
|
|
||||||
Component component = this.minecraft.isLocalServer() ? RETURN_TO_MENU : CommonComponents.GUI_DISCONNECT;
|
this.disconnectButton = gridlayout$rowhelper.addChild(Button.builder(CommonComponents.disconnectButtonLabel(this.minecraft.isLocalServer()), p_280815_ -> {
|
||||||
this.disconnectButton = gridlayout$rowhelper.addChild(Button.builder(component, p_280815_ -> {
|
p_280815_.active = false;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/Screen.java
|
--- a/net/minecraft/client/gui/screens/Screen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/Screen.java
|
+++ b/net/minecraft/client/gui/screens/Screen.java
|
||||||
@@ -197,7 +_,7 @@
|
@@ -191,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClose() {
|
public void onClose() {
|
||||||
@@ -9,37 +9,37 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T p_169406_) {
|
protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T p_169406_) {
|
||||||
@@ -311,8 +_,10 @@
|
@@ -339,8 +_,10 @@
|
||||||
this.width = p_96608_;
|
this.width = p_96608_;
|
||||||
this.height = p_96609_;
|
this.height = p_96609_;
|
||||||
if (!this.initialized) {
|
if (!this.initialized) {
|
||||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget)))
|
+ if (!net.minecraftforge.client.event.ScreenEvent.Init.Pre.BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget)))
|
||||||
this.init();
|
this.init();
|
||||||
this.setInitialFocus();
|
this.setInitialFocus();
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget));
|
+ net.minecraftforge.client.event.ScreenEvent.Init.Post.BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget));
|
||||||
} else {
|
} else {
|
||||||
this.repositionElements();
|
this.repositionElements();
|
||||||
}
|
}
|
||||||
@@ -325,8 +_,10 @@
|
@@ -353,8 +_,10 @@
|
||||||
protected void rebuildWidgets() {
|
protected void rebuildWidgets() {
|
||||||
this.clearWidgets();
|
this.clearWidgets();
|
||||||
this.clearFocus();
|
this.clearFocus();
|
||||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget)))
|
+ if (!net.minecraftforge.client.event.ScreenEvent.Init.Pre.BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget)))
|
||||||
this.init();
|
this.init();
|
||||||
this.setInitialFocus();
|
this.setInitialFocus();
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget));
|
+ net.minecraftforge.client.event.ScreenEvent.Init.Post.BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
protected void fadeWidgets(float p_409453_) {
|
||||||
@@ -353,6 +_,7 @@
|
@@ -389,6 +_,7 @@
|
||||||
|
|
||||||
this.renderBlurredBackground();
|
this.renderBlurredBackground(p_283688_);
|
||||||
this.renderMenuBackground(p_283688_);
|
this.renderMenuBackground(p_283688_);
|
||||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderScreenBackground(this, p_283688_);
|
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderScreenBackground(this, p_283688_);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderBlurredBackground() {
|
protected void renderBlurredBackground(GuiGraphics p_407253_) {
|
||||||
@@ -453,6 +_,19 @@
|
@@ -492,6 +_,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFilesDrop(List<Path> p_96591_) {
|
public void onFilesDrop(List<Path> p_96591_) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/TitleScreen.java
|
--- a/net/minecraft/client/gui/screens/TitleScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
|
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
|
||||||
@@ -58,6 +_,7 @@
|
@@ -54,6 +_,7 @@
|
||||||
private boolean fading;
|
private boolean fading;
|
||||||
private long fadeInStart;
|
private long fadeInStart;
|
||||||
private final LogoRenderer logoRenderer;
|
private final LogoRenderer logoRenderer;
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
public TitleScreen() {
|
public TitleScreen() {
|
||||||
this(false);
|
this(false);
|
||||||
@@ -111,11 +_,15 @@
|
@@ -106,11 +_,15 @@
|
||||||
int j = this.width - i - 2;
|
int j = this.width - i - 2;
|
||||||
int k = 24;
|
int k = 24;
|
||||||
int l = this.height / 4 + 48;
|
int l = this.height / 4 + 48;
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
l = this.createTestWorldButton(l, 24);
|
l = this.createTestWorldButton(l, 24);
|
||||||
SpriteIconButton spriteiconbutton = this.addRenderableWidget(
|
SpriteIconButton spriteiconbutton = this.addRenderableWidget(
|
||||||
@@ -180,7 +_,7 @@
|
@@ -175,7 +_,7 @@
|
||||||
}).bounds(this.width / 2 - 100, i = p_96764_ + p_96765_, 200, 20).tooltip(tooltip).build()).active = flag;
|
}).bounds(this.width / 2 - 100, i = p_96764_ + p_96765_, 200, 20).tooltip(tooltip).build()).active = flag;
|
||||||
this.addRenderableWidget(
|
this.addRenderableWidget(
|
||||||
Button.builder(Component.translatable("menu.online"), p_325369_ -> this.minecraft.setScreen(new RealmsMainScreen(this)))
|
Button.builder(Component.translatable("menu.online"), p_325369_ -> this.minecraft.setScreen(new RealmsMainScreen(this)))
|
||||||
@@ -33,30 +33,22 @@
|
|||||||
.tooltip(tooltip)
|
.tooltip(tooltip)
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
@@ -289,6 +_,7 @@
|
@@ -295,9 +_,18 @@
|
||||||
if ((i & -67108864) != 0) {
|
s = s + I18n.get("menu.modded");
|
||||||
super.render(p_282860_, p_281753_, p_283539_, p_282628_);
|
}
|
||||||
this.logoRenderer.renderLogo(p_282860_, this.width, f);
|
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_282860_, this.font, this.width, this.height, i);
|
|
||||||
if (this.splash != null && !this.minecraft.options.hideSplashTexts().get()) {
|
|
||||||
this.splash.render(p_282860_, this.width, this.font, i);
|
|
||||||
}
|
|
||||||
@@ -304,10 +_,18 @@
|
|
||||||
s = s + I18n.get("menu.modded");
|
|
||||||
}
|
|
||||||
|
|
||||||
- p_282860_.drawString(this.font, s, 2, this.height - 10, 16777215 | i);
|
- p_282860_.drawString(this.font, s, 2, this.height - 10, ARGB.color(f, -1));
|
||||||
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brd, brdline) ->
|
+ final float f_f = f;
|
||||||
+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), 16777215 | i)
|
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brd, brdline) ->
|
||||||
+ );
|
+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), ARGB.color(f_f, -1))
|
||||||
|
+ );
|
||||||
+
|
+
|
||||||
+ net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brd, brdline) ->
|
+ net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brd, brdline) ->
|
||||||
+ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), 16777215 | i)
|
+ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), ARGB.color(f_f, -1))
|
||||||
+ );
|
+ );
|
||||||
+
|
+
|
||||||
if (this.realmsNotificationsEnabled() && f >= 1.0F) {
|
if (this.realmsNotificationsEnabled() && f >= 1.0F) {
|
||||||
this.realmsNotificationsScreen.render(p_282860_, p_281753_, p_283539_, p_282628_);
|
this.realmsNotificationsScreen.render(p_282860_, p_281753_, p_283539_, p_282628_);
|
||||||
}
|
|
||||||
+ if (f >= 1.0f) this.modUpdateNotification.render(p_282860_, p_281753_, p_283539_, p_282628_);
|
+ if (f >= 1.0f) this.modUpdateNotification.render(p_282860_, p_281753_, p_283539_, p_282628_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@
|
|||||||
public AdvancementTabType getType() {
|
public AdvancementTabType getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
@@ -148,8 +_,8 @@
|
@@ -145,8 +_,8 @@
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
for (AdvancementTabType advancementtabtype : AdvancementTabType.values()) {
|
for (AdvancementTabType advancementtabtype : AdvancementTabType.values()) {
|
||||||
|
|||||||
+4
-4
@@ -37,8 +37,8 @@
|
|||||||
this.advancements.setSelectedTab(advancementtab.getRootNode().holder(), true);
|
this.advancements.setSelectedTab(advancementtab.getRootNode().holder(), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -181,10 +_,12 @@
|
@@ -183,10 +_,12 @@
|
||||||
p_283395_.blit(RenderType::guiTextured, WINDOW_LOCATION, p_281890_, p_282532_, 0.0F, 0.0F, 252, 140, 256, 256);
|
p_283395_.blit(RenderPipelines.GUI_TEXTURED, WINDOW_LOCATION, p_281890_, p_282532_, 0.0F, 0.0F, 252, 140, 256, 256);
|
||||||
if (this.tabs.size() > 1) {
|
if (this.tabs.size() > 1) {
|
||||||
for (AdvancementTab advancementtab : this.tabs.values()) {
|
for (AdvancementTab advancementtab : this.tabs.values()) {
|
||||||
+ if (advancementtab.getPage() == tabPage)
|
+ if (advancementtab.getPage() == tabPage)
|
||||||
@@ -50,11 +50,11 @@
|
|||||||
advancementtab1.drawIcon(p_283395_, p_281890_, p_282532_);
|
advancementtab1.drawIcon(p_283395_, p_281890_, p_282532_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,6 +_,7 @@
|
@@ -205,6 +_,7 @@
|
||||||
|
|
||||||
if (this.tabs.size() > 1) {
|
if (this.tabs.size() > 1) {
|
||||||
for (AdvancementTab advancementtab : this.tabs.values()) {
|
for (AdvancementTab advancementtab : this.tabs.values()) {
|
||||||
+ if (advancementtab.getPage() == tabPage)
|
+ if (advancementtab.getPage() == tabPage)
|
||||||
if (advancementtab.isMouseOver(p_281519_, p_283371_, p_283556_, p_282458_)) {
|
if (advancementtab.isMouseOver(p_281519_, p_283371_, p_283556_, p_282458_)) {
|
||||||
p_282784_.renderTooltip(this.font, advancementtab.getTitle(), p_283556_, p_282458_);
|
p_282784_.setTooltipForNextFrame(this.font, advancementtab.getTitle(), p_283556_, p_282458_);
|
||||||
}
|
}
|
||||||
+27
-25
@@ -1,42 +1,42 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
|
||||||
@@ -106,6 +_,7 @@
|
@@ -107,6 +_,7 @@
|
||||||
int i = this.leftPos;
|
int i = this.leftPos;
|
||||||
int j = this.topPos;
|
int j = this.topPos;
|
||||||
super.render(p_283479_, p_283661_, p_281248_, p_281886_);
|
super.render(p_409971_, p_409213_, p_408205_, p_408282_);
|
||||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderBackground(this, p_283479_, p_283661_, p_281248_);
|
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderBackground(this, p_409971_, p_409213_, p_408205_);
|
||||||
p_283479_.pose().pushPose();
|
p_409971_.pose().pushMatrix();
|
||||||
p_283479_.pose().translate(i, j, 0.0F);
|
p_409971_.pose().translate(i, j);
|
||||||
Slot slot = this.hoveredSlot;
|
this.renderLabels(p_409971_, p_409213_, p_408205_);
|
||||||
@@ -117,6 +_,8 @@
|
@@ -119,6 +_,8 @@
|
||||||
this.onStopHovering(slot);
|
this.onStopHovering(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderForeground(this, p_283479_, p_283661_, p_281248_);
|
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderForeground(this, p_409971_, p_409213_, p_408205_);
|
||||||
+
|
+
|
||||||
this.renderLabels(p_283479_, p_283661_, p_281248_);
|
p_409971_.pose().popMatrix();
|
||||||
ItemStack itemstack = this.draggingItem.isEmpty() ? this.menu.getCarried() : this.draggingItem;
|
}
|
||||||
if (!itemstack.isEmpty()) {
|
|
||||||
@@ -197,7 +_,7 @@
|
@@ -202,7 +_,7 @@
|
||||||
ItemStack itemstack = this.hoveredSlot.getItem();
|
ItemStack itemstack = this.hoveredSlot.getItem();
|
||||||
if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(itemstack)) {
|
if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(itemstack)) {
|
||||||
p_283594_.renderTooltip(
|
p_283594_.setTooltipForNextFrame(
|
||||||
- this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), p_282171_, p_281909_, itemstack.get(DataComponents.TOOLTIP_STYLE)
|
- this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), p_282171_, p_281909_, itemstack.get(DataComponents.TOOLTIP_STYLE)
|
||||||
+ this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), itemstack, p_282171_, p_281909_
|
+ this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), itemstack, p_282171_, p_281909_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,7 +_,8 @@
|
@@ -218,7 +_,8 @@
|
||||||
p_282567_.pose().pushPose();
|
|
||||||
p_282567_.pose().translate(0.0F, 0.0F, 232.0F);
|
private void renderFloatingItem(GuiGraphics p_282567_, ItemStack p_281330_, int p_281772_, int p_281689_, @Nullable String p_282568_) {
|
||||||
p_282567_.renderItem(p_281330_, p_281772_, p_281689_);
|
p_282567_.renderItem(p_281330_, p_281772_, p_281689_);
|
||||||
- p_282567_.renderItemDecorations(this.font, p_281330_, p_281772_, p_281689_ - (this.draggingItem.isEmpty() ? 0 : 8), p_282568_);
|
- p_282567_.renderItemDecorations(this.font, p_281330_, p_281772_, p_281689_ - (this.draggingItem.isEmpty() ? 0 : 8), p_282568_);
|
||||||
+ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_281330_).getFont(p_281330_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT);
|
+ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_281330_).getFont(p_281330_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT);
|
||||||
+ p_282567_.renderItemDecorations(font == null ? this.font : font, p_281330_, p_281772_, p_281689_ - (this.draggingItem.isEmpty() ? 0 : 8), p_282568_);
|
+ p_282567_.renderItemDecorations(font == null ? this.font : font, p_281330_, p_281772_, p_281689_ - (this.draggingItem.isEmpty() ? 0 : 8), p_282568_);
|
||||||
p_282567_.pose().popPose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +_,8 @@
|
protected void renderLabels(GuiGraphics p_281635_, int p_282681_, int p_283686_) {
|
||||||
|
@@ -319,7 +_,8 @@
|
||||||
if (super.mouseClicked(p_97748_, p_97749_, p_97750_)) {
|
if (super.mouseClicked(p_97748_, p_97749_, p_97750_)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
Slot slot = this.getHoveredSlot(p_97748_, p_97749_);
|
Slot slot = this.getHoveredSlot(p_97748_, p_97749_);
|
||||||
long i = Util.getMillis();
|
long i = Util.getMillis();
|
||||||
this.doubleclick = this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == p_97750_;
|
this.doubleclick = this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == p_97750_;
|
||||||
@@ -332,6 +_,7 @@
|
@@ -330,6 +_,7 @@
|
||||||
int j = this.leftPos;
|
int j = this.leftPos;
|
||||||
int k = this.topPos;
|
int k = this.topPos;
|
||||||
boolean flag1 = this.hasClickedOutside(p_97748_, p_97749_, j, k, p_97750_);
|
boolean flag1 = this.hasClickedOutside(p_97748_, p_97749_, j, k, p_97750_);
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
int l = -1;
|
int l = -1;
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
l = slot.index;
|
l = slot.index;
|
||||||
@@ -357,7 +_,7 @@
|
@@ -355,7 +_,7 @@
|
||||||
}
|
}
|
||||||
} else if (!this.isQuickCrafting) {
|
} else if (!this.isQuickCrafting) {
|
||||||
if (this.menu.getCarried().isEmpty()) {
|
if (this.menu.getCarried().isEmpty()) {
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
this.slotClicked(slot, l, p_97750_, ClickType.CLONE);
|
this.slotClicked(slot, l, p_97750_, ClickType.CLONE);
|
||||||
} else {
|
} else {
|
||||||
boolean flag2 = l != -999
|
boolean flag2 = l != -999
|
||||||
@@ -385,7 +_,7 @@
|
@@ -383,7 +_,7 @@
|
||||||
this.quickCraftingType = 0;
|
this.quickCraftingType = 0;
|
||||||
} else if (p_97750_ == 1) {
|
} else if (p_97750_ == 1) {
|
||||||
this.quickCraftingType = 1;
|
this.quickCraftingType = 1;
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
this.quickCraftingType = 2;
|
this.quickCraftingType = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -461,10 +_,13 @@
|
@@ -459,10 +_,13 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseReleased(double p_97812_, double p_97813_, int p_97814_) {
|
public boolean mouseReleased(double p_97812_, double p_97813_, int p_97814_) {
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
int k = -1;
|
int k = -1;
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
k = slot.index;
|
k = slot.index;
|
||||||
@@ -481,7 +_,7 @@
|
@@ -479,7 +_,7 @@
|
||||||
if (slot2 != null
|
if (slot2 != null
|
||||||
&& slot2.mayPickup(this.minecraft.player)
|
&& slot2.mayPickup(this.minecraft.player)
|
||||||
&& slot2.hasItem()
|
&& slot2.hasItem()
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
this.onClose();
|
this.onClose();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -698,4 +_,11 @@
|
@@ -698,6 +_,13 @@
|
||||||
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
@@ -127,4 +127,6 @@
|
|||||||
+ public int getGuiTop() { return topPos; }
|
+ public int getGuiTop() { return topPos; }
|
||||||
+ public int getXSize() { return imageWidth; }
|
+ public int getXSize() { return imageWidth; }
|
||||||
+ public int getYSize() { return imageHeight; }
|
+ public int getYSize() { return imageHeight; }
|
||||||
}
|
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
record SnapbackData(ItemStack item, Vector2i start, Vector2i end, long time) {
|
||||||
+23
-32
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
|
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
|
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
|
||||||
@@ -114,6 +_,8 @@
|
@@ -113,6 +_,8 @@
|
||||||
private final Set<TagKey<Item>> visibleTags = new HashSet<>();
|
private final Set<TagKey<Item>> visibleTags = new HashSet<>();
|
||||||
private final boolean displayOperatorCreativeTab;
|
private final boolean displayOperatorCreativeTab;
|
||||||
private final EffectsInInventory effects;
|
private final EffectsInInventory effects;
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
public CreativeModeInventoryScreen(LocalPlayer p_344408_, FeatureFlagSet p_260074_, boolean p_259569_) {
|
public CreativeModeInventoryScreen(LocalPlayer p_344408_, FeatureFlagSet p_260074_, boolean p_259569_) {
|
||||||
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_344408_), p_344408_.getInventory(), CommonComponents.EMPTY);
|
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_344408_), p_344408_.getInventory(), CommonComponents.EMPTY);
|
||||||
@@ -162,7 +_,7 @@
|
@@ -161,7 +_,7 @@
|
||||||
private void refreshCurrentTabContents(Collection<ItemStack> p_261591_) {
|
private void refreshCurrentTabContents(Collection<ItemStack> p_261591_) {
|
||||||
int i = this.menu.getRowIndexForScroll(this.scrollOffs);
|
int i = this.menu.getRowIndexForScroll(this.scrollOffs);
|
||||||
this.menu.items.clear();
|
this.menu.items.clear();
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
this.refreshSearchResults();
|
this.refreshSearchResults();
|
||||||
} else {
|
} else {
|
||||||
this.menu.items.addAll(p_261591_);
|
this.menu.items.addAll(p_261591_);
|
||||||
@@ -330,6 +_,35 @@
|
@@ -329,6 +_,35 @@
|
||||||
protected void init() {
|
protected void init() {
|
||||||
if (this.minecraft.player.hasInfiniteMaterials()) {
|
if (this.minecraft.player.hasInfiniteMaterials()) {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search"));
|
this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search"));
|
||||||
this.searchBox.setMaxLength(50);
|
this.searchBox.setMaxLength(50);
|
||||||
this.searchBox.setBordered(false);
|
this.searchBox.setBordered(false);
|
||||||
@@ -376,7 +_,7 @@
|
@@ -375,7 +_,7 @@
|
||||||
public boolean charTyped(char p_98521_, int p_98522_) {
|
public boolean charTyped(char p_98521_, int p_98522_) {
|
||||||
if (this.ignoreTextInput) {
|
if (this.ignoreTextInput) {
|
||||||
return false;
|
return false;
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
String s = this.searchBox.getValue();
|
String s = this.searchBox.getValue();
|
||||||
@@ -395,7 +_,7 @@
|
@@ -394,7 +_,7 @@
|
||||||
@Override
|
@Override
|
||||||
public boolean keyPressed(int p_98547_, int p_98548_, int p_98549_) {
|
public boolean keyPressed(int p_98547_, int p_98548_, int p_98549_) {
|
||||||
this.ignoreTextInput = false;
|
this.ignoreTextInput = false;
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
if (this.minecraft.options.keyChat.matches(p_98547_, p_98548_)) {
|
if (this.minecraft.options.keyChat.matches(p_98547_, p_98548_)) {
|
||||||
this.ignoreTextInput = true;
|
this.ignoreTextInput = true;
|
||||||
this.selectTab(CreativeModeTabs.searchTab());
|
this.selectTab(CreativeModeTabs.searchTab());
|
||||||
@@ -431,6 +_,7 @@
|
@@ -430,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshSearchResults() {
|
private void refreshSearchResults() {
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
this.menu.items.clear();
|
this.menu.items.clear();
|
||||||
this.visibleTags.clear();
|
this.visibleTags.clear();
|
||||||
String s = this.searchBox.getValue();
|
String s = this.searchBox.getValue();
|
||||||
@@ -443,10 +_,10 @@
|
@@ -442,10 +_,10 @@
|
||||||
SearchTree<ItemStack> searchtree;
|
SearchTree<ItemStack> searchtree;
|
||||||
if (s.startsWith("#")) {
|
if (s.startsWith("#")) {
|
||||||
s = s.substring(1);
|
s = s.substring(1);
|
||||||
@@ -93,17 +93,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
|
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
|
||||||
@@ -478,7 +_,8 @@
|
@@ -477,7 +_,8 @@
|
||||||
@Override
|
@Override
|
||||||
protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
|
protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
|
||||||
if (selectedTab.showTitle()) {
|
if (selectedTab.showTitle()) {
|
||||||
- p_283168_.drawString(this.font, selectedTab.getDisplayName(), 8, 6, 4210752, false);
|
- p_283168_.drawString(this.font, selectedTab.getDisplayName(), 8, 6, -12566464, false);
|
||||||
+ com.mojang.blaze3d.opengl.GlStateManager._disableBlend();
|
+ com.mojang.blaze3d.opengl.GlStateManager._disableBlend();
|
||||||
+ p_283168_.drawString(this.font, selectedTab.getDisplayName(), 8, 6, selectedTab.getLabelColor(), false);
|
+ p_283168_.drawString(this.font, selectedTab.getDisplayName(), 8, 6, selectedTab.getLabelColor(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,7 +_,7 @@
|
@@ -487,7 +_,7 @@
|
||||||
double d0 = p_98531_ - this.leftPos;
|
double d0 = p_98531_ - this.leftPos;
|
||||||
double d1 = p_98532_ - this.topPos;
|
double d1 = p_98532_ - this.topPos;
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -510,7 +_,7 @@
|
@@ -509,7 +_,7 @@
|
||||||
double d1 = p_98623_ - this.topPos;
|
double d1 = p_98623_ - this.topPos;
|
||||||
this.scrolling = false;
|
this.scrolling = false;
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
||||||
this.selectTab(creativemodetab);
|
this.selectTab(creativemodetab);
|
||||||
return true;
|
return true;
|
||||||
@@ -604,13 +_,15 @@
|
@@ -603,13 +_,15 @@
|
||||||
this.originalSlots = null;
|
this.originalSlots = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,31 +138,22 @@
|
|||||||
|
|
||||||
this.refreshSearchResults();
|
this.refreshSearchResults();
|
||||||
} else {
|
} else {
|
||||||
@@ -673,7 +_,15 @@
|
@@ -673,7 +_,14 @@
|
||||||
super.render(p_283000_, p_281317_, p_282770_, p_281295_);
|
super.render(p_283000_, p_281317_, p_282770_, p_281295_);
|
||||||
this.effects.render(p_283000_, p_281317_, p_282770_, p_281295_);
|
this.effects.renderTooltip(p_283000_, p_281317_, p_282770_);
|
||||||
|
|
||||||
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||||
+ if (this.pages.size() != 1) {
|
+ if (this.pages.size() != 1) {
|
||||||
+ Component page = Component.literal(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size()));
|
+ Component page = Component.literal(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size()));
|
||||||
+ p_283000_.pose().pushPose();
|
+ p_283000_.pose().pushMatrix();
|
||||||
+ p_283000_.pose().translate(0F, 0F, 300F);
|
|
||||||
+ p_283000_.drawString(font, page.getVisualOrderText(), leftPos + (imageWidth / 2) - (font.width(page) / 2), topPos - 44, -1);
|
+ p_283000_.drawString(font, page.getVisualOrderText(), leftPos + (imageWidth / 2) - (font.width(page) / 2), topPos - 44, -1);
|
||||||
+ p_283000_.pose().popPose();
|
+ p_283000_.pose().popMatrix();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||||
if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
|
if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -685,6 +_,7 @@
|
|
||||||
p_283000_.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, p_281317_, p_282770_);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ com.mojang.blaze3d.systems.RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
this.renderTooltip(p_283000_, p_281317_, p_282770_);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -697,7 +_,7 @@
|
@@ -697,7 +_,7 @@
|
||||||
public List<Component> getTooltipFromContainerItem(ItemStack p_281769_) {
|
public List<Component> getTooltipFromContainerItem(ItemStack p_281769_) {
|
||||||
boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
|
boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
|
||||||
@@ -177,7 +168,7 @@
|
|||||||
|
|
||||||
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||||
- if (creativemodetab.getType() != CreativeModeTab.Type.SEARCH && creativemodetab.contains(p_281769_)) {
|
- if (creativemodetab.getType() != CreativeModeTab.Type.SEARCH && creativemodetab.contains(p_281769_)) {
|
||||||
+ if (creativemodetab.hasSearchBar() && creativemodetab.contains(p_281769_)) {
|
+ if (!creativemodetab.hasSearchBar() && creativemodetab.contains(p_281769_)) {
|
||||||
list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
|
list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,7 +182,7 @@
|
|||||||
this.renderTabButton(p_282663_, creativemodetab);
|
this.renderTabButton(p_282663_, creativemodetab);
|
||||||
}
|
}
|
||||||
@@ -745,6 +_,7 @@
|
@@ -745,6 +_,7 @@
|
||||||
p_282663_.blitSprite(RenderType::guiTextured, resourcelocation, j, k + (int)((i - k - 17) * this.scrollOffs), 12, 15);
|
p_282663_.blitSprite(RenderPipelines.GUI_TEXTURED, resourcelocation, j, k + (int)((i - k - 17) * this.scrollOffs), 12, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (currentPage.getVisibleTabs().contains(selectedTab)) //Forge: only display tab selection when the selected tab is on the current page
|
+ if (currentPage.getVisibleTabs().contains(selectedTab)) //Forge: only display tab selection when the selected tab is on the current page
|
||||||
@@ -232,10 +223,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
|
+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
|
||||||
p_283590_.blitSprite(RenderType::guiTextured, aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32);
|
p_283590_.blitSprite(RenderPipelines.GUI_TEXTURED, aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32);
|
||||||
p_283590_.pose().pushPose();
|
int l = j + 13 - 8;
|
||||||
p_283590_.pose().translate(0.0F, 0.0F, 100.0F);
|
int i1 = k + 16 - 8 + (flag1 ? 1 : -1);
|
||||||
@@ -855,6 +_,14 @@
|
@@ -850,6 +_,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +241,7 @@
|
|||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
static class CustomCreativeSlot extends Slot {
|
static class CustomCreativeSlot extends Slot {
|
||||||
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
|
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
|
||||||
@@ -1036,6 +_,22 @@
|
@@ -1031,6 +_,22 @@
|
||||||
@Override
|
@Override
|
||||||
public boolean mayPickup(Player p_98665_) {
|
public boolean mayPickup(Player p_98665_) {
|
||||||
return this.target.mayPickup(p_98665_);
|
return this.target.mayPickup(p_98665_);
|
||||||
|
|||||||
+8
-8
@@ -1,11 +1,11 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
|
--- a/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
|
||||||
+++ b/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
|
+++ b/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
|
||||||
@@ -48,12 +_,16 @@
|
@@ -47,12 +_,16 @@
|
||||||
Collection<MobEffectInstance> collection = this.minecraft.player.getActiveEffects();
|
Collection<MobEffectInstance> collection = this.minecraft.player.getActiveEffects();
|
||||||
if (!collection.isEmpty() && j >= 32) {
|
if (!collection.isEmpty() && j >= 32) {
|
||||||
boolean flag = j >= 120;
|
boolean flag = j >= 120;
|
||||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, j, !flag, i);
|
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, j, !flag, i);
|
||||||
+ if (event.isCanceled()) return;
|
+ if (event == null) return;
|
||||||
+ flag = !event.isCompact();
|
+ flag = !event.isCompact();
|
||||||
+ i = event.getHorizontalOffset();
|
+ i = event.getHorizontalOffset();
|
||||||
int k = 33;
|
int k = 33;
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
this.renderBackgrounds(p_362146_, i, k, iterable, flag);
|
this.renderBackgrounds(p_362146_, i, k, iterable, flag);
|
||||||
this.renderIcons(p_362146_, i, k, iterable, flag);
|
this.renderIcons(p_362146_, i, k, iterable, flag);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@@ -99,6 +_,11 @@
|
@@ -98,6 +_,11 @@
|
||||||
int i = this.screen.topPos;
|
int i = this.screen.topPos;
|
||||||
|
|
||||||
for (MobEffectInstance mobeffectinstance : p_361981_) {
|
for (MobEffectInstance mobeffectinstance : p_361981_) {
|
||||||
@@ -28,9 +28,9 @@
|
|||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
Holder<MobEffect> holder = mobeffectinstance.getEffect();
|
Holder<MobEffect> holder = mobeffectinstance.getEffect();
|
||||||
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder);
|
ResourceLocation resourcelocation = Gui.getMobEffectSprite(holder);
|
||||||
p_367085_.blitSprite(RenderType::guiTextured, textureatlassprite, p_367644_ + (p_368681_ ? 6 : 7), i + 7, 18, 18);
|
p_367085_.blitSprite(RenderPipelines.GUI_TEXTURED, resourcelocation, p_367644_ + (p_368681_ ? 6 : 7), i + 7, 18, 18);
|
||||||
@@ -110,6 +_,11 @@
|
@@ -109,6 +_,11 @@
|
||||||
int i = this.screen.topPos;
|
int i = this.screen.topPos;
|
||||||
|
|
||||||
for (MobEffectInstance mobeffectinstance : p_365480_) {
|
for (MobEffectInstance mobeffectinstance : p_365480_) {
|
||||||
@@ -40,9 +40,9 @@
|
|||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
Component component = this.getEffectName(mobeffectinstance);
|
Component component = this.getEffectName(mobeffectinstance);
|
||||||
p_361851_.drawString(this.screen.getFont(), component, p_367468_ + 10 + 18, i + 6, 16777215);
|
p_361851_.drawString(this.screen.getFont(), component, p_367468_ + 10 + 18, i + 6, -1);
|
||||||
Component component1 = MobEffectUtil.formatDuration(mobeffectinstance, 1.0F, this.minecraft.level.tickRateManager().tickrate());
|
Component component1 = MobEffectUtil.formatDuration(mobeffectinstance, 1.0F, this.minecraft.level.tickRateManager().tickrate());
|
||||||
@@ -125,5 +_,9 @@
|
@@ -124,5 +_,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return mutablecomponent;
|
return mutablecomponent;
|
||||||
|
|||||||
+6
-6
@@ -1,15 +1,15 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||||
@@ -109,7 +_,7 @@
|
@@ -106,7 +_,7 @@
|
||||||
int l1 = 86 - this.font.width(s);
|
int l1 = 86 - this.font.width(s);
|
||||||
FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1);
|
FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1);
|
||||||
int i2 = 6839882;
|
int i2 = -9937334;
|
||||||
- if ((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.hasInfiniteMaterials()) {
|
- if ((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.hasInfiniteMaterials()) {
|
||||||
+ if (((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.hasInfiniteMaterials()) || this.menu.enchantClue[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels{
|
+ if (((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.hasInfiniteMaterials()) || this.menu.enchantClue[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels{
|
||||||
p_282430_.blitSprite(RenderType::guiTextured, ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
|
p_282430_.blitSprite(RenderPipelines.GUI_TEXTURED, ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
|
||||||
p_282430_.blitSprite(RenderType::guiTextured, DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
|
p_282430_.blitSprite(RenderPipelines.GUI_TEXTURED, DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
|
||||||
p_282430_.drawWordWrap(this.font, formattedtext, j1, j + 16 + 19 * l, l1, (i2 & 16711422) >> 1, false);
|
p_282430_.drawWordWrap(this.font, formattedtext, j1, j + 16 + 19 * l, l1, ARGB.opaque((i2 & 16711422) >> 1), false);
|
||||||
@@ -175,13 +_,16 @@
|
@@ -157,13 +_,16 @@
|
||||||
.registryAccess()
|
.registryAccess()
|
||||||
.lookupOrThrow(Registries.ENCHANTMENT)
|
.lookupOrThrow(Registries.ENCHANTMENT)
|
||||||
.get(this.menu.enchantClue[j]);
|
.get(this.menu.enchantClue[j]);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
|
--- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
|
+++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
|
||||||
@@ -16,7 +_,7 @@
|
@@ -15,7 +_,7 @@
|
||||||
private static final Vector3f TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
|
private static final Vector3f TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
|
||||||
private static final int TEXTURE_WIDTH = 16;
|
private static final int TEXTURE_WIDTH = 16;
|
||||||
private static final int TEXTURE_HEIGHT = 16;
|
private static final int TEXTURE_HEIGHT = 16;
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
|
--- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
|
+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
|
||||||
@@ -232,6 +_,14 @@
|
@@ -229,6 +_,14 @@
|
||||||
} else {
|
} else {
|
||||||
p_281357_.renderItemDecorations(this.font, p_282046_, p_282403_, p_283601_, p_282046_.getCount() == 1 ? "1" : null);
|
p_281357_.renderItemDecorations(this.font, p_282046_, p_282403_, p_283601_, p_282046_.getCount() == 1 ? "1" : null);
|
||||||
p_281357_.renderItemDecorations(this.font, p_283466_, p_282403_ + 14, p_283601_, p_283466_.getCount() == 1 ? "1" : null);
|
p_281357_.renderItemDecorations(this.font, p_283466_, p_282403_ + 14, p_283601_, p_283466_.getCount() == 1 ? "1" : null);
|
||||||
@@ -12,6 +12,6 @@
|
|||||||
+ font.drawInBatch(count, (float) (p_282403_ + 14) + 19 - 2 - font.width(count), (float)p_283601_ + 6 + 3, 0xFFFFFF, true, p_281357_.pose().last().pose(), p_281357_.bufferSource(), net.minecraft.client.gui.Font.DisplayMode.NORMAL, 0, 15728880, false);
|
+ font.drawInBatch(count, (float) (p_282403_ + 14) + 19 - 2 - font.width(count), (float)p_283601_ + 6 + 3, 0xFFFFFF, true, p_281357_.pose().last().pose(), p_281357_.bufferSource(), net.minecraft.client.gui.Font.DisplayMode.NORMAL, 0, 15728880, false);
|
||||||
+ p_281357_.pose().popPose();
|
+ p_281357_.pose().popPose();
|
||||||
+ */
|
+ */
|
||||||
p_281357_.pose().pushPose();
|
p_281357_.blitSprite(RenderPipelines.GUI_TEXTURED, DISCOUNT_STRIKETHRUOGH_SPRITE, p_282403_ + 7, p_283601_ + 12, 9, 2);
|
||||||
p_281357_.pose().translate(0.0F, 0.0F, 300.0F);
|
}
|
||||||
p_281357_.blitSprite(RenderType::guiTextured, DISCOUNT_STRIKETHRUOGH_SPRITE, p_282403_ + 7, p_283601_ + 12, 9, 2);
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||||
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||||
@@ -22,7 +_,7 @@
|
@@ -20,7 +_,7 @@
|
||||||
case ClientActivePlayersTooltip.ActivePlayersTooltip clientactiveplayerstooltip$activeplayerstooltip -> new ClientActivePlayersTooltip(
|
case ClientActivePlayersTooltip.ActivePlayersTooltip clientactiveplayerstooltip$activeplayerstooltip -> new ClientActivePlayersTooltip(
|
||||||
clientactiveplayerstooltip$activeplayerstooltip
|
clientactiveplayerstooltip$activeplayerstooltip
|
||||||
);
|
);
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||||
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||||
@@ -371,6 +_,8 @@
|
@@ -371,6 +_,8 @@
|
||||||
this.screen.setTooltipForNextRenderPass(Lists.transform(this.onlinePlayersTooltip, Component::getVisualOrderText));
|
p_281406_.setTooltipForNextFrame(Lists.transform(this.onlinePlayersTooltip, Component::getVisualOrderText), p_283567_, p_282864_);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.screen, serverData, p_281406_, p_281363_, p_282921_, p_283596_, p_283567_ - p_281363_, p_282864_ - p_282921_);
|
+ net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.screen, serverData, p_281406_, p_281363_, p_282921_, p_283596_, p_283567_ - p_281363_, p_282864_ - p_282921_);
|
||||||
|
|||||||
+2
-2
@@ -6,6 +6,6 @@
|
|||||||
p_100014_.setSelected(null);
|
p_100014_.setSelected(null);
|
||||||
- p_100015_.forEach(
|
- p_100015_.forEach(
|
||||||
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach(
|
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach(
|
||||||
p_389318_ -> {
|
p_404866_ -> {
|
||||||
TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(
|
TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(
|
||||||
this.minecraft, p_100014_, p_389318_
|
this.minecraft, p_100014_, p_404866_
|
||||||
+5
-5
@@ -11,13 +11,13 @@
|
|||||||
@@ -400,6 +_,7 @@
|
@@ -400,6 +_,7 @@
|
||||||
p_281612_.drawString(this.minecraft.font, s1, p_282820_ + 32 + 3, p_283181_ + 9 + 3, -8355712);
|
p_281612_.drawString(this.minecraft.font, s1, p_282820_ + 32 + 3, p_283181_ + 9 + 3, -8355712);
|
||||||
p_281612_.drawString(this.minecraft.font, component, p_282820_ + 32 + 3, p_283181_ + 9 + 9 + 3, -8355712);
|
p_281612_.drawString(this.minecraft.font, component, p_282820_ + 32 + 3, p_283181_ + 9 + 9 + 3, -8355712);
|
||||||
p_281612_.blit(RenderType::guiTextured, this.icon.textureLocation(), p_282820_, p_283181_, 0.0F, 0.0F, 32, 32, 32, 32);
|
p_281612_.blit(RenderPipelines.GUI_TEXTURED, this.icon.textureLocation(), p_282820_, p_283181_, 0.0F, 0.0F, 32, 32, 32, 32);
|
||||||
+ renderExperimentalWarning(p_281612_, p_283204_, p_283025_, p_283181_, p_282820_);
|
+ renderExperimentalWarning(p_281612_, p_283204_, p_283025_, p_283181_, p_282820_);
|
||||||
if (this.minecraft.options.touchscreen().get() || p_283396_) {
|
if (this.minecraft.options.touchscreen().get() || p_283396_) {
|
||||||
p_281612_.fill(p_282820_, p_283181_, p_282820_ + 32, p_283181_ + 32, -1601138544);
|
p_281612_.fill(p_282820_, p_283181_, p_282820_ + 32, p_283181_ + 32, -1601138544);
|
||||||
int j = p_283204_ - p_282820_;
|
int j = p_283204_ - p_282820_;
|
||||||
@@ -446,6 +_,19 @@
|
@@ -450,6 +_,19 @@
|
||||||
p_281612_.blitSprite(RenderType::guiTextured, resourcelocation, p_282820_, p_283181_, 32, 32);
|
p_281612_.blitSprite(RenderPipelines.GUI_TEXTURED, resourcelocation, p_282820_, p_283181_, 32, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ }
|
+ }
|
||||||
@@ -26,11 +26,11 @@
|
|||||||
+ private void renderExperimentalWarning(GuiGraphics guiGraphics, int mouseX, int mouseY, int top, int left) {
|
+ private void renderExperimentalWarning(GuiGraphics guiGraphics, int mouseX, int mouseY, int top, int left) {
|
||||||
+ if (this.summary.isLifecycleExperimental()) {
|
+ if (this.summary.isLifecycleExperimental()) {
|
||||||
+ int leftStart = left + WorldSelectionList.this.getRowWidth();
|
+ int leftStart = left + WorldSelectionList.this.getRowWidth();
|
||||||
+ guiGraphics.blit(RenderType::guiTextured, WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
|
+ guiGraphics.blit(RenderPipelines.GUI_TEXTURED, WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
|
||||||
+ if (WorldSelectionList.this.getEntryAtPosition(mouseX, mouseY) == this && mouseX > leftStart - 36 && mouseX < leftStart) {
|
+ if (WorldSelectionList.this.getEntryAtPosition(mouseX, mouseY) == this && mouseX > leftStart - 36 && mouseX < leftStart) {
|
||||||
+ var font = Minecraft.getInstance().font;
|
+ var font = Minecraft.getInstance().font;
|
||||||
+ List<net.minecraft.util.FormattedCharSequence> tooltip = font.split(Component.translatable("forge.experimentalsettings.tooltip"), 200);
|
+ List<net.minecraft.util.FormattedCharSequence> tooltip = font.split(Component.translatable("forge.experimentalsettings.tooltip"), 200);
|
||||||
+ guiGraphics.renderTooltip(font, tooltip, mouseX, mouseY);
|
+ guiGraphics.setTooltipForNextFrame(font, tooltip, mouseX, mouseY);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/main/Main.java
|
--- a/net/minecraft/client/main/Main.java
|
||||||
+++ b/net/minecraft/client/main/Main.java
|
+++ b/net/minecraft/client/main/Main.java
|
||||||
@@ -121,8 +_,8 @@
|
@@ -123,8 +_,8 @@
|
||||||
CrashReport.preload();
|
CrashReport.preload();
|
||||||
logger = LogUtils.getLogger();
|
logger = LogUtils.getLogger();
|
||||||
s1 = "Bootstrap";
|
s1 = "Bootstrap";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
|
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||||
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
|
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||||
@@ -497,6 +_,7 @@
|
@@ -505,6 +_,7 @@
|
||||||
builder.put(ModelLayers.createHangingSignModelName(p_374591_, hangingsignrenderer$attachmenttype), layerdefinition60);
|
builder.put(ModelLayers.createHangingSignModelName(p_374591_, hangingsignrenderer$attachmenttype), layerdefinition60);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/model/geom/ModelLayers.java
|
--- a/net/minecraft/client/model/geom/ModelLayers.java
|
||||||
+++ b/net/minecraft/client/model/geom/ModelLayers.java
|
+++ b/net/minecraft/client/model/geom/ModelLayers.java
|
||||||
@@ -330,15 +_,18 @@
|
@@ -336,15 +_,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModelLayerLocation createStandingSignModelName(WoodType p_171292_) {
|
public static ModelLayerLocation createStandingSignModelName(WoodType p_171292_) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
int i = this.storage.getIndex(p_298665_.x, p_298665_.z);
|
int i = this.storage.getIndex(p_298665_.x, p_298665_.z);
|
||||||
LevelChunk levelchunk = this.storage.getChunk(i);
|
LevelChunk levelchunk = this.storage.getChunk(i);
|
||||||
if (isValidChunk(levelchunk, p_298665_.x, p_298665_.z)) {
|
if (isValidChunk(levelchunk, p_298665_.x, p_298665_.z)) {
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Unload(levelchunk));
|
+ net.minecraftforge.event.level.ChunkEvent.Unload.BUS.post(new net.minecraftforge.event.level.ChunkEvent.Unload(levelchunk));
|
||||||
this.storage.drop(i, levelchunk);
|
this.storage.drop(i, levelchunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.level.onChunkLoaded(chunkpos);
|
this.level.onChunkLoaded(chunkpos);
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(levelchunk, false));
|
+ net.minecraftforge.event.level.ChunkEvent.Load.BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(levelchunk, false));
|
||||||
return levelchunk;
|
return levelchunk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
|
--- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
|
||||||
+++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
|
+++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
|
||||||
@@ -142,6 +_,7 @@
|
@@ -153,6 +_,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleCustomPayload(ClientboundCustomPayloadPacket p_298103_) {
|
public void handleCustomPayload(ClientboundCustomPayloadPacket p_298103_) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
||||||
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
||||||
@@ -147,6 +_,7 @@
|
@@ -157,6 +_,7 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
+3
-3
@@ -1,14 +1,14 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||||
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||||
@@ -209,6 +_,7 @@
|
@@ -208,6 +_,7 @@
|
||||||
Component component = this.wasTransferredTo ? CommonComponents.TRANSFER_CONNECT_FAILED : CommonComponents.CONNECT_FAILED;
|
Component component = this.wasTransferredTo ? CommonComponents.TRANSFER_CONNECT_FAILED : CommonComponents.CONNECT_FAILED;
|
||||||
if (this.serverData != null && this.serverData.isRealm()) {
|
if (this.serverData != null && this.serverData.isRealm()) {
|
||||||
this.minecraft.setScreen(new DisconnectedRealmsScreen(this.parent, component, p_342266_.reason()));
|
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_342266_.reason(), CommonComponents.GUI_BACK));
|
||||||
+ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, p_342266_.reason())) {
|
+ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, p_342266_.reason())) {
|
||||||
} else {
|
} else {
|
||||||
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_342266_));
|
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_342266_));
|
||||||
}
|
}
|
||||||
@@ -233,6 +_,7 @@
|
@@ -232,6 +_,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleCustomQuery(ClientboundCustomQueryPacket p_104545_) {
|
public void handleCustomQuery(ClientboundCustomQueryPacket p_104545_) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/ClientLevel.java
|
--- a/net/minecraft/client/multiplayer/ClientLevel.java
|
||||||
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
|
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
|
||||||
@@ -126,6 +_,7 @@
|
@@ -130,6 +_,7 @@
|
||||||
p_389331_.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_194177_ -> this.calculateBlockTint(p_194177_, BiomeColors.FOLIAGE_COLOR_RESOLVER)));
|
p_389331_.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_194177_ -> this.calculateBlockTint(p_194177_, BiomeColors.FOLIAGE_COLOR_RESOLVER)));
|
||||||
p_389331_.put(BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_389335_ -> this.calculateBlockTint(p_389335_, BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER)));
|
p_389331_.put(BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_389335_ -> this.calculateBlockTint(p_389335_, BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER)));
|
||||||
p_389331_.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(p_194168_ -> this.calculateBlockTint(p_194168_, BiomeColors.WATER_COLOR_RESOLVER)));
|
p_389331_.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(p_194168_ -> this.calculateBlockTint(p_194168_, BiomeColors.WATER_COLOR_RESOLVER)));
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
});
|
});
|
||||||
private final ClientChunkCache chunkSource;
|
private final ClientChunkCache chunkSource;
|
||||||
private final Deque<Runnable> lightUpdateQueue = Queues.newArrayDeque();
|
private final Deque<Runnable> lightUpdateQueue = Queues.newArrayDeque();
|
||||||
@@ -134,6 +_,8 @@
|
@@ -139,6 +_,8 @@
|
||||||
private final int seaLevel;
|
private final int seaLevel;
|
||||||
private boolean tickDayTime;
|
private boolean tickDayTime;
|
||||||
private static final Set<Item> MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT);
|
private static final Set<Item> MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT);
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
public void handleBlockChangedAck(int p_233652_) {
|
public void handleBlockChangedAck(int p_233652_) {
|
||||||
this.blockStatePredictionHandler.endPredictionsUpTo(p_233652_, this);
|
this.blockStatePredictionHandler.endPredictionsUpTo(p_233652_, this);
|
||||||
@@ -200,6 +_,8 @@
|
@@ -217,6 +_,8 @@
|
||||||
this.serverSimulationDistance = p_364305_;
|
this.serverSimulationDistance = p_364305_;
|
||||||
this.updateSkyBrightness();
|
this.updateSkyBrightness();
|
||||||
this.prepareWeather();
|
this.prepareWeather();
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void queueLightUpdate(Runnable p_194172_) {
|
public void queueLightUpdate(Runnable p_194172_) {
|
||||||
@@ -282,6 +_,7 @@
|
@@ -299,6 +_,7 @@
|
||||||
p_104640_.setOldPosAndRot();
|
p_104640_.setOldPosAndRot();
|
||||||
p_104640_.tickCount++;
|
p_104640_.tickCount++;
|
||||||
Profiler.get().push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_104640_.getType()).toString());
|
Profiler.get().push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_104640_.getType()).toString());
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
p_104640_.tick();
|
p_104640_.tick();
|
||||||
Profiler.get().pop();
|
Profiler.get().pop();
|
||||||
|
|
||||||
@@ -333,8 +_,10 @@
|
@@ -350,8 +_,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEntity(Entity p_104741_) {
|
public void addEntity(Entity p_104741_) {
|
||||||
@@ -45,12 +45,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeEntity(int p_171643_, Entity.RemovalReason p_171644_) {
|
public void removeEntity(int p_171643_, Entity.RemovalReason p_171644_) {
|
||||||
@@ -516,6 +_,12 @@
|
@@ -532,6 +_,12 @@
|
||||||
float p_263349_,
|
float p_263349_,
|
||||||
long p_263408_
|
long p_263408_
|
||||||
) {
|
) {
|
||||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_263372_, p_263404_, p_263365_, p_263335_, p_263417_, p_263416_, p_263349_);
|
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_263372_, p_263404_, p_263365_, p_263335_, p_263417_, p_263416_, p_263349_);
|
||||||
+ if (event.isCanceled() || event.getSound() == null) return;
|
+ if (event == null || event.getSound() == null) return;
|
||||||
+ p_263335_ = event.getSound();
|
+ p_263335_ = event.getSound();
|
||||||
+ p_263417_ = event.getSource();
|
+ p_263417_ = event.getSource();
|
||||||
+ p_263416_ = event.getNewVolume();
|
+ p_263416_ = event.getNewVolume();
|
||||||
@@ -58,12 +58,12 @@
|
|||||||
if (p_394722_ == this.minecraft.player) {
|
if (p_394722_ == this.minecraft.player) {
|
||||||
this.playSound(p_263372_, p_263404_, p_263365_, p_263335_.value(), p_263417_, p_263416_, p_263349_, false, p_263408_);
|
this.playSound(p_263372_, p_263404_, p_263365_, p_263335_.value(), p_263417_, p_263416_, p_263349_, false, p_263408_);
|
||||||
}
|
}
|
||||||
@@ -525,6 +_,12 @@
|
@@ -541,6 +_,12 @@
|
||||||
public void playSeededSound(
|
public void playSeededSound(
|
||||||
@Nullable Entity p_263536_, Entity p_396496_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_
|
@Nullable Entity p_263536_, Entity p_396496_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_
|
||||||
) {
|
) {
|
||||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_263536_, p_263518_, p_263487_, p_263538_, p_263524_);
|
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this.minecraft.level, p_263536_, p_263518_, p_263487_, p_263538_, p_263524_);
|
||||||
+ if (event.isCanceled() || event.getSound() == null) return;
|
+ if (event == null || event.getSound() == null) return;
|
||||||
+ p_263518_ = event.getSound();
|
+ p_263518_ = event.getSound();
|
||||||
+ p_263487_ = event.getSource();
|
+ p_263487_ = event.getSource();
|
||||||
+ p_263538_ = event.getNewVolume();
|
+ p_263538_ = event.getNewVolume();
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
if (p_263536_ == this.minecraft.player) {
|
if (p_263536_ == this.minecraft.player) {
|
||||||
this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(p_263518_.value(), p_263487_, p_263538_, p_263524_, p_396496_, p_263509_));
|
this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(p_263518_.value(), p_263487_, p_263538_, p_263524_, p_396496_, p_263509_));
|
||||||
}
|
}
|
||||||
@@ -975,6 +_,16 @@
|
@@ -991,6 +_,16 @@
|
||||||
this.connection.registerForCleaning(p_396040_);
|
this.connection.registerForCleaning(p_396040_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static class ClientLevelData implements WritableLevelData {
|
public static class ClientLevelData implements WritableLevelData {
|
||||||
private final boolean hardcore;
|
private final boolean hardcore;
|
||||||
@@ -1063,6 +_,7 @@
|
@@ -1079,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDifficulty(Difficulty p_104852_) {
|
public void setDifficulty(Difficulty p_104852_) {
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
this.difficulty = p_104852_;
|
this.difficulty = p_104852_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1105,6 +_,12 @@
|
@@ -1121,6 +_,12 @@
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onTrackingEnd(Entity p_171716_) {
|
public void onTrackingEnd(Entity p_171716_) {
|
||||||
@@ -1117,6 +_,15 @@
|
@@ -1133,6 +_,15 @@
|
||||||
ClientLevel.this.dragonParts.removeAll(Arrays.asList(enderdragon.getSubEntities()));
|
ClientLevel.this.dragonParts.removeAll(Arrays.asList(enderdragon.getSubEntities()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
+27
-19
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
|
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||||
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
|
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||||
@@ -477,6 +_,7 @@
|
@@ -528,6 +_,7 @@
|
||||||
|
|
||||||
this.minecraft.debugRenderer.clear();
|
this.minecraft.debugRenderer.clear();
|
||||||
this.minecraft.player.resetPos();
|
this.minecraft.player.resetPos();
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
this.minecraft.player.setId(p_105030_.playerId());
|
this.minecraft.player.setId(p_105030_.playerId());
|
||||||
this.level.addEntity(this.minecraft.player);
|
this.level.addEntity(this.minecraft.player);
|
||||||
this.minecraft.player.input = new KeyboardInput(this.minecraft.options);
|
this.minecraft.player.input = new KeyboardInput(this.minecraft.options);
|
||||||
@@ -1263,6 +_,8 @@
|
@@ -1315,6 +_,8 @@
|
||||||
localplayer1.getAttributes().assignBaseValues(localplayer.getAttributes());
|
localplayer1.getAttributes().assignBaseValues(localplayer.getAttributes());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,27 +17,27 @@
|
|||||||
this.level.addEntity(localplayer1);
|
this.level.addEntity(localplayer1);
|
||||||
localplayer1.input = new KeyboardInput(this.minecraft.options);
|
localplayer1.input = new KeyboardInput(this.minecraft.options);
|
||||||
this.minecraft.gameMode.adjustPlayer(localplayer1);
|
this.minecraft.gameMode.adjustPlayer(localplayer1);
|
||||||
@@ -1407,7 +_,7 @@
|
@@ -1462,7 +_,7 @@
|
||||||
PacketUtils.ensureRunningOnSameThread(p_104976_, this, this.minecraft);
|
ProblemReporter.ScopedCollector problemreporter$scopedcollector = new ProblemReporter.ScopedCollector(p_404890_.problemPath(), LOGGER);
|
||||||
BlockPos blockpos = p_104976_.getPos();
|
|
||||||
this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_389343_ -> {
|
try {
|
||||||
- p_389343_.loadWithComponents(p_104976_.getTag(), this.registryAccess);
|
- p_404890_.loadWithComponents(TagValueInput.create(problemreporter$scopedcollector, this.registryAccess, p_104976_.getTag()));
|
||||||
+ p_389343_.onDataPacket(connection, p_104976_, this.registryAccess);
|
+ p_404890_.onDataPacket(connection, TagValueInput.create(problemreporter$scopedcollector, this.registryAccess, p_104976_.getTag()), this.registryAccess);
|
||||||
if (p_389343_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) {
|
} catch (Throwable throwable1) {
|
||||||
((CommandBlockEditScreen)this.minecraft.screen).updateGui();
|
try {
|
||||||
}
|
problemreporter$scopedcollector.close();
|
||||||
@@ -1567,7 +_,9 @@
|
@@ -1630,7 +_,9 @@
|
||||||
@Override
|
@Override
|
||||||
public void handleCommands(ClientboundCommandsPacket p_104990_) {
|
public void handleCommands(ClientboundCommandsPacket p_104990_) {
|
||||||
PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft);
|
PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft);
|
||||||
- this.commands = new CommandDispatcher<>(p_104990_.getRoot(CommandBuildContext.simple(this.registryAccess, this.enabledFeatures)));
|
- this.commands = new CommandDispatcher<>(p_104990_.getRoot(CommandBuildContext.simple(this.registryAccess, this.enabledFeatures), COMMAND_NODE_BUILDER));
|
||||||
+ var context = CommandBuildContext.simple(this.registryAccess, this.enabledFeatures);
|
+ var context = CommandBuildContext.simple(this.registryAccess, this.enabledFeatures);
|
||||||
+ this.commands = new CommandDispatcher<>(p_104990_.getRoot(context));
|
+ this.commands = new CommandDispatcher<>(p_104990_.getRoot(context, COMMAND_NODE_BUILDER));
|
||||||
+ this.commands = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.commands, context);
|
+ this.commands = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.commands, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1668,6 +_,7 @@
|
@@ -1731,6 +_,7 @@
|
||||||
if (this.minecraft.screen instanceof RecipeUpdateListener recipeupdatelistener) {
|
if (this.minecraft.screen instanceof RecipeUpdateListener recipeupdatelistener) {
|
||||||
recipeupdatelistener.recipesUpdated();
|
recipeupdatelistener.recipesUpdated();
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1706,6 +_,8 @@
|
@@ -1769,6 +_,8 @@
|
||||||
this.fuelValues = FuelValues.vanillaBurnTimes(this.registryAccess, this.enabledFeatures);
|
this.fuelValues = FuelValues.vanillaBurnTimes(this.registryAccess, this.enabledFeatures);
|
||||||
List<ItemStack> list1 = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems());
|
List<ItemStack> list1 = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems());
|
||||||
this.searchTrees.updateCreativeTags(list1);
|
this.searchTrees.updateCreativeTags(list1);
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2548,6 +_,8 @@
|
@@ -2617,6 +_,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendChat(String p_249888_) {
|
public void sendChat(String p_249888_) {
|
||||||
@@ -63,11 +63,19 @@
|
|||||||
Instant instant = Instant.now();
|
Instant instant = Instant.now();
|
||||||
long i = Crypt.SaltSupplier.getLong();
|
long i = Crypt.SaltSupplier.getLong();
|
||||||
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate();
|
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate();
|
||||||
@@ -2556,6 +_,7 @@
|
@@ -2625,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendCommand(String p_250092_) {
|
public void sendCommand(String p_250092_) {
|
||||||
+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_250092_)) return;
|
+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_250092_)) return;
|
||||||
SignableCommand<SharedSuggestionProvider> signablecommand = SignableCommand.of(this.parseCommand(p_250092_));
|
SignableCommand<ClientSuggestionProvider> signablecommand = SignableCommand.of(this.commands.parse(p_250092_, this.suggestionsProvider));
|
||||||
if (signablecommand.arguments().isEmpty()) {
|
if (signablecommand.arguments().isEmpty()) {
|
||||||
this.send(new ServerboundChatCommandPacket(p_250092_));
|
this.send(new ServerboundChatCommandPacket(p_250092_));
|
||||||
|
@@ -2641,6 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendUnattendedCommand(String p_407213_, @Nullable Screen p_406262_) {
|
||||||
|
+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_407213_)) return;
|
||||||
|
switch (this.verifyCommand(p_407213_)) {
|
||||||
|
case NO_ISSUES:
|
||||||
|
this.send(new ServerboundChatCommandPacket(p_407213_));
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
--- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
||||||
+++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
+++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
||||||
@@ -110,6 +_,7 @@
|
@@ -111,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean destroyBlock(BlockPos p_105268_) {
|
public boolean destroyBlock(BlockPos p_105268_) {
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) {
|
if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -124,9 +_,8 @@
|
@@ -125,9 +_,8 @@
|
||||||
} else if (blockstate.isAir()) {
|
} else if (blockstate.isAir()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -19,15 +19,15 @@
|
|||||||
if (flag) {
|
if (flag) {
|
||||||
block.destroy(level, p_105268_, blockstate);
|
block.destroy(level, p_105268_, blockstate);
|
||||||
}
|
}
|
||||||
@@ -147,6 +_,7 @@
|
@@ -148,6 +_,7 @@
|
||||||
BlockState blockstate = this.minecraft.level.getBlockState(p_105270_);
|
BlockState blockstate = this.minecraft.level.getBlockState(p_105270_);
|
||||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate, 1.0F);
|
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate, 1.0F);
|
||||||
this.startPrediction(this.minecraft.level, p_233757_ -> {
|
this.startPrediction(this.minecraft.level, p_233757_ -> {
|
||||||
+ if (!net.minecraftforge.event.ForgeEventFactory.onLeftClickBlock(this.minecraft.player, p_105270_, p_105271_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK).isCanceled())
|
+ if (!net.minecraftforge.event.ForgeEventFactory.isLeftClickBlockCancelled(this.minecraft.player, p_105270_, p_105271_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK))
|
||||||
this.destroyBlock(p_105270_);
|
this.destroyBlock(p_105270_);
|
||||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_);
|
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_);
|
||||||
});
|
});
|
||||||
@@ -156,15 +_,18 @@
|
@@ -157,15 +_,18 @@
|
||||||
this.connection
|
this.connection
|
||||||
.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_));
|
.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_));
|
||||||
}
|
}
|
||||||
@@ -38,15 +38,15 @@
|
|||||||
this.startPrediction(this.minecraft.level, p_233728_ -> {
|
this.startPrediction(this.minecraft.level, p_233728_ -> {
|
||||||
boolean flag = !blockstate1.isAir();
|
boolean flag = !blockstate1.isAir();
|
||||||
if (flag && this.destroyProgress == 0.0F) {
|
if (flag && this.destroyProgress == 0.0F) {
|
||||||
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY)
|
+ if (event != null && !event.getUseBlock().isDenied())
|
||||||
blockstate1.attack(this.minecraft.level, p_105270_, this.minecraft.player);
|
blockstate1.attack(this.minecraft.level, p_105270_, this.minecraft.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
|
+ if (event != null && !event.getUseItem().isDenied()) {
|
||||||
if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) {
|
if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) {
|
||||||
this.destroyBlock(p_105270_);
|
this.destroyBlock(p_105270_);
|
||||||
} else {
|
} else {
|
||||||
@@ -175,6 +_,7 @@
|
@@ -176,6 +_,7 @@
|
||||||
this.destroyTicks = 0.0F;
|
this.destroyTicks = 0.0F;
|
||||||
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
|
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
|
||||||
}
|
}
|
||||||
@@ -54,15 +54,15 @@
|
|||||||
|
|
||||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
|
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
|
||||||
});
|
});
|
||||||
@@ -207,6 +_,7 @@
|
@@ -208,6 +_,7 @@
|
||||||
BlockState blockstate1 = this.minecraft.level.getBlockState(p_105284_);
|
BlockState blockstate1 = this.minecraft.level.getBlockState(p_105284_);
|
||||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate1, 1.0F);
|
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate1, 1.0F);
|
||||||
this.startPrediction(this.minecraft.level, p_233753_ -> {
|
this.startPrediction(this.minecraft.level, p_233753_ -> {
|
||||||
+ if (!net.minecraftforge.event.ForgeEventFactory.onLeftClickBlock(this.minecraft.player, p_105284_, p_105285_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK).isCanceled())
|
+ if (!net.minecraftforge.event.ForgeEventFactory.isLeftClickBlockCancelled(this.minecraft.player, p_105284_, p_105285_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK))
|
||||||
this.destroyBlock(p_105284_);
|
this.destroyBlock(p_105284_);
|
||||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_);
|
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_);
|
||||||
});
|
});
|
||||||
@@ -219,7 +_,7 @@
|
@@ -220,7 +_,7 @@
|
||||||
} else {
|
} else {
|
||||||
this.destroyProgress = this.destroyProgress + blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_);
|
this.destroyProgress = this.destroyProgress + blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_);
|
||||||
if (this.destroyTicks % 4.0F == 0.0F) {
|
if (this.destroyTicks % 4.0F == 0.0F) {
|
||||||
@@ -71,15 +71,15 @@
|
|||||||
this.minecraft
|
this.minecraft
|
||||||
.getSoundManager()
|
.getSoundManager()
|
||||||
.play(
|
.play(
|
||||||
@@ -236,6 +_,7 @@
|
@@ -237,6 +_,7 @@
|
||||||
|
|
||||||
this.destroyTicks++;
|
this.destroyTicks++;
|
||||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F));
|
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F));
|
||||||
+ if (net.minecraftforge.event.ForgeEventFactory.onLeftClickBlockHold(this.minecraft.player, p_105284_, p_105285_).getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true;
|
+ if (net.minecraftforge.event.ForgeEventFactory.onLeftClickBlockHold(this.minecraft.player, p_105284_, p_105285_).getUseItem().isDenied()) return true;
|
||||||
if (this.destroyProgress >= 1.0F) {
|
if (this.destroyProgress >= 1.0F) {
|
||||||
this.isDestroying = false;
|
this.isDestroying = false;
|
||||||
this.startPrediction(this.minecraft.level, p_233739_ -> {
|
this.startPrediction(this.minecraft.level, p_233739_ -> {
|
||||||
@@ -274,7 +_,7 @@
|
@@ -275,7 +_,7 @@
|
||||||
|
|
||||||
private boolean sameDestroyTarget(BlockPos p_105282_) {
|
private boolean sameDestroyTarget(BlockPos p_105282_) {
|
||||||
ItemStack itemstack = this.minecraft.player.getMainHandItem();
|
ItemStack itemstack = this.minecraft.player.getMainHandItem();
|
||||||
@@ -88,12 +88,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ensureHasSentCarriedItem() {
|
private void ensureHasSentCarriedItem() {
|
||||||
@@ -302,12 +_,23 @@
|
@@ -303,12 +_,23 @@
|
||||||
private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
|
private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
|
||||||
BlockPos blockpos = p_233749_.getBlockPos();
|
BlockPos blockpos = p_233749_.getBlockPos();
|
||||||
ItemStack itemstack = p_233747_.getItemInHand(p_233748_);
|
ItemStack itemstack = p_233747_.getItemInHand(p_233748_);
|
||||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onRightClickBlock(p_233747_, p_233748_, blockpos, p_233749_);
|
+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock(p_233747_, p_233748_, blockpos, p_233749_);
|
||||||
+ if (event.isCanceled()) {
|
+ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock.BUS.post(event)) {
|
||||||
+ return event.getCancellationResult();
|
+ return event.getCancellationResult();
|
||||||
+ }
|
+ }
|
||||||
if (this.localPlayerMode == GameType.SPECTATOR) {
|
if (this.localPlayerMode == GameType.SPECTATOR) {
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
} else {
|
} else {
|
||||||
- boolean flag = !p_233747_.getMainHandItem().isEmpty() || !p_233747_.getOffhandItem().isEmpty();
|
- boolean flag = !p_233747_.getMainHandItem().isEmpty() || !p_233747_.getOffhandItem().isEmpty();
|
||||||
+ UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
|
+ UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
|
||||||
+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
|
+ if (!event.getUseItem().isDenied()) {
|
||||||
+ InteractionResult result = itemstack.onItemUseFirst(useoncontext);
|
+ InteractionResult result = itemstack.onItemUseFirst(useoncontext);
|
||||||
+ if (result != InteractionResult.PASS) {
|
+ if (result != InteractionResult.PASS) {
|
||||||
+ return result;
|
+ return result;
|
||||||
@@ -110,36 +110,36 @@
|
|||||||
+ boolean flag = !p_233747_.getMainHandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_) || !p_233747_.getOffhandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_);
|
+ boolean flag = !p_233747_.getMainHandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_) || !p_233747_.getOffhandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_);
|
||||||
boolean flag1 = p_233747_.isSecondaryUseActive() && flag;
|
boolean flag1 = p_233747_.isSecondaryUseActive() && flag;
|
||||||
- if (!flag1) {
|
- if (!flag1) {
|
||||||
+ if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) {
|
+ if (event.getUseBlock().isAllowed() || (!event.getUseBlock().isDenied() && !flag1)) {
|
||||||
BlockState blockstate = this.minecraft.level.getBlockState(blockpos);
|
BlockState blockstate = this.minecraft.level.getBlockState(blockpos);
|
||||||
if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) {
|
if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) {
|
||||||
return InteractionResult.FAIL;
|
return InteractionResult.FAIL;
|
||||||
@@ -328,8 +_,10 @@
|
@@ -329,8 +_,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- if (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack)) {
|
- if (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack)) {
|
||||||
- UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
|
- UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
|
||||||
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) {
|
+ if (event.getUseItem().isDenied()) {
|
||||||
+ return InteractionResult.PASS;
|
+ return InteractionResult.PASS;
|
||||||
+ }
|
+ }
|
||||||
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack))) {
|
+ if (event.getUseItem().isAllowed() || (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack))) {
|
||||||
InteractionResult interactionresult2;
|
InteractionResult interactionresult2;
|
||||||
if (p_233747_.hasInfiniteMaterials()) {
|
if (p_233747_.hasInfiniteMaterials()) {
|
||||||
int i = itemstack.getCount();
|
int i = itemstack.getCount();
|
||||||
@@ -363,6 +_,11 @@
|
@@ -364,6 +_,11 @@
|
||||||
mutableobject.setValue(InteractionResult.PASS);
|
mutableobject.setValue(InteractionResult.PASS);
|
||||||
return serverbounduseitempacket;
|
return serverbounduseitempacket;
|
||||||
} else {
|
} else {
|
||||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onRightClickItem(p_233722_, p_233723_);
|
+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickItem(p_233722_, p_233723_);
|
||||||
+ if (event.isCanceled()) {
|
+ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickItem.BUS.post(event)) {
|
||||||
+ mutableobject.setValue(event.getCancellationResult());
|
+ mutableobject.setValue(event.getCancellationResult());
|
||||||
+ return serverbounduseitempacket;
|
+ return serverbounduseitempacket;
|
||||||
+ }
|
+ }
|
||||||
InteractionResult interactionresult = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
|
InteractionResult interactionresult = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
|
||||||
ItemStack itemstack1;
|
ItemStack itemstack1;
|
||||||
if (interactionresult instanceof InteractionResult.Success interactionresult$success) {
|
if (interactionresult instanceof InteractionResult.Success interactionresult$success) {
|
||||||
@@ -373,6 +_,9 @@
|
@@ -374,6 +_,9 @@
|
||||||
|
|
||||||
if (itemstack1 != itemstack) {
|
if (itemstack1 != itemstack) {
|
||||||
p_233722_.setItemInHand(p_233723_, itemstack1);
|
p_233722_.setItemInHand(p_233723_, itemstack1);
|
||||||
@@ -149,24 +149,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
mutableobject.setValue(interactionresult);
|
mutableobject.setValue(interactionresult);
|
||||||
@@ -404,6 +_,10 @@
|
@@ -405,6 +_,10 @@
|
||||||
public InteractionResult interact(Player p_105227_, Entity p_105228_, InteractionHand p_105229_) {
|
public InteractionResult interact(Player p_105227_, Entity p_105228_, InteractionHand p_105229_) {
|
||||||
this.ensureHasSentCarriedItem();
|
this.ensureHasSentCarriedItem();
|
||||||
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105228_, p_105227_.isShiftKeyDown(), p_105229_));
|
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105228_, p_105227_.isShiftKeyDown(), p_105229_));
|
||||||
+ if (this.localPlayerMode != GameType.SPECTATOR) {
|
+ if (this.localPlayerMode != GameType.SPECTATOR) {
|
||||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onEntityInteract(p_105227_, p_105228_, p_105229_);
|
+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteract(p_105227_, p_105229_, p_105228_);
|
||||||
+ if (event.isCanceled()) return event.getCancellationResult();
|
+ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteract.BUS.post(event)) return event.getCancellationResult();
|
||||||
+ }
|
+ }
|
||||||
return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105227_.interactOn(p_105228_, p_105229_));
|
return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105227_.interactOn(p_105228_, p_105229_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,6 +_,10 @@
|
@@ -412,6 +_,10 @@
|
||||||
this.ensureHasSentCarriedItem();
|
this.ensureHasSentCarriedItem();
|
||||||
Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ());
|
Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ());
|
||||||
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3));
|
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3));
|
||||||
+ if (this.localPlayerMode != GameType.SPECTATOR) {
|
+ if (this.localPlayerMode != GameType.SPECTATOR) {
|
||||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onEntityInteractSpecific(p_105231_, p_105232_, p_105234_, vec3);
|
+ var event = new net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteractSpecific(p_105231_, p_105234_, p_105232_, vec3);
|
||||||
+ if (event.isCanceled()) return event.getCancellationResult();
|
+ if (net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteractSpecific.BUS.post(event)) return event.getCancellationResult();
|
||||||
+ }
|
+ }
|
||||||
return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105232_.interactAt(p_105231_, vec3, p_105234_));
|
return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105232_.interactAt(p_105231_, vec3, p_105234_));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/chat/ChatListener.java
|
--- a/net/minecraft/client/multiplayer/chat/ChatListener.java
|
||||||
+++ b/net/minecraft/client/multiplayer/chat/ChatListener.java
|
+++ b/net/minecraft/client/multiplayer/chat/ChatListener.java
|
||||||
@@ -123,7 +_,9 @@
|
@@ -124,7 +_,9 @@
|
||||||
Instant instant = Instant.now();
|
Instant instant = Instant.now();
|
||||||
this.handleMessage(null, () -> {
|
this.handleMessage(null, () -> {
|
||||||
Component component = p_251256_.decorate(p_250375_);
|
Component component = p_251256_.decorate(p_250375_);
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
this.narrateChatMessage(p_251256_, p_250375_);
|
this.narrateChatMessage(p_251256_, p_250375_);
|
||||||
this.logSystemMessage(component, instant);
|
this.logSystemMessage(component, instant);
|
||||||
this.previousMessageTime = Util.getMillis();
|
this.previousMessageTime = Util.getMillis();
|
||||||
@@ -142,12 +_,16 @@
|
@@ -143,12 +_,16 @@
|
||||||
MessageSignature messagesignature = p_249430_.signature();
|
MessageSignature messagesignature = p_249430_.signature();
|
||||||
FilterMask filtermask = p_249430_.filterMask();
|
FilterMask filtermask = p_249430_.filterMask();
|
||||||
if (filtermask.isEmpty()) {
|
if (filtermask.isEmpty()) {
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
this.narrateChatMessage(p_251766_, component);
|
this.narrateChatMessage(p_251766_, component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,6 +_,8 @@
|
@@ -181,6 +_,8 @@
|
||||||
|
|
||||||
public void handleSystemMessage(Component p_240522_, boolean p_240642_) {
|
public void handleSystemMessage(Component p_240522_, boolean p_240642_) {
|
||||||
if (!this.minecraft.options.hideMatchedNames().get() || !this.minecraft.isBlocked(this.guessChatUUID(p_240522_))) {
|
if (!this.minecraft.options.hideMatchedNames().get() || !this.minecraft.isBlocked(this.guessChatUUID(p_240522_))) {
|
||||||
@@ -38,4 +38,4 @@
|
|||||||
+ if (p_240522_ == null) return;
|
+ if (p_240522_ == null) return;
|
||||||
if (p_240642_) {
|
if (p_240642_) {
|
||||||
this.minecraft.gui.setOverlayMessage(p_240522_, false);
|
this.minecraft.gui.setOverlayMessage(p_240522_, false);
|
||||||
} else {
|
this.minecraft.getNarrator().saySystemQueued(p_240522_);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/player/LocalPlayer.java
|
--- a/net/minecraft/client/player/LocalPlayer.java
|
||||||
+++ b/net/minecraft/client/player/LocalPlayer.java
|
+++ b/net/minecraft/client/player/LocalPlayer.java
|
||||||
@@ -303,6 +_,7 @@
|
@@ -297,6 +_,7 @@
|
||||||
ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_
|
ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_
|
||||||
? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS
|
? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS
|
||||||
: ServerboundPlayerActionPacket.Action.DROP_ITEM;
|
: ServerboundPlayerActionPacket.Action.DROP_ITEM;
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_);
|
ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_);
|
||||||
this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN));
|
this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN));
|
||||||
return !itemstack.isEmpty();
|
return !itemstack.isEmpty();
|
||||||
@@ -483,7 +_,11 @@
|
@@ -478,7 +_,11 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) {
|
public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) {
|
||||||
- this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), p_108651_, this.getSoundSource(), p_108652_, p_108653_, false);
|
- this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), p_108651_, this.getSoundSource(), p_108652_, p_108653_, false);
|
||||||
+ var holder = net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(p_108651_);
|
+ var holder = net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(p_108651_);
|
||||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, holder, this.getSoundSource(), p_108652_, p_108653_);
|
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this.level(), this, holder, this.getSoundSource(), p_108652_, p_108653_);
|
||||||
+ if (event.isCanceled() || event.getSound() == null) return;
|
+ if (event == null || event.getSound() == null) return;
|
||||||
+ this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), event.getSound().get(), event.getSource(), event.getNewVolume(), event.getNewPitch(), false);
|
+ this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), event.getSound().get(), event.getSource(), event.getNewVolume(), event.getNewPitch(), false);
|
||||||
+
|
+
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean vehicleCanSprint(Entity p_265184_) {
|
private boolean vehicleCanSprint(Entity p_265184_) {
|
||||||
@@ -1169,6 +_,18 @@
|
@@ -1169,6 +_,17 @@
|
||||||
@Override
|
@Override
|
||||||
public float getVisualRotationYInDegrees() {
|
public float getVisualRotationYInDegrees() {
|
||||||
return this.getYRot();
|
return this.getYRot();
|
||||||
@@ -89,7 +89,6 @@
|
|||||||
+ this.yRotLast = old.yRotLast;
|
+ this.yRotLast = old.yRotLast;
|
||||||
+ this.xRotLast = old.xRotLast;
|
+ this.xRotLast = old.xRotLast;
|
||||||
+ this.lastOnGround = old.lastOnGround;
|
+ this.lastOnGround = old.lastOnGround;
|
||||||
+ this.wasShiftKeyDown = old.wasShiftKeyDown;
|
|
||||||
+ this.wasSprinting = old.wasSprinting;
|
+ this.wasSprinting = old.wasSprinting;
|
||||||
+ this.positionReminder = old.positionReminder;
|
+ this.positionReminder = old.positionReminder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/renderer/DimensionSpecialEffects.java
|
--- a/net/minecraft/client/renderer/DimensionSpecialEffects.java
|
||||||
+++ b/net/minecraft/client/renderer/DimensionSpecialEffects.java
|
+++ b/net/minecraft/client/renderer/DimensionSpecialEffects.java
|
||||||
@@ -36,7 +_,7 @@
|
@@ -32,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DimensionSpecialEffects forType(DimensionType p_108877_) {
|
public static DimensionSpecialEffects forType(DimensionType p_108877_) {
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
--- a/net/minecraft/client/renderer/FogRenderer.java
|
|
||||||
+++ b/net/minecraft/client/renderer/FogRenderer.java
|
|
||||||
@@ -187,6 +_,12 @@
|
|
||||||
f2 = f2 * (1.0F - f10) + f2 * f12 * f10;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ Vector3f fogColor = net.minecraftforge.client.ForgeHooksClient.getFogColor(p_362477_, p_364035_, p_361507_, p_361512_, p_367602_, f, f1, f2);
|
|
||||||
+
|
|
||||||
+ f = fogColor.x();
|
|
||||||
+ f1 = fogColor.y();
|
|
||||||
+ f2 = fogColor.z();
|
|
||||||
+
|
|
||||||
return new Vector4f(f, f1, f2, 1.0F);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -265,9 +_,10 @@
|
|
||||||
fogrenderer$fogdata.shape = FogShape.CYLINDER;
|
|
||||||
}
|
|
||||||
|
|
||||||
- return new FogParameters(
|
|
||||||
+ var original = new FogParameters(
|
|
||||||
fogrenderer$fogdata.start, fogrenderer$fogdata.end, fogrenderer$fogdata.shape, p_365589_.x, p_365589_.y, p_365589_.z, p_365589_.w
|
|
||||||
);
|
|
||||||
+ return net.minecraftforge.client.ForgeHooksClient.getFogParameters(p_234174_, fogtype, p_234173_, p_234177_, p_234175_, original);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/renderer/GameRenderer.java
|
--- a/net/minecraft/client/renderer/GameRenderer.java
|
||||||
+++ b/net/minecraft/client/renderer/GameRenderer.java
|
+++ b/net/minecraft/client/renderer/GameRenderer.java
|
||||||
@@ -168,6 +_,10 @@
|
@@ -194,6 +_,10 @@
|
||||||
this.setPostEffect(ResourceLocation.withDefaultNamespace("spider"));
|
this.setPostEffect(ResourceLocation.withDefaultNamespace("spider"));
|
||||||
} else if (p_109107_ instanceof EnderMan) {
|
} else if (p_109107_ instanceof EnderMan) {
|
||||||
this.setPostEffect(ResourceLocation.withDefaultNamespace("invert"));
|
this.setPostEffect(ResourceLocation.withDefaultNamespace("invert"));
|
||||||
@@ -11,21 +11,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +_,13 @@
|
@@ -205,7 +_,13 @@
|
||||||
if (!(f < 1.0F)) {
|
public void processBlurEffect() {
|
||||||
PostChain postchain = this.minecraft.getShaderManager().getPostChain(BLUR_POST_CHAIN_ID, LevelTargetBundle.MAIN_TARGETS);
|
PostChain postchain = this.minecraft.getShaderManager().getPostChain(BLUR_POST_CHAIN_ID, LevelTargetBundle.MAIN_TARGETS);
|
||||||
if (postchain != null) {
|
if (postchain != null) {
|
||||||
+ // TODO: [Forge][Rendering] Check if this blend management is needed anymnore with the new render pipeline changes
|
+ // TODO: [Forge][Rendering] Check if this blend management is needed anymnore with the new render pipeline changes
|
||||||
+ boolean wasBlendEnabled = com.mojang.blaze3d.opengl.GlStateManager._isBlendEnabled();
|
+ boolean wasBlendEnabled = com.mojang.blaze3d.opengl.GlStateManager._isBlendEnabled();
|
||||||
+ if (wasBlendEnabled)
|
+ if (wasBlendEnabled)
|
||||||
+ com.mojang.blaze3d.opengl.GlStateManager._disableBlend();
|
+ com.mojang.blaze3d.opengl.GlStateManager._disableBlend();
|
||||||
postchain.process(this.minecraft.getMainRenderTarget(), this.resourcePool, p_389358_ -> p_389358_.setUniform("Radius", f));
|
postchain.process(this.minecraft.getMainRenderTarget(), this.resourcePool);
|
||||||
+ if (wasBlendEnabled)
|
+ if (wasBlendEnabled)
|
||||||
+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend();
|
+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,7 +_,7 @@
|
|
||||||
|
@@ -364,7 +_,7 @@
|
||||||
f *= Mth.lerp(f2, 1.0F, 0.85714287F);
|
f *= Mth.lerp(f2, 1.0F, 0.85714287F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,21 +34,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,11 +_,11 @@
|
@@ -512,7 +_,7 @@
|
||||||
RenderTarget rendertarget = this.minecraft.getMainRenderTarget();
|
|
||||||
RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(rendertarget.getDepthTexture(), 1.0);
|
|
||||||
Matrix4f matrix4f = new Matrix4f()
|
|
||||||
- .setOrtho(0.0F, (float)(window.getWidth() / window.getGuiScale()), (float)(window.getHeight() / window.getGuiScale()), 0.0F, 1000.0F, 21000.0F);
|
|
||||||
+ .setOrtho(0.0F, (float)(window.getWidth() / window.getGuiScale()), (float)(window.getHeight() / window.getGuiScale()), 0.0F, 1000.0F, net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
|
|
||||||
RenderSystem.setProjectionMatrix(matrix4f, ProjectionType.ORTHOGRAPHIC);
|
|
||||||
Matrix4fStack matrix4fstack = RenderSystem.getModelViewStack();
|
|
||||||
matrix4fstack.pushMatrix();
|
|
||||||
- matrix4fstack.translation(0.0F, 0.0F, -11000.0F);
|
|
||||||
+ matrix4fstack.translation(0.0F, 0.0F, 10000F - net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
|
|
||||||
Lighting.setupFor3DItems();
|
|
||||||
GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource());
|
|
||||||
if (flag && p_109096_ && this.minecraft.level != null) {
|
|
||||||
@@ -520,7 +_,7 @@
|
|
||||||
}
|
}
|
||||||
} else if (flag && this.minecraft.screen != null) {
|
} else if (flag && this.minecraft.screen != null) {
|
||||||
try {
|
try {
|
||||||
@@ -57,7 +43,7 @@
|
|||||||
} catch (Throwable throwable1) {
|
} catch (Throwable throwable1) {
|
||||||
CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen");
|
CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen");
|
||||||
CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details");
|
CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details");
|
||||||
@@ -654,6 +_,9 @@
|
@@ -646,6 +_,9 @@
|
||||||
if (this.minecraft.options.bobView().get()) {
|
if (this.minecraft.options.bobView().get()) {
|
||||||
this.bobView(posestack, camera.getPartialTickTime());
|
this.bobView(posestack, camera.getPartialTickTime());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,63 +1,62 @@
|
|||||||
--- a/net/minecraft/client/renderer/ItemBlockRenderTypes.java
|
--- a/net/minecraft/client/renderer/ItemBlockRenderTypes.java
|
||||||
+++ b/net/minecraft/client/renderer/ItemBlockRenderTypes.java
|
+++ b/net/minecraft/client/renderer/ItemBlockRenderTypes.java
|
||||||
@@ -18,6 +_,7 @@
|
@@ -19,6 +_,7 @@
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class ItemBlockRenderTypes {
|
public class ItemBlockRenderTypes {
|
||||||
+ @Deprecated
|
+ @Deprecated
|
||||||
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_389364_ -> {
|
private static final Map<Block, ChunkSectionLayer> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_389364_ -> {
|
||||||
RenderType rendertype = RenderType.tripwire();
|
ChunkSectionLayer chunksectionlayer = ChunkSectionLayer.TRIPWIRE;
|
||||||
p_389364_.put(Blocks.TRIPWIRE, rendertype);
|
p_389364_.put(Blocks.TRIPWIRE, chunksectionlayer);
|
||||||
@@ -352,6 +_,7 @@
|
@@ -353,12 +_,15 @@
|
||||||
p_389364_.put(Blocks.BUBBLE_COLUMN, rendertype3);
|
p_389364_.put(Blocks.BUBBLE_COLUMN, chunksectionlayer3);
|
||||||
p_389364_.put(Blocks.TINTED_GLASS, rendertype3);
|
p_389364_.put(Blocks.TINTED_GLASS, chunksectionlayer3);
|
||||||
});
|
});
|
||||||
+ @Deprecated
|
+ @Deprecated
|
||||||
private static final Map<Fluid, RenderType> TYPE_BY_FLUID = Util.make(Maps.newHashMap(), p_109290_ -> {
|
private static final Map<Fluid, ChunkSectionLayer> LAYER_BY_FLUID = Util.make(Maps.newHashMap(), p_404902_ -> {
|
||||||
RenderType rendertype = RenderType.translucent();
|
p_404902_.put(Fluids.FLOWING_WATER, ChunkSectionLayer.TRANSLUCENT);
|
||||||
p_109290_.put(Fluids.FLOWING_WATER, rendertype);
|
p_404902_.put(Fluids.WATER, ChunkSectionLayer.TRANSLUCENT);
|
||||||
@@ -359,6 +_,8 @@
|
|
||||||
});
|
});
|
||||||
private static boolean renderCutout;
|
private static boolean renderCutout;
|
||||||
|
|
||||||
+ /** @deprecated Forge: Use {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
|
+ /** @deprecated Forge: Use {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
|
||||||
+ @Deprecated // Note: this method does NOT support model-based render types
|
+ @Deprecated // Note: this method does NOT support model-based render types
|
||||||
public static RenderType getChunkRenderType(BlockState p_109283_) {
|
public static ChunkSectionLayer getChunkRenderType(BlockState p_109283_) {
|
||||||
Block block = p_109283_.getBlock();
|
Block block = p_109283_.getBlock();
|
||||||
if (block instanceof LeavesBlock) {
|
if (block instanceof LeavesBlock) {
|
||||||
@@ -369,6 +_,8 @@
|
@@ -369,6 +_,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ /** @deprecated Forge: Use {@link net.minecraftforge.client.RenderTypeHelper#getMovingBlockRenderType(RenderType)} while iterating through {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
|
+ /** @deprecated Forge: Use {@link net.minecraftforge.client.RenderTypeHelper#getMovingBlockRenderType(ChunkSectionLayer)} while iterating through {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
|
||||||
+ @Deprecated // Note: this method does NOT support model-based render types
|
+ @Deprecated // Note: this method does NOT support model-based render types
|
||||||
public static RenderType getMovingBlockRenderType(BlockState p_109294_) {
|
public static RenderType getMovingBlockRenderType(BlockState p_109294_) {
|
||||||
Block block = p_109294_.getBlock();
|
Block block = p_109294_.getBlock();
|
||||||
if (block instanceof LeavesBlock) {
|
if (block instanceof LeavesBlock) {
|
||||||
@@ -383,11 +_,14 @@
|
@@ -389,11 +_,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ /** @deprecated Forge: Use {@link net.minecraftforge.client.RenderTypeHelper#getEntityRenderType(RenderType)} while iterating through {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
|
+ /** @deprecated Forge: Use {@link net.minecraftforge.client.RenderTypeHelper#getEntityRenderType(ChunkSectionLayer)} while iterating through {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
|
||||||
+ @Deprecated // Note: this method does NOT support model-based render types
|
+ @Deprecated // Note: this method does NOT support model-based render types
|
||||||
public static RenderType getRenderType(BlockState p_364446_) {
|
public static RenderType getRenderType(BlockState p_364446_) {
|
||||||
RenderType rendertype = getChunkRenderType(p_364446_);
|
ChunkSectionLayer chunksectionlayer = getChunkRenderType(p_364446_);
|
||||||
return rendertype == RenderType.translucent() ? Sheets.translucentItemSheet() : Sheets.cutoutBlockSheet();
|
return chunksectionlayer == ChunkSectionLayer.TRANSLUCENT ? Sheets.translucentItemSheet() : Sheets.cutoutBlockSheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
+ /* Forge: Use {@link net.minecraft.client.resources.model.BakedModel#getRenderPasses(ItemStack, boolean)} and {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(ItemStack, boolean)}. */
|
+ /* Forge: Use {@link net.minecraft.client.resources.model.BakedModel#getRenderPasses(ItemStack, boolean)} and {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(ItemStack, boolean)}. */
|
||||||
public static RenderType getRenderType(ItemStack p_363859_) {
|
public static RenderType getRenderType(ItemStack p_363859_) {
|
||||||
if (p_363859_.getItem() instanceof BlockItem blockitem) {
|
if (p_363859_.getItem() instanceof BlockItem blockitem) {
|
||||||
Block block = blockitem.getBlock();
|
Block block = blockitem.getBlock();
|
||||||
@@ -397,12 +_,81 @@
|
@@ -403,12 +_,71 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Note: this method does NOT support model-based render types
|
+ // Note: this method does NOT support model-based render types
|
||||||
public static RenderType getRenderLayer(FluidState p_109288_) {
|
public static ChunkSectionLayer getRenderLayer(FluidState p_109288_) {
|
||||||
- RenderType rendertype = TYPE_BY_FLUID.get(p_109288_.getType());
|
- ChunkSectionLayer chunksectionlayer = LAYER_BY_FLUID.get(p_109288_.getType());
|
||||||
+ RenderType rendertype = FLUID_RENDER_TYPES.get(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(p_109288_.getType()));
|
+ var chunksectionlayer = FLUID_RENDER_TYPES.get(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(p_109288_.getType()));
|
||||||
return rendertype != null ? rendertype : RenderType.solid();
|
return chunksectionlayer != null ? chunksectionlayer : ChunkSectionLayer.SOLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setFancy(boolean p_109292_) {
|
public static void setFancy(boolean p_109292_) {
|
||||||
@@ -69,24 +68,21 @@
|
|||||||
+ return renderCutout;
|
+ return renderCutout;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private static final net.minecraftforge.client.ChunkRenderTypeSet CUTOUT_MIPPED = net.minecraftforge.client.ChunkRenderTypeSet.of(RenderType.cutoutMipped());
|
+ private static final java.util.Collection<ChunkSectionLayer> CUTOUT_MIPPED = java.util.EnumSet.of(ChunkSectionLayer.CUTOUT_MIPPED);
|
||||||
+ private static final net.minecraftforge.client.ChunkRenderTypeSet SOLID = net.minecraftforge.client.ChunkRenderTypeSet.of(RenderType.solid());
|
+ private static final java.util.Collection<ChunkSectionLayer> SOLID = java.util.EnumSet.of(ChunkSectionLayer.SOLID);
|
||||||
+ private static final Map<net.minecraft.core.Holder.Reference<Block>, net.minecraftforge.client.ChunkRenderTypeSet> BLOCK_RENDER_TYPES = Util.make(new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(TYPE_BY_BLOCK.size(), 0.5F), map -> {
|
+ private static final Map<net.minecraft.core.Holder.Reference<Block>, java.util.Collection<ChunkSectionLayer>> BLOCK_RENDER_TYPES = Util.make(new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(TYPE_BY_BLOCK.size(), 0.5F), map -> {
|
||||||
+ map.defaultReturnValue(SOLID);
|
+ map.defaultReturnValue(SOLID);
|
||||||
+ for(Map.Entry<Block, RenderType> entry : TYPE_BY_BLOCK.entrySet()) {
|
+ for(Map.Entry<Block, ChunkSectionLayer> entry : TYPE_BY_BLOCK.entrySet())
|
||||||
+ map.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(entry.getKey()), net.minecraftforge.client.ChunkRenderTypeSet.of(entry.getValue()));
|
+ map.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(entry.getKey()), java.util.EnumSet.of(entry.getValue()));
|
||||||
+ }
|
|
||||||
+ });
|
+ });
|
||||||
+ private static final Map<net.minecraft.core.Holder.Reference<Fluid>, RenderType> FLUID_RENDER_TYPES = Util.make(new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(TYPE_BY_FLUID.size(), 0.5F), map -> {
|
+ private static final Map<net.minecraft.core.Holder.Reference<Fluid>, ChunkSectionLayer> FLUID_RENDER_TYPES = Util.make(new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(LAYER_BY_FLUID.size(), 0.5F), map -> {
|
||||||
+ map.defaultReturnValue(RenderType.solid());
|
+ map.defaultReturnValue(ChunkSectionLayer.SOLID);
|
||||||
+ for(Map.Entry<Fluid, RenderType> entry : TYPE_BY_FLUID.entrySet()) {
|
+ for(var entry : LAYER_BY_FLUID.entrySet())
|
||||||
+ map.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(entry.getKey()), entry.getValue());
|
+ map.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(entry.getKey()), entry.getValue());
|
||||||
+ }
|
|
||||||
+ });
|
+ });
|
||||||
+
|
+
|
||||||
+ /** @deprecated Use {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
|
+ /** @deprecated Use {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
|
||||||
+ @Deprecated(forRemoval = true, since = "1.21.4")
|
+ public static java.util.Collection<ChunkSectionLayer> getRenderLayers(BlockState state) {
|
||||||
+ public static net.minecraftforge.client.ChunkRenderTypeSet getRenderLayers(BlockState state) {
|
|
||||||
+ Block block = state.getBlock();
|
+ Block block = state.getBlock();
|
||||||
+ if (block instanceof LeavesBlock) {
|
+ if (block instanceof LeavesBlock) {
|
||||||
+ return renderCutout ? CUTOUT_MIPPED : SOLID;
|
+ return renderCutout ? CUTOUT_MIPPED : SOLID;
|
||||||
@@ -95,28 +91,25 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
|
+ /**
|
||||||
+ @Deprecated(forRemoval = true, since = "1.21.4")
|
+ * It is recommended to set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) so that it can be data driven.
|
||||||
+ public static void setRenderLayer(Block block, RenderType type) {
|
+ * But if you want to set it in code feel free to set it here like vanilla does.
|
||||||
+ com.google.common.base.Preconditions.checkArgument(type.getChunkLayerId() >= 0, "The argument must be a valid chunk render type returned by RenderType#chunkBufferLayers().");
|
+ */
|
||||||
+ setRenderLayer(block, net.minecraftforge.client.ChunkRenderTypeSet.of(type));
|
+ public static void setRenderLayer(Block block, ChunkSectionLayer type) {
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
|
|
||||||
+ @Deprecated(forRemoval = true, since = "1.21.4")
|
|
||||||
+ public static synchronized void setRenderLayer(Block block, java.util.function.Predicate<RenderType> predicate) {
|
|
||||||
+ setRenderLayer(block, createSetFromPredicate(predicate));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
|
|
||||||
+ @Deprecated(forRemoval = true, since = "1.21.4")
|
|
||||||
+ public static synchronized void setRenderLayer(Block block, net.minecraftforge.client.ChunkRenderTypeSet layers) {
|
|
||||||
+ checkClientLoading();
|
+ checkClientLoading();
|
||||||
+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), layers);
|
+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), java.util.EnumSet.of(type));
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static synchronized void setRenderLayer(Fluid fluid, RenderType type) {
|
+ /**
|
||||||
+ com.google.common.base.Preconditions.checkArgument(type.getChunkLayerId() >= 0, "The argument must be a valid chunk render type returned by RenderType#chunkBufferLayers().");
|
+ * It is recommended to set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) so that it can be data driven.
|
||||||
|
+ * But if you want to set it in code feel free to set it here like vanilla does.
|
||||||
|
+ */
|
||||||
|
+ public static synchronized void setRenderLayer(Block block, ChunkSectionLayer first, ChunkSectionLayer... others) {
|
||||||
|
+ checkClientLoading();
|
||||||
|
+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), java.util.EnumSet.of(first, others));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static synchronized void setRenderLayer(Fluid fluid, ChunkSectionLayer type) {
|
||||||
+ checkClientLoading();
|
+ checkClientLoading();
|
||||||
+ FLUID_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid), type);
|
+ FLUID_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid), type);
|
||||||
+ }
|
+ }
|
||||||
@@ -126,9 +119,5 @@
|
|||||||
+ "Render layers can only be set during client loading! " +
|
+ "Render layers can only be set during client loading! " +
|
||||||
+ "This might ideally be done from `FMLClientSetupEvent`."
|
+ "This might ideally be done from `FMLClientSetupEvent`."
|
||||||
+ );
|
+ );
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ private static net.minecraftforge.client.ChunkRenderTypeSet createSetFromPredicate(java.util.function.Predicate<RenderType> predicate) {
|
|
||||||
+ return net.minecraftforge.client.ChunkRenderTypeSet.of(RenderType.chunkBufferLayers().stream().filter(predicate).toArray(RenderType[]::new));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/renderer/LevelRenderer.java
|
--- a/net/minecraft/client/renderer/LevelRenderer.java
|
||||||
+++ b/net/minecraft/client/renderer/LevelRenderer.java
|
+++ b/net/minecraft/client/renderer/LevelRenderer.java
|
||||||
@@ -113,7 +_,7 @@
|
@@ -121,7 +_,7 @@
|
||||||
private final SkyRenderer skyRenderer = new SkyRenderer();
|
private final SkyRenderer skyRenderer = new SkyRenderer();
|
||||||
private final CloudRenderer cloudRenderer = new CloudRenderer();
|
private final CloudRenderer cloudRenderer = new CloudRenderer();
|
||||||
private final WorldBorderRenderer worldBorderRenderer = new WorldBorderRenderer();
|
private final WorldBorderRenderer worldBorderRenderer = new WorldBorderRenderer();
|
||||||
@@ -9,28 +9,16 @@
|
|||||||
@Nullable
|
@Nullable
|
||||||
private ClientLevel level;
|
private ClientLevel level;
|
||||||
private final SectionOcclusionGraph sectionOcclusionGraph = new SectionOcclusionGraph();
|
private final SectionOcclusionGraph sectionOcclusionGraph = new SectionOcclusionGraph();
|
||||||
@@ -483,7 +_,7 @@
|
@@ -480,7 +_,7 @@
|
||||||
postchain1.addToFrame(framegraphbuilder, i, j, this.targets, null);
|
postchain1.addToFrame(framegraphbuilder, i, j, this.targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
- this.addParticlesPass(framegraphbuilder, p_109604_, f, fogparameters);
|
- this.addParticlesPass(framegraphbuilder, p_109604_, f, p_407881_);
|
||||||
+ this.addParticlesPass(framegraphbuilder, p_109604_, f, fogparameters, frustum);
|
+ this.addParticlesPass(framegraphbuilder, p_109604_, f, p_407881_, frustum);
|
||||||
CloudStatus cloudstatus = this.minecraft.options.getCloudsType();
|
CloudStatus cloudstatus = this.minecraft.options.getCloudsType();
|
||||||
if (cloudstatus != CloudStatus.OFF) {
|
if (cloudstatus != CloudStatus.OFF) {
|
||||||
float f2 = this.level.effects().getCloudHeight();
|
Optional<Integer> optional = this.level.dimensionType().cloudHeight();
|
||||||
@@ -561,7 +_,11 @@
|
@@ -577,7 +_,7 @@
|
||||||
double d2 = vec3.z();
|
|
||||||
p_369478_.push("terrain");
|
|
||||||
this.renderSectionLayer(RenderType.solid(), d0, d1, d2, p_361439_, p_369924_);
|
|
||||||
+ // FORGE: fix flickering leaves when mods mess up the blurMipmap settings
|
|
||||||
+ var atlas = this.minecraft.getModelManager().getAtlas(net.minecraft.client.renderer.texture.TextureAtlas.LOCATION_BLOCKS);
|
|
||||||
+ atlas.setBlurMipmap(false, this.minecraft.options.mipmapLevels().get() > 0);
|
|
||||||
this.renderSectionLayer(RenderType.cutoutMipped(), d0, d1, d2, p_361439_, p_369924_);
|
|
||||||
+ atlas.restoreLastBlurMipmap();
|
|
||||||
this.renderSectionLayer(RenderType.cutout(), d0, d1, d2, p_361439_, p_369924_);
|
|
||||||
if (this.level.effects().constantAmbientLight()) {
|
|
||||||
Lighting.setupNetherLevel();
|
|
||||||
@@ -586,7 +_,7 @@
|
|
||||||
multibuffersource$buffersource.endLastBatch();
|
multibuffersource$buffersource.endLastBatch();
|
||||||
this.checkPoseStack(posestack);
|
this.checkPoseStack(posestack);
|
||||||
p_369478_.popPush("blockentities");
|
p_369478_.popPush("blockentities");
|
||||||
@@ -39,7 +27,7 @@
|
|||||||
multibuffersource$buffersource.endLastBatch();
|
multibuffersource$buffersource.endLastBatch();
|
||||||
this.checkPoseStack(posestack);
|
this.checkPoseStack(posestack);
|
||||||
multibuffersource$buffersource.endBatch(RenderType.solid());
|
multibuffersource$buffersource.endBatch(RenderType.solid());
|
||||||
@@ -600,8 +_,8 @@
|
@@ -591,8 +_,8 @@
|
||||||
multibuffersource$buffersource.endBatch(Sheets.hangingSignSheet());
|
multibuffersource$buffersource.endBatch(Sheets.hangingSignSheet());
|
||||||
multibuffersource$buffersource.endBatch(Sheets.chestSheet());
|
multibuffersource$buffersource.endBatch(Sheets.chestSheet());
|
||||||
this.renderBuffers.outlineBufferSource().endOutlineBatch();
|
this.renderBuffers.outlineBufferSource().endOutlineBatch();
|
||||||
@@ -50,10 +38,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
p_369478_.popPush("debug");
|
p_369478_.popPush("debug");
|
||||||
@@ -629,8 +_,8 @@
|
@@ -620,8 +_,8 @@
|
||||||
this.renderSectionLayer(RenderType.translucent(), d0, d1, d2, p_361439_, p_369924_);
|
chunksectionstorender.renderGroup(ChunkSectionLayerGroup.TRANSLUCENT);
|
||||||
p_369478_.popPush("string");
|
p_369478_.popPush("string");
|
||||||
this.renderSectionLayer(RenderType.tripwire(), d0, d1, d2, p_361439_, p_369924_);
|
chunksectionstorender.renderGroup(ChunkSectionLayerGroup.TRIPWIRE);
|
||||||
- if (p_362593_) {
|
- if (p_362593_) {
|
||||||
- this.renderBlockOutline(p_364769_, multibuffersource$buffersource, posestack, true);
|
- this.renderBlockOutline(p_364769_, multibuffersource$buffersource, posestack, true);
|
||||||
+ if (renderOutline) {
|
+ if (renderOutline) {
|
||||||
@@ -61,16 +49,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
multibuffersource$buffersource.endBatch();
|
multibuffersource$buffersource.endBatch();
|
||||||
@@ -638,7 +_,7 @@
|
@@ -629,7 +_,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- private void addParticlesPass(FrameGraphBuilder p_366471_, Camera p_363128_, float p_365755_, FogParameters p_363695_) {
|
- private void addParticlesPass(FrameGraphBuilder p_366471_, Camera p_363128_, float p_365755_, GpuBufferSlice p_405857_) {
|
||||||
+ private void addParticlesPass(FrameGraphBuilder p_366471_, Camera p_363128_, float p_365755_, FogParameters p_363695_, Frustum frustum) {
|
+ private void addParticlesPass(FrameGraphBuilder p_366471_, Camera p_363128_, float p_365755_, GpuBufferSlice p_405857_, Frustum frustum) {
|
||||||
FramePass framepass = p_366471_.addPass("particles");
|
FramePass framepass = p_366471_.addPass("particles");
|
||||||
if (this.targets.particles != null) {
|
if (this.targets.particles != null) {
|
||||||
this.targets.particles = framepass.readsAndWrites(this.targets.particles);
|
this.targets.particles = framepass.readsAndWrites(this.targets.particles);
|
||||||
@@ -655,7 +_,7 @@
|
@@ -646,7 +_,7 @@
|
||||||
resourcehandle1.get().copyDepthFrom(resourcehandle.get());
|
resourcehandle1.get().copyDepthFrom(resourcehandle.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +67,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,9 +_,9 @@
|
@@ -716,9 +_,9 @@
|
||||||
|| p_365712_.isDetached()
|
|| p_365712_.isDetached()
|
||||||
|| p_365712_.getEntity() instanceof LivingEntity && ((LivingEntity)p_365712_.getEntity()).isSleeping()
|
|| p_365712_.getEntity() instanceof LivingEntity && ((LivingEntity)p_365712_.getEntity()).isSleeping()
|
||||||
)
|
)
|
||||||
@@ -91,7 +79,7 @@
|
|||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -767,9 +_,10 @@
|
@@ -758,9 +_,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,15 +92,15 @@
|
|||||||
Vec3 vec3 = p_369847_.getPosition();
|
Vec3 vec3 = p_369847_.getPosition();
|
||||||
double d0 = vec3.x();
|
double d0 = vec3.x();
|
||||||
double d1 = vec3.y();
|
double d1 = vec3.y();
|
||||||
@@ -779,6 +_,7 @@
|
@@ -770,6 +_,7 @@
|
||||||
List<BlockEntity> list = sectionrenderdispatcher$rendersection.getCompiled().getRenderableBlockEntities();
|
List<BlockEntity> list = sectionrenderdispatcher$rendersection.getSectionMesh().getRenderableBlockEntities();
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
for (BlockEntity blockentity : list) {
|
for (BlockEntity blockentity : list) {
|
||||||
+ if (!frustum.isVisible(blockentity.getRenderBoundingBox())) continue;
|
+ if (!frustum.isVisible(blockentity.getRenderBoundingBox())) continue;
|
||||||
BlockPos blockpos = blockentity.getBlockPos();
|
BlockPos blockpos = blockentity.getBlockPos();
|
||||||
MultiBufferSource multibuffersource = p_362022_;
|
MultiBufferSource multibuffersource = p_362022_;
|
||||||
p_366168_.pushPose();
|
p_366168_.pushPose();
|
||||||
@@ -798,6 +_,9 @@
|
@@ -789,6 +_,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,10 +110,10 @@
|
|||||||
this.blockEntityRenderDispatcher.render(blockentity, p_367074_, p_366168_, multibuffersource);
|
this.blockEntityRenderDispatcher.render(blockentity, p_367074_, p_366168_, multibuffersource);
|
||||||
p_366168_.popPose();
|
p_366168_.popPose();
|
||||||
}
|
}
|
||||||
@@ -806,13 +_,18 @@
|
@@ -802,13 +_,18 @@
|
||||||
|
if (blockentity1.isRemoved()) {
|
||||||
synchronized (this.globalBlockEntities) {
|
iterator.remove();
|
||||||
for (BlockEntity blockentity1 : this.globalBlockEntities) {
|
} else {
|
||||||
+ if (!frustum.isVisible(blockentity1.getRenderBoundingBox())) continue;
|
+ if (!frustum.isVisible(blockentity1.getRenderBoundingBox())) continue;
|
||||||
BlockPos blockpos1 = blockentity1.getBlockPos();
|
BlockPos blockpos1 = blockentity1.getBlockPos();
|
||||||
p_366168_.pushPose();
|
p_366168_.pushPose();
|
||||||
@@ -141,7 +129,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderBlockDestroyAnimation(PoseStack p_366956_, Camera p_369324_, MultiBufferSource.BufferSource p_365998_) {
|
private void renderBlockDestroyAnimation(PoseStack p_366956_, Camera p_369324_, MultiBufferSource.BufferSource p_365998_) {
|
||||||
@@ -831,14 +_,14 @@
|
@@ -827,14 +_,14 @@
|
||||||
p_366956_.translate(blockpos.getX() - d0, blockpos.getY() - d1, blockpos.getZ() - d2);
|
p_366956_.translate(blockpos.getX() - d0, blockpos.getY() - d1, blockpos.getZ() - d2);
|
||||||
PoseStack.Pose posestack$pose = p_366956_.last();
|
PoseStack.Pose posestack$pose = p_366956_.last();
|
||||||
VertexConsumer vertexconsumer = new SheetedDecalTextureGenerator(p_365998_.getBuffer(ModelBakery.DESTROY_TYPES.get(i)), posestack$pose, 1.0F);
|
VertexConsumer vertexconsumer = new SheetedDecalTextureGenerator(p_365998_.getBuffer(ModelBakery.DESTROY_TYPES.get(i)), posestack$pose, 1.0F);
|
||||||
@@ -158,7 +146,7 @@
|
|||||||
if (this.minecraft.hitResult instanceof BlockHitResult blockhitresult) {
|
if (this.minecraft.hitResult instanceof BlockHitResult blockhitresult) {
|
||||||
if (blockhitresult.getType() != HitResult.Type.MISS) {
|
if (blockhitresult.getType() != HitResult.Type.MISS) {
|
||||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||||
@@ -849,6 +_,9 @@
|
@@ -845,6 +_,9 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +156,7 @@
|
|||||||
Vec3 vec3 = p_367935_.getPosition();
|
Vec3 vec3 = p_367935_.getPosition();
|
||||||
Boolean obool = this.minecraft.options.highContrastBlockOutline().get();
|
Boolean obool = this.minecraft.options.highContrastBlockOutline().get();
|
||||||
if (obool) {
|
if (obool) {
|
||||||
@@ -864,6 +_,8 @@
|
@@ -860,6 +_,8 @@
|
||||||
p_367206_.endLastBatch();
|
p_367206_.endLastBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,7 +165,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1359,7 +_,7 @@
|
@@ -1344,7 +_,7 @@
|
||||||
} else {
|
} else {
|
||||||
int i = p_398213_.packedBrightness(p_109538_, p_109540_);
|
int i = p_398213_.packedBrightness(p_109538_, p_109540_);
|
||||||
int j = LightTexture.block(i);
|
int j = LightTexture.block(i);
|
||||||
@@ -186,7 +174,7 @@
|
|||||||
if (j < k) {
|
if (j < k) {
|
||||||
int l = LightTexture.sky(i);
|
int l = LightTexture.sky(i);
|
||||||
return LightTexture.pack(k, l);
|
return LightTexture.pack(k, l);
|
||||||
@@ -1422,6 +_,22 @@
|
@@ -1406,6 +_,22 @@
|
||||||
|
|
||||||
public CloudRenderer getCloudRenderer() {
|
public CloudRenderer getCloudRenderer() {
|
||||||
return this.cloudRenderer;
|
return this.cloudRenderer;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/renderer/LightTexture.java
|
--- a/net/minecraft/client/renderer/LightTexture.java
|
||||||
+++ b/net/minecraft/client/renderer/LightTexture.java
|
+++ b/net/minecraft/client/renderer/LightTexture.java
|
||||||
@@ -142,7 +_,7 @@
|
@@ -171,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int block(int p_109884_) {
|
public static int block(int p_109884_) {
|
||||||
|
|||||||
@@ -1,15 +1,6 @@
|
|||||||
--- a/net/minecraft/client/renderer/RenderType.java
|
--- a/net/minecraft/client/renderer/RenderType.java
|
||||||
+++ b/net/minecraft/client/renderer/RenderType.java
|
+++ b/net/minecraft/client/renderer/RenderType.java
|
||||||
@@ -633,9 +_,20 @@
|
@@ -521,6 +_,11 @@
|
||||||
.createCompositeState(false)
|
|
||||||
);
|
|
||||||
private static final ImmutableList<RenderType> CHUNK_BUFFER_LAYERS = ImmutableList.of(solid(), cutoutMipped(), cutout(), translucent(), tripwire());
|
|
||||||
+ static {
|
|
||||||
+ int i = 0;
|
|
||||||
+ for (var layer : CHUNK_BUFFER_LAYERS)
|
|
||||||
+ layer.chunkLayerId = i++;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
private final int bufferSize;
|
private final int bufferSize;
|
||||||
private final boolean affectsCrumbling;
|
private final boolean affectsCrumbling;
|
||||||
private final boolean sortOnUpload;
|
private final boolean sortOnUpload;
|
||||||
@@ -21,7 +12,7 @@
|
|||||||
|
|
||||||
public static RenderType solid() {
|
public static RenderType solid() {
|
||||||
return SOLID;
|
return SOLID;
|
||||||
@@ -820,7 +_,7 @@
|
@@ -701,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RenderType text(ResourceLocation p_110498_) {
|
public static RenderType text(ResourceLocation p_110498_) {
|
||||||
@@ -30,7 +21,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static RenderType textBackground() {
|
public static RenderType textBackground() {
|
||||||
@@ -828,19 +_,19 @@
|
@@ -709,19 +_,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RenderType textIntensity(ResourceLocation p_173238_) {
|
public static RenderType textIntensity(ResourceLocation p_173238_) {
|
||||||
@@ -54,7 +45,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static RenderType textBackgroundSeeThrough() {
|
public static RenderType textBackgroundSeeThrough() {
|
||||||
@@ -848,7 +_,7 @@
|
@@ -729,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RenderType textIntensitySeeThrough(ResourceLocation p_173241_) {
|
public static RenderType textIntensitySeeThrough(ResourceLocation p_173241_) {
|
||||||
|
|||||||
@@ -1,33 +1,32 @@
|
|||||||
--- a/net/minecraft/client/renderer/ScreenEffectRenderer.java
|
--- a/net/minecraft/client/renderer/ScreenEffectRenderer.java
|
||||||
+++ b/net/minecraft/client/renderer/ScreenEffectRenderer.java
|
+++ b/net/minecraft/client/renderer/ScreenEffectRenderer.java
|
||||||
@@ -27,17 +_,24 @@
|
@@ -55,18 +_,24 @@
|
||||||
Player player = p_110719_.player;
|
Player player = this.minecraft.player;
|
||||||
if (!player.noPhysics) {
|
if (this.minecraft.options.getCameraType().isFirstPerson() && !p_409640_) {
|
||||||
BlockState blockstate = getViewBlockingState(player);
|
if (!player.noPhysics) {
|
||||||
- if (blockstate != null) {
|
- BlockState blockstate = getViewBlockingState(player);
|
||||||
- renderTex(p_110719_.getBlockRenderer().getBlockModelShaper().getParticleIcon(blockstate), p_110720_, p_378238_);
|
+ var overlay = getOverlayBlock(player);
|
||||||
+ var overlay = getOverlayBlock(player);
|
+ BlockState blockstate = overlay == null ? null : overlay.getLeft();
|
||||||
+ if (overlay != null) {
|
if (blockstate != null) {
|
||||||
+ if (!net.minecraftforge.client.ForgeHooksClient.renderBlockOverlay(player, p_110720_, net.minecraftforge.client.event.RenderBlockScreenEffectEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight())) {
|
+ if (!net.minecraftforge.client.ForgeHooksClient.renderBlockOverlay(player, posestack, net.minecraftforge.client.event.RenderBlockScreenEffectEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight()))
|
||||||
+ renderTex(p_110719_.getBlockRenderer().getBlockModelShaper().getParticleIcon(overlay.getLeft(), p_110719_.level, overlay.getRight()), p_110720_, p_378238_);
|
renderTex(this.minecraft.getBlockRenderer().getBlockModelShaper().getParticleIcon(blockstate), posestack, this.bufferSource);
|
||||||
+ }
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!p_110719_.player.isSpectator()) {
|
|
||||||
if (p_110719_.player.isEyeInFluid(FluidTags.WATER)) {
|
|
||||||
+ if (!net.minecraftforge.client.ForgeHooksClient.renderWaterOverlay(player, p_110720_))
|
|
||||||
renderWater(p_110719_, p_110720_, p_378238_);
|
|
||||||
+ } else if (!player.getEyeInFluidType().isAir()) {
|
|
||||||
+ net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(player.getEyeInFluidType()).renderOverlay(p_110719_, p_110720_, p_378238_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_110719_.player.isOnFire()) {
|
if (!this.minecraft.player.isSpectator()) {
|
||||||
+ if (!net.minecraftforge.client.ForgeHooksClient.renderFireOverlay(player, p_110720_))
|
if (this.minecraft.player.isEyeInFluid(FluidTags.WATER)) {
|
||||||
renderFire(p_110720_, p_378238_);
|
+ if (!net.minecraftforge.client.ForgeHooksClient.renderWaterOverlay(player, posestack))
|
||||||
|
renderWater(this.minecraft, posestack, this.bufferSource);
|
||||||
|
+ } else if (!player.getEyeInFluidType().isAir()) {
|
||||||
|
+ net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(player.getEyeInFluidType()).renderOverlay(this.minecraft, posestack, this.bufferSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.minecraft.player.isOnFire()) {
|
||||||
|
+ if (!net.minecraftforge.client.ForgeHooksClient.renderFireOverlay(player, posestack))
|
||||||
|
renderFire(posestack, this.bufferSource);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
@@ -116,6 +_,12 @@
|
||||||
@@ -45,6 +_,12 @@
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private static BlockState getViewBlockingState(Player p_110717_) {
|
private static BlockState getViewBlockingState(Player p_110717_) {
|
||||||
@@ -40,7 +39,7 @@
|
|||||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
@@ -54,7 +_,7 @@
|
@@ -125,7 +_,7 @@
|
||||||
blockpos$mutableblockpos.set(d0, d1, d2);
|
blockpos$mutableblockpos.set(d0, d1, d2);
|
||||||
BlockState blockstate = p_110717_.level().getBlockState(blockpos$mutableblockpos);
|
BlockState blockstate = p_110717_.level().getBlockState(blockpos$mutableblockpos);
|
||||||
if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.isViewBlocking(p_110717_.level(), blockpos$mutableblockpos)) {
|
if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.isViewBlocking(p_110717_.level(), blockpos$mutableblockpos)) {
|
||||||
@@ -49,7 +48,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +_,10 @@
|
@@ -153,6 +_,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void renderWater(Minecraft p_110726_, PoseStack p_110727_, MultiBufferSource p_376402_) {
|
private static void renderWater(Minecraft p_110726_, PoseStack p_110727_, MultiBufferSource p_376402_) {
|
||||||
@@ -60,7 +59,7 @@
|
|||||||
BlockPos blockpos = BlockPos.containing(p_110726_.player.getX(), p_110726_.player.getEyeY(), p_110726_.player.getZ());
|
BlockPos blockpos = BlockPos.containing(p_110726_.player.getX(), p_110726_.player.getEyeY(), p_110726_.player.getZ());
|
||||||
float f = LightTexture.getBrightness(p_110726_.player.level().dimensionType(), p_110726_.player.level().getMaxLocalRawBrightness(blockpos));
|
float f = LightTexture.getBrightness(p_110726_.player.level().dimensionType(), p_110726_.player.level().getMaxLocalRawBrightness(blockpos));
|
||||||
int i = ARGB.colorFromFloat(0.1F, f, f, f);
|
int i = ARGB.colorFromFloat(0.1F, f, f, f);
|
||||||
@@ -94,7 +_,7 @@
|
@@ -165,7 +_,7 @@
|
||||||
float f7 = -p_110726_.player.getYRot() / 64.0F;
|
float f7 = -p_110726_.player.getYRot() / 64.0F;
|
||||||
float f8 = p_110726_.player.getXRot() / 64.0F;
|
float f8 = p_110726_.player.getXRot() / 64.0F;
|
||||||
Matrix4f matrix4f = p_110727_.last().pose();
|
Matrix4f matrix4f = p_110727_.last().pose();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
- int p_111076_
|
- int p_111076_
|
||||||
+ int p_111076_,
|
+ int p_111076_,
|
||||||
+ net.minecraftforge.client.model.data.ModelData modelData,
|
+ net.minecraftforge.client.model.data.ModelData modelData,
|
||||||
+ @org.jetbrains.annotations.Nullable net.minecraft.client.renderer.RenderType renderType
|
+ @org.jetbrains.annotations.Nullable net.minecraft.client.renderer.chunk.ChunkSectionLayer renderType
|
||||||
) {
|
) {
|
||||||
- for (BlockModelPart blockmodelpart : p_397754_.collectParts(RandomSource.create(42L))) {
|
- for (BlockModelPart blockmodelpart : p_397754_.collectParts(RandomSource.create(42L))) {
|
||||||
+ for (BlockModelPart blockmodelpart : p_397754_.collectParts(RandomSource.create(42L), modelData, renderType)) {
|
+ for (BlockModelPart blockmodelpart : p_397754_.collectParts(RandomSource.create(42L), modelData, renderType)) {
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
--- a/net/minecraft/client/renderer/block/model/BlockModelPart.java
|
||||||
|
+++ b/net/minecraft/client/renderer/block/model/BlockModelPart.java
|
||||||
|
@@ -10,7 +_,7 @@
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
-public interface BlockModelPart {
|
||||||
|
+public interface BlockModelPart extends net.minecraftforge.client.extensions.IForgeBlockModelPart {
|
||||||
|
List<BakedQuad> getQuads(@Nullable Direction p_395320_);
|
||||||
|
|
||||||
|
boolean useAmbientOcclusion();
|
||||||
Loaded 100 of 771 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user