mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 19:59:42 +00:00
1.21.6 - New EventBus 7
A full rewrite and redesign of the library that offers much better performance, new features and fixes all previous design flaws See the migration guide here: https://gist.github.com/PaintNinja/ad82c224aecee25efac1ea3e2cf19b91 Co-authored-by: Paint_Ninja <[email protected]>
This commit is contained in:
642 files changed
+7258
-6187
No files matched your search
@@ -1,223 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An immutable ordered set (not implementing {@link java.util.Set}) of chunk {@linkplain RenderType render types}.
|
||||
* <p>
|
||||
* Considerably speeds up lookups and merges of sets of chunk {@linkplain RenderType render types}.
|
||||
* Users should cache their instances of this class whenever possible, as instantiating it is cheap, but not free.
|
||||
*/
|
||||
public sealed class ChunkRenderTypeSet implements Iterable<RenderType>
|
||||
{
|
||||
private static final List<RenderType> CHUNK_RENDER_TYPES_LIST = RenderType.chunkBufferLayers();
|
||||
private static final RenderType[] CHUNK_RENDER_TYPES = CHUNK_RENDER_TYPES_LIST.toArray(new RenderType[0]);
|
||||
|
||||
private static final ChunkRenderTypeSet NONE = new None();
|
||||
private static final ChunkRenderTypeSet ALL = new All();
|
||||
|
||||
public static ChunkRenderTypeSet none()
|
||||
{
|
||||
return NONE;
|
||||
}
|
||||
|
||||
public static ChunkRenderTypeSet all()
|
||||
{
|
||||
return ALL;
|
||||
}
|
||||
|
||||
public static ChunkRenderTypeSet of(RenderType... renderTypes)
|
||||
{
|
||||
return of(Arrays.asList(renderTypes));
|
||||
}
|
||||
|
||||
public static ChunkRenderTypeSet of(Collection<RenderType> renderTypes)
|
||||
{
|
||||
if (renderTypes.isEmpty())
|
||||
return none();
|
||||
return of((Iterable<RenderType>) renderTypes);
|
||||
}
|
||||
|
||||
private static ChunkRenderTypeSet of(Iterable<RenderType> renderTypes)
|
||||
{
|
||||
var bits = new BitSet();
|
||||
for (RenderType renderType : renderTypes)
|
||||
{
|
||||
int index = renderType.getChunkLayerId();
|
||||
Preconditions.checkArgument(index >= 0, "Attempted to create chunk render type set with a non-chunk render type: " + renderType);
|
||||
bits.set(index);
|
||||
}
|
||||
return new ChunkRenderTypeSet(bits);
|
||||
}
|
||||
|
||||
public static ChunkRenderTypeSet union(ChunkRenderTypeSet... sets)
|
||||
{
|
||||
return union(Arrays.asList(sets));
|
||||
}
|
||||
|
||||
public static ChunkRenderTypeSet union(Collection<ChunkRenderTypeSet> sets)
|
||||
{
|
||||
if (sets.isEmpty())
|
||||
return none();
|
||||
return union((Iterable<ChunkRenderTypeSet>) sets);
|
||||
}
|
||||
|
||||
public static ChunkRenderTypeSet union(Iterable<ChunkRenderTypeSet> sets)
|
||||
{
|
||||
var bits = new BitSet();
|
||||
for (var set : sets)
|
||||
bits.or(set.bits);
|
||||
return new ChunkRenderTypeSet(bits);
|
||||
}
|
||||
|
||||
public static ChunkRenderTypeSet intersection(ChunkRenderTypeSet... sets)
|
||||
{
|
||||
return intersection(Arrays.asList(sets));
|
||||
}
|
||||
|
||||
public static ChunkRenderTypeSet intersection(Collection<ChunkRenderTypeSet> sets)
|
||||
{
|
||||
if (sets.isEmpty())
|
||||
return all();
|
||||
return intersection((Iterable<ChunkRenderTypeSet>) sets);
|
||||
}
|
||||
|
||||
public static ChunkRenderTypeSet intersection(Iterable<ChunkRenderTypeSet> sets)
|
||||
{
|
||||
var bits = new BitSet();
|
||||
bits.set(0, CHUNK_RENDER_TYPES.length);
|
||||
for (var set : sets)
|
||||
bits.and(set.bits);
|
||||
return new ChunkRenderTypeSet(bits);
|
||||
}
|
||||
|
||||
private final BitSet bits;
|
||||
|
||||
private ChunkRenderTypeSet(BitSet bits)
|
||||
{
|
||||
this.bits = bits;
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return bits.isEmpty();
|
||||
}
|
||||
|
||||
public boolean contains(RenderType renderType)
|
||||
{
|
||||
int id = renderType.getChunkLayerId();
|
||||
return id >= 0 && bits.get(id);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<RenderType> iterator()
|
||||
{
|
||||
return new IteratorImpl();
|
||||
}
|
||||
|
||||
public List<RenderType> asList()
|
||||
{
|
||||
return ImmutableList.copyOf(this);
|
||||
}
|
||||
|
||||
private final class IteratorImpl implements Iterator<RenderType>
|
||||
{
|
||||
private int index = bits.nextSetBit(0);
|
||||
|
||||
@Override
|
||||
public boolean hasNext()
|
||||
{
|
||||
return index >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType next()
|
||||
{
|
||||
var renderType = CHUNK_RENDER_TYPES[index];
|
||||
index = bits.nextSetBit(index + 1);
|
||||
return renderType;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class None extends ChunkRenderTypeSet
|
||||
{
|
||||
private None()
|
||||
{
|
||||
super(new BitSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(RenderType renderType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<RenderType> iterator()
|
||||
{
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RenderType> asList()
|
||||
{
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
|
||||
private static final class All extends ChunkRenderTypeSet
|
||||
{
|
||||
private All()
|
||||
{
|
||||
super(Util.make(new BitSet(), bits -> bits.set(0, CHUNK_RENDER_TYPES.length)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(RenderType renderType)
|
||||
{
|
||||
return renderType.getChunkLayerId() >= 0; // Could just return true for efficiency purposes, but checking is near-free
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<RenderType> iterator()
|
||||
{
|
||||
return CHUNK_RENDER_TYPES_LIST.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RenderType> asList()
|
||||
{
|
||||
return CHUNK_RENDER_TYPES_LIST;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import com.mojang.brigadier.tree.RootCommandNode;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||
import net.minecraft.client.multiplayer.ClientSuggestionProvider;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.commands.CommandBuildContext;
|
||||
import net.minecraft.commands.CommandSource;
|
||||
@@ -39,7 +40,7 @@ public class ClientCommandHandler {
|
||||
private static CommandDispatcher<CommandSourceStack> commands = null;
|
||||
|
||||
public static void init() {
|
||||
MinecraftForge.EVENT_BUS.addListener(ClientCommandHandler::handleClientPlayerLogin);
|
||||
ClientPlayerNetworkEvent.LoggingIn.BUS.addListener(ClientCommandHandler::handleClientPlayerLogin);
|
||||
}
|
||||
|
||||
private static void handleClientPlayerLogin(ClientPlayerNetworkEvent.LoggingIn event) {
|
||||
@@ -56,24 +57,24 @@ public class ClientCommandHandler {
|
||||
* with server commands in suggestions
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public static CommandDispatcher<SharedSuggestionProvider> mergeServerCommands(CommandDispatcher<SharedSuggestionProvider> serverCommands, CommandBuildContext buildContext) {
|
||||
public static <T extends SharedSuggestionProvider> CommandDispatcher<T> mergeServerCommands(CommandDispatcher<T> serverCommands, CommandBuildContext buildContext) {
|
||||
CommandDispatcher<CommandSourceStack> commandsTemp = new CommandDispatcher<>();
|
||||
MinecraftForge.EVENT_BUS.post(new RegisterClientCommandsEvent(commandsTemp, buildContext));
|
||||
RegisterClientCommandsEvent.BUS.post(new RegisterClientCommandsEvent(commandsTemp, buildContext));
|
||||
|
||||
// Copies the client commands into another RootCommandNode so that redirects can't be used with server commands
|
||||
commands = new CommandDispatcher<>();
|
||||
copy(commandsTemp.getRoot(), commands.getRoot());
|
||||
|
||||
// Copies the server commands into another RootCommandNode so that redirects can't be used with client commands
|
||||
RootCommandNode<SharedSuggestionProvider> serverCommandsRoot = serverCommands.getRoot();
|
||||
CommandDispatcher<SharedSuggestionProvider> newServerCommands = new CommandDispatcher<>();
|
||||
RootCommandNode<T> serverCommandsRoot = serverCommands.getRoot();
|
||||
CommandDispatcher<T> newServerCommands = new CommandDispatcher<>();
|
||||
copy(serverCommandsRoot, newServerCommands.getRoot());
|
||||
|
||||
// Copies the client side commands into the server side commands to be used for suggestions
|
||||
CommandHelper.mergeCommandNode(commands.getRoot(), newServerCommands.getRoot(), new IdentityHashMap<>(), getSource(), (context) -> 0, (suggestions) -> {
|
||||
@SuppressWarnings("unchecked")
|
||||
var shared = (SuggestionProvider<SharedSuggestionProvider>)(SuggestionProvider<?>)suggestions;
|
||||
var suggestionProvider = SuggestionProviders.safelySwap(shared);
|
||||
var shared = (SuggestionProvider<T>)(SuggestionProvider<?>)suggestions;
|
||||
var suggestionProvider = shared; //SuggestionProviders.safelySwap(shared);
|
||||
if (suggestionProvider == SuggestionProviders.ASK_SERVER) {
|
||||
suggestionProvider = (context, builder) -> {
|
||||
ClientCommandSourceStack source = getSource();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
|
||||
import net.minecraft.client.resources.model.UnbakedGeometry;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ModelEvent;
|
||||
@@ -14,7 +14,7 @@ import net.minecraftforge.client.event.RegisterNamedRenderTypesEvent;
|
||||
import net.minecraftforge.client.model.DynamicFluidContainerModel;
|
||||
import net.minecraftforge.client.model.ItemLayerGeometry;
|
||||
import net.minecraftforge.client.model.obj.ObjLoader;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD, modid = "forge")
|
||||
@@ -34,6 +34,6 @@ public class ClientForgeMod {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRegisterNamedRenderTypes(RegisterNamedRenderTypesEvent event) {
|
||||
event.register("item_unlit", RenderType.translucent(), ForgeRenderTypes.ITEM_UNSORTED_UNLIT_TRANSLUCENT.get());
|
||||
event.register("item_unlit", ChunkSectionLayer.TRANSLUCENT, ForgeRenderTypes.ITEM_UNSORTED_UNLIT_TRANSLUCENT.get());
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import com.mojang.math.Transformation;
|
||||
|
||||
import net.minecraft.FileUtil;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Options;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
@@ -40,12 +41,12 @@ import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraft.client.particle.ParticleEngine;
|
||||
import net.minecraft.client.particle.ParticleRenderType;
|
||||
import net.minecraft.client.player.ClientInput;
|
||||
import net.minecraft.client.renderer.FogParameters;
|
||||
import net.minecraft.client.renderer.FogRenderer;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
|
||||
import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
|
||||
import net.minecraft.client.renderer.fog.FogData;
|
||||
import net.minecraft.client.renderer.texture.SpriteContents;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -126,7 +127,6 @@ import net.minecraftforge.client.textures.ForgeTextureMetadata;
|
||||
import net.minecraftforge.client.textures.TextureAtlasSpriteLoaderManager;
|
||||
import net.minecraftforge.common.ForgeI18n;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.IExtensionPoint;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
@@ -144,6 +144,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -196,7 +197,7 @@ public class ForgeHooksClient {
|
||||
guiLayers.push(minecraft.screen);
|
||||
minecraft.screen = Objects.requireNonNull(screen);
|
||||
screen.init(minecraft, minecraft.getWindow().getGuiScaledWidth(), minecraft.getWindow().getGuiScaledHeight());
|
||||
minecraft.getNarrator().sayNow(screen.getNarrationMessage());
|
||||
minecraft.getNarrator().saySystemNow(screen.getNarrationMessage());
|
||||
}
|
||||
|
||||
public static void popGuiLayer(Minecraft minecraft) {
|
||||
@@ -207,7 +208,7 @@ public class ForgeHooksClient {
|
||||
|
||||
popGuiLayerInternal(minecraft);
|
||||
if (minecraft.screen != null)
|
||||
minecraft.getNarrator().sayNow(minecraft.screen.getNarrationMessage());
|
||||
minecraft.getNarrator().saySystemNow(minecraft.screen.getNarrationMessage());
|
||||
}
|
||||
|
||||
public static float getGuiFarPlane() {
|
||||
@@ -218,11 +219,11 @@ public class ForgeHooksClient {
|
||||
}
|
||||
|
||||
public static boolean onClientPauseChangePre(boolean pause) {
|
||||
return MinecraftForge.EVENT_BUS.post(new ClientPauseChangeEvent.Pre(pause));
|
||||
return ClientPauseChangeEvent.Pre.BUS.post(new ClientPauseChangeEvent.Pre(pause));
|
||||
}
|
||||
|
||||
public static void onClientPauseChangePost(boolean pause) {
|
||||
MinecraftForge.EVENT_BUS.post(new ClientPauseChangeEvent.Post(pause));
|
||||
ClientPauseChangeEvent.Post.BUS.post(new ClientPauseChangeEvent.Post(pause));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -236,17 +237,17 @@ public class ForgeHooksClient {
|
||||
switch (target.getType()) {
|
||||
case BLOCK:
|
||||
if (!(target instanceof BlockHitResult blockTarget)) return false;
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderHighlightEvent.Block(context, camera, blockTarget, partialTick, poseStack, bufferSource));
|
||||
return RenderHighlightEvent.Block.BUS.post(new RenderHighlightEvent.Block(context, camera, blockTarget, partialTick, poseStack, bufferSource));
|
||||
case ENTITY:
|
||||
if (!(target instanceof EntityHitResult entityTarget)) return false;
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderHighlightEvent.Entity(context, camera, entityTarget, partialTick, poseStack, bufferSource));
|
||||
return RenderHighlightEvent.Entity.BUS.post(new RenderHighlightEvent.Entity(context, camera, entityTarget, partialTick, poseStack, bufferSource));
|
||||
default:
|
||||
return false; // NO-OP - This doesn't even get called for anything other than blocks and entities
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean renderSpecificFirstPersonHand(InteractionHand hand, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, float partialTick, float interpPitch, float swingProgress, float equipProgress, ItemStack stack) {
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderHandEvent(hand, poseStack, bufferSource, packedLight, partialTick, interpPitch, swingProgress, equipProgress, stack));
|
||||
return RenderHandEvent.BUS.post(new RenderHandEvent(hand, poseStack, bufferSource, packedLight, partialTick, interpPitch, swingProgress, equipProgress, stack));
|
||||
}
|
||||
|
||||
public static void onTextureStitchedPost(TextureAtlas map) {
|
||||
@@ -294,24 +295,24 @@ public class ForgeHooksClient {
|
||||
|
||||
@Nullable
|
||||
public static SoundInstance playSound(SoundEngine manager, SoundInstance sound) {
|
||||
return MinecraftForge.EVENT_BUS.fire(new PlaySoundEvent(manager, sound)).getSound();
|
||||
return PlaySoundEvent.BUS.fire(new PlaySoundEvent(manager, sound)).getSound();
|
||||
}
|
||||
|
||||
public static void drawScreen(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
|
||||
guiGraphics.pose().pushPose();
|
||||
guiGraphics.pose().pushMatrix();
|
||||
for (Screen layer : guiLayers) {
|
||||
// Prevent the background layers from thinking the mouse is over their controls and showing them as highlighted.
|
||||
drawScreenInternal(layer, guiGraphics, Integer.MAX_VALUE, Integer.MAX_VALUE, partialTick);
|
||||
guiGraphics.pose().translate(0, 0, 10000);
|
||||
//guiGraphics.pose().translate(0, 0, 10000);
|
||||
}
|
||||
drawScreenInternal(screen, guiGraphics, mouseX, mouseY, partialTick);
|
||||
guiGraphics.pose().popPose();
|
||||
guiGraphics.pose().popMatrix();
|
||||
}
|
||||
|
||||
private static void drawScreenInternal(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
|
||||
if (!MinecraftForge.EVENT_BUS.post(new ScreenEvent.Render.Pre(screen, guiGraphics, mouseX, mouseY, partialTick)))
|
||||
if (!ScreenEvent.Render.Pre.BUS.post(new ScreenEvent.Render.Pre(screen, guiGraphics, mouseX, mouseY, partialTick)))
|
||||
screen.renderWithTooltip(guiGraphics, mouseX, mouseY, partialTick);
|
||||
MinecraftForge.EVENT_BUS.post(new ScreenEvent.Render.Post(screen, guiGraphics, mouseX, mouseY, partialTick));
|
||||
ScreenEvent.Render.Post.BUS.post(new ScreenEvent.Render.Post(screen, guiGraphics, mouseX, mouseY, partialTick));
|
||||
}
|
||||
|
||||
public static Vector3f getFogColor(Camera camera, float partialTick, ClientLevel level, int renderDistance, float darkenWorldAmount, float fogRed, float fogGreen, float fogBlue) {
|
||||
@@ -321,29 +322,20 @@ public class ForgeHooksClient {
|
||||
if (camera.getPosition().y < (double)((float)camera.getBlockPosition().getY() + state.getHeight(level, camera.getBlockPosition())))
|
||||
fluidFogColor = IClientFluidTypeExtensions.of(state).modifyFogColor(camera, partialTick, level, renderDistance, darkenWorldAmount, fluidFogColor);
|
||||
|
||||
ViewportEvent.ComputeFogColor event = new ViewportEvent.ComputeFogColor(camera, partialTick, fluidFogColor.x(), fluidFogColor.y(), fluidFogColor.z());
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
var event = ViewportEvent.ComputeFogColor.BUS.fire(new ViewportEvent.ComputeFogColor(camera, partialTick, fluidFogColor.x(), fluidFogColor.y(), fluidFogColor.z()));
|
||||
|
||||
fluidFogColor.set(event.getRed(), event.getGreen(), event.getBlue());
|
||||
return fluidFogColor;
|
||||
}
|
||||
|
||||
public static FogParameters getFogParameters(FogRenderer.FogMode mode, FogType type, Camera camera, float partialTick, float renderDistance, FogParameters original) {
|
||||
var ret = original;
|
||||
public static Vector4f setupFog(FogType type, Camera camera, DeltaTracker delta, FogData data, Vector4f color) {
|
||||
// Modify fog rendering depending on the fluid
|
||||
FluidState state = camera.getEntity().level().getFluidState(camera.getBlockPosition());
|
||||
if (camera.getPosition().y < (double)((float)camera.getBlockPosition().getY() + state.getHeight(camera.getEntity().level(), camera.getBlockPosition())))
|
||||
ret = IClientFluidTypeExtensions.of(state).modifyFogRender(camera, mode, renderDistance, partialTick, ret);
|
||||
IClientFluidTypeExtensions.of(state).modifyFogRender(camera, type, delta.getRealtimeDeltaTicks(), data, color);
|
||||
|
||||
var event = new ViewportEvent.RenderFog(mode, type, camera, partialTick, ret.start(), ret.end(), ret.shape());
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) {
|
||||
return new FogParameters(
|
||||
event.getNearPlaneDistance(), event.getFarPlaneDistance(), event.getFogShape(),
|
||||
ret.red(), ret.green(), ret.blue(), ret.alpha()
|
||||
);
|
||||
}
|
||||
|
||||
return ret;
|
||||
ViewportEvent.RenderFog.BUS.post(new ViewportEvent.RenderFog(type, camera, delta.getRealtimeDeltaTicks(), data, color));
|
||||
return color;
|
||||
}
|
||||
|
||||
public static void onModifyBakingResult(ModelBakery modelBakery, ModelBakery.BakingResult results) {
|
||||
@@ -384,38 +376,37 @@ public class ForgeHooksClient {
|
||||
return from.getItem().shouldCauseReequipAnimation(from, to, changed);
|
||||
}
|
||||
|
||||
public static CustomizeGuiOverlayEvent.BossEventProgress onCustomizeBossEventProgress(GuiGraphics guiGraphics, Window window, LerpingBossEvent bossInfo, int x, int y, int increment) {
|
||||
public static @Nullable CustomizeGuiOverlayEvent.BossEventProgress onCustomizeBossEventProgress(GuiGraphics guiGraphics, Window window, LerpingBossEvent bossInfo, int x, int y, int increment) {
|
||||
var evt = new CustomizeGuiOverlayEvent.BossEventProgress(window, guiGraphics,
|
||||
Minecraft.getInstance().getDeltaTracker().getGameTimeDeltaPartialTick(false), bossInfo, x, y, increment);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
return evt;
|
||||
return CustomizeGuiOverlayEvent.BossEventProgress.BUS.post(evt) ? null : evt;
|
||||
}
|
||||
|
||||
public static void onCustomizeChatEvent(GuiGraphics guiGraphics, ChatComponent chat, Window window, int mouseX, int mouseY, int tickCount) {
|
||||
var minecraft = Minecraft.getInstance();
|
||||
var evt = new CustomizeGuiOverlayEvent.Chat(window, guiGraphics, minecraft.getDeltaTracker().getRealtimeDeltaTicks(), 0, chat.getHeight() - 40);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
guiGraphics.pose().pushPose();
|
||||
CustomizeGuiOverlayEvent.Chat.BUS.post(evt);
|
||||
guiGraphics.pose().pushMatrix();
|
||||
// We give the absolute Y position of the chat component in the event and account for the chat component's own offsetting here.
|
||||
guiGraphics.pose().translate(evt.getPosX(), (evt.getPosY() - chat.getHeight() + 40) / chat.getScale(), 0.0D);
|
||||
guiGraphics.pose().translate(evt.getPosX(), (float) ((evt.getPosY() - chat.getHeight() + 40) / chat.getScale()));
|
||||
chat.render(guiGraphics, tickCount, mouseX, mouseY, false);
|
||||
guiGraphics.pose().popPose();
|
||||
guiGraphics.pose().popMatrix();
|
||||
}
|
||||
|
||||
public static void onCustomizeDebugEvent(GuiGraphics guiGraphics, Window window, float partialTick, List<String> text, boolean isLeft) {
|
||||
var evt = new CustomizeGuiOverlayEvent.DebugText(window, guiGraphics, partialTick, text,
|
||||
isLeft ? CustomizeGuiOverlayEvent.DebugText.Side.Left : CustomizeGuiOverlayEvent.DebugText.Side.Right);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
CustomizeGuiOverlayEvent.DebugText.BUS.post(evt);
|
||||
}
|
||||
|
||||
public static void onClientChangeGameType(PlayerInfo info, GameType currentGameMode, GameType newGameMode) {
|
||||
if (currentGameMode != newGameMode) {
|
||||
MinecraftForge.EVENT_BUS.post(new ClientPlayerChangeGameTypeEvent(info, currentGameMode, newGameMode));
|
||||
ClientPlayerChangeGameTypeEvent.BUS.post(new ClientPlayerChangeGameTypeEvent(info, currentGameMode, newGameMode));
|
||||
}
|
||||
}
|
||||
|
||||
public static void onMovementInputUpdate(Player player, ClientInput movementInput) {
|
||||
MinecraftForge.EVENT_BUS.post(new MovementInputUpdateEvent(player, movementInput));
|
||||
MovementInputUpdateEvent.BUS.post(new MovementInputUpdateEvent(player, movementInput));
|
||||
}
|
||||
|
||||
public static boolean onScreenKeyPressed(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
@@ -437,7 +428,7 @@ public class ForgeHooksClient {
|
||||
}
|
||||
|
||||
public static void onKeyInput(int key, int scanCode, int action, int modifiers) {
|
||||
MinecraftForge.EVENT_BUS.post(new InputEvent.Key(key, scanCode, action, modifiers));
|
||||
InputEvent.Key.BUS.post(new InputEvent.Key(key, scanCode, action, modifiers));
|
||||
}
|
||||
|
||||
public static boolean isNameplateInRenderDistance(Entity entity, double squareDistance) {
|
||||
@@ -576,13 +567,13 @@ public class ForgeHooksClient {
|
||||
tooltip = ForgeI18n.parseMessage("fml.menu.multiplayer.unknown", target.forgeData.type());
|
||||
}
|
||||
|
||||
guiGraphics.blit(RenderType::guiTextured, ICON_SHEET, x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256);
|
||||
guiGraphics.blit(RenderPipelines.GUI_TEXTURED, ICON_SHEET, x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256);
|
||||
|
||||
if(relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26) {
|
||||
//this is not the most proper way to do it,
|
||||
//but works best here and has the least maintenance overhead
|
||||
var lines = Arrays.stream(tooltip.split("\n")).map(Component::literal).toList();
|
||||
gui.setTooltipForNextRenderPass(Lists.transform(lines, Component::getVisualOrderText));
|
||||
guiGraphics.setTooltipForNextFrame(Lists.transform(lines, Component::getVisualOrderText), relativeMouseX + x, relativeMouseY + y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,26 +599,26 @@ public class ForgeHooksClient {
|
||||
@Nullable
|
||||
public static Component onClientChat(ChatType.Bound boundChatType, Component message, UUID sender) {
|
||||
ClientChatReceivedEvent event = new ClientChatReceivedEvent(boundChatType, message, sender);
|
||||
return MinecraftForge.EVENT_BUS.post(event) ? null : event.getMessage();
|
||||
return ClientChatReceivedEvent.BUS.post(event) ? null : event.getMessage();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Component onClientPlayerChat(ChatType.Bound boundChatType, Component message, PlayerChatMessage playerChatMessage, UUID sender) {
|
||||
ClientChatReceivedEvent.Player event = new ClientChatReceivedEvent.Player(boundChatType, message, playerChatMessage, sender);
|
||||
return MinecraftForge.EVENT_BUS.post(event) ? null : event.getMessage();
|
||||
return ClientChatReceivedEvent.Player.BUS.post(event) ? null : event.getMessage();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Component onClientSystemMessage(Component message, boolean overlay) {
|
||||
var event = new SystemMessageReceivedEvent(message, overlay);
|
||||
return MinecraftForge.EVENT_BUS.post(event) ? null : event.getMessage();
|
||||
return SystemMessageReceivedEvent.BUS.post(event) ? null : event.getMessage();
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String onClientSendMessage(String message) {
|
||||
ClientChatEvent event = new ClientChatEvent(message);
|
||||
return MinecraftForge.EVENT_BUS.post(event) ? "" : event.getMessage();
|
||||
return ClientChatEvent.BUS.post(event) ? "" : event.getMessage();
|
||||
}
|
||||
|
||||
public static Font getTooltipFont(@NotNull ItemStack stack, Font fallbackFont) {
|
||||
@@ -635,10 +626,9 @@ public class ForgeHooksClient {
|
||||
return stackFont == null ? fallbackFont : stackFont;
|
||||
}
|
||||
|
||||
public static RenderTooltipEvent.Pre onRenderTooltipPre(@NotNull ItemStack stack, GuiGraphics graphics, int x, int y, int screenWidth, int screenHeight, @NotNull List<ClientTooltipComponent> components, @NotNull Font fallbackFont, @NotNull ClientTooltipPositioner positioner) {
|
||||
public static @Nullable RenderTooltipEvent.Pre onRenderTooltipPre(@NotNull ItemStack stack, GuiGraphics graphics, int x, int y, int screenWidth, int screenHeight, @NotNull List<ClientTooltipComponent> components, @NotNull Font fallbackFont, @NotNull ClientTooltipPositioner positioner) {
|
||||
var preEvent = new RenderTooltipEvent.Pre(stack, graphics, x, y, screenWidth, screenHeight, getTooltipFont(stack, fallbackFont), components, positioner);
|
||||
MinecraftForge.EVENT_BUS.post(preEvent);
|
||||
return preEvent;
|
||||
return RenderTooltipEvent.Pre.BUS.post(preEvent) ? null : preEvent;
|
||||
}
|
||||
|
||||
public static List<ClientTooltipComponent> gatherTooltipComponents(ItemStack stack, List<? extends FormattedText> textElements, int mouseX, int screenWidth, int screenHeight, Font fallbackFont) {
|
||||
@@ -657,7 +647,7 @@ public class ForgeHooksClient {
|
||||
Font font = getTooltipFont(stack, fallbackFont);
|
||||
|
||||
var event = new RenderTooltipEvent.GatherComponents(stack, screenWidth, screenHeight, elements, -1);
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) return List.of();
|
||||
if (RenderTooltipEvent.GatherComponents.BUS.post(event)) return List.of();
|
||||
|
||||
// text wrapping
|
||||
int tooltipTextWidth = event.getTooltipElements().stream()
|
||||
@@ -723,7 +713,7 @@ public class ForgeHooksClient {
|
||||
|
||||
public static boolean isBlockInSolidLayer(BlockState state) {
|
||||
var model = Minecraft.getInstance().getBlockRenderer().getBlockModel(state);
|
||||
return model.getRenderTypes(state, RandomSource.create(), ModelData.EMPTY).contains(RenderType.solid());
|
||||
return model.getRenderTypes(state, RandomSource.create(), ModelData.EMPTY).contains(ChunkSectionLayer.SOLID);
|
||||
}
|
||||
|
||||
public static void createWorldConfirmationScreen(Runnable doConfirmedWorldLoad) {
|
||||
@@ -751,7 +741,7 @@ public class ForgeHooksClient {
|
||||
}
|
||||
|
||||
public static boolean renderBlockOverlay(Player player, PoseStack mat, RenderBlockScreenEffectEvent.OverlayType type, BlockState block, BlockPos pos) {
|
||||
return MinecraftForge.EVENT_BUS.post(new RenderBlockScreenEffectEvent(player, mat, type, block, pos));
|
||||
return RenderBlockScreenEffectEvent.BUS.post(new RenderBlockScreenEffectEvent(player, mat, type, block, pos));
|
||||
}
|
||||
|
||||
public static int getMaxMipmapLevel(int width, int height) {
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import com.mojang.blaze3d.opengl.GlConst;
|
||||
import com.mojang.blaze3d.opengl.GlTexture;
|
||||
import com.mojang.blaze3d.pipeline.BlendFunction;
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import com.mojang.blaze3d.platform.DepthTestFunction;
|
||||
import com.mojang.blaze3d.platform.DestFactor;
|
||||
import com.mojang.blaze3d.platform.SourceFactor;
|
||||
import com.mojang.blaze3d.systems.GpuDevice;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.textures.GpuTexture;
|
||||
import com.mojang.blaze3d.textures.GpuTextureView;
|
||||
import com.mojang.blaze3d.textures.TextureFormat;
|
||||
|
||||
import net.minecraft.Util;
|
||||
@@ -25,14 +27,11 @@ import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.TriState;
|
||||
import net.minecraftforge.common.util.NonNullLazy;
|
||||
import net.minecraftforge.common.util.NonNullSupplier;
|
||||
import net.minecraftforge.fml.earlydisplay.DisplayWindow;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.lwjgl.opengl.GL30C;
|
||||
|
||||
@@ -56,7 +55,7 @@ public enum ForgeRenderTypes {
|
||||
* @see ForgeRenderTypes#getTextSeeThrough
|
||||
* @see ForgeRenderTypes#getTextIntensitySeeThrough
|
||||
*/
|
||||
public static TriState enableTextTextureLinearFiltering = TriState.FALSE;
|
||||
public static boolean enableTextTextureLinearFiltering = false;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static ResourceLocation blockAtlas() {
|
||||
@@ -230,7 +229,7 @@ public enum ForgeRenderTypes {
|
||||
false,
|
||||
RenderPipelines.ENTITY_TRANSLUCENT,
|
||||
CompositeState.builder()
|
||||
.setTextureState(new TextureStateShard(textureLocation, TriState.FALSE, false))
|
||||
.setTextureState(new TextureStateShard(textureLocation, false))
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true));
|
||||
@@ -244,7 +243,7 @@ public enum ForgeRenderTypes {
|
||||
true,
|
||||
RenderPipelines.ENTITY_TRANSLUCENT,
|
||||
CompositeState.builder()
|
||||
.setTextureState(new TextureStateShard(textureLocation, TriState.FALSE, false))
|
||||
.setTextureState(new TextureStateShard(textureLocation, false))
|
||||
.setLightmapState(NO_LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true));
|
||||
@@ -258,7 +257,7 @@ public enum ForgeRenderTypes {
|
||||
false,
|
||||
RenderPipelines.ENTITY_TRANSLUCENT,
|
||||
CompositeState.builder()
|
||||
.setTextureState(new TextureStateShard(textureLocation, TriState.FALSE, false))
|
||||
.setTextureState(new TextureStateShard(textureLocation, false))
|
||||
.setLightmapState(NO_LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true));
|
||||
@@ -273,7 +272,7 @@ public enum ForgeRenderTypes {
|
||||
false,
|
||||
RenderPipelines.ENTITY_SOLID,
|
||||
CompositeState.builder()
|
||||
.setTextureState(new TextureStateShard(locationIn, TriState.FALSE, false))
|
||||
.setTextureState(new TextureStateShard(locationIn, false))
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true)
|
||||
@@ -289,7 +288,7 @@ public enum ForgeRenderTypes {
|
||||
false,
|
||||
RenderPipelines.ENTITY_CUTOUT,
|
||||
CompositeState.builder()
|
||||
.setTextureState(new TextureStateShard(locationIn, TriState.FALSE, false))
|
||||
.setTextureState(new TextureStateShard(locationIn, false))
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true)
|
||||
@@ -305,7 +304,7 @@ public enum ForgeRenderTypes {
|
||||
false,
|
||||
RenderPipelines.ENTITY_SMOOTH_CUTOUT,
|
||||
CompositeState.builder()
|
||||
.setTextureState(new TextureStateShard(locationIn, TriState.FALSE, true))
|
||||
.setTextureState(new TextureStateShard(locationIn, true))
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true)
|
||||
@@ -321,7 +320,7 @@ public enum ForgeRenderTypes {
|
||||
true,
|
||||
RenderPipelines.ITEM_ENTITY_TRANSLUCENT_CULL,
|
||||
CompositeState.builder()
|
||||
.setTextureState(new TextureStateShard(locationIn, TriState.FALSE, false))
|
||||
.setTextureState(new TextureStateShard(locationIn, false))
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true)
|
||||
@@ -367,7 +366,7 @@ public enum ForgeRenderTypes {
|
||||
true,
|
||||
RenderPipelines.TEXT_POLYGON_OFFSET,
|
||||
CompositeState.builder()
|
||||
.setTextureState(new CustomizableTextureState(locationIn, () -> enableTextTextureLinearFiltering, () -> false))
|
||||
.setTextureState(new CustomizableTextureState(locationIn, false))
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.createCompositeState(false)
|
||||
);
|
||||
@@ -438,7 +437,7 @@ public enum ForgeRenderTypes {
|
||||
true,
|
||||
RenderPipelines.TRANSLUCENT_PARTICLE,
|
||||
CompositeState.builder()
|
||||
.setTextureState(new TextureStateShard(locationIn, TriState.FALSE, false))
|
||||
.setTextureState(new TextureStateShard(locationIn, false))
|
||||
.setOutputState(PARTICLES_TARGET)
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.createCompositeState(true)
|
||||
@@ -467,41 +466,35 @@ public enum ForgeRenderTypes {
|
||||
}
|
||||
|
||||
private static class CustomizableTextureState extends TextureStateShard {
|
||||
// [VEN] Here to make init shorter
|
||||
private static final Supplier<TriState> BLUR_STATE = () -> enableTextTextureLinearFiltering;
|
||||
private static final Supplier<Boolean> MIP_ON_STATE = () -> true;
|
||||
private static final Supplier<Boolean> MIP_OFF_STATE = () -> false;
|
||||
private CustomizableTextureState(ResourceLocation resLoc, boolean mipmap) {
|
||||
this(resLoc, BLUR_STATE, mipmap ? MIP_ON_STATE : MIP_OFF_STATE);
|
||||
}
|
||||
|
||||
private CustomizableTextureState(ResourceLocation resLoc, Supplier<TriState> blur, Supplier<Boolean> mipmap) {
|
||||
super(resLoc, blur.get(), mipmap.get());
|
||||
super(resLoc, mipmap);
|
||||
this.setupState = () -> {
|
||||
this.blur = blur.get();
|
||||
this.mipmap = mipmap.get();
|
||||
TextureManager manager = Minecraft.getInstance().getTextureManager();
|
||||
var texture = manager.getTexture(resLoc);
|
||||
texture.setFilter(this.blur, this.mipmap);
|
||||
RenderSystem.setShaderTexture(0, texture.getTexture());
|
||||
texture.setFilter(enableTextTextureLinearFiltering, this.mipmap);
|
||||
RenderSystem.setShaderTexture(0, texture.getTextureView());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static class LoadingOverlayTextureState extends TextureStateShard {
|
||||
private static final ResourceLocation LOADING_TEXTURE = ResourceLocation.fromNamespaceAndPath("forge", "loading_overlay");
|
||||
private final GlTexture texture;
|
||||
private final GpuTexture texture;
|
||||
private final GpuTextureView textureView;
|
||||
|
||||
private LoadingOverlayTextureState(DisplayWindow window) {
|
||||
super(LOADING_TEXTURE, TriState.DEFAULT, false);
|
||||
this.texture = new GlTexture(LOADING_TEXTURE.toString(), TextureFormat.RGBA8,
|
||||
window.context().width(), window.context().height(), 0,
|
||||
window.getFramebufferTextureId()) {};
|
||||
super(LOADING_TEXTURE, false);
|
||||
|
||||
GpuDevice gpu = RenderSystem.getDevice();
|
||||
this.texture = gpu.createTexture(LOADING_TEXTURE.toString(), 5, TextureFormat.RGBA8,
|
||||
window.context().width(), window.context().height(),
|
||||
1, window.getFramebufferTextureId());
|
||||
this.textureView = gpu.createTextureView(this.texture);
|
||||
|
||||
this.setupState = () -> {
|
||||
GL30C.glTexParameterIi(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MIN_FILTER, GlConst.GL_NEAREST);
|
||||
GL30C.glTexParameterIi(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MAG_FILTER, GlConst.GL_NEAREST);
|
||||
RenderSystem.setShaderTexture(0, texture);
|
||||
RenderSystem.setShaderTexture(0, this.textureView);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package net.minecraftforge.client;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RegisterNamedRenderTypesEvent;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
@@ -43,13 +44,13 @@ public final class NamedRenderTypeManager {
|
||||
* Pre-registers vanilla render types.
|
||||
*/
|
||||
private static void preRegisterVanillaRenderTypes(Map<ResourceLocation, RenderTypeGroup> blockRenderTypes) {
|
||||
blockRenderTypes.put(rl("solid"), new RenderTypeGroup(RenderType.solid(), ForgeRenderTypes.ITEM_LAYERED_SOLID.get()));
|
||||
blockRenderTypes.put(rl("cutout"), new RenderTypeGroup(RenderType.cutout(), ForgeRenderTypes.ITEM_LAYERED_CUTOUT.get()));
|
||||
blockRenderTypes.put(rl("solid"), new RenderTypeGroup(ChunkSectionLayer.SOLID, ForgeRenderTypes.ITEM_LAYERED_SOLID.get()));
|
||||
blockRenderTypes.put(rl("cutout"), new RenderTypeGroup(ChunkSectionLayer.CUTOUT, ForgeRenderTypes.ITEM_LAYERED_CUTOUT.get()));
|
||||
// Generally entity/item rendering shouldn't use mipmaps, so cutout_mipped has them off by default. To enforce them, use cutout_mipped_all.
|
||||
blockRenderTypes.put(rl("cutout_mipped"), new RenderTypeGroup(RenderType.cutoutMipped(), ForgeRenderTypes.ITEM_LAYERED_CUTOUT.get()));
|
||||
blockRenderTypes.put(rl("cutout_mipped_all"), new RenderTypeGroup(RenderType.cutoutMipped(), ForgeRenderTypes.ITEM_LAYERED_CUTOUT_MIPPED.get()));
|
||||
blockRenderTypes.put(rl("translucent"), new RenderTypeGroup(RenderType.translucent(), ForgeRenderTypes.ITEM_LAYERED_TRANSLUCENT.get()));
|
||||
blockRenderTypes.put(rl("tripwire"), new RenderTypeGroup(RenderType.tripwire(), ForgeRenderTypes.ITEM_LAYERED_TRANSLUCENT.get()));
|
||||
blockRenderTypes.put(rl("cutout_mipped"), new RenderTypeGroup(ChunkSectionLayer.CUTOUT_MIPPED, ForgeRenderTypes.ITEM_LAYERED_CUTOUT.get()));
|
||||
blockRenderTypes.put(rl("cutout_mipped_all"), new RenderTypeGroup(ChunkSectionLayer.CUTOUT_MIPPED, ForgeRenderTypes.ITEM_LAYERED_CUTOUT_MIPPED.get()));
|
||||
blockRenderTypes.put(rl("translucent_moving_block"), new RenderTypeGroup(ChunkSectionLayer.TRANSLUCENT, ForgeRenderTypes.ITEM_LAYERED_TRANSLUCENT.get()));
|
||||
blockRenderTypes.put(rl("tripwire"), new RenderTypeGroup(ChunkSectionLayer.TRIPWIRE, ForgeRenderTypes.ITEM_LAYERED_TRANSLUCENT.get()));
|
||||
}
|
||||
|
||||
private static ResourceLocation rl(String paht) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
|
||||
|
||||
/**
|
||||
* A set of functionally equivalent shaders. One using {@link com.mojang.blaze3d.vertex.DefaultVertexFormat#BLOCK},
|
||||
@@ -13,7 +14,7 @@ import net.minecraft.client.renderer.RenderType;
|
||||
* {@code entityFabulous} may support custom render targets and other aspects of the fabulous pipeline, or can otherwise
|
||||
* be the same as {@code entity}.
|
||||
*/
|
||||
public record RenderTypeGroup(RenderType block, RenderType entity, RenderType entityFabulous) {
|
||||
public record RenderTypeGroup(ChunkSectionLayer block, RenderType entity, RenderType entityFabulous) {
|
||||
public static final RenderTypeGroup EMPTY = new RenderTypeGroup(null, null, null);
|
||||
|
||||
public RenderTypeGroup {
|
||||
@@ -21,7 +22,7 @@ public record RenderTypeGroup(RenderType block, RenderType entity, RenderType en
|
||||
throw new IllegalArgumentException("The render types in a group must either be all null, or all non-null.");
|
||||
}
|
||||
|
||||
public RenderTypeGroup(RenderType block, RenderType entity) {
|
||||
public RenderTypeGroup(ChunkSectionLayer block, RenderType entity) {
|
||||
this(block, entity, entity);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Sheets;
|
||||
import net.minecraft.client.renderer.block.model.BlockStateModel;
|
||||
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -28,8 +29,8 @@ public final class RenderTypeHelper {
|
||||
* Mimics the behavior of vanilla's {@link ItemBlockRenderTypes#getRenderType(BlockState)}.
|
||||
*/
|
||||
@NotNull
|
||||
public static RenderType getEntityRenderType(RenderType chunkRenderType) {
|
||||
return chunkRenderType == RenderType.translucent() ? Sheets.translucentItemSheet() : Sheets.cutoutBlockSheet();
|
||||
public static RenderType getEntityRenderType(ChunkSectionLayer layer) {
|
||||
return layer == ChunkSectionLayer.TRANSLUCENT ? Sheets.translucentItemSheet() : Sheets.cutoutBlockSheet();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,10 +40,17 @@ public final class RenderTypeHelper {
|
||||
* Mimics the behavior of vanilla's {@link ItemBlockRenderTypes#getMovingBlockRenderType(BlockState)}.
|
||||
*/
|
||||
@NotNull
|
||||
public static RenderType getMovingBlockRenderType(RenderType renderType) {
|
||||
if (renderType == RenderType.translucent())
|
||||
return RenderType.translucentMovingBlock();
|
||||
return renderType;
|
||||
public static RenderType getMovingBlockRenderType(ChunkSectionLayer layer) {
|
||||
if (layer == null)
|
||||
return RenderType.solid();
|
||||
|
||||
return switch (layer) {
|
||||
case SOLID -> RenderType.solid();
|
||||
case CUTOUT_MIPPED -> RenderType.cutoutMipped();
|
||||
case CUTOUT -> RenderType.cutout();
|
||||
case TRANSLUCENT -> RenderType.translucentMovingBlock();
|
||||
case TRIPWIRE -> RenderType.tripwire();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,8 +63,8 @@ public final class RenderTypeHelper {
|
||||
public static RenderType getFallbackItemRenderType(ItemStack stack, BlockStateModel model) {
|
||||
if (stack.getItem() instanceof BlockItem blockItem) {
|
||||
var renderTypes = model.getRenderTypes(blockItem.getBlock().defaultBlockState(), RandomSource.create(42), ModelData.EMPTY);
|
||||
if (renderTypes.contains(RenderType.translucent()))
|
||||
return getEntityRenderType(RenderType.translucent());
|
||||
if (renderTypes.contains(ChunkSectionLayer.TRANSLUCENT))
|
||||
return getEntityRenderType(ChunkSectionLayer.TRANSLUCENT);
|
||||
return Sheets.cutoutBlockSheet();
|
||||
}
|
||||
return Sheets.translucentItemSheet();
|
||||
|
||||
@@ -7,8 +7,9 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -21,15 +22,14 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
**/
|
||||
@Cancelable
|
||||
public final class ClientChatEvent extends Event
|
||||
{
|
||||
public final class ClientChatEvent extends MutableEvent implements Cancellable {
|
||||
public static final CancellableEventBus<ClientChatEvent> BUS = CancellableEventBus.create(ClientChatEvent.class);
|
||||
|
||||
private String message;
|
||||
private final String originalMessage;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public ClientChatEvent(String message)
|
||||
{
|
||||
public ClientChatEvent(String message) {
|
||||
this.setMessage(message);
|
||||
this.originalMessage = Strings.nullToEmpty(message);
|
||||
this.message = this.originalMessage;
|
||||
@@ -38,8 +38,7 @@ public final class ClientChatEvent extends Event
|
||||
/**
|
||||
* {@return the message that will be sent to the server, if the event is not cancelled. This can be changed by mods}
|
||||
*/
|
||||
public String getMessage()
|
||||
{
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
@@ -48,16 +47,14 @@ public final class ClientChatEvent extends Event
|
||||
*
|
||||
* @param message the new message to be sent
|
||||
*/
|
||||
public void setMessage(String message)
|
||||
{
|
||||
public void setMessage(String message) {
|
||||
this.message = Strings.nullToEmpty(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the original message that was to be sent to the server. This cannot be changed by mods}
|
||||
*/
|
||||
public String getOriginalMessage()
|
||||
{
|
||||
public String getOriginalMessage() {
|
||||
return this.originalMessage;
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,10 @@ import net.minecraft.network.chat.ChatType;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.PlayerChatMessage;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import java.util.UUID;
|
||||
@@ -28,8 +30,9 @@ import java.util.UUID;
|
||||
*
|
||||
* @see ChatType
|
||||
*/
|
||||
@Cancelable
|
||||
public sealed class ClientChatReceivedEvent extends Event {
|
||||
public sealed class ClientChatReceivedEvent extends MutableEvent implements Cancellable, InheritableEvent {
|
||||
public static final CancellableEventBus<ClientChatReceivedEvent> BUS = CancellableEventBus.create(ClientChatReceivedEvent.class);
|
||||
|
||||
private Component message;
|
||||
private final ChatType.Bound boundChatType;
|
||||
private final UUID sender;
|
||||
@@ -75,7 +78,7 @@ public sealed class ClientChatReceivedEvent extends Event {
|
||||
/**
|
||||
* {@return {@code true} if the message was sent by the system, {@code false} otherwise}
|
||||
*
|
||||
* @Deprecated Mojang made ChatType a registry, which isn't always accessible when the System messages are sent.
|
||||
* @deprecated Mojang made ChatType a registry, which isn't always accessible when the System messages are sent.
|
||||
* So moved to it's own event. {@link SystemMessageReceivedEvent}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
||||
@@ -95,6 +98,8 @@ public sealed class ClientChatReceivedEvent extends Event {
|
||||
* @see ChatType
|
||||
*/
|
||||
public static final class Player extends ClientChatReceivedEvent {
|
||||
public static final CancellableEventBus<Player> BUS = CancellableEventBus.create(Player.class);
|
||||
|
||||
private final PlayerChatMessage playerChatMessage;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -120,6 +125,8 @@ public sealed class ClientChatReceivedEvent extends Event {
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
||||
public static final class System extends ClientChatReceivedEvent {
|
||||
public static final CancellableEventBus<System> BUS = CancellableEventBus.create(System.class);
|
||||
|
||||
private final boolean overlay;
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -6,10 +6,13 @@
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
|
||||
/**
|
||||
@@ -21,7 +24,9 @@ import net.minecraftforge.fml.LogicalSide;
|
||||
* @see ClientPauseChangeEvent.Pre
|
||||
* @see ClientPauseChangeEvent.Post
|
||||
*/
|
||||
public abstract sealed class ClientPauseChangeEvent extends Event {
|
||||
public abstract sealed class ClientPauseChangeEvent extends MutableEvent implements InheritableEvent {
|
||||
public static final EventBus<ClientPauseChangeEvent> BUS = EventBus.create(ClientPauseChangeEvent.class);
|
||||
|
||||
private final boolean pause;
|
||||
|
||||
public ClientPauseChangeEvent(boolean pause) {
|
||||
@@ -37,8 +42,8 @@ public abstract sealed class ClientPauseChangeEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends ClientPauseChangeEvent {
|
||||
public static final class Pre extends ClientPauseChangeEvent implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
public Pre(boolean pause) {
|
||||
super(pause);
|
||||
@@ -54,6 +59,7 @@ public abstract sealed class ClientPauseChangeEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Post extends ClientPauseChangeEvent {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
public Post(boolean pause) {
|
||||
super(pause);
|
||||
|
||||
+15
-41
@@ -7,55 +7,29 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.multiplayer.PlayerInfo;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.common.util.HasResult;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.RecordEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Fired when the client player is notified of a change of {@link GameType} from the server.
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
* <p>This event is not {@linkplain Cancellable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param getInfo the client player information
|
||||
* @param getCurrentGameType the current game type of the player
|
||||
* @param getNewGameType the new game type of the player
|
||||
*/
|
||||
public final class ClientPlayerChangeGameTypeEvent extends Event
|
||||
{
|
||||
private final PlayerInfo info;
|
||||
private final GameType currentGameType;
|
||||
private final GameType newGameType;
|
||||
@NullMarked
|
||||
public record ClientPlayerChangeGameTypeEvent(PlayerInfo getInfo, GameType getCurrentGameType, GameType getNewGameType) implements RecordEvent {
|
||||
public static final EventBus<ClientPlayerChangeGameTypeEvent> BUS = EventBus.create(ClientPlayerChangeGameTypeEvent.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public ClientPlayerChangeGameTypeEvent(PlayerInfo info, GameType currentGameType, GameType newGameType)
|
||||
{
|
||||
this.info = info;
|
||||
this.currentGameType = currentGameType;
|
||||
this.newGameType = newGameType;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the client player information}
|
||||
*/
|
||||
public PlayerInfo getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the current game type of the player}
|
||||
*/
|
||||
public GameType getCurrentGameType()
|
||||
{
|
||||
return currentGameType;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the new game type of the player}
|
||||
*/
|
||||
public GameType getNewGameType()
|
||||
{
|
||||
return newGameType;
|
||||
}
|
||||
public ClientPlayerChangeGameTypeEvent {}
|
||||
}
|
||||
@@ -9,8 +9,9 @@ import net.minecraft.client.multiplayer.MultiPlayerGameMode;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -26,7 +27,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @see LoggingOut
|
||||
* @see Clone
|
||||
**/
|
||||
public abstract sealed class ClientPlayerNetworkEvent extends Event {
|
||||
public abstract sealed class ClientPlayerNetworkEvent extends MutableEvent implements InheritableEvent {
|
||||
public static final EventBus<ClientPlayerNetworkEvent> BUS = EventBus.create(ClientPlayerNetworkEvent.class);
|
||||
|
||||
private final MultiPlayerGameMode multiPlayerGameMode;
|
||||
private final LocalPlayer player;
|
||||
private final Connection connection;
|
||||
@@ -68,6 +71,8 @@ public abstract sealed class ClientPlayerNetworkEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class LoggingIn extends ClientPlayerNetworkEvent {
|
||||
public static final EventBus<LoggingIn> BUS = EventBus.create(LoggingIn.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public LoggingIn(final MultiPlayerGameMode controller, final LocalPlayer player, final Connection networkManager) {
|
||||
super(controller, player, networkManager);
|
||||
@@ -85,6 +90,8 @@ public abstract sealed class ClientPlayerNetworkEvent extends Event {
|
||||
@SuppressWarnings("NullableProblems")
|
||||
// Shush IntelliJ, we override non-nullables as nullables in this specific event; see later comment
|
||||
public static final class LoggingOut extends ClientPlayerNetworkEvent {
|
||||
public static final EventBus<LoggingOut> BUS = EventBus.create(LoggingOut.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public LoggingOut(@Nullable final MultiPlayerGameMode controller, @Nullable final LocalPlayer player, @Nullable final Connection networkManager) {
|
||||
//noinspection ConstantConditions we know these are nullable, but we don't want to annotate the super as nullable since this is the only event with nullables
|
||||
@@ -134,6 +141,8 @@ public abstract sealed class ClientPlayerNetworkEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Clone extends ClientPlayerNetworkEvent {
|
||||
public static final EventBus<Clone> BUS = EventBus.create(Clone.class);
|
||||
|
||||
private final LocalPlayer oldPlayer;
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -5,12 +5,11 @@
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -24,7 +23,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* @see ViewportEvent.ComputeFov
|
||||
*/
|
||||
public final class ComputeFovModifierEvent extends Event {
|
||||
public final class ComputeFovModifierEvent extends MutableEvent {
|
||||
public static final EventBus<ComputeFovModifierEvent> BUS = EventBus.create(ComputeFovModifierEvent.class);
|
||||
|
||||
private final Player player;
|
||||
private final float fovModifier;
|
||||
private final float scale;
|
||||
|
||||
@@ -8,8 +8,9 @@ package net.minecraftforge.client.event;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -23,7 +24,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see Render.Foreground
|
||||
* @see Render.Background
|
||||
*/
|
||||
public abstract sealed class ContainerScreenEvent extends Event {
|
||||
public abstract sealed class ContainerScreenEvent extends MutableEvent implements InheritableEvent {
|
||||
public static final EventBus<ContainerScreenEvent> BUS = EventBus.create(ContainerScreenEvent.class);
|
||||
|
||||
private final AbstractContainerScreen<?> containerScreen;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -49,6 +52,8 @@ public abstract sealed class ContainerScreenEvent extends Event {
|
||||
* @see Background
|
||||
*/
|
||||
public static abstract sealed class Render extends ContainerScreenEvent {
|
||||
public static final EventBus<Render> BUS = EventBus.create(Render.class);
|
||||
|
||||
private final GuiGraphics guiGraphics;
|
||||
private final int mouseX;
|
||||
private final int mouseY;
|
||||
@@ -95,6 +100,8 @@ public abstract sealed class ContainerScreenEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Foreground extends Render {
|
||||
public static final EventBus<Foreground> BUS = EventBus.create(Foreground.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Foreground(AbstractContainerScreen<?> guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY) {
|
||||
super(guiContainer, guiGraphics, mouseX, mouseY);
|
||||
@@ -111,6 +118,8 @@ public abstract sealed class ContainerScreenEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Background extends Render {
|
||||
public static final EventBus<Background> BUS = EventBus.create(Background.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Background(AbstractContainerScreen<?> guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY) {
|
||||
super(guiContainer, guiGraphics, mouseX, mouseY);
|
||||
|
||||
@@ -9,9 +9,12 @@ import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.special.SpecialModelRenderer;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
|
||||
public final class CreateSpecialBlockRendererEvent extends MutableEvent {
|
||||
public static final EventBus<CreateSpecialBlockRendererEvent> BUS = EventBus.create(CreateSpecialBlockRendererEvent.class);
|
||||
|
||||
public final class CreateSpecialBlockRendererEvent extends Event {
|
||||
private final Map<Block, SpecialModelRenderer.Unbaked> map;
|
||||
|
||||
public CreateSpecialBlockRendererEvent(Map<Block, SpecialModelRenderer.Unbaked> map) {
|
||||
|
||||
@@ -9,8 +9,10 @@ import com.mojang.blaze3d.platform.Window;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.LerpingBossEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -23,7 +25,9 @@ import java.util.List;
|
||||
* @see DebugText
|
||||
* @see Chat
|
||||
*/
|
||||
public abstract sealed class CustomizeGuiOverlayEvent extends Event {
|
||||
public abstract sealed class CustomizeGuiOverlayEvent extends MutableEvent implements Cancellable, InheritableEvent {
|
||||
public static final CancellableEventBus<CustomizeGuiOverlayEvent> BUS = CancellableEventBus.create(CustomizeGuiOverlayEvent.class);
|
||||
|
||||
private final Window window;
|
||||
private final GuiGraphics guiGraphics;
|
||||
private final float partialTick;
|
||||
@@ -56,8 +60,9 @@ public abstract sealed class CustomizeGuiOverlayEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class BossEventProgress extends CustomizeGuiOverlayEvent {
|
||||
public static final CancellableEventBus<BossEventProgress> BUS = CancellableEventBus.create(BossEventProgress.class);
|
||||
|
||||
private final LerpingBossEvent bossEvent;
|
||||
private final int x;
|
||||
private final int y;
|
||||
@@ -120,6 +125,8 @@ public abstract sealed class CustomizeGuiOverlayEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class DebugText extends CustomizeGuiOverlayEvent {
|
||||
public static final CancellableEventBus<DebugText> BUS = CancellableEventBus.create(DebugText.class);
|
||||
|
||||
private final List<String> text;
|
||||
|
||||
private final Side side;
|
||||
@@ -160,6 +167,8 @@ public abstract sealed class CustomizeGuiOverlayEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Chat extends CustomizeGuiOverlayEvent {
|
||||
public static final CancellableEventBus<Chat> BUS = CancellableEventBus.create(Chat.class);
|
||||
|
||||
private int posX;
|
||||
private int posY;
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ import net.minecraft.world.level.block.SkullBlock.Type;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -53,7 +53,7 @@ import java.util.function.Supplier;
|
||||
* @see EntityRenderersEvent.RegisterRenderers
|
||||
* @see EntityRenderersEvent.AddLayers
|
||||
*/
|
||||
public abstract sealed class EntityRenderersEvent extends Event implements IModBusEvent {
|
||||
public abstract sealed class EntityRenderersEvent implements IModBusEvent {
|
||||
@ApiStatus.Internal
|
||||
protected EntityRenderersEvent() {}
|
||||
|
||||
@@ -66,6 +66,10 @@ public abstract sealed class EntityRenderersEvent extends Event implements IModB
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class RegisterLayerDefinitions extends EntityRenderersEvent {
|
||||
public static EventBus<RegisterLayerDefinitions> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterLayerDefinitions.class);
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterLayerDefinitions() {}
|
||||
|
||||
@@ -94,6 +98,10 @@ public abstract sealed class EntityRenderersEvent extends Event implements IModB
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class RegisterRenderers extends EntityRenderersEvent {
|
||||
public static EventBus<RegisterRenderers> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterRenderers.class);
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterRenderers() {}
|
||||
|
||||
@@ -128,6 +136,10 @@ public abstract sealed class EntityRenderersEvent extends Event implements IModB
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class AddLayers extends EntityRenderersEvent {
|
||||
public static EventBus<AddLayers> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, AddLayers.class);
|
||||
}
|
||||
|
||||
private final Map<EntityType<?>, EntityRenderer<?, ?>> renderers;
|
||||
private final Map<PlayerSkin.Model, EntityRenderer<? extends Player, ?>> skinMap;
|
||||
private final EntityRendererProvider.Context context;
|
||||
@@ -202,6 +214,10 @@ public abstract sealed class EntityRenderersEvent extends Event implements IModB
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class CreateSkullModels extends EntityRenderersEvent {
|
||||
public static EventBus<CreateSkullModels> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, CreateSkullModels.class);
|
||||
}
|
||||
|
||||
private final ImmutableMap.Builder<Type, Function<EntityModelSet, SkullModelBase>> builder;
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -11,8 +11,8 @@ import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.Result;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -67,7 +67,6 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SkullBlock.Type;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundSourceEvent;
|
||||
import net.minecraftforge.client.event.sound.PlayStreamingSourceEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public final class ForgeEventFactoryClient {
|
||||
@@ -75,28 +74,11 @@ public final class ForgeEventFactoryClient {
|
||||
|
||||
private ForgeEventFactoryClient() {}
|
||||
|
||||
/**
|
||||
* Post an event to the {@link MinecraftForge#EVENT_BUS}
|
||||
* @return true if the event is {@link Cancelable} and has been canceled
|
||||
*/
|
||||
private static boolean post(Event e) {
|
||||
return MinecraftForge.EVENT_BUS.post(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post an event to the {@link MinecraftForge#EVENT_BUS}, then return the event object
|
||||
* @return the event object passed in and possibly modified by listeners
|
||||
*/
|
||||
private static <E extends Event> E fire(E e) {
|
||||
return MinecraftForge.EVENT_BUS.fire(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post an event to the {@link ModLoader#get()} event bus
|
||||
*/
|
||||
private static <T extends Event & IModBusEvent> T fireModBus(T e) {
|
||||
ML.postEvent(e);
|
||||
return e;
|
||||
private static <T extends IModBusEvent> T fireModBus(T e) {
|
||||
return ML.postEventWithReturn(e);
|
||||
}
|
||||
|
||||
public static void onGatherLayers(Map<EntityType<?>, EntityRenderer<?, ?>> renderers, Map<Model, EntityRenderer<? extends Player, ?>> playerRenderers, Context context) {
|
||||
@@ -105,192 +87,190 @@ public final class ForgeEventFactoryClient {
|
||||
}
|
||||
|
||||
public static boolean onScreenMouseReleased(Screen screen, double mouseX, double mouseY, int button) {
|
||||
if (post(new ScreenEvent.MouseButtonReleased.Pre(screen, mouseX, mouseY, button)))
|
||||
if (ScreenEvent.MouseButtonReleased.Pre.BUS.post(new ScreenEvent.MouseButtonReleased.Pre(screen, mouseX, mouseY, button)))
|
||||
return true;
|
||||
|
||||
var ret = screen.mouseReleased(mouseX, mouseY, button);
|
||||
var result = fire(new ScreenEvent.MouseButtonReleased.Post(screen, mouseX, mouseY, button, ret)).getResult();
|
||||
return result == Event.Result.DEFAULT ? ret : result == Event.Result.ALLOW;
|
||||
var result = ScreenEvent.MouseButtonReleased.Post.BUS.fire(new ScreenEvent.MouseButtonReleased.Post(screen, mouseX, mouseY, button, ret)).getResult();
|
||||
return result == Result.DEFAULT ? ret : result == Result.ALLOW;
|
||||
}
|
||||
|
||||
public static boolean onScreenMouseClicked(Screen screen, double mouseX, double mouseY, int button) {
|
||||
var ret = post(new ScreenEvent.MouseButtonPressed.Pre(screen, mouseX, mouseY, button));
|
||||
var ret = ScreenEvent.MouseButtonPressed.Pre.BUS.post(new ScreenEvent.MouseButtonPressed.Pre(screen, mouseX, mouseY, button));
|
||||
if (!ret)
|
||||
ret = screen.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
var result = fire(new ScreenEvent.MouseButtonPressed.Post(screen, mouseX, mouseY, button, ret)).getResult();
|
||||
return result == Event.Result.DEFAULT ? ret : result == Event.Result.ALLOW;
|
||||
var result = ScreenEvent.MouseButtonPressed.Post.BUS.fire(new ScreenEvent.MouseButtonPressed.Post(screen, mouseX, mouseY, button, ret)).getResult();
|
||||
return result == Result.DEFAULT ? ret : result == Result.ALLOW;
|
||||
}
|
||||
|
||||
public static boolean onMouseButtonPre(int button, int action, int mods) {
|
||||
return post(new InputEvent.MouseButton.Pre(button, action, mods));
|
||||
return InputEvent.MouseButton.Pre.BUS.post(new InputEvent.MouseButton.Pre(button, action, mods));
|
||||
}
|
||||
|
||||
public static void onMouseButtonPost(int button, int action, int mods) {
|
||||
post(new InputEvent.MouseButton.Post(button, action, mods));
|
||||
InputEvent.MouseButton.Post.BUS.post(new InputEvent.MouseButton.Post(button, action, mods));
|
||||
}
|
||||
|
||||
public static boolean onScreenMouseScrollPre(Screen guiScreen, double mouseX, double mouseY, double deltaX, double deltaY) {
|
||||
return post(new ScreenEvent.MouseScrolled.Pre(guiScreen, mouseX, mouseY, deltaX, deltaY));
|
||||
return ScreenEvent.MouseScrolled.Pre.BUS.post(new ScreenEvent.MouseScrolled.Pre(guiScreen, mouseX, mouseY, deltaX, deltaY));
|
||||
}
|
||||
|
||||
public static void onScreenMouseScrollPost(Screen guiScreen, double mouseX, double mouseY, double deltaX, double deltaY) {
|
||||
post(new ScreenEvent.MouseScrolled.Post(guiScreen, mouseX, mouseY, deltaX, deltaY));
|
||||
ScreenEvent.MouseScrolled.Post.BUS.post(new ScreenEvent.MouseScrolled.Post(guiScreen, mouseX, mouseY, deltaX, deltaY));
|
||||
}
|
||||
|
||||
public static boolean onMouseScroll(MouseHandler mouseHelper, double deltaX, double deltaY) {
|
||||
return post(new InputEvent.MouseScrollingEvent(deltaX, deltaY, mouseHelper.isLeftPressed(), mouseHelper.isMiddlePressed(), mouseHelper.isRightPressed(), mouseHelper.xpos(), mouseHelper.ypos()));
|
||||
return InputEvent.MouseScrollingEvent.BUS.post(new InputEvent.MouseScrollingEvent(deltaX, deltaY, mouseHelper.isLeftPressed(), mouseHelper.isMiddlePressed(), mouseHelper.isRightPressed(), mouseHelper.xpos(), mouseHelper.ypos()));
|
||||
}
|
||||
|
||||
public static boolean onScreenMouseDragPre(Screen guiScreen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
|
||||
return post(new ScreenEvent.MouseDragged.Pre(guiScreen, mouseX, mouseY, mouseButton, dragX, dragY));
|
||||
return ScreenEvent.MouseDragged.Pre.BUS.post(new ScreenEvent.MouseDragged.Pre(guiScreen, mouseX, mouseY, mouseButton, dragX, dragY));
|
||||
}
|
||||
|
||||
public static boolean onScreenMouseDragPost(Screen guiScreen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
|
||||
return post(new ScreenEvent.MouseDragged.Post(guiScreen, mouseX, mouseY, mouseButton, dragX, dragY));
|
||||
return ScreenEvent.MouseDragged.Post.BUS.post(new ScreenEvent.MouseDragged.Post(guiScreen, mouseX, mouseY, mouseButton, dragX, dragY));
|
||||
}
|
||||
|
||||
public static @Nullable Screen onScreenOpening(Screen old, Screen screen) {
|
||||
var event = new ScreenEvent.Opening(old, screen);
|
||||
if (post(event))
|
||||
if (ScreenEvent.Opening.BUS.post(event))
|
||||
return null;
|
||||
return event.getNewScreen();
|
||||
}
|
||||
|
||||
public static void onScreenClose(Screen screen) {
|
||||
post(new ScreenEvent.Closing(screen));
|
||||
ScreenEvent.Closing.BUS.post(new ScreenEvent.Closing(screen));
|
||||
}
|
||||
|
||||
public static void onPlaySoundSource(SoundEngine engine, SoundInstance sound, Channel channel) {
|
||||
post(new PlaySoundSourceEvent(engine, sound, channel));
|
||||
PlaySoundSourceEvent.BUS.post(new PlaySoundSourceEvent(engine, sound, channel));
|
||||
}
|
||||
|
||||
public static void onPlayStreamingSource(SoundEngine engine, SoundInstance sound, Channel channel) {
|
||||
post(new PlayStreamingSourceEvent(engine, sound, channel));
|
||||
}
|
||||
|
||||
public static ScreenshotEvent onScreenshot(NativeImage image, File screenshotFile) {
|
||||
return fire(new ScreenshotEvent(image, screenshotFile));
|
||||
PlayStreamingSourceEvent.BUS.post(new PlayStreamingSourceEvent(engine, sound, channel));
|
||||
}
|
||||
|
||||
public static boolean onScreenKeyPressedPre(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
return post(new ScreenEvent.KeyPressed.Pre(screen, keyCode, scanCode, modifiers));
|
||||
return ScreenEvent.KeyPressed.Pre.BUS.post(new ScreenEvent.KeyPressed.Pre(screen, keyCode, scanCode, modifiers));
|
||||
}
|
||||
|
||||
public static boolean onScreenKeyPressedPost(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
return post(new ScreenEvent.KeyPressed.Post(screen, keyCode, scanCode, modifiers));
|
||||
return ScreenEvent.KeyPressed.Post.BUS.post(new ScreenEvent.KeyPressed.Post(screen, keyCode, scanCode, modifiers));
|
||||
}
|
||||
|
||||
public static boolean onScreenKeyReleasedPre(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
return post(new ScreenEvent.KeyReleased.Pre(screen, keyCode, scanCode, modifiers));
|
||||
return ScreenEvent.KeyReleased.Pre.BUS.post(new ScreenEvent.KeyReleased.Pre(screen, keyCode, scanCode, modifiers));
|
||||
}
|
||||
|
||||
public static boolean onScreenKeyReleasedPost(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
return post(new ScreenEvent.KeyReleased.Post(screen, keyCode, scanCode, modifiers));
|
||||
return ScreenEvent.KeyReleased.Post.BUS.post(new ScreenEvent.KeyReleased.Post(screen, keyCode, scanCode, modifiers));
|
||||
}
|
||||
|
||||
public static boolean onScreenCharTypedPre(Screen screen, char codePoint, int modifiers) {
|
||||
return post(new ScreenEvent.CharacterTyped.Pre(screen, codePoint, modifiers));
|
||||
return ScreenEvent.CharacterTyped.Pre.BUS.post(new ScreenEvent.CharacterTyped.Pre(screen, codePoint, modifiers));
|
||||
}
|
||||
|
||||
public static boolean onScreenCharTypedPost(Screen screen, char codePoint, int modifiers) {
|
||||
return post(new ScreenEvent.CharacterTyped.Post(screen, codePoint, modifiers));
|
||||
return ScreenEvent.CharacterTyped.Post.BUS.post(new ScreenEvent.CharacterTyped.Post(screen, codePoint, modifiers));
|
||||
}
|
||||
|
||||
public static InputEvent.InteractionKeyMappingTriggered onClickInput(int button, KeyMapping keyBinding, InteractionHand hand) {
|
||||
return fire(new InputEvent.InteractionKeyMappingTriggered(button, keyBinding, hand));
|
||||
public static boolean onClickInputPickBlock(KeyMapping keyBinding) {
|
||||
var event = new InputEvent.InteractionKeyMappingTriggered(2, keyBinding, InteractionHand.MAIN_HAND);
|
||||
return InputEvent.InteractionKeyMappingTriggered.BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onContainerRenderBackground(AbstractContainerScreen<?> screen, GuiGraphics graphics, int mouseX, int mouseY) {
|
||||
post(new ContainerScreenEvent.Render.Background(screen, graphics, mouseX, mouseY));
|
||||
ContainerScreenEvent.Render.Background.BUS.post(new ContainerScreenEvent.Render.Background(screen, graphics, mouseX, mouseY));
|
||||
}
|
||||
|
||||
public static void onContainerRenderForeground(AbstractContainerScreen<?> screen, GuiGraphics graphics, int mouseX, int mouseY) {
|
||||
post(new ContainerScreenEvent.Render.Foreground(screen, graphics, mouseX, mouseY));
|
||||
ContainerScreenEvent.Render.Foreground.BUS.post(new ContainerScreenEvent.Render.Foreground(screen, graphics, mouseX, mouseY));
|
||||
}
|
||||
|
||||
public static void firePlayerLogin(MultiPlayerGameMode pc, LocalPlayer player, Connection networkManager) {
|
||||
post(new ClientPlayerNetworkEvent.LoggingIn(pc, player, networkManager));
|
||||
ClientPlayerNetworkEvent.LoggingIn.BUS.post(new ClientPlayerNetworkEvent.LoggingIn(pc, player, networkManager));
|
||||
}
|
||||
|
||||
public static void firePlayerLogout(@Nullable MultiPlayerGameMode pc, @Nullable LocalPlayer player) {
|
||||
post(new ClientPlayerNetworkEvent.LoggingOut(pc, player, player != null ? player.connection != null ? player.connection.getConnection() : null : null));
|
||||
ClientPlayerNetworkEvent.LoggingOut.BUS.post(new ClientPlayerNetworkEvent.LoggingOut(pc, player, player != null ? player.connection != null ? player.connection.getConnection() : null : null));
|
||||
}
|
||||
|
||||
public static void firePlayerRespawn(MultiPlayerGameMode pc, LocalPlayer oldPlayer, LocalPlayer newPlayer, Connection networkManager) {
|
||||
post(new ClientPlayerNetworkEvent.Clone(pc, oldPlayer, newPlayer, networkManager));
|
||||
ClientPlayerNetworkEvent.Clone.BUS.post(new ClientPlayerNetworkEvent.Clone(pc, oldPlayer, newPlayer, networkManager));
|
||||
}
|
||||
|
||||
public static ViewportEvent.ComputeFov fireComputeFov(GameRenderer renderer, Camera camera, double partialTick, float fov, boolean usedConfiguredFov) {
|
||||
return fire(new ViewportEvent.ComputeFov(renderer, camera, partialTick, fov, usedConfiguredFov));
|
||||
return ViewportEvent.ComputeFov.BUS.fire(new ViewportEvent.ComputeFov(renderer, camera, partialTick, fov, usedConfiguredFov));
|
||||
}
|
||||
|
||||
public static ViewportEvent.ComputeCameraAngles fireComputeCameraAngles(GameRenderer renderer, Camera camera, float partial) {
|
||||
return fire(new ViewportEvent.ComputeCameraAngles(renderer, camera, partial, camera.getYRot(), camera.getXRot(), 0));
|
||||
return ViewportEvent.ComputeCameraAngles.BUS.fire(new ViewportEvent.ComputeCameraAngles(renderer, camera, partial, camera.getYRot(), camera.getXRot(), 0));
|
||||
}
|
||||
|
||||
public static <T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> boolean onRenderLivingPre(S state, LivingEntityRenderer<T, S, M> renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return post(new RenderLivingEvent.Pre<T, S, M>(state, renderer, poseStack, multiBufferSource, packedLight));
|
||||
return RenderLivingEvent.Pre.BUS.post(new RenderLivingEvent.Pre<T, S, M>(state, renderer, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static <T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> boolean onRenderLivingPost(S state, LivingEntityRenderer<T, S, M> renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return post(new RenderLivingEvent.Post<T, S, M>(state, renderer, poseStack, multiBufferSource, packedLight));
|
||||
return RenderLivingEvent.Post.BUS.post(new RenderLivingEvent.Post<T, S, M>(state, renderer, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static boolean onRenderPlayerPre(PlayerRenderState player, PlayerRenderer renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return post(new RenderPlayerEvent.Pre(player, renderer, poseStack, multiBufferSource, packedLight));
|
||||
return RenderPlayerEvent.Pre.BUS.post(new RenderPlayerEvent.Pre(player, renderer, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static boolean onRenderPlayerPost(PlayerRenderState player, PlayerRenderer renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return post(new RenderPlayerEvent.Post(player, renderer, poseStack, multiBufferSource, packedLight));
|
||||
return RenderPlayerEvent.Post.BUS.post(new RenderPlayerEvent.Post(player, renderer, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static boolean onRenderArm(PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, HumanoidArm arm) {
|
||||
return post(new RenderArmEvent(poseStack, multiBufferSource, packedLight, arm));
|
||||
return RenderArmEvent.BUS.post(new RenderArmEvent(poseStack, multiBufferSource, packedLight, arm));
|
||||
}
|
||||
|
||||
public static boolean onRenderItemInFrame(ItemFrameRenderState state, ItemFrameRenderer<?> renderItemFrame, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return post(new RenderItemInFrameEvent(state, renderItemFrame, poseStack, multiBufferSource, packedLight));
|
||||
return RenderItemInFrameEvent.BUS.post(new RenderItemInFrameEvent(state, renderItemFrame, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static RenderNameTagEvent fireRenderNameTagEvent(EntityRenderState state, Component content, EntityRenderer<?, ?> entityRenderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
return fire(new RenderNameTagEvent(state, content, entityRenderer, poseStack, multiBufferSource, packedLight));
|
||||
return RenderNameTagEvent.BUS.fire(new RenderNameTagEvent(state, content, entityRenderer, poseStack, multiBufferSource, packedLight));
|
||||
}
|
||||
|
||||
public static void onRenderScreenBackground(Screen screen, GuiGraphics guiGraphics) {
|
||||
fire(new ScreenEvent.BackgroundRendered(screen, guiGraphics));
|
||||
ScreenEvent.BackgroundRendered.BUS.post(new ScreenEvent.BackgroundRendered(screen, guiGraphics));
|
||||
}
|
||||
|
||||
public static void onRenderTickStart(DeltaTracker timer) {
|
||||
post(new TickEvent.RenderTickEvent.Pre(timer));
|
||||
TickEvent.RenderTickEvent.Pre.BUS.post(new TickEvent.RenderTickEvent.Pre(timer));
|
||||
}
|
||||
|
||||
public static void onRenderTickEnd(DeltaTracker timer) {
|
||||
post(new TickEvent.RenderTickEvent.Post(timer));
|
||||
TickEvent.RenderTickEvent.Post.BUS.post(new TickEvent.RenderTickEvent.Post(timer));
|
||||
}
|
||||
|
||||
public static RenderTooltipEvent.Background onRenderTooltipBackground(@NotNull ItemStack stack, GuiGraphics graphics, int x, int y, @NotNull Font font, @NotNull List<ClientTooltipComponent> components, @Nullable ResourceLocation backgroundPrefix) {
|
||||
return fire(new RenderTooltipEvent.Background(stack, graphics, x, y, font, components, backgroundPrefix));
|
||||
return RenderTooltipEvent.Background.BUS.fire(new RenderTooltipEvent.Background(stack, graphics, x, y, font, components, backgroundPrefix));
|
||||
}
|
||||
|
||||
public static boolean onToastAdd(Toast toast) {
|
||||
return post(new ToastAddEvent(toast));
|
||||
return ToastAddEvent.BUS.post(new ToastAddEvent(toast));
|
||||
}
|
||||
|
||||
public static ScreenEvent.RenderInventoryMobEffects onScreenEffectSize(Screen screen, int availableSpace, boolean compact, int horizontalOffset) {
|
||||
return fire(new ScreenEvent.RenderInventoryMobEffects(screen, availableSpace, compact, horizontalOffset));
|
||||
public static @Nullable ScreenEvent.RenderInventoryMobEffects onScreenEffectSize(Screen screen, int availableSpace, boolean compact, int horizontalOffset) {
|
||||
var event = new ScreenEvent.RenderInventoryMobEffects(screen, availableSpace, compact, horizontalOffset);
|
||||
return ScreenEvent.RenderInventoryMobEffects.BUS.post(event) ? null : event;
|
||||
}
|
||||
|
||||
public static void onRecipesUpdated(ClientRecipeBook book) {
|
||||
post(new RecipesUpdatedEvent(book));
|
||||
RecipesUpdatedEvent.BUS.post(new RecipesUpdatedEvent(book));
|
||||
}
|
||||
|
||||
public static ComputeFovModifierEvent fireFovModifierEvent(Player entity, float modifier, float scale) {
|
||||
return fire(new ComputeFovModifierEvent(entity, modifier, scale));
|
||||
return ComputeFovModifierEvent.BUS.fire(new ComputeFovModifierEvent(entity, modifier, scale));
|
||||
}
|
||||
|
||||
public static void onCreateSpecialBlockRenderers(Map<Block, SpecialModelRenderer.Unbaked> map) {
|
||||
post(new CreateSpecialBlockRendererEvent(map));
|
||||
CreateSpecialBlockRendererEvent.BUS.post(new CreateSpecialBlockRendererEvent(map));
|
||||
}
|
||||
|
||||
public static Map<Type, Function<EntityModelSet, SkullModelBase>> onCreateSkullModels() {
|
||||
|
||||
@@ -8,9 +8,11 @@ package net.minecraftforge.client.event;
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
@@ -24,21 +26,24 @@ import org.lwjgl.glfw.GLFW;
|
||||
* @see Key
|
||||
* @see InteractionKeyMappingTriggered
|
||||
*/
|
||||
public abstract sealed class InputEvent extends Event {
|
||||
public abstract sealed class InputEvent extends MutableEvent implements InheritableEvent {
|
||||
public static final EventBus<InputEvent> BUS = EventBus.create(InputEvent.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected InputEvent() {}
|
||||
|
||||
/**
|
||||
* Fired when a mouse button is pressed/released. Sub-events get fired {@link Pre before} and {@link Post after} this happens.
|
||||
*
|
||||
* <p>These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>These events are fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button" target="_top">the online GLFW documentation</a>
|
||||
* @see Pre
|
||||
* @see Post
|
||||
*/
|
||||
public static abstract sealed class MouseButton extends InputEvent {
|
||||
public static final EventBus<MouseButton> BUS = EventBus.create(MouseButton.class);
|
||||
|
||||
private final int button;
|
||||
private final int action;
|
||||
private final int modifiers;
|
||||
@@ -88,16 +93,15 @@ public abstract sealed class InputEvent extends Event {
|
||||
/**
|
||||
* Fired when a mouse button is pressed/released, <b>before</b> being processed by vanilla.
|
||||
*
|
||||
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* If the event is cancelled, then the mouse event will not be processed by vanilla (e.g. keymappings and screens) </p>
|
||||
* <p>If the event is cancelled, then the mouse event will not be processed by vanilla (e.g. keymappings and screens) </p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button" target="_top">the online GLFW documentation</a>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends MouseButton {
|
||||
public static final class Pre extends MouseButton implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(int button, int action, int modifiers) {
|
||||
super(button, action, modifiers);
|
||||
@@ -107,14 +111,13 @@ public abstract sealed class InputEvent extends Event {
|
||||
/**
|
||||
* Fired when a mouse button is pressed/released, <b>after</b> processing.
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button" target="_top">the online GLFW documentation</a>
|
||||
*/
|
||||
public static final class Post extends MouseButton {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(int button, int action, int modifiers) {
|
||||
super(button, action, modifiers);
|
||||
@@ -126,16 +129,15 @@ public abstract sealed class InputEvent extends Event {
|
||||
* Fired when a mouse scroll wheel is used outside of a screen and a player is loaded, <b>before</b> being
|
||||
* processed by vanilla.
|
||||
*
|
||||
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* If the event is cancelled, then the mouse scroll event will not be processed further.</p>
|
||||
* <p>If the event is cancelled, then the mouse scroll event will not be processed further.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see <a href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button" target="_top">the online GLFW documentation</a>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class MouseScrollingEvent extends InputEvent {
|
||||
public static final class MouseScrollingEvent extends InputEvent implements Cancellable {
|
||||
public static final CancellableEventBus<MouseScrollingEvent> BUS = CancellableEventBus.create(MouseScrollingEvent.class);
|
||||
|
||||
private final double deltaX;
|
||||
private final double deltaY;
|
||||
private final double mouseX;
|
||||
@@ -208,12 +210,11 @@ public abstract sealed class InputEvent extends Event {
|
||||
/**
|
||||
* Fired when a keyboard key input occurs, such as pressing, releasing, or repeating a key.
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Key extends InputEvent {
|
||||
public static final EventBus<Key> BUS = EventBus.create(Key.class);
|
||||
|
||||
private final int key;
|
||||
private final int scanCode;
|
||||
private final int action;
|
||||
@@ -288,16 +289,15 @@ public abstract sealed class InputEvent extends Event {
|
||||
* <li><b>Attack</b> - defaults to <em>right mouse click</em></li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* If this event is cancelled, then the keymapping's action is not processed further, and the hand will be swung
|
||||
* <p>If this event is cancelled, then the keymapping's action is not processed further, and the hand will be swung
|
||||
* according to {@link #shouldSwingHand()}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
// TODO: Change the 'button' to sub events. - Lex 0422202
|
||||
@Cancelable
|
||||
public static final class InteractionKeyMappingTriggered extends InputEvent {
|
||||
public static final class InteractionKeyMappingTriggered extends InputEvent implements Cancellable {
|
||||
public static final CancellableEventBus<InteractionKeyMappingTriggered> BUS = CancellableEventBus.create(InteractionKeyMappingTriggered.class);
|
||||
|
||||
private final int button;
|
||||
private final KeyMapping keyMapping;
|
||||
private final InteractionHand hand;
|
||||
|
||||
@@ -13,8 +13,8 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraftforge.client.model.geometry.IGeometryLoader;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
@@ -28,9 +28,9 @@ import java.util.Map;
|
||||
/**
|
||||
* Houses events related to models.
|
||||
*/
|
||||
public abstract sealed class ModelEvent extends Event {
|
||||
public abstract sealed class ModelEvent {
|
||||
@ApiStatus.Internal
|
||||
protected ModelEvent() { }
|
||||
protected ModelEvent() {}
|
||||
|
||||
/**
|
||||
* Fired while the {@link ModelManager} is reloading models, after the model registry is set up, but before it's
|
||||
@@ -49,6 +49,10 @@ public abstract sealed class ModelEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class ModifyBakingResult extends ModelEvent implements IModBusEvent {
|
||||
public static EventBus<ModifyBakingResult> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, ModifyBakingResult.class);
|
||||
}
|
||||
|
||||
private final ModelBakery modelBakery;
|
||||
private final ModelBakery.BakingResult results;
|
||||
|
||||
@@ -85,6 +89,10 @@ public abstract sealed class ModelEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class BakingCompleted extends ModelEvent implements IModBusEvent {
|
||||
public static EventBus<BakingCompleted> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, BakingCompleted.class);
|
||||
}
|
||||
|
||||
private final ModelManager modelManager;
|
||||
private final ModelBakery modelBakery;
|
||||
|
||||
@@ -119,6 +127,10 @@ public abstract sealed class ModelEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class RegisterModelStateDefinitions extends ModelEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterModelStateDefinitions> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterModelStateDefinitions.class);
|
||||
}
|
||||
|
||||
private final Map<ResourceLocation, StateDefinition<Block, BlockState>> states = new HashMap<>();
|
||||
private final Map<ResourceLocation, StateDefinition<Block, BlockState>> view = Collections.unmodifiableMap(states);
|
||||
|
||||
@@ -149,6 +161,10 @@ public abstract sealed class ModelEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class RegisterGeometryLoaders extends ModelEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterGeometryLoaders> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterGeometryLoaders.class);
|
||||
}
|
||||
|
||||
private final Map<ResourceLocation, IGeometryLoader> loaders;
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.client.player.ClientInput;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -22,6 +22,8 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class MovementInputUpdateEvent extends PlayerEvent {
|
||||
public static final EventBus<MovementInputUpdateEvent> BUS = EventBus.create(MovementInputUpdateEvent.class);
|
||||
|
||||
private final ClientInput input;
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -7,8 +7,8 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.ClientRecipeBook;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.RecordEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -19,19 +19,12 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param getRecipeBook the recipe manager
|
||||
*/
|
||||
public final class RecipesUpdatedEvent extends Event {
|
||||
private final ClientRecipeBook recipeBook;
|
||||
public record RecipesUpdatedEvent(ClientRecipeBook getRecipeBook) implements RecordEvent {
|
||||
public static final EventBus<RecipesUpdatedEvent> BUS = EventBus.create(RecipesUpdatedEvent.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RecipesUpdatedEvent(ClientRecipeBook recipeBook) {
|
||||
this.recipeBook = recipeBook;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the recipe manager}
|
||||
*/
|
||||
public ClientRecipeBook getRecipeBook() {
|
||||
return recipeBook;
|
||||
}
|
||||
public RecipesUpdatedEvent {}
|
||||
}
|
||||
@@ -10,11 +10,13 @@ import net.minecraft.commands.CommandBuildContext;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.arguments.ObjectiveArgument;
|
||||
import net.minecraft.commands.arguments.ResourceLocationArgument;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.common.util.HasResult;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.RecordEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Fired to allow mods to register client commands.
|
||||
@@ -27,38 +29,22 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* objectives that are displayed to the player.
|
||||
* </ul>
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
* <p>This event is not {@linkplain Cancellable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param getDispatcher the command dispatcher for registering commands to be executed on the client
|
||||
* @param getBuildContext the context to build the commands for
|
||||
*
|
||||
* @see net.minecraftforge.event.RegisterCommandsEvent
|
||||
*/
|
||||
public final class RegisterClientCommandsEvent extends Event
|
||||
{
|
||||
private final CommandDispatcher<CommandSourceStack> dispatcher;
|
||||
private final CommandBuildContext context;
|
||||
@NullMarked
|
||||
public record RegisterClientCommandsEvent(
|
||||
CommandDispatcher<CommandSourceStack> getDispatcher,
|
||||
CommandBuildContext getBuildContext
|
||||
) implements RecordEvent {
|
||||
public static final EventBus<RegisterClientCommandsEvent> BUS = EventBus.create(RegisterClientCommandsEvent.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterClientCommandsEvent(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext context)
|
||||
{
|
||||
this.dispatcher = dispatcher;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the command dispatcher for registering commands to be executed on the client}
|
||||
*/
|
||||
public CommandDispatcher<CommandSourceStack> getDispatcher()
|
||||
{
|
||||
return dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the context to build the commands for}
|
||||
*/
|
||||
public CommandBuildContext getBuildContext()
|
||||
{
|
||||
return context;
|
||||
}
|
||||
public RegisterClientCommandsEvent {}
|
||||
}
|
||||
+9
-8
@@ -9,8 +9,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
||||
import net.minecraftforge.event.AddReloadListenerEvent;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -27,13 +27,15 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class RegisterClientReloadListenersEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public final class RegisterClientReloadListenersEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterClientReloadListenersEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterClientReloadListenersEvent.class);
|
||||
}
|
||||
|
||||
private final ReloadableResourceManager resourceManager;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterClientReloadListenersEvent(ReloadableResourceManager resourceManager)
|
||||
{
|
||||
public RegisterClientReloadListenersEvent(ReloadableResourceManager resourceManager) {
|
||||
this.resourceManager = resourceManager;
|
||||
}
|
||||
|
||||
@@ -42,8 +44,7 @@ public final class RegisterClientReloadListenersEvent extends Event implements I
|
||||
*
|
||||
* @param reloadListener the reload listener
|
||||
*/
|
||||
public void registerReloadListener(PreparableReloadListener reloadListener)
|
||||
{
|
||||
public void registerReloadListener(PreparableReloadListener reloadListener) {
|
||||
resourceManager.registerReloadListener(reloadListener);
|
||||
}
|
||||
}
|
||||
+9
-8
@@ -7,8 +7,8 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
|
||||
import net.minecraft.world.inventory.tooltip.TooltipComponent;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -26,13 +26,15 @@ import java.util.function.Function;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class RegisterClientTooltipComponentFactoriesEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public final class RegisterClientTooltipComponentFactoriesEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterClientTooltipComponentFactoriesEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterClientTooltipComponentFactoriesEvent.class);
|
||||
}
|
||||
|
||||
private final Map<Class<? extends TooltipComponent>, Function<TooltipComponent, ClientTooltipComponent>> factories;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterClientTooltipComponentFactoriesEvent(Map<Class<? extends TooltipComponent>, Function<TooltipComponent, ClientTooltipComponent>> factories)
|
||||
{
|
||||
public RegisterClientTooltipComponentFactoriesEvent(Map<Class<? extends TooltipComponent>, Function<TooltipComponent, ClientTooltipComponent>> factories) {
|
||||
this.factories = factories;
|
||||
}
|
||||
|
||||
@@ -40,8 +42,7 @@ public final class RegisterClientTooltipComponentFactoriesEvent extends Event im
|
||||
* Registers a {@link ClientTooltipComponent} factory for a {@link TooltipComponent}.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends TooltipComponent> void register(Class<T> type, Function<? super T, ? extends ClientTooltipComponent> factory)
|
||||
{
|
||||
public <T extends TooltipComponent> void register(Class<T> type, Function<? super T, ? extends ClientTooltipComponent> factory) {
|
||||
factories.put(type, (Function<TooltipComponent, ClientTooltipComponent>) factory);
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.client.color.block.BlockColor;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.ColorResolver;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -25,9 +25,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see RegisterColorHandlersEvent.Block
|
||||
* @see RegisterColorHandlersEvent.Item
|
||||
* @see RegisterColorHandlersEvent.ColorResolvers
|
||||
*/
|
||||
public abstract sealed class RegisterColorHandlersEvent extends Event implements IModBusEvent {
|
||||
public abstract sealed class RegisterColorHandlersEvent implements IModBusEvent {
|
||||
@ApiStatus.Internal
|
||||
protected RegisterColorHandlersEvent() {}
|
||||
|
||||
@@ -40,6 +40,10 @@ public abstract sealed class RegisterColorHandlersEvent extends Event implements
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Block extends RegisterColorHandlersEvent {
|
||||
public static EventBus<Block> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, Block.class);
|
||||
}
|
||||
|
||||
private final BlockColors blockColors;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -73,6 +77,10 @@ public abstract sealed class RegisterColorHandlersEvent extends Event implements
|
||||
* {@link net.minecraft.world.level.BlockAndTintGetter#getBlockTint(BlockPos, ColorResolver)}.
|
||||
*/
|
||||
public static final class ColorResolvers extends RegisterColorHandlersEvent {
|
||||
public static EventBus<ColorResolvers> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, ColorResolvers.class);
|
||||
}
|
||||
|
||||
private final ImmutableList.Builder<ColorResolver> builder;
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
+9
-8
@@ -7,8 +7,8 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.renderer.DimensionSpecialEffects;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -24,21 +24,22 @@ import java.util.Map;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class RegisterDimensionSpecialEffectsEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public final class RegisterDimensionSpecialEffectsEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterDimensionSpecialEffectsEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterDimensionSpecialEffectsEvent.class);
|
||||
}
|
||||
|
||||
private final Map<ResourceLocation, DimensionSpecialEffects> effects;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterDimensionSpecialEffectsEvent(Map<ResourceLocation, DimensionSpecialEffects> effects)
|
||||
{
|
||||
public RegisterDimensionSpecialEffectsEvent(Map<ResourceLocation, DimensionSpecialEffects> effects) {
|
||||
this.effects = effects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the effects for a given dimension type.
|
||||
*/
|
||||
public void register(ResourceLocation dimensionType, DimensionSpecialEffects effects)
|
||||
{
|
||||
public void register(ResourceLocation dimensionType, DimensionSpecialEffects effects) {
|
||||
this.effects.put(dimensionType, effects);
|
||||
}
|
||||
}
|
||||
+9
-8
@@ -7,8 +7,8 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -25,21 +25,22 @@ import java.util.Map;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class RegisterEntitySpectatorShadersEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public final class RegisterEntitySpectatorShadersEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterEntitySpectatorShadersEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterEntitySpectatorShadersEvent.class);
|
||||
}
|
||||
|
||||
private final Map<EntityType<?>, ResourceLocation> shaders;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterEntitySpectatorShadersEvent(Map<EntityType<?>, ResourceLocation> shaders)
|
||||
{
|
||||
public RegisterEntitySpectatorShadersEvent(Map<EntityType<?>, ResourceLocation> shaders) {
|
||||
this.shaders = shaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a spectator shader for a given entity type.
|
||||
*/
|
||||
public void register(EntityType<?> entityType, ResourceLocation shader)
|
||||
{
|
||||
public void register(EntityType<?> entityType, ResourceLocation shader) {
|
||||
shaders.put(entityType, shader);
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.client.IItemDecorator;
|
||||
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -28,22 +28,22 @@ import java.util.Map;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class RegisterItemDecorationsEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public final class RegisterItemDecorationsEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterItemDecorationsEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterItemDecorationsEvent.class);
|
||||
}
|
||||
|
||||
private final Map<Item, List<IItemDecorator>> decorators;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterItemDecorationsEvent(Map<Item, List<IItemDecorator>> decorators)
|
||||
{
|
||||
public RegisterItemDecorationsEvent(Map<Item, List<IItemDecorator>> decorators) {
|
||||
this.decorators = decorators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an ItemDecorator to an Item
|
||||
*/
|
||||
public void register(ItemLike itemLike, IItemDecorator decorator)
|
||||
{
|
||||
public void register(ItemLike itemLike, IItemDecorator decorator) {
|
||||
List<IItemDecorator> itemDecoratorList = decorators.computeIfAbsent(itemLike.asItem(), item -> new ArrayList<>());
|
||||
itemDecoratorList.add(decorator);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Options;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -23,21 +23,22 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class RegisterKeyMappingsEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public final class RegisterKeyMappingsEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterKeyMappingsEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterKeyMappingsEvent.class);
|
||||
}
|
||||
|
||||
private final Options options;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterKeyMappingsEvent(Options options)
|
||||
{
|
||||
public RegisterKeyMappingsEvent(Options options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new key mapping.
|
||||
*/
|
||||
public void register(KeyMapping key)
|
||||
{
|
||||
public void register(KeyMapping key) {
|
||||
options.keyMappings = ArrayUtils.add(options.keyMappings, key);
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,14 @@ package net.minecraftforge.client.event;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.client.RenderTypeGroup;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -23,18 +23,17 @@ import java.util.Map;
|
||||
/**
|
||||
* Allows users to register custom named {@link RenderType render types}.
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class RegisterNamedRenderTypesEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public final class RegisterNamedRenderTypesEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterNamedRenderTypesEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterNamedRenderTypesEvent.class);
|
||||
}
|
||||
|
||||
private final Map<ResourceLocation, RenderTypeGroup> renderTypes;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterNamedRenderTypesEvent(Map<ResourceLocation, RenderTypeGroup> renderTypes)
|
||||
{
|
||||
public RegisterNamedRenderTypesEvent(Map<ResourceLocation, RenderTypeGroup> renderTypes) {
|
||||
this.renderTypes = renderTypes;
|
||||
}
|
||||
|
||||
@@ -42,11 +41,10 @@ public final class RegisterNamedRenderTypesEvent extends Event implements IModBu
|
||||
* Registers a named {@link RenderTypeGroup}.
|
||||
*
|
||||
* @param name The name
|
||||
* @param blockRenderType One of the values returned by {@link RenderType#chunkBufferLayers()}
|
||||
* @param blockRenderType What ChunkSectionLayer to render in
|
||||
* @param entityRenderType A {@link RenderType} using {@link DefaultVertexFormat#NEW_ENTITY}
|
||||
*/
|
||||
public void register(String name, RenderType blockRenderType, RenderType entityRenderType)
|
||||
{
|
||||
public void register(String name, ChunkSectionLayer blockRenderType, RenderType entityRenderType) {
|
||||
register(name, blockRenderType, entityRenderType, entityRenderType);
|
||||
}
|
||||
|
||||
@@ -54,17 +52,15 @@ public final class RegisterNamedRenderTypesEvent extends Event implements IModBu
|
||||
* Registers a named {@link RenderTypeGroup}.
|
||||
*
|
||||
* @param name The name
|
||||
* @param blockRenderType One of the values returned by {@link RenderType#chunkBufferLayers()}
|
||||
* @param blockRenderType What ChunkSectionLayer to render in
|
||||
* @param entityRenderType A {@link RenderType} using {@link DefaultVertexFormat#NEW_ENTITY}
|
||||
* @param fabulousEntityRenderType A {@link RenderType} using {@link DefaultVertexFormat#NEW_ENTITY} for use when
|
||||
* "fabulous" rendering is enabled
|
||||
*/
|
||||
public void register(String name, RenderType blockRenderType, RenderType entityRenderType, RenderType fabulousEntityRenderType)
|
||||
{
|
||||
public void register(String name, ChunkSectionLayer blockRenderType, RenderType entityRenderType, RenderType fabulousEntityRenderType) {
|
||||
@SuppressWarnings("removal")
|
||||
var key = ResourceLocation.fromNamespaceAndPath(ModLoadingContext.get().getActiveNamespace(), name);
|
||||
Preconditions.checkArgument(!renderTypes.containsKey(key), "Render type already registered: " + key);
|
||||
Preconditions.checkArgument(blockRenderType.format() == DefaultVertexFormat.BLOCK, "The block render type must use the BLOCK vertex format.");
|
||||
Preconditions.checkArgument(blockRenderType.getChunkLayerId() >= 0, "Only chunk render types can be used for block rendering. Query RenderType#chunkBufferLayers() for a list.");
|
||||
Preconditions.checkArgument(entityRenderType.format() == DefaultVertexFormat.NEW_ENTITY, "The entity render type must use the NEW_ENTITY vertex format.");
|
||||
Preconditions.checkArgument(fabulousEntityRenderType.format() == DefaultVertexFormat.NEW_ENTITY, "The fabulous entity render type must use the NEW_ENTITY vertex format.");
|
||||
renderTypes.put(key, new RenderTypeGroup(blockRenderType, entityRenderType, fabulousEntityRenderType));
|
||||
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.client.particle.ParticleProvider;
|
||||
import net.minecraft.client.particle.TextureSheetParticle;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -29,13 +29,15 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class RegisterParticleProvidersEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public final class RegisterParticleProvidersEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterParticleProvidersEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterParticleProvidersEvent.class);
|
||||
}
|
||||
|
||||
private final ParticleEngine particleEngine;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterParticleProvidersEvent(ParticleEngine particleEngine)
|
||||
{
|
||||
public RegisterParticleProvidersEvent(ParticleEngine particleEngine) {
|
||||
this.particleEngine = particleEngine;
|
||||
}
|
||||
|
||||
@@ -67,8 +69,7 @@ public final class RegisterParticleProvidersEvent extends Event implements IModB
|
||||
* @param sprite Sprite function responsible for providing that ParticleType's particles.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public <T extends ParticleOptions> void registerSprite(ParticleType<T> type, ParticleProvider.Sprite<T> sprite)
|
||||
{
|
||||
public <T extends ParticleOptions> void registerSprite(ParticleType<T> type, ParticleProvider.Sprite<T> sprite) {
|
||||
particleEngine.register(type, sprite);
|
||||
}
|
||||
|
||||
@@ -84,9 +85,7 @@ public final class RegisterParticleProvidersEvent extends Event implements IModB
|
||||
* @param registration SpriteParticleRegistration function responsible for providing that ParticleType's particles.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public <T extends ParticleOptions> void registerSpriteSet(ParticleType<T> type, ParticleEngine.SpriteParticleRegistration<T> registration)
|
||||
{
|
||||
public <T extends ParticleOptions> void registerSpriteSet(ParticleType<T> type, ParticleEngine.SpriteParticleRegistration<T> registration) {
|
||||
particleEngine.register(type, registration);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,8 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -14,8 +16,6 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import net.minecraft.client.gui.screens.worldselection.PresetEditor;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
@@ -29,26 +29,26 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class RegisterPresetEditorsEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public final class RegisterPresetEditorsEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterPresetEditorsEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterPresetEditorsEvent.class);
|
||||
}
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
private final Map<ResourceKey<WorldPreset>, PresetEditor> editors;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RegisterPresetEditorsEvent(Map<ResourceKey<WorldPreset>, PresetEditor> editors)
|
||||
{
|
||||
public RegisterPresetEditorsEvent(Map<ResourceKey<WorldPreset>, PresetEditor> editors) {
|
||||
this.editors = editors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a PresetEditor for a given world preset key.
|
||||
*/
|
||||
public void register(ResourceKey<WorldPreset> key, PresetEditor editor)
|
||||
{
|
||||
public void register(ResourceKey<WorldPreset> key, PresetEditor editor) {
|
||||
PresetEditor old = this.editors.put(key, editor);
|
||||
if (old != null)
|
||||
{
|
||||
if (old != null) {
|
||||
LOGGER.debug("PresetEditor {} overridden by mod {}", key.location(), ModLoadingContext.get().getActiveNamespace());
|
||||
}
|
||||
}
|
||||
|
||||
+7
-3
@@ -10,8 +10,8 @@ import com.google.common.collect.BiMap;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.client.textures.ITextureAtlasSpriteLoader;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
@@ -26,7 +26,11 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class RegisterTextureAtlasSpriteLoadersEvent extends Event implements IModBusEvent {
|
||||
public final class RegisterTextureAtlasSpriteLoadersEvent implements IModBusEvent {
|
||||
public static EventBus<RegisterTextureAtlasSpriteLoadersEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, RegisterTextureAtlasSpriteLoadersEvent.class);
|
||||
}
|
||||
|
||||
private final BiMap<ResourceLocation, ITextureAtlasSpriteLoader> loaders;
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -10,8 +10,9 @@ import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.world.entity.HumanoidArm;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -26,8 +27,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public final class RenderArmEvent extends Event {
|
||||
public final class RenderArmEvent extends MutableEvent implements Cancellable {
|
||||
public static final CancellableEventBus<RenderArmEvent> BUS = CancellableEventBus.create(RenderArmEvent.class);
|
||||
|
||||
private final PoseStack poseStack;
|
||||
private final MultiBufferSource multiBufferSource;
|
||||
private final int packedLight;
|
||||
|
||||
@@ -10,8 +10,9 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -24,16 +25,15 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public final class RenderBlockScreenEffectEvent extends Event
|
||||
{
|
||||
public final class RenderBlockScreenEffectEvent extends MutableEvent implements Cancellable {
|
||||
public static final CancellableEventBus<RenderBlockScreenEffectEvent> BUS = CancellableEventBus.create(RenderBlockScreenEffectEvent.class);
|
||||
|
||||
/**
|
||||
* The type of the block overlay to be rendered.
|
||||
*
|
||||
* @see RenderBlockScreenEffectEvent
|
||||
*/
|
||||
public enum OverlayType
|
||||
{
|
||||
public enum OverlayType {
|
||||
/**
|
||||
* The type of the overlay when the player is burning / on fire.
|
||||
*/
|
||||
@@ -55,8 +55,7 @@ public final class RenderBlockScreenEffectEvent extends Event
|
||||
private final BlockPos blockPos;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RenderBlockScreenEffectEvent(Player player, PoseStack poseStack, OverlayType type, BlockState block, BlockPos blockPos)
|
||||
{
|
||||
public RenderBlockScreenEffectEvent(Player player, PoseStack poseStack, OverlayType type, BlockState block, BlockPos blockPos) {
|
||||
this.player = player;
|
||||
this.poseStack = poseStack;
|
||||
this.overlayType = type;
|
||||
@@ -67,40 +66,35 @@ public final class RenderBlockScreenEffectEvent extends Event
|
||||
/**
|
||||
* {@return the player which the overlay will apply to}
|
||||
*/
|
||||
public Player getPlayer()
|
||||
{
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the pose stack used for rendering}
|
||||
*/
|
||||
public PoseStack getPoseStack()
|
||||
{
|
||||
public PoseStack getPoseStack() {
|
||||
return poseStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the type of the overlay}
|
||||
*/
|
||||
public OverlayType getOverlayType()
|
||||
{
|
||||
public OverlayType getOverlayType() {
|
||||
return overlayType;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the block which the overlay is gotten from}
|
||||
*/
|
||||
public BlockState getBlockState()
|
||||
{
|
||||
public BlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the position of the block which the overlay is gotten from}
|
||||
*/
|
||||
public BlockPos getBlockPos()
|
||||
{
|
||||
public BlockPos getBlockPos() {
|
||||
return blockPos;
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,9 @@ import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -27,9 +28,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* @see RenderArmEvent
|
||||
*/
|
||||
@Cancelable
|
||||
public final class RenderHandEvent extends Event
|
||||
{
|
||||
public final class RenderHandEvent extends MutableEvent implements Cancellable {
|
||||
public static final CancellableEventBus<RenderHandEvent> BUS = CancellableEventBus.create(RenderHandEvent.class);
|
||||
|
||||
private final InteractionHand hand;
|
||||
private final PoseStack poseStack;
|
||||
private final MultiBufferSource multiBufferSource;
|
||||
@@ -59,24 +60,21 @@ public final class RenderHandEvent extends Event
|
||||
/**
|
||||
* {@return the hand being rendered}
|
||||
*/
|
||||
public InteractionHand getHand()
|
||||
{
|
||||
public InteractionHand getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the pose stack used for rendering}
|
||||
*/
|
||||
public PoseStack getPoseStack()
|
||||
{
|
||||
public PoseStack getPoseStack() {
|
||||
return poseStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the source of rendering buffers}
|
||||
*/
|
||||
public MultiBufferSource getMultiBufferSource()
|
||||
{
|
||||
public MultiBufferSource getMultiBufferSource() {
|
||||
return multiBufferSource;
|
||||
}
|
||||
|
||||
@@ -85,48 +83,42 @@ public final class RenderHandEvent extends Event
|
||||
*
|
||||
* @see LightTexture
|
||||
*/
|
||||
public int getPackedLight()
|
||||
{
|
||||
public int getPackedLight() {
|
||||
return packedLight;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the partial tick}
|
||||
*/
|
||||
public float getPartialTick()
|
||||
{
|
||||
public float getPartialTick() {
|
||||
return partialTick;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the interpolated pitch of the player entity}
|
||||
*/
|
||||
public float getInterpolatedPitch()
|
||||
{
|
||||
public float getInterpolatedPitch() {
|
||||
return interpolatedPitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the swing progress of the hand being rendered}
|
||||
*/
|
||||
public float getSwingProgress()
|
||||
{
|
||||
public float getSwingProgress() {
|
||||
return swingProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the progress of the equip animation, from {@code 0.0} to {@code 1.0}}
|
||||
*/
|
||||
public float getEquipProgress()
|
||||
{
|
||||
public float getEquipProgress() {
|
||||
return equipProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the item stack to be rendered}
|
||||
*/
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
public ItemStack getItemStack() {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,10 @@ import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -25,9 +27,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see Block
|
||||
* @see Entity
|
||||
*/
|
||||
@Cancelable
|
||||
public abstract sealed class RenderHighlightEvent extends Event
|
||||
{
|
||||
public abstract sealed class RenderHighlightEvent extends MutableEvent implements Cancellable, InheritableEvent {
|
||||
public static final CancellableEventBus<RenderHighlightEvent> BUS = CancellableEventBus.create(RenderHighlightEvent.class);
|
||||
|
||||
private final LevelRenderer levelRenderer;
|
||||
private final Camera camera;
|
||||
private final HitResult target;
|
||||
@@ -36,8 +38,7 @@ public abstract sealed class RenderHighlightEvent extends Event
|
||||
private final MultiBufferSource multiBufferSource;
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected RenderHighlightEvent(LevelRenderer levelRenderer, Camera camera, HitResult target, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource)
|
||||
{
|
||||
protected RenderHighlightEvent(LevelRenderer levelRenderer, Camera camera, HitResult target, float partialTick, PoseStack poseStack, MultiBufferSource multiBufferSource) {
|
||||
this.levelRenderer = levelRenderer;
|
||||
this.camera = camera;
|
||||
this.target = target;
|
||||
@@ -49,48 +50,42 @@ public abstract sealed class RenderHighlightEvent extends Event
|
||||
/**
|
||||
* {@return the level renderer}
|
||||
*/
|
||||
public LevelRenderer getLevelRenderer()
|
||||
{
|
||||
public LevelRenderer getLevelRenderer() {
|
||||
return levelRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the camera information}
|
||||
*/
|
||||
public Camera getCamera()
|
||||
{
|
||||
public Camera getCamera() {
|
||||
return camera;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the hit result which triggered the selection highlight}
|
||||
*/
|
||||
public HitResult getTarget()
|
||||
{
|
||||
public HitResult getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the partial tick}
|
||||
*/
|
||||
public float getPartialTick()
|
||||
{
|
||||
public float getPartialTick() {
|
||||
return partialTick;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the pose stack used for rendering}
|
||||
*/
|
||||
public PoseStack getPoseStack()
|
||||
{
|
||||
public PoseStack getPoseStack() {
|
||||
return poseStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the source of rendering buffers}
|
||||
*/
|
||||
public MultiBufferSource getMultiBufferSource()
|
||||
{
|
||||
public MultiBufferSource getMultiBufferSource() {
|
||||
return multiBufferSource;
|
||||
}
|
||||
|
||||
@@ -103,12 +98,11 @@ public abstract sealed class RenderHighlightEvent extends Event
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Block extends RenderHighlightEvent
|
||||
{
|
||||
public static final class Block extends RenderHighlightEvent {
|
||||
public static final CancellableEventBus<Block> BUS = CancellableEventBus.create(Block.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Block(LevelRenderer levelRenderer, Camera camera, BlockHitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource)
|
||||
{
|
||||
public Block(LevelRenderer levelRenderer, Camera camera, BlockHitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource) {
|
||||
super(levelRenderer, camera, target, partialTick, poseStack, bufferSource);
|
||||
}
|
||||
|
||||
@@ -116,8 +110,7 @@ public abstract sealed class RenderHighlightEvent extends Event
|
||||
* {@return the block hit result}
|
||||
*/
|
||||
@Override
|
||||
public BlockHitResult getTarget()
|
||||
{
|
||||
public BlockHitResult getTarget() {
|
||||
return (BlockHitResult) super.target;
|
||||
}
|
||||
}
|
||||
@@ -130,11 +123,11 @@ public abstract sealed class RenderHighlightEvent extends Event
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Entity extends RenderHighlightEvent
|
||||
{
|
||||
public static final class Entity extends RenderHighlightEvent {
|
||||
public static final CancellableEventBus<Entity> BUS = CancellableEventBus.create(Entity.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Entity(LevelRenderer levelRenderer, Camera camera, EntityHitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource)
|
||||
{
|
||||
public Entity(LevelRenderer levelRenderer, Camera camera, EntityHitResult target, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource) {
|
||||
super(levelRenderer, camera, target, partialTick, poseStack, bufferSource);
|
||||
}
|
||||
|
||||
@@ -142,8 +135,7 @@ public abstract sealed class RenderHighlightEvent extends Event
|
||||
* {@return the entity hit result}
|
||||
*/
|
||||
@Override
|
||||
public EntityHitResult getTarget()
|
||||
{
|
||||
public EntityHitResult getTarget() {
|
||||
return (EntityHitResult) super.target;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,9 @@ import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.entity.ItemFrameRenderer;
|
||||
import net.minecraft.client.renderer.entity.state.ItemFrameRenderState;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -28,8 +29,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* @see ItemFrameRenderer
|
||||
*/
|
||||
@Cancelable
|
||||
public final class RenderItemInFrameEvent extends Event {
|
||||
public final class RenderItemInFrameEvent extends MutableEvent implements Cancellable {
|
||||
public static final CancellableEventBus<RenderItemInFrameEvent> BUS = CancellableEventBus.create(RenderItemInFrameEvent.class);
|
||||
|
||||
private final ItemFrameRenderState state;
|
||||
private final ItemFrameRenderer<?> renderer;
|
||||
private final PoseStack poseStack;
|
||||
|
||||
@@ -13,8 +13,11 @@ import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.state.LivingEntityRenderState;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -32,7 +35,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see RenderPlayerEvent
|
||||
* @see LivingEntityRenderer
|
||||
*/
|
||||
public abstract sealed class RenderLivingEvent<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends Event {
|
||||
public abstract sealed class RenderLivingEvent<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends MutableEvent implements InheritableEvent {
|
||||
public static final EventBus<RenderLivingEvent> BUS = EventBus.create(RenderLivingEvent.class);
|
||||
|
||||
private final S state;
|
||||
private final LivingEntityRenderer<T, S, M> renderer;
|
||||
private final PoseStack poseStack;
|
||||
@@ -99,8 +104,9 @@ public abstract sealed class RenderLivingEvent<T extends LivingEntity, S extends
|
||||
* @param <T> the living entity that is being rendered
|
||||
* @param <M> the model for the living entity
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends RenderLivingEvent<T, S, M> {
|
||||
public static final class Pre<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends RenderLivingEvent<T, S, M> implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(S state, LivingEntityRenderer<T, S, M> renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(state, renderer, poseStack, multiBufferSource, packedLight);
|
||||
@@ -119,6 +125,8 @@ public abstract sealed class RenderLivingEvent<T extends LivingEntity, S extends
|
||||
* @param <M> the model for the living entity
|
||||
*/
|
||||
public static final class Post<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> extends RenderLivingEvent<T, S, M> {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(S state, LivingEntityRenderer<T, S, M> renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(state, renderer, poseStack, multiBufferSource, packedLight);
|
||||
|
||||
@@ -11,8 +11,10 @@ import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.state.EntityRenderState;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.common.util.HasResult;
|
||||
import net.minecraftforge.common.util.Result;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -31,8 +33,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* @see EntityRenderer
|
||||
*/
|
||||
@Event.HasResult
|
||||
public final class RenderNameTagEvent extends Event {
|
||||
public final class RenderNameTagEvent extends MutableEvent implements HasResult {
|
||||
public static final EventBus<RenderNameTagEvent> BUS = EventBus.create(RenderNameTagEvent.class);
|
||||
|
||||
private Component nameplateContent;
|
||||
private final EntityRenderState state;
|
||||
private final Component originalContent;
|
||||
@@ -40,6 +43,7 @@ public final class RenderNameTagEvent extends Event {
|
||||
private final PoseStack poseStack;
|
||||
private final MultiBufferSource multiBufferSource;
|
||||
private final int packedLight;
|
||||
private Result result = Result.DEFAULT;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RenderNameTagEvent(EntityRenderState state, Component content, EntityRenderer<?, ?> entityRenderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
@@ -109,4 +113,14 @@ public final class RenderNameTagEvent extends Event {
|
||||
public int getPackedLight() {
|
||||
return this.packedLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,11 @@ import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
||||
import net.minecraft.client.renderer.entity.state.PlayerRenderState;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -24,7 +27,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see RenderPlayerEvent.Post
|
||||
* @see PlayerRenderer
|
||||
*/
|
||||
public abstract sealed class RenderPlayerEvent extends Event {
|
||||
public abstract sealed class RenderPlayerEvent extends MutableEvent implements InheritableEvent {
|
||||
public static final EventBus<RenderPlayerEvent> BUS = EventBus.create(RenderPlayerEvent.class);
|
||||
|
||||
private final PlayerRenderState state;
|
||||
private final PlayerRenderer renderer;
|
||||
private final PoseStack poseStack;
|
||||
@@ -85,8 +90,9 @@ public abstract sealed class RenderPlayerEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends RenderPlayerEvent {
|
||||
public static final class Pre extends RenderPlayerEvent implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(PlayerRenderState state, PlayerRenderer renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(state, renderer, poseStack, multiBufferSource, packedLight);
|
||||
@@ -102,6 +108,8 @@ public abstract sealed class RenderPlayerEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Post extends RenderPlayerEvent {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(PlayerRenderState state, PlayerRenderer renderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
super(state, renderer, poseStack, multiBufferSource, packedLight);
|
||||
|
||||
@@ -16,8 +16,11 @@ import net.minecraft.world.inventory.tooltip.TooltipComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -34,8 +37,9 @@ import java.util.List;
|
||||
* @see RenderTooltipEvent.Pre
|
||||
* @see RenderTooltipEvent.Background
|
||||
*/
|
||||
public abstract sealed class RenderTooltipEvent extends Event
|
||||
{
|
||||
public abstract sealed class RenderTooltipEvent extends MutableEvent implements InheritableEvent {
|
||||
public static final EventBus<RenderTooltipEvent> BUS = EventBus.create(RenderTooltipEvent.class);
|
||||
|
||||
@NotNull
|
||||
protected final ItemStack itemStack;
|
||||
protected final GuiGraphics graphics;
|
||||
@@ -120,9 +124,9 @@ public abstract sealed class RenderTooltipEvent extends Event
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class GatherComponents extends Event
|
||||
{
|
||||
public static final class GatherComponents extends MutableEvent implements Cancellable {
|
||||
public static final CancellableEventBus<GatherComponents> BUS = CancellableEventBus.create(GatherComponents.class);
|
||||
|
||||
private final ItemStack itemStack;
|
||||
private final int screenWidth;
|
||||
private final int screenHeight;
|
||||
@@ -209,9 +213,9 @@ public abstract sealed class RenderTooltipEvent extends Event
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends RenderTooltipEvent
|
||||
{
|
||||
public static final class Pre extends RenderTooltipEvent implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
private final int screenWidth;
|
||||
private final int screenHeight;
|
||||
private final ClientTooltipPositioner positioner;
|
||||
@@ -290,6 +294,8 @@ public abstract sealed class RenderTooltipEvent extends Event
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Background extends RenderTooltipEvent {
|
||||
public static final EventBus<Background> BUS = EventBus.create(Background.class);
|
||||
|
||||
private final ResourceLocation originalBackground;
|
||||
private ResourceLocation background;
|
||||
|
||||
|
||||
@@ -10,8 +10,12 @@ import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.common.util.HasResult;
|
||||
import net.minecraftforge.common.util.Result;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -35,7 +39,9 @@ import java.util.function.Consumer;
|
||||
* @see MouseInput
|
||||
* @see KeyInput
|
||||
*/
|
||||
public abstract sealed class ScreenEvent extends Event {
|
||||
public abstract sealed class ScreenEvent extends MutableEvent {
|
||||
public static final EventBus<ScreenEvent> BUS = EventBus.create(ScreenEvent.class);
|
||||
|
||||
private final Screen screen;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -110,8 +116,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends Init {
|
||||
public static final class Pre extends Init implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(Screen screen, List<GuiEventListener> list, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove) {
|
||||
super(screen, list, add, remove);
|
||||
@@ -127,6 +134,8 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Post extends Init {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(Screen screen, List<GuiEventListener> list, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove) {
|
||||
super(screen, list, add, remove);
|
||||
@@ -193,8 +202,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends Render {
|
||||
public static final class Pre extends Render implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
|
||||
super(screen, guiGraphics, mouseX, mouseY, partialTick);
|
||||
@@ -210,6 +220,8 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Post extends Render {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
|
||||
super(screen, guiGraphics, mouseX, mouseY, partialTick);
|
||||
@@ -227,6 +239,8 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class BackgroundRendered extends ScreenEvent {
|
||||
public static final EventBus<BackgroundRendered> BUS = EventBus.create(BackgroundRendered.class);
|
||||
|
||||
private final GuiGraphics guiGraphics;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -254,8 +268,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class RenderInventoryMobEffects extends ScreenEvent {
|
||||
public static final class RenderInventoryMobEffects extends ScreenEvent implements Cancellable {
|
||||
public static final CancellableEventBus<RenderInventoryMobEffects> BUS = CancellableEventBus.create(RenderInventoryMobEffects.class);
|
||||
|
||||
private final int availableSpace;
|
||||
private boolean compact;
|
||||
private int horizontalOffset;
|
||||
@@ -382,8 +397,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends MouseButtonPressed {
|
||||
public static final class Pre extends MouseButtonPressed implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(Screen screen, double mouseX, double mouseY, int button) {
|
||||
super(screen, mouseX, mouseY, button);
|
||||
@@ -405,9 +421,11 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@HasResult
|
||||
public static final class Post extends MouseButtonPressed {
|
||||
public static final class Post extends MouseButtonPressed implements HasResult {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
private final boolean handled;
|
||||
private Result result = Result.DEFAULT;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(Screen screen, double mouseX, double mouseY, int button, boolean handled) {
|
||||
@@ -421,6 +439,16 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
public boolean wasHandled() {
|
||||
return handled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,8 +488,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends MouseButtonReleased {
|
||||
public static final class Pre extends MouseButtonReleased implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(Screen screen, double mouseX, double mouseY, int button) {
|
||||
super(screen, mouseX, mouseY, button);
|
||||
@@ -483,9 +512,11 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@HasResult
|
||||
public static final class Post extends MouseButtonReleased {
|
||||
public static final class Post extends MouseButtonReleased implements HasResult {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
private final boolean handled;
|
||||
private Result result = Result.DEFAULT;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(Screen screen, double mouseX, double mouseY, int button, boolean handled) {
|
||||
@@ -499,6 +530,16 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
public boolean wasHandled() {
|
||||
return handled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,8 +597,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends MouseDragged {
|
||||
public static final class Pre extends MouseDragged implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
|
||||
super(screen, mouseX, mouseY, mouseButton, dragX, dragY);
|
||||
@@ -575,6 +617,8 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Post extends MouseDragged {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) {
|
||||
super(screen, mouseX, mouseY, mouseButton, dragX, dragY);
|
||||
@@ -624,8 +668,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends MouseScrolled {
|
||||
public static final class Pre extends MouseScrolled implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(Screen screen, double mouseX, double mouseY, double deltaX, double deltaY) {
|
||||
super(screen, mouseX, mouseY, deltaX, deltaY);
|
||||
@@ -643,6 +688,8 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Post extends MouseScrolled {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(Screen screen, double mouseX, double mouseY, double deltaX, double deltaY) {
|
||||
super(screen, mouseX, mouseY, deltaX, deltaY);
|
||||
@@ -735,8 +782,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends KeyPressed {
|
||||
public static final class Pre extends KeyPressed implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
super(screen, keyCode, scanCode, modifiers);
|
||||
@@ -753,8 +801,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Post extends KeyPressed {
|
||||
public static final class Post extends KeyPressed implements Cancellable {
|
||||
public static final CancellableEventBus<Post> BUS = CancellableEventBus.create(Post.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
super(screen, keyCode, scanCode, modifiers);
|
||||
@@ -785,8 +834,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends KeyReleased {
|
||||
public static final class Pre extends KeyReleased implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
super(screen, keyCode, scanCode, modifiers);
|
||||
@@ -803,8 +853,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Post extends KeyReleased {
|
||||
public static final class Post extends KeyReleased implements Cancellable {
|
||||
public static final CancellableEventBus<Post> BUS = CancellableEventBus.create(Post.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(Screen screen, int keyCode, int scanCode, int modifiers) {
|
||||
super(screen, keyCode, scanCode, modifiers);
|
||||
@@ -863,8 +914,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Pre extends CharacterTyped {
|
||||
public static final class Pre extends CharacterTyped implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(Screen screen, char codePoint, int modifiers) {
|
||||
super(screen, codePoint, modifiers);
|
||||
@@ -882,6 +934,8 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Post extends CharacterTyped {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Post(Screen screen, char codePoint, int modifiers) {
|
||||
super(screen, codePoint, modifiers);
|
||||
@@ -901,8 +955,9 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class Opening extends ScreenEvent {
|
||||
public static final class Opening extends ScreenEvent implements Cancellable {
|
||||
public static final CancellableEventBus<Opening> BUS = CancellableEventBus.create(Opening.class);
|
||||
|
||||
@Nullable
|
||||
private final Screen currentScreen;
|
||||
private Screen newScreen;
|
||||
@@ -950,6 +1005,8 @@ public abstract sealed class ScreenEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Closing extends ScreenEvent {
|
||||
public static final EventBus<Closing> BUS = EventBus.create(Closing.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Closing(Screen screen) {
|
||||
super(screen);
|
||||
|
||||
@@ -9,8 +9,9 @@ import com.mojang.blaze3d.platform.NativeImage;
|
||||
import net.minecraft.client.Screenshot;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -30,8 +31,8 @@ import java.io.IOException;
|
||||
*
|
||||
* @see Screenshot
|
||||
*/
|
||||
@Cancelable
|
||||
public final class ScreenshotEvent extends Event {
|
||||
public final class ScreenshotEvent extends MutableEvent implements Cancellable {
|
||||
public static final CancellableEventBus<ScreenshotEvent> BUS = CancellableEventBus.create(ScreenshotEvent.class);
|
||||
public static final Component DEFAULT_CANCEL_REASON = Component.literal("Screenshot canceled");
|
||||
|
||||
private final NativeImage image;
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
@@ -17,8 +18,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* <p>If the event is cancelled, the message is not displayed in the chat message window.</p>
|
||||
*
|
||||
*/
|
||||
@Cancelable
|
||||
public final class SystemMessageReceivedEvent extends Event {
|
||||
public final class SystemMessageReceivedEvent extends MutableEvent implements Cancellable {
|
||||
public static final CancellableEventBus<SystemMessageReceivedEvent> BUS = CancellableEventBus.create(SystemMessageReceivedEvent.class);
|
||||
|
||||
private Component message;
|
||||
private final boolean overlay;
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -19,21 +19,18 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see TextureStitchEvent.Post
|
||||
* @see TextureAtlas
|
||||
*/
|
||||
public sealed class TextureStitchEvent extends Event implements IModBusEvent
|
||||
{
|
||||
public sealed class TextureStitchEvent extends MutableEvent implements IModBusEvent, InheritableEvent {
|
||||
private final TextureAtlas atlas;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public TextureStitchEvent(TextureAtlas atlas)
|
||||
{
|
||||
public TextureStitchEvent(TextureAtlas atlas) {
|
||||
this.atlas = atlas;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the texture atlas}
|
||||
*/
|
||||
public TextureAtlas getAtlas()
|
||||
{
|
||||
public TextureAtlas getAtlas() {
|
||||
return atlas;
|
||||
}
|
||||
|
||||
@@ -80,11 +77,9 @@ public sealed class TextureStitchEvent extends Event implements IModBusEvent
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus()} mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Post extends TextureStitchEvent
|
||||
{
|
||||
public static final class Post extends TextureStitchEvent {
|
||||
@ApiStatus.Internal
|
||||
public Post(TextureAtlas map)
|
||||
{
|
||||
public Post(TextureAtlas map) {
|
||||
super(map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.gui.components.toasts.Toast;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.RecordEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
|
||||
/**
|
||||
@@ -21,15 +22,6 @@ import net.minecraftforge.fml.LogicalSide;
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public final class ToastAddEvent extends Event {
|
||||
private final Toast toast;
|
||||
|
||||
public ToastAddEvent(Toast toast) {
|
||||
this.toast = toast;
|
||||
}
|
||||
|
||||
public Toast getToast() {
|
||||
return toast;
|
||||
}
|
||||
public record ToastAddEvent(Toast getToast) implements Cancellable, RecordEvent {
|
||||
public static final CancellableEventBus<ToastAddEvent> BUS = CancellableEventBus.create(ToastAddEvent.class);
|
||||
}
|
||||
@@ -5,17 +5,20 @@
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.shaders.FogShape;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.fog.FogData;
|
||||
import net.minecraft.world.level.material.FogType;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
/**
|
||||
* Fired for hooking into the entity view rendering in {@link GameRenderer}.
|
||||
@@ -30,7 +33,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see ComputeCameraAngles
|
||||
* @see ComputeFov
|
||||
*/
|
||||
public abstract sealed class ViewportEvent extends Event {
|
||||
public abstract sealed class ViewportEvent extends MutableEvent implements InheritableEvent {
|
||||
public static final EventBus<ViewportEvent> BUS = EventBus.create(ViewportEvent.class);
|
||||
|
||||
private final GameRenderer renderer;
|
||||
private final Camera camera;
|
||||
private final double partialTick;
|
||||
@@ -72,30 +77,28 @@ public abstract sealed class ViewportEvent extends Event {
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static final class RenderFog extends ViewportEvent {
|
||||
private final FogMode mode;
|
||||
public static final class RenderFog extends ViewportEvent implements Cancellable {
|
||||
public static final CancellableEventBus<RenderFog> BUS = CancellableEventBus.create(RenderFog.class);
|
||||
|
||||
private final FogType type;
|
||||
private float farPlaneDistance;
|
||||
private float nearPlaneDistance;
|
||||
private FogShape fogShape;
|
||||
private final FogData data;
|
||||
private final Vector4f color;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@ApiStatus.Internal
|
||||
public RenderFog(FogMode mode, FogType type, Camera camera, float partialTicks, float nearPlaneDistance, float farPlaneDistance, FogShape fogShape) {
|
||||
public RenderFog(FogType type, Camera camera, float partialTicks, FogData data, Vector4f color) {
|
||||
super(Minecraft.getInstance().gameRenderer, camera, partialTicks);
|
||||
this.mode = mode;
|
||||
this.type = type;
|
||||
setFarPlaneDistance(farPlaneDistance);
|
||||
setNearPlaneDistance(nearPlaneDistance);
|
||||
setFogShape(fogShape);
|
||||
this.data = data;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the mode of fog being rendered}
|
||||
*/
|
||||
public FogMode getMode() {
|
||||
return mode;
|
||||
public FogData getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public Vector4f getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,21 +112,14 @@ public abstract sealed class ViewportEvent extends Event {
|
||||
* {@return the distance to the far plane where the fog ends}
|
||||
*/
|
||||
public float getFarPlaneDistance() {
|
||||
return farPlaneDistance;
|
||||
return this.getData().renderDistanceEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the distance to the near plane where the fog starts}
|
||||
*/
|
||||
public float getNearPlaneDistance() {
|
||||
return nearPlaneDistance;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the shape of the fog being rendered}
|
||||
*/
|
||||
public FogShape getFogShape() {
|
||||
return fogShape;
|
||||
return this.getData().renderDistanceStart;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +129,7 @@ public abstract sealed class ViewportEvent extends Event {
|
||||
* @see #scaleFarPlaneDistance(float)
|
||||
*/
|
||||
public void setFarPlaneDistance(float distance) {
|
||||
farPlaneDistance = distance;
|
||||
getData().renderDistanceEnd = distance;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,16 +139,7 @@ public abstract sealed class ViewportEvent extends Event {
|
||||
* @see #scaleNearPlaneDistance(float)
|
||||
*/
|
||||
public void setNearPlaneDistance(float distance) {
|
||||
nearPlaneDistance = distance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the new shape of the fog being rendered. The new shape will only take effect if the event is cancelled.
|
||||
*
|
||||
* @param shape the new shape of the fog
|
||||
*/
|
||||
public void setFogShape(FogShape shape) {
|
||||
fogShape = shape;
|
||||
getData().renderDistanceStart = distance;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +148,7 @@ public abstract sealed class ViewportEvent extends Event {
|
||||
* @param factor the factor to scale the far plane distance by
|
||||
*/
|
||||
public void scaleFarPlaneDistance(float factor) {
|
||||
farPlaneDistance *= factor;
|
||||
getData().renderDistanceEnd *= factor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +157,7 @@ public abstract sealed class ViewportEvent extends Event {
|
||||
* @param factor the factor to scale the near plane distance by
|
||||
*/
|
||||
public void scaleNearPlaneDistance(float factor) {
|
||||
nearPlaneDistance *= factor;
|
||||
getData().renderDistanceStart *= factor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,6 +170,8 @@ public abstract sealed class ViewportEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class ComputeFogColor extends ViewportEvent {
|
||||
public static final EventBus<ComputeFogColor> BUS = EventBus.create(ComputeFogColor.class);
|
||||
|
||||
private float red;
|
||||
private float green;
|
||||
private float blue;
|
||||
@@ -255,6 +244,8 @@ public abstract sealed class ViewportEvent extends Event {
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class ComputeCameraAngles extends ViewportEvent {
|
||||
public static final EventBus<ComputeCameraAngles> BUS = EventBus.create(ComputeCameraAngles.class);
|
||||
|
||||
private float yaw;
|
||||
private float pitch;
|
||||
private float roll;
|
||||
@@ -328,6 +319,8 @@ public abstract sealed class ViewportEvent extends Event {
|
||||
* @see ComputeFovModifierEvent
|
||||
*/
|
||||
public static final class ComputeFov extends ViewportEvent {
|
||||
public static final EventBus<ComputeFov> BUS = EventBus.create(ComputeFov.class);
|
||||
|
||||
private final boolean usedConfiguredFov;
|
||||
private float fov;
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.client.sounds.SoundEngine;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.common.util.HasResult;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Fired when a sound is about to be played by the sound engine. This fires before the sound is played and before any
|
||||
@@ -19,7 +19,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* others). This can be used to change or prevent (by passing {@code null)} a sound from being played through
|
||||
* {@link #setSound(SoundInstance)}).
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
* <p>This event is not {@linkplain Cancellable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
@@ -27,16 +27,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @see PlaySoundSourceEvent
|
||||
* @see PlayStreamingSourceEvent
|
||||
*/
|
||||
public final class PlaySoundEvent extends SoundEvent
|
||||
{
|
||||
public final class PlaySoundEvent extends SoundEvent {
|
||||
public static final EventBus<PlaySoundEvent> BUS = EventBus.create(PlaySoundEvent.class);
|
||||
|
||||
private final String name;
|
||||
private final SoundInstance originalSound;
|
||||
@Nullable
|
||||
private SoundInstance sound;
|
||||
private @Nullable SoundInstance sound;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PlaySoundEvent(SoundEngine manager, SoundInstance sound)
|
||||
{
|
||||
public PlaySoundEvent(SoundEngine manager, SoundInstance sound) {
|
||||
super(manager);
|
||||
this.originalSound = sound;
|
||||
this.name = sound.getLocation().getPath();
|
||||
@@ -46,16 +45,14 @@ public final class PlaySoundEvent extends SoundEvent
|
||||
/**
|
||||
* {@return the name of the original sound} This is equivalent to the path of the location of the original sound.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the original sound that was to be played}
|
||||
*/
|
||||
public SoundInstance getOriginalSound()
|
||||
{
|
||||
public SoundInstance getOriginalSound() {
|
||||
return originalSound;
|
||||
}
|
||||
|
||||
@@ -63,8 +60,7 @@ public final class PlaySoundEvent extends SoundEvent
|
||||
* {@return the sound to be played, or {@code null} if no sound will be played}
|
||||
*/
|
||||
@Nullable
|
||||
public SoundInstance getSound()
|
||||
{
|
||||
public SoundInstance getSound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
@@ -73,8 +69,7 @@ public final class PlaySoundEvent extends SoundEvent
|
||||
*
|
||||
* @param newSound the new sound to be played, or {@code null} for no sound
|
||||
*/
|
||||
public void setSound(@Nullable SoundInstance newSound)
|
||||
{
|
||||
public void setSound(@Nullable SoundInstance newSound) {
|
||||
this.sound = newSound;
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.client.sounds.SoundEngine;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent.SoundSourceEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -26,11 +26,11 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* @see PlayStreamingSourceEvent
|
||||
*/
|
||||
public final class PlaySoundSourceEvent extends SoundSourceEvent
|
||||
{
|
||||
public final class PlaySoundSourceEvent extends SoundSourceEvent {
|
||||
public static final EventBus<PlaySoundSourceEvent> BUS = EventBus.create(PlaySoundSourceEvent.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PlaySoundSourceEvent(SoundEngine engine, SoundInstance sound, Channel channel)
|
||||
{
|
||||
public PlaySoundSourceEvent(SoundEngine engine, SoundInstance sound, Channel channel) {
|
||||
super(engine, sound, channel);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.client.sounds.SoundEngine;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent.SoundSourceEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -26,11 +26,11 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* @see PlayStreamingSourceEvent
|
||||
*/
|
||||
public final class PlayStreamingSourceEvent extends SoundSourceEvent
|
||||
{
|
||||
public final class PlayStreamingSourceEvent extends SoundSourceEvent {
|
||||
public static final EventBus<PlayStreamingSourceEvent> BUS = EventBus.create(PlayStreamingSourceEvent.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PlayStreamingSourceEvent(SoundEngine engine, SoundInstance sound, Channel channel)
|
||||
{
|
||||
public PlayStreamingSourceEvent(SoundEngine engine, SoundInstance sound, Channel channel) {
|
||||
super(engine, sound, channel);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,10 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.sounds.SoundEngine;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.common.util.HasResult;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@@ -16,16 +19,18 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* Fired when the {@link SoundEngine} is constructed or (re)loaded, such as during game initialization or when the sound
|
||||
* output device is changed.
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
* <p>This event is not {@linkplain Cancellable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public final class SoundEngineLoadEvent extends SoundEvent implements IModBusEvent
|
||||
{
|
||||
public final class SoundEngineLoadEvent extends SoundEvent implements IModBusEvent {
|
||||
public static EventBus<SoundEngineLoadEvent> getBus(BusGroup modBusGroup) {
|
||||
return IModBusEvent.getBus(modBusGroup, SoundEngineLoadEvent.class);
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public SoundEngineLoadEvent(SoundEngine manager)
|
||||
{
|
||||
public SoundEngineLoadEvent(SoundEngine manager) {
|
||||
super(manager);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,9 @@ import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.client.sounds.SoundEngine;
|
||||
import com.mojang.blaze3d.audio.Channel;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -23,21 +25,20 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see PlaySoundEvent
|
||||
* @see SoundEngineLoadEvent
|
||||
*/
|
||||
public abstract class SoundEvent extends Event
|
||||
{
|
||||
public abstract class SoundEvent extends MutableEvent implements InheritableEvent {
|
||||
public static final EventBus<SoundEvent> BUS = EventBus.create(SoundEvent.class);
|
||||
|
||||
private final SoundEngine engine;
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected SoundEvent(SoundEngine engine)
|
||||
{
|
||||
protected SoundEvent(SoundEngine engine) {
|
||||
this.engine = engine;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the sound engine}
|
||||
*/
|
||||
public SoundEngine getEngine()
|
||||
{
|
||||
public SoundEngine getEngine() {
|
||||
return engine;
|
||||
}
|
||||
|
||||
@@ -50,15 +51,15 @@ public abstract class SoundEvent extends Event
|
||||
* @see PlaySoundSourceEvent
|
||||
* @see PlayStreamingSourceEvent
|
||||
*/
|
||||
public static abstract class SoundSourceEvent extends SoundEvent
|
||||
{
|
||||
public static abstract class SoundSourceEvent extends SoundEvent {
|
||||
public static final EventBus<SoundSourceEvent> BUS = EventBus.create(SoundSourceEvent.class);
|
||||
|
||||
private final SoundInstance sound;
|
||||
private final Channel channel;
|
||||
private final String name;
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected SoundSourceEvent(SoundEngine engine, SoundInstance sound, Channel channel)
|
||||
{
|
||||
protected SoundSourceEvent(SoundEngine engine, SoundInstance sound, Channel channel) {
|
||||
super(engine);
|
||||
this.name = sound.getLocation().getPath();
|
||||
this.sound = sound;
|
||||
@@ -68,24 +69,21 @@ public abstract class SoundEvent extends Event
|
||||
/**
|
||||
* {@return the sound being played}
|
||||
*/
|
||||
public SoundInstance getSound()
|
||||
{
|
||||
public SoundInstance getSound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the audio channel on which the sound is playing on}
|
||||
*/
|
||||
public Channel getChannel()
|
||||
{
|
||||
public Channel getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the name of the sound being played} This is equivalent to the path of the location of the original sound.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
|
||||
|
||||
public interface IForgeBlockModelPart {
|
||||
/*
|
||||
private BlockModelPart self() {
|
||||
return (BlockModelPart)this;
|
||||
}
|
||||
*/
|
||||
|
||||
default ChunkSectionLayer layer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default ChunkSectionLayer layerFast() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -9,18 +9,19 @@ import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.model.BlockModelPart;
|
||||
import net.minecraft.client.renderer.block.model.BlockStateModel;
|
||||
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -29,7 +30,6 @@ public interface IForgeBlockStateModel {
|
||||
return (BlockStateModel)this;
|
||||
}
|
||||
|
||||
|
||||
default @NotNull ModelData getModelData(@NotNull BlockAndTintGetter level, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull ModelData modelData) {
|
||||
return modelData;
|
||||
}
|
||||
@@ -44,8 +44,7 @@ public interface IForgeBlockStateModel {
|
||||
* <p>
|
||||
* By default, defers query to {@link ItemBlockRenderTypes}.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
default ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
default Collection<ChunkSectionLayer> getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
}
|
||||
|
||||
@@ -54,7 +53,7 @@ public interface IForgeBlockStateModel {
|
||||
* Not all paths call this, or use a valid render type. So it is recommended to also implement a sane default in
|
||||
* the normal {@link BlockStateModel#collectParts(RandomSource, List)} method.
|
||||
*/
|
||||
default List<BlockModelPart> collectParts(RandomSource random, ModelData data, @Nullable RenderType renderType) {
|
||||
default List<BlockModelPart> collectParts(RandomSource random, ModelData data, @Nullable ChunkSectionLayer renderType) {
|
||||
List<BlockModelPart> list = new ObjectArrayList<>();
|
||||
this.collectParts(random, list, data, renderType);
|
||||
return list;
|
||||
@@ -65,7 +64,7 @@ public interface IForgeBlockStateModel {
|
||||
* Not all paths call this, or use a valid render type. So it is recommended to also implement a sane default in
|
||||
* the normal {@link BlockStateModel#collectParts(RandomSource, List)} method.
|
||||
*/
|
||||
default void collectParts(RandomSource random, List<BlockModelPart> dest, ModelData data, @Nullable RenderType renderType) {
|
||||
default void collectParts(RandomSource random, List<BlockModelPart> dest, ModelData data, @Nullable ChunkSectionLayer renderType) {
|
||||
self().collectParts(random, dest);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
/**
|
||||
@@ -80,31 +80,31 @@ public interface IForgeGuiGraphics {
|
||||
|
||||
// Draw Border
|
||||
// Top Left
|
||||
self().blit(RenderType::guiTextured, texture, x, y, 0, u, v, leftBorder, topBorder, 256, 256);
|
||||
self().blit(RenderPipelines.GUI_TEXTURED, texture, x, y, 0, u, v, leftBorder, topBorder, 256, 256);
|
||||
// Top Right
|
||||
self().blit(RenderType::guiTextured, texture, x + leftBorder + canvasWidth, y, 0, u + leftBorder + fillerWidth, v, rightBorder, topBorder, 256, 256);
|
||||
self().blit(RenderPipelines.GUI_TEXTURED, texture, x + leftBorder + canvasWidth, y, 0, u + leftBorder + fillerWidth, v, rightBorder, topBorder, 256, 256);
|
||||
// Bottom Left
|
||||
self().blit(RenderType::guiTextured, texture, x, y + topBorder + canvasHeight, 0, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, 256, 256);
|
||||
self().blit(RenderPipelines.GUI_TEXTURED, texture, x, y + topBorder + canvasHeight, 0, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, 256, 256);
|
||||
// Bottom Right
|
||||
self().blit(RenderType::guiTextured, texture, x + leftBorder + canvasWidth, y + topBorder + canvasHeight, 0, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, 256, 256);
|
||||
self().blit(RenderPipelines.GUI_TEXTURED, texture, x + leftBorder + canvasWidth, y + topBorder + canvasHeight, 0, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, 256, 256);
|
||||
|
||||
for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++) {
|
||||
// Top Border
|
||||
self().blit(RenderType::guiTextured, texture, x + leftBorder + (i * fillerWidth), y, 0, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, 256, 256);
|
||||
self().blit(RenderPipelines.GUI_TEXTURED, texture, x + leftBorder + (i * fillerWidth), y, 0, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, 256, 256);
|
||||
// Bottom Border
|
||||
self().blit(RenderType::guiTextured, texture, x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, 0, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, 256, 256);
|
||||
self().blit(RenderPipelines.GUI_TEXTURED, texture, x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, 0, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, 256, 256);
|
||||
|
||||
// Throw in some filler for good measure
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
|
||||
self().blit(RenderType::guiTextured, texture, x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), 0, u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), 256, 256);
|
||||
self().blit(RenderPipelines.GUI_TEXTURED, texture, x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), 0, u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), 256, 256);
|
||||
}
|
||||
|
||||
// Side Borders
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) {
|
||||
// Left Border
|
||||
self().blit(RenderType::guiTextured, texture, x, y + topBorder + (j * fillerHeight), 0, u, v + topBorder, leftBorder, (j == yPasses ? remainderHeight : fillerHeight), 256, 256);
|
||||
self().blit(RenderPipelines.GUI_TEXTURED, texture, x, y + topBorder + (j * fillerHeight), 0, u, v + topBorder, leftBorder, (j == yPasses ? remainderHeight : fillerHeight), 256, 256);
|
||||
// Right Border
|
||||
self().blit(RenderType::guiTextured, texture, x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), 0, u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), 256, 256);
|
||||
self().blit(RenderPipelines.GUI_TEXTURED, texture, x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), 0, u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), 256, 256);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public interface IForgeGuiGraphics {
|
||||
if (centerX) x += (w - boundsWidth) / 2;
|
||||
}
|
||||
|
||||
//self().blit(RenderType::guiTextured, texture, x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight);
|
||||
self().blit(RenderType::guiTextured, texture, x, y, 0.0f, 0.0f, boundsWidth, boundsHeight, boundsWidth, boundsHeight);
|
||||
//self().blit(RenderPipelines.GUI_TEXTURED, texture, x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight);
|
||||
self().blit(RenderPipelines.GUI_TEXTURED, texture, x, y, 0.0f, 0.0f, boundsWidth, boundsHeight, boundsWidth, boundsHeight);
|
||||
}
|
||||
}
|
||||
+4
-9
@@ -10,22 +10,23 @@ import java.util.function.Consumer;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.renderer.FogParameters;
|
||||
import net.minecraft.client.renderer.FogRenderer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.ScreenEffectRenderer;
|
||||
import net.minecraft.client.renderer.fog.FogData;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.material.FogType;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
/**
|
||||
* {@linkplain LogicalSide#CLIENT Client-only} extensions to {@link FluidType}.
|
||||
@@ -163,14 +164,8 @@ public interface IClientFluidTypeExtensions {
|
||||
/**
|
||||
* Modifies how the fog is currently being rendered when the camera is
|
||||
* within a fluid.
|
||||
*
|
||||
* @param camera the camera instance
|
||||
* @param mode the type of fog being rendered
|
||||
* @param renderDistance the render distance of the client
|
||||
* @param partialTick the delta time of where the current frame is within a tick
|
||||
*/
|
||||
default FogParameters modifyFogRender(Camera camera, FogRenderer.FogMode mode, float renderDistance, float partialTick, FogParameters original) {
|
||||
return original;
|
||||
default void modifyFogRender(Camera camera, FogType type, float partialTick, FogData data, Vector4f color) {
|
||||
}
|
||||
|
||||
/* Level-Based Accessors */
|
||||
|
||||
@@ -78,8 +78,8 @@ public class LoadingErrorScreen extends ErrorScreen {
|
||||
|
||||
private void drawMultiLineCenteredString(GuiGraphics guiGraphics, Font fr, Component str, int x, int y) {
|
||||
for (FormattedCharSequence s : fr.split(str, this.width)) {
|
||||
guiGraphics.drawString(fr, s, (float) (x - fr.width(s) / 2.0), (float) y, 0xFFFFFF, true);
|
||||
y+=fr.lineHeight;
|
||||
guiGraphics.drawString(fr, s, x - fr.width(s) / 2, y, 0xFFFFFF);
|
||||
y += fr.lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class LoadingErrorScreen extends ErrorScreen {
|
||||
int y = top + 2;
|
||||
for (var string : strings) {
|
||||
if (center)
|
||||
guiGraphics.drawString(font, string, left + (width / 2F) - (font.width(string) / 2F), y, 0xFFFFFF, false);
|
||||
guiGraphics.drawString(font, string, left + (width / 2) - (font.width(string) / 2), y, 0xFFFFFF, false);
|
||||
else
|
||||
guiGraphics.drawString(font, string, left + 5, y, 0xFFFFFF, false);
|
||||
y += font.lineHeight;
|
||||
|
||||
@@ -24,8 +24,6 @@ import net.minecraftforge.client.gui.widget.ScrollPanel;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
||||
import org.apache.maven.artifact.versioning.ComparableVersion;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -38,6 +36,7 @@ import net.minecraft.client.gui.components.StringWidget;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ARGB;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.Util;
|
||||
@@ -164,7 +163,7 @@ public class ModListScreen extends Screen {
|
||||
@Override
|
||||
protected void drawPanel(GuiGraphics guiGraphics, int entryRight, int relativeY, int mouseX, int mouseY) {
|
||||
if (logoPath != null) {
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
//RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// Draw the logo image inscribed in a rectangle with width entryWidth (minus some padding) and height 50
|
||||
int headerHeight = 50;
|
||||
guiGraphics.blitInscribed(logoPath, left + PADDING, relativeY, width - (PADDING * 2), headerHeight, logoDims.width(), logoDims.height(), false, true);
|
||||
@@ -173,7 +172,7 @@ public class ModListScreen extends Screen {
|
||||
|
||||
for (FormattedCharSequence line : lines) {
|
||||
if (line != null)
|
||||
guiGraphics.drawString(ModListScreen.this.font, line, left + PADDING, relativeY, 0xFFFFFF);
|
||||
guiGraphics.drawString(ModListScreen.this.font, line, left + PADDING, relativeY, ARGB.white(1));
|
||||
relativeY += font.lineHeight;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ package net.minecraftforge.client.gui;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -49,7 +49,7 @@ public class TitleScreenModUpdateIndicator extends Screen {
|
||||
int w = modButton.getWidth();
|
||||
int h = modButton.getHeight();
|
||||
|
||||
guiGraphics.blit(RenderType::guiTextured, VERSION_CHECK_ICONS, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16);
|
||||
guiGraphics.blit(RenderPipelines.GUI_TEXTURED, VERSION_CHECK_ICONS, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16);
|
||||
}
|
||||
|
||||
public static TitleScreenModUpdateIndicator init(TitleScreen guiMainMenu, Button modButton) {
|
||||
|
||||
@@ -8,7 +8,7 @@ package net.minecraftforge.client.gui.widget;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.locale.Language;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.FormattedText;
|
||||
@@ -40,7 +40,7 @@ public class ExtendedButton extends Button {
|
||||
@Override
|
||||
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
guiGraphics.blitSprite(RenderType::guiTextured, SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
guiGraphics.blitSprite(RenderPipelines.GUI_TEXTURED, SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
|
||||
final FormattedText buttonText = mc.font.ellipsize(this.getMessage(), this.width - 6); // Remove 6 pixels so that the text is always contained within the button's borders
|
||||
guiGraphics.drawCenteredString(mc.font, Language.getInstance().getVisualOrder(buttonText), this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, getFGColor());
|
||||
|
||||
@@ -8,7 +8,7 @@ package net.minecraftforge.client.gui.widget;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.AbstractSliderButton;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
@@ -197,8 +197,8 @@ public class ForgeSlider extends AbstractSliderButton {
|
||||
@Override
|
||||
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
|
||||
final Minecraft mc = Minecraft.getInstance();
|
||||
guiGraphics.blitSprite(RenderType::guiTextured, this.getSprite(), this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
guiGraphics.blitSprite(RenderType::guiTextured, this.getHandleSprite(), this.getX() + (int)(this.value * (double)(this.width - 8)), this.getY(), 8, this.getHeight());
|
||||
guiGraphics.blitSprite(RenderPipelines.GUI_TEXTURED, this.getSprite(), this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
guiGraphics.blitSprite(RenderPipelines.GUI_TEXTURED, this.getHandleSprite(), this.getX() + (int)(this.value * (double)(this.width - 8)), this.getY(), 8, this.getHeight());
|
||||
|
||||
renderScrollingString(guiGraphics, mc.font, 2, getFGColor() | Mth.ceil(this.alpha * 255.0F) << 24);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ package net.minecraftforge.client.gui.widget;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.ObjectSelectionList;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.FormattedText;
|
||||
@@ -19,8 +19,6 @@ import net.minecraftforge.common.util.MavenVersionStringHelper;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
public class ModListWidget extends ObjectSelectionList<ModListWidget.ModEntry> {
|
||||
private static String stripControlCodes(String value) { return net.minecraft.util.StringUtil.stripColor(value); }
|
||||
private static final ResourceLocation VERSION_CHECK_ICONS = ResourceLocation.fromNamespaceAndPath(ForgeVersion.MOD_ID, "textures/gui/version_check_icons.png");
|
||||
@@ -80,14 +78,13 @@ public class ModListWidget extends ObjectSelectionList<ModListWidget.ModEntry> {
|
||||
VersionChecker.CheckResult vercheck = VersionChecker.getResult(modInfo);
|
||||
Font font = this.parent.getFontRenderer();
|
||||
var barOffset = ModListWidget.this.scrollbarVisible() ? 6 : 0;
|
||||
guiGraphics.drawString(font, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(name, listWidth - 6 - barOffset))), left + 3, top + 2, 0xFFFFFF, false);
|
||||
guiGraphics.drawString(font, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(version, listWidth - 6 - barOffset))), left + 3, top + 2 + font.lineHeight, 0xCCCCCC, false);
|
||||
guiGraphics.drawString(font, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(name, listWidth - 6 - barOffset))), left + 3, top + 2, 0xFFFFFFFF, false);
|
||||
guiGraphics.drawString(font, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(version, listWidth - 6 - barOffset))), left + 3, top + 2 + font.lineHeight, 0xFFCCCCCC, false);
|
||||
if (vercheck.status().shouldDraw()) {
|
||||
//TODO: [Forge][ModList] Consider adding more icons for visualization
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
guiGraphics.pose().pushPose();
|
||||
guiGraphics.blit(RenderType::guiTextured, VERSION_CHECK_ICONS, getX() + width - 12 - barOffset, top + entryHeight / 4, vercheck.status().getSheetOffset() * 8, (vercheck.status().isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
|
||||
guiGraphics.pose().popPose();
|
||||
guiGraphics.pose().pushMatrix();
|
||||
guiGraphics.blit(RenderPipelines.GUI_TEXTURED, VERSION_CHECK_ICONS, getX() + width - 12 - barOffset, top + entryHeight / 4, vercheck.status().getSheetOffset() * 8, (vercheck.status().isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
|
||||
guiGraphics.pose().popMatrix();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.components.events.AbstractContainerEventHandler;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -264,24 +262,29 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen
|
||||
if (barTop < this.top)
|
||||
barTop = this.top;
|
||||
|
||||
guiGraphics.fill(barLeft, this.top, barLeft + barWidth, this.bottom, barBgColor);
|
||||
guiGraphics.fill(barLeft, barTop, barLeft + barWidth, barTop + barHeight, barColor);
|
||||
guiGraphics.fill(barLeft, barTop + barHeight - 1, barLeft + barWidth - 1, barTop, barBorderColor);
|
||||
/*
|
||||
var source = guiGraphics.getBufferSource();
|
||||
var buf = source.getBuffer(RenderType.gui());
|
||||
var buf = source.getBuffer(RenderPipelines.GUI);
|
||||
buf.addVertex(barLeft, this.bottom, 0.0F).setColor(barBgColor);
|
||||
buf.addVertex(barLeft + barWidth, this.bottom, 0.0F).setColor(barBgColor);
|
||||
buf.addVertex(barLeft + barWidth, this.top, 0.0F).setColor(barBgColor);
|
||||
buf.addVertex(barLeft, this.top, 0.0F).setColor(barBgColor);
|
||||
|
||||
buf = source.getBuffer(RenderType.gui());
|
||||
buf = source.getBuffer(RenderPipelines.GUI);
|
||||
buf.addVertex(barLeft, barTop + barHeight, 0.0F).setColor(barColor);
|
||||
buf.addVertex(barLeft + barWidth, barTop + barHeight, 0.0F).setColor(barColor);
|
||||
buf.addVertex(barLeft + barWidth, barTop, 0.0F).setColor(barColor);
|
||||
buf.addVertex(barLeft, barTop, 0.0F).setColor(barColor);
|
||||
|
||||
buf = source.getBuffer(RenderType.gui());
|
||||
buf = source.getBuffer(RenderPipelines.GUI);
|
||||
buf.addVertex(barLeft, barTop + barHeight - 1, 0.0F).setColor(barBorderColor);
|
||||
buf.addVertex(barLeft + barWidth - 1, barTop + barHeight - 1, 0.0F).setColor(barBorderColor);
|
||||
buf.addVertex(barLeft + barWidth - 1, barTop, 0.0F).setColor(barBorderColor);
|
||||
buf.addVertex(barLeft, barTop, 0.0F).setColor(barBorderColor);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.world.level.DataPackConfig;
|
||||
import net.minecraftforge.event.AddPackFindersEvent;
|
||||
import net.minecraftforge.eventbus.api.bus.BusGroup;
|
||||
import net.minecraftforge.fml.*;
|
||||
import net.minecraftforge.fml.loading.ImmediateWindowHandler;
|
||||
import net.minecraftforge.internal.BrandingControl;
|
||||
@@ -106,16 +107,14 @@ public class ClientModLoader {
|
||||
}
|
||||
|
||||
File dumpedLocation = null;
|
||||
if (error == null) {
|
||||
// We can finally start the forge eventbus up
|
||||
MinecraftForge.EVENT_BUS.start();
|
||||
} else {
|
||||
if (error != null) {
|
||||
// Double check we have the langs loaded for forge
|
||||
LanguageHook.loadForgeAndMCLangs();
|
||||
dumpedLocation = CrashReportExtender.dumpModLoadingCrashReport(LOGGER, error, mc.gameDirectory);
|
||||
}
|
||||
|
||||
if (error != null || !warnings.isEmpty()) {
|
||||
BusGroup.DEFAULT.shutdown();
|
||||
mc.setScreen(new LoadingErrorScreen(error, warnings, dumpedLocation));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.LoadingOverlay;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.server.packs.resources.ReloadInstance;
|
||||
import net.minecraft.util.ARGB;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraftforge.client.ForgeRenderTypes;
|
||||
import net.minecraftforge.fml.StartupMessageManager;
|
||||
@@ -33,7 +34,7 @@ import java.util.function.Supplier;
|
||||
* It is somewhat a copy of the superclass render method.
|
||||
*/
|
||||
public class ForgeLoadingOverlay extends LoadingOverlay {
|
||||
private static final boolean ENABLE = Boolean.parseBoolean("forge.enableForgeLoadingOverlay");
|
||||
private static final boolean ENABLE = false; //Boolean.parseBoolean("forge.enableForgeLoadingOverlay");
|
||||
private final Minecraft minecraft;
|
||||
private final ReloadInstance reload;
|
||||
private final DisplayWindow displayWindow;
|
||||
@@ -60,6 +61,10 @@ public class ForgeLoadingOverlay extends LoadingOverlay {
|
||||
protected boolean renderContents(GuiGraphics gui, float fade) {
|
||||
if (!ENABLE)
|
||||
return true;
|
||||
/* This should render the framebuffer but it doesnt work in 1.21.6's rendering changes.
|
||||
* The proper way to fix this is to just kill off the display window when Vanilla gets to this phase, and render our extra elements normally.
|
||||
* TODO: [Forge][Rendering] Render only out elements from the loading screen
|
||||
*
|
||||
progress.setAbsolute(Mth.clamp((int)(this.reload.getActualProgress() * 100f), 0, 100));
|
||||
|
||||
int alpha = (int)(fade * 255);
|
||||
@@ -72,39 +77,12 @@ public class ForgeLoadingOverlay extends LoadingOverlay {
|
||||
var fbHeight = this.minecraft.getWindow().getHeight();
|
||||
GL30C.glViewport(0, 0, fbWidth, fbHeight);
|
||||
|
||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, fade);
|
||||
Matrix4f pos = gui.pose().last().pose();
|
||||
/*
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GlConst.GL_SRC_ALPHA, GlConst.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.setShader(CoreShaders.POSITION_TEX_COLOR);
|
||||
RenderSystem.setShaderTexture(0, displayWindow.getFramebufferTextureId());
|
||||
GL30C.glTexParameterIi(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MIN_FILTER, GlConst.GL_NEAREST);
|
||||
GL30C.glTexParameterIi(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MAG_FILTER, GlConst.GL_NEAREST);
|
||||
*/
|
||||
|
||||
var buf = gui.getBufferSource().getBuffer(earlyBuffer);
|
||||
buf.addVertex(pos, 0, 0, 0f).setUv(0, 0).setColor(1f, 1f, 1f, fade);
|
||||
buf.addVertex(pos, 0, height, 0f).setUv(0, 1).setColor(1f, 1f, 1f, fade);
|
||||
buf.addVertex(pos, width, height, 0f).setUv(1, 1).setColor(1f, 1f, 1f, fade);
|
||||
buf.addVertex(pos, width, 0, 0f).setUv(1, 0).setColor(1f, 1f, 1f, fade);
|
||||
/*
|
||||
BufferUploader.drawWithShader(buf.buildOrThrow());
|
||||
|
||||
// I dont know what exactly this does, but without it the screen flickers black.
|
||||
// So as a hack we just render the mojang logo as a 0x0 cube
|
||||
// TODO: Remove this when early screen is re-written to not be a texture based renderer
|
||||
var logo = gui.getBufferSource().getBuffer(RenderType.mojangLogo());
|
||||
logo.addVertex(pos, 0, 0, 0f).setUv(0, 0).setColor(1f, 1f, 1f, fade);
|
||||
logo.addVertex(pos, 0, 0, 0f).setUv(0, 1).setColor(1f, 1f, 1f, fade);
|
||||
logo.addVertex(pos, 0, 0, 0f).setUv(1, 1).setColor(1f, 1f, 1f, fade);
|
||||
logo.addVertex(pos, 0, 0, 0f).setUv(1, 0).setColor(1f, 1f, 1f, fade);
|
||||
|
||||
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.disableBlend();
|
||||
*/
|
||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ package net.minecraftforge.client.model;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.math.Transformation;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.model.TextureSlots;
|
||||
import net.minecraft.client.renderer.chunk.ChunkSectionLayer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.model.Material;
|
||||
@@ -61,7 +61,7 @@ public class DynamicFluidContainerModel implements UnbakedGeometry {
|
||||
}
|
||||
|
||||
public static RenderTypeGroup getLayerRenderTypes(boolean unlit) {
|
||||
return new RenderTypeGroup(RenderType.translucent(), unlit ? ForgeRenderTypes.ITEM_UNSORTED_UNLIT_TRANSLUCENT.get() : ForgeRenderTypes.ITEM_UNSORTED_TRANSLUCENT.get());
|
||||
return new RenderTypeGroup(ChunkSectionLayer.TRANSLUCENT, unlit ? ForgeRenderTypes.ITEM_UNSORTED_UNLIT_TRANSLUCENT.get() : ForgeRenderTypes.ITEM_UNSORTED_TRANSLUCENT.get());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.event.level.ChunkEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@@ -8,7 +8,6 @@ package net.minecraftforge.client.model.obj;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.TextureSlots;
|
||||
import net.minecraft.client.resources.model.ModelBaker;
|
||||
@@ -21,12 +20,10 @@ import net.minecraft.server.packs.resources.Resource;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.server.packs.resources.ResourceManagerReloadListener;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraftforge.client.model.IModelBuilder;
|
||||
import net.minecraftforge.client.model.geometry.IGeometryBakingContext;
|
||||
import net.minecraftforge.client.model.geometry.IGeometryLoader;
|
||||
import net.minecraftforge.client.model.geometry.StandaloneGeometryBakingContext;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user