Package net.minecraftforge.client
Class ForgeHooksClient
java.lang.Object
net.minecraftforge.client.ForgeHooksClient
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.apache.logging.log4j.Marker
static String
Contains the *extra* GUI layers.private static final ResourceLocation
private static boolean
private static final Map
<ModelLayerLocation, Supplier<LayerDefinition>> private static final org.apache.logging.log4j.Logger
private static int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
calculateFaceWithoutAO
(BlockAndTintGetter getter, BlockState state, BlockPos pos, BakedQuad quad, boolean isFaceCubic, float[] brightness, int[] lightmap) static void
clearGuiLayers
(Minecraft minecraft) static <T extends LivingEntity>
voidcopyModelProperties
(HumanoidModel<T> original, HumanoidModel<?> replacement) Copies humanoid model properties from the original model to another, used for armor modelsstatic void
createWorldConfirmationScreen
(Runnable doConfirmedWorldLoad) static void
dispatchRenderStage
(RenderType renderType, LevelRenderer levelRenderer, org.joml.Matrix4f poseStack, org.joml.Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) static void
drawForgePingInfo
(JoinMultiplayerScreen gui, ServerData target, GuiGraphics guiGraphics, int x, int y, int width, int relativeMouseX, int relativeMouseY) static void
drawScreen
(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) private static void
drawScreenInternal
(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) static void
fillNormal
(int[] faceData, Direction facing) static void
fillNormal
(int[] faceData, Direction facing, boolean calculateNormals) internal, relies on fixed format of FaceBakerystatic String
static List
<ClientTooltipComponent> gatherTooltipComponents
(ItemStack stack, List<? extends FormattedText> textElements, int mouseX, int screenWidth, int screenHeight, Font fallbackFont) static List
<ClientTooltipComponent> gatherTooltipComponents
(ItemStack stack, List<? extends FormattedText> textElements, Optional<TooltipComponent> itemComponent, int mouseX, int screenWidth, int screenHeight, Font fallbackFont) static Model
getArmorModel
(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot slot, HumanoidModel<?> _default) static ResourceLocation
getArmorTexture
(Entity entity, ItemStack armor, EquipmentSlot slot, ArmorMaterial.Layer layer, boolean inner) static Material
private static Connection
static @NotNull RenderType
getEntityRenderType
(RenderType chunkRenderType, boolean cull) Mimics the behavior ofItemBlockRenderTypes.getRenderType(BlockState, boolean)
for the inputRenderType
.static float
getFieldOfViewModifier
(Player entity, float fovModifier) static TextureAtlasSprite[]
getFluidSprites
(BlockAndTintGetter level, BlockPos pos, FluidState fluidStateIn) static org.joml.Vector3f
getFogColor
(Camera camera, float partialTick, ClientLevel level, int renderDistance, float darkenWorldAmount, float fogRed, float fogGreen, float fogBlue) static float
static int
getMaxMipmapLevel
(int width, int height) static Direction
getNearestStable
(float nX, float nY, float nZ) This function is a clone ofDirection.getNearest(float, float, float)
designed to return a consistent direction when the normal is at an inflection point (ie 45 degrees) rounding errors from associated matrix multiplication (such as duringinvalid reference
SheetedDecalTextureGenerator#endVertex()
static ResourceLocation
getShaderImportLocation
(String basePath, boolean isRelative, String importPath) static Font
getTooltipFont
(@NotNull ItemStack stack, Font fallbackFont) private static org.joml.Vector3f
getVertexPos
(int[] data, int vertex) static void
static void
initClientHooks
(Minecraft mc, ReloadableResourceManager resourceManager) static boolean
isBlockInSolidLayer
(BlockState state) static boolean
isNameplateInRenderDistance
(Entity entity, double squareDistance) static void
loadEntityShader
(Entity entity, GameRenderer entityRenderer) static void
loadLayerDefinitions
(com.google.common.collect.ImmutableMap.Builder<ModelLayerLocation, LayerDefinition> builder) static @Nullable SpriteContents
loadSpriteContents
(ResourceLocation name, Resource resource, FrameSize frameSize, NativeImage image, ResourceMetadata animationMeta) static @Nullable TextureAtlasSprite
loadTextureAtlasSprite
(ResourceLocation atlasName, SpriteContents contents, int atlasWidth, int atlasHeight, int spriteX, int spriteY, int mipmapLevel) static Comparator
<ParticleRenderType> makeParticleRenderTypeComparator
(List<ParticleRenderType> renderOrder) static void
onBlockColorsInit
(BlockColors blockColors) static void
onClientChangeGameType
(PlayerInfo info, GameType currentGameMode, GameType newGameMode) static @Nullable Component
onClientChat
(ChatType.Bound boundChatType, Component message, UUID sender) static boolean
onClientDisconnect
(Connection connection, Minecraft mc, Screen parent, Component message) static void
onClientPauseChangePost
(boolean pause) static boolean
onClientPauseChangePre
(boolean pause) static @Nullable Component
onClientPlayerChat
(ChatType.Bound boundChatType, Component message, PlayerChatMessage playerChatMessage, UUID sender) static @NotNull String
onClientSendMessage
(String message) static @Nullable Component
onClientSystemChat
(Component message, boolean overlay, RegistryAccess registry) onCustomizeBossEventProgress
(GuiGraphics guiGraphics, Window window, LerpingBossEvent bossInfo, int x, int y, int increment) static void
onCustomizeChatEvent
(GuiGraphics guiGraphics, ChatComponent chat, Window window, int mouseX, int mouseY, int tickCount) static void
onCustomizeDebugEvent
(GuiGraphics guiGraphics, Window window, float partialTick, List<String> text, boolean isLeft) static boolean
onDrawHighlight
(LevelRenderer context, Camera camera, HitResult target, float partialTick, org.joml.Matrix4f ctxPos, MultiBufferSource bufferSource) static void
onFogRender
(FogRenderer.FogMode mode, FogType type, Camera camera, float partialTick, float renderDistance, float nearDistance, float farDistance, FogShape shape) static void
onItemColorsInit
(ItemColors itemColors, BlockColors blockColors) static void
onKeyInput
(int key, int scanCode, int action, int modifiers) static void
onModelBake
(ModelManager modelManager, Map<ModelResourceLocation, BakedModel> models, ModelBakery modelBakery) static void
onModifyBakingResult
(Map<ModelResourceLocation, BakedModel> models, ModelBakery modelBakery) static void
onMovementInputUpdate
(Player player, Input movementInput) static void
static void
onRegisterAdditionalModels
(Set<ModelResourceLocation> additionalModels) static void
onRegisterKeyMappings
(Options options) static void
onRegisterParticleProviders
(ParticleEngine particleEngine) static RenderTooltipEvent.Color
onRenderTooltipColor
(@NotNull ItemStack stack, GuiGraphics graphics, int x, int y, @NotNull Font font, @NotNull List<ClientTooltipComponent> components) 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) static boolean
onScreenCharTyped
(Screen screen, char codePoint, int modifiers) static void
onScreenKeyPressed
(boolean[] state, Screen screen, int keyCode, int scanCode, int modifiers) static void
onScreenKeyReleased
(boolean[] state, Screen screen, int keyCode, int scanCode, int modifiers) static void
onScreenMouseDrag
(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) onScreenPotionSize
(Screen screen, int availableSpace, boolean compact, int horizontalOffset) static void
static boolean
onToastAdd
(Toast toast) static @Nullable SoundInstance
playSound
(SoundEngine manager, SoundInstance sound) static void
popGuiLayer
(Minecraft minecraft) private static void
popGuiLayerInternal
(Minecraft minecraft) static void
processForgeListPingData
(ServerStatus packet, ServerData target) static void
pushGuiLayer
(Minecraft minecraft, Screen screen) static void
registerLayerDefinition
(ModelLayerLocation layerLocation, Supplier<LayerDefinition> supplier) static boolean
renderBlockOverlay
(Player player, PoseStack mat, RenderBlockScreenEffectEvent.OverlayType type, BlockState block, BlockPos pos) static boolean
renderFireOverlay
(Player player, PoseStack mat) static void
renderMainMenu
(TitleScreen gui, GuiGraphics graphics, Font font, int width, int height, int alpha) static boolean
renderSpecificFirstPersonHand
(InteractionHand hand, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, float partialTick, float interpPitch, float swingProgress, float equipProgress, ItemStack stack) static boolean
renderWaterOverlay
(Player player, PoseStack mat) static void
resizeGuiLayers
(Minecraft minecraft, int width, int height) static boolean
shouldCauseReequipAnimation
(@NotNull ItemStack from, @NotNull ItemStack to, int slot) static boolean
shouldRenderEffect
(MobEffectInstance effectInstance) private static Stream
<ClientTooltipComponent> splitLine
(FormattedText text, Font font, int maxWidth)
-
Field Details
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
CLIENTHOOKS
private static final org.apache.logging.log4j.Marker CLIENTHOOKS -
guiLayers
Contains the *extra* GUI layers. The current top layer stays in Minecraft#currentScreen, and the rest serve as a background for it. -
forgeStatusLine
-
slotMainHand
private static int slotMainHand -
layerDefinitions
-
ICON_SHEET
-
initializedClientHooks
private static boolean initializedClientHooks
-
-
Constructor Details
-
ForgeHooksClient
public ForgeHooksClient()
-
-
Method Details
-
resizeGuiLayers
-
clearGuiLayers
-
popGuiLayerInternal
-
pushGuiLayer
-
popGuiLayer
-
getGuiFarPlane
public static float getGuiFarPlane() -
onClientPauseChangePre
public static boolean onClientPauseChangePre(boolean pause) -
onClientPauseChangePost
public static void onClientPauseChangePost(boolean pause) -
getArmorTexture
public static ResourceLocation getArmorTexture(Entity entity, ItemStack armor, EquipmentSlot slot, ArmorMaterial.Layer layer, boolean inner) -
onDrawHighlight
public static boolean onDrawHighlight(LevelRenderer context, Camera camera, HitResult target, float partialTick, org.joml.Matrix4f ctxPos, MultiBufferSource bufferSource) -
dispatchRenderStage
public static void dispatchRenderStage(RenderType renderType, LevelRenderer levelRenderer, org.joml.Matrix4f poseStack, org.joml.Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) -
renderSpecificFirstPersonHand
public static boolean renderSpecificFirstPersonHand(InteractionHand hand, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, float partialTick, float interpPitch, float swingProgress, float equipProgress, ItemStack stack) -
onTextureStitchedPost
-
onBlockColorsInit
-
onItemColorsInit
-
getArmorModel
public static Model getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot slot, HumanoidModel<?> _default) -
copyModelProperties
public static <T extends LivingEntity> void copyModelProperties(HumanoidModel<T> original, HumanoidModel<?> replacement) Copies humanoid model properties from the original model to another, used for armor models -
fixDomain
-
getFieldOfViewModifier
-
renderMainMenu
public static void renderMainMenu(TitleScreen gui, GuiGraphics graphics, Font font, int width, int height, int alpha) -
playSound
-
drawScreen
public static void drawScreen(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) -
drawScreenInternal
private static void drawScreenInternal(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) -
getFogColor
public static org.joml.Vector3f getFogColor(Camera camera, float partialTick, ClientLevel level, int renderDistance, float darkenWorldAmount, float fogRed, float fogGreen, float fogBlue) -
onFogRender
public static void onFogRender(FogRenderer.FogMode mode, FogType type, Camera camera, float partialTick, float renderDistance, float nearDistance, float farDistance, FogShape shape) -
onModifyBakingResult
public static void onModifyBakingResult(Map<ModelResourceLocation, BakedModel> models, ModelBakery modelBakery) -
onModelBake
public static void onModelBake(ModelManager modelManager, Map<ModelResourceLocation, BakedModel> models, ModelBakery modelBakery) -
getFluidSprites
public static TextureAtlasSprite[] getFluidSprites(BlockAndTintGetter level, BlockPos pos, FluidState fluidStateIn) -
getBlockMaterial
-
fillNormal
-
fillNormal
internal, relies on fixed format of FaceBakery -
getVertexPos
private static org.joml.Vector3f getVertexPos(int[] data, int vertex) -
calculateFaceWithoutAO
public static boolean calculateFaceWithoutAO(BlockAndTintGetter getter, BlockState state, BlockPos pos, BakedQuad quad, boolean isFaceCubic, float[] brightness, int[] lightmap) -
loadEntityShader
-
shouldCauseReequipAnimation
-
onCustomizeBossEventProgress
public static CustomizeGuiOverlayEvent.BossEventProgress onCustomizeBossEventProgress(GuiGraphics guiGraphics, Window window, LerpingBossEvent bossInfo, int x, int y, int increment) -
onCustomizeChatEvent
public static void onCustomizeChatEvent(GuiGraphics guiGraphics, ChatComponent chat, Window window, int mouseX, int mouseY, int tickCount) -
onCustomizeDebugEvent
public static void onCustomizeDebugEvent(GuiGraphics guiGraphics, Window window, float partialTick, List<String> text, boolean isLeft) -
onClientChangeGameType
public static void onClientChangeGameType(PlayerInfo info, GameType currentGameMode, GameType newGameMode) -
onMovementInputUpdate
-
onScreenKeyPressed
public static void onScreenKeyPressed(boolean[] state, Screen screen, int keyCode, int scanCode, int modifiers) -
onScreenKeyReleased
public static void onScreenKeyReleased(boolean[] state, Screen screen, int keyCode, int scanCode, int modifiers) -
onScreenCharTyped
-
onRecipesUpdated
-
onKeyInput
public static void onKeyInput(int key, int scanCode, int action, int modifiers) -
isNameplateInRenderDistance
-
shouldRenderEffect
-
loadSpriteContents
@Nullable public static @Nullable SpriteContents loadSpriteContents(ResourceLocation name, Resource resource, FrameSize frameSize, NativeImage image, ResourceMetadata animationMeta) -
loadTextureAtlasSprite
@Nullable public static @Nullable TextureAtlasSprite loadTextureAtlasSprite(ResourceLocation atlasName, SpriteContents contents, int atlasWidth, int atlasHeight, int spriteX, int spriteY, int mipmapLevel) -
registerLayerDefinition
public static void registerLayerDefinition(ModelLayerLocation layerLocation, Supplier<LayerDefinition> supplier) -
loadLayerDefinitions
public static void loadLayerDefinitions(com.google.common.collect.ImmutableMap.Builder<ModelLayerLocation, LayerDefinition> builder) -
processForgeListPingData
-
drawForgePingInfo
public static void drawForgePingInfo(JoinMultiplayerScreen gui, ServerData target, GuiGraphics guiGraphics, int x, int y, int width, int relativeMouseX, int relativeMouseY) -
getClientConnection
-
handleClientLevelClosing
-
onRegisterParticleProviders
-
onRegisterKeyMappings
-
onRegisterAdditionalModels
-
onClientChat
@Nullable public static @Nullable Component onClientChat(ChatType.Bound boundChatType, Component message, UUID sender) -
onClientPlayerChat
@Nullable public static @Nullable Component onClientPlayerChat(ChatType.Bound boundChatType, Component message, PlayerChatMessage playerChatMessage, UUID sender) -
onClientSystemChat
@Nullable public static @Nullable Component onClientSystemChat(Component message, boolean overlay, RegistryAccess registry) -
onClientSendMessage
-
getEntityRenderType
@NotNull public static @NotNull RenderType getEntityRenderType(RenderType chunkRenderType, boolean cull) Mimics the behavior ofItemBlockRenderTypes.getRenderType(BlockState, boolean)
for the inputRenderType
. -
getTooltipFont
-
onRenderTooltipPre
public static RenderTooltipEvent.Pre onRenderTooltipPre(@NotNull @NotNull ItemStack stack, GuiGraphics graphics, int x, int y, int screenWidth, int screenHeight, @NotNull @NotNull List<ClientTooltipComponent> components, @NotNull @NotNull Font fallbackFont, @NotNull @NotNull ClientTooltipPositioner positioner) -
onRenderTooltipColor
public static RenderTooltipEvent.Color onRenderTooltipColor(@NotNull @NotNull ItemStack stack, GuiGraphics graphics, int x, int y, @NotNull @NotNull Font font, @NotNull @NotNull List<ClientTooltipComponent> components) -
gatherTooltipComponents
public static List<ClientTooltipComponent> gatherTooltipComponents(ItemStack stack, List<? extends FormattedText> textElements, int mouseX, int screenWidth, int screenHeight, Font fallbackFont) -
gatherTooltipComponents
public static List<ClientTooltipComponent> gatherTooltipComponents(ItemStack stack, List<? extends FormattedText> textElements, Optional<TooltipComponent> itemComponent, int mouseX, int screenWidth, int screenHeight, Font fallbackFont) -
splitLine
private static Stream<ClientTooltipComponent> splitLine(FormattedText text, Font font, int maxWidth) -
makeParticleRenderTypeComparator
public static Comparator<ParticleRenderType> makeParticleRenderTypeComparator(List<ParticleRenderType> renderOrder) -
onScreenPotionSize
public static ScreenEvent.RenderInventoryMobEffects onScreenPotionSize(Screen screen, int availableSpace, boolean compact, int horizontalOffset) -
onToastAdd
-
isBlockInSolidLayer
-
createWorldConfirmationScreen
-
renderFireOverlay
-
renderWaterOverlay
-
renderBlockOverlay
public static boolean renderBlockOverlay(Player player, PoseStack mat, RenderBlockScreenEffectEvent.OverlayType type, BlockState block, BlockPos pos) -
getMaxMipmapLevel
public static int getMaxMipmapLevel(int width, int height) -
getShaderImportLocation
public static ResourceLocation getShaderImportLocation(String basePath, boolean isRelative, String importPath) -
getNearestStable
This function is a clone ofDirection.getNearest(float, float, float)
designed to return a consistent direction when the normal is at an inflection point (ie 45 degrees) rounding errors from associated matrix multiplication (such as duringinvalid reference
SheetedDecalTextureGenerator#endVertex()
- Parameters:
nX
- X component of the normalnY
- Y component of the normalnZ
- Z component of the normal- Returns:
- the nearest Direction to the passed in normal, biased slightly in favor of the order of declaration
-
initClientHooks
@Internal public static void initClientHooks(Minecraft mc, ReloadableResourceManager resourceManager) -
onClientDisconnect
public static boolean onClientDisconnect(Connection connection, Minecraft mc, Screen parent, Component message) -
onScreenMouseDrag
public static void onScreenMouseDrag(Screen screen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY)
-