mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 14:34:28 +00:00
Forge 1.19
* Bump pack.mcmeta formats * 1.19 biome modifiers * Mark ClientPlayerNetworkEvent.LoggedOutEvent's getters as nullable * Add docs and package-info to client extension interfaces package * Move RenderBlockOverlayEvent hooks to ForgeHooksClient * Add package-infos to client events package * Rename SoundLoadEvent to SoundEngineLoadEvent This reduces confusion from consumers which may think the name SoundLoadEvent refers to an individual sound being loaded rather than the sound engine. * Document and change SoundLoadEvent to fire on mod bus Previously, it fired on both the mod bus and the Forge bus, which is confusing for consumers. * Delete SoundSetupEvent Looking at its original implementation shows that there isn't an appropriate place in the new sound code to reinsert the event, and the place of 'sound engine/manager initialization event' is taken already by SoundLoadEvent. * Perform some cleanup on client events - Removed nullable annotations from ClientPlayerNetworkEvent - Renamed #getPartialTicks methods to #getPartialTick, to be consistent with vanilla's naming of the partial tick - Cleanup documentation to remove line breaks, use the spelling 'cancelled' over 'canceled', and improve docs on existing and new methods. * Remove EntityEvent.CanUpdate Closes MinecraftForge/MinecraftForge#6394 * Switch to Jetbrains nullability annotations * New PlayLevelSoundEvent; replaces old PlaySoundAtEntityEvent * Remove ForgeWorldPresetScreens * Remove IForgeRegistryEntry * Remove use of List<Throwable> in FML's CompletableFutures * Add docs to mod loading stages, stages, and phases * Gradle 7.4.2 * Use SLF4J in FMLLoader and other subprojects * Switch dynamic versions in subprojects to pinned ones * Switch ForgeRoot and MDK to FG plugin markers * Configure Forge javadoc task The task now uses a custom stylesheet with MCForge elements, and configured to combine the generation from the four FML subprojects (fmlloader, fmlcore, javafmllanguage, mclanguage) and the Forge project into the javadoc output. * Update docs/md files, for 1.19 update and the move away from IRC to Discord. * Make "Potentially dangerous alternative prefix" a debug warning, not info. Co-authored-by: Curle <[email protected]> Co-authored-by: sciwhiz12 <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
270e778ac5
commit
4ed9117799
1485 files changed
+14960
-15446
No files matched your search
@@ -7,14 +7,11 @@ package net.minecraftforge.client.extensions;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
@@ -27,7 +24,12 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Extension interface for {@link IForgeBakedModel}.
|
||||
*/
|
||||
public interface IForgeBakedModel
|
||||
{
|
||||
private BakedModel self()
|
||||
@@ -35,8 +37,8 @@ public interface IForgeBakedModel
|
||||
return (BakedModel) this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
default List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData)
|
||||
@NotNull
|
||||
default List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull IModelData extraData)
|
||||
{
|
||||
return self().getQuads(state, side, rand);
|
||||
}
|
||||
@@ -57,12 +59,12 @@ public interface IForgeBakedModel
|
||||
return net.minecraftforge.client.ForgeHooksClient.handlePerspective(self(), cameraTransformType, poseStack);
|
||||
}
|
||||
|
||||
default @Nonnull IModelData getModelData(@Nonnull BlockAndTintGetter level, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData modelData)
|
||||
default @NotNull IModelData getModelData(@NotNull BlockAndTintGetter level, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData modelData)
|
||||
{
|
||||
return modelData;
|
||||
}
|
||||
|
||||
default TextureAtlasSprite getParticleIcon(@Nonnull IModelData data)
|
||||
default TextureAtlasSprite getParticleIcon(@NotNull IModelData data)
|
||||
{
|
||||
return self().getParticleIcon();
|
||||
}
|
||||
|
||||
@@ -5,18 +5,23 @@
|
||||
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import net.minecraftforge.client.settings.IKeyConflictContext;
|
||||
import net.minecraftforge.client.settings.KeyModifier;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Extension interface for {@link KeyMapping}.
|
||||
*/
|
||||
public interface IForgeKeyMapping
|
||||
{
|
||||
private KeyMapping self() { return (KeyMapping) this; }
|
||||
|
||||
@Nonnull InputConstants.Key getKey();
|
||||
private KeyMapping self()
|
||||
{
|
||||
return (KeyMapping) this;
|
||||
}
|
||||
|
||||
@NotNull InputConstants.Key getKey();
|
||||
|
||||
/**
|
||||
* Checks that the key conflict context and modifier are active, and that the keyCode matches this binding.
|
||||
@@ -25,7 +30,7 @@ public interface IForgeKeyMapping
|
||||
{
|
||||
return keyCode != InputConstants.UNKNOWN && keyCode.equals(getKey()) && getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext());
|
||||
}
|
||||
|
||||
|
||||
default void setToDefault()
|
||||
{
|
||||
setKeyModifierAndCode(getDefaultKeyModifier(), self().getDefaultKey());
|
||||
|
||||
@@ -9,15 +9,29 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
/**
|
||||
* Extension interface for {@link IForgeMinecraft}.
|
||||
*/
|
||||
public interface IForgeMinecraft
|
||||
{
|
||||
private Minecraft self() { return (Minecraft)this; }
|
||||
private Minecraft self()
|
||||
{
|
||||
return (Minecraft) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes a screen as a new GUI layer.
|
||||
*
|
||||
* @param screen the new GUI layer
|
||||
*/
|
||||
default void pushGuiLayer(Screen screen)
|
||||
{
|
||||
ForgeHooksClient.pushGuiLayer(self(), screen);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pops a GUI layer from the screen.
|
||||
*/
|
||||
default void popGuiLayer()
|
||||
{
|
||||
ForgeHooksClient.popGuiLayer(self());
|
||||
|
||||
@@ -6,18 +6,27 @@
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import com.mojang.math.Transformation;
|
||||
import net.minecraft.client.resources.model.ModelState;
|
||||
|
||||
/**
|
||||
* An {@code IModelState} is a function from model part to a transformation that should be applied
|
||||
* when that part is baked, thus representing the current "state" of the model and its parts.
|
||||
* Extension interface for {@link ModelState}. An {@code ModelState} is a function from model part to a
|
||||
* transformation that should be applied when that part is baked, thus representing the current "state" of the model
|
||||
* and its parts.
|
||||
*/
|
||||
public interface IForgeModelState
|
||||
{
|
||||
private ModelState self()
|
||||
{
|
||||
return (ModelState) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param part Part of the model we are wanting to transform. An empty optional means
|
||||
* {@return A transformation to apply to the part} This may be an {@linkplain Transformation#isIdentity() identity
|
||||
* transformation} if there is no transformation to be applied. The coordinate system of the transform is determined
|
||||
* by the part type.
|
||||
*
|
||||
* @param part part of the model we are wanting to transform. An empty optional means
|
||||
* we want a transform for the entire model.
|
||||
* @return A transformation to apply to the part, if any. The coordinate system of the transform
|
||||
* is determined by the part type.
|
||||
*/
|
||||
default Transformation getPartTransformation(Object part)
|
||||
{
|
||||
|
||||
@@ -13,18 +13,32 @@ import com.mojang.math.Transformation;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Vector4f;
|
||||
|
||||
/**
|
||||
* Extension interface for {@link Transformation}.
|
||||
*/
|
||||
public interface IForgeTransformation
|
||||
{
|
||||
private Transformation self()
|
||||
{
|
||||
return (Transformation)this;
|
||||
return (Transformation) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return whether this transformation is the identity transformation}
|
||||
*
|
||||
* @see Transformation#identity()
|
||||
*/
|
||||
default boolean isIdentity()
|
||||
{
|
||||
return self().equals(Transformation.identity());
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes and applies this transformation to the pose stack. The effects of this method can be reversed by a
|
||||
* corresponding {@link PoseStack#popPose()}.
|
||||
*
|
||||
* @param stack the pose stack to modify
|
||||
*/
|
||||
default void push(PoseStack stack)
|
||||
{
|
||||
stack.pushPose();
|
||||
@@ -41,24 +55,45 @@ public interface IForgeTransformation
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms the position according to this transformation.
|
||||
*
|
||||
* @param position the position to transform
|
||||
*/
|
||||
default void transformPosition(Vector4f position)
|
||||
{
|
||||
position.transform(self().getMatrix());
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms the normal according to this transformation and normalizes it.
|
||||
*
|
||||
* @param normal the normal to transform
|
||||
*/
|
||||
default void transformNormal(Vector3f normal)
|
||||
{
|
||||
normal.transform(self().getNormalMatrix());
|
||||
normal.normalize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates the direction according to this transformation and returns the nearest {@code Direction} to the
|
||||
* resulting direction.
|
||||
*
|
||||
* @param facing the direction to transform
|
||||
* @return the {@code Direction} value nearest to the resulting transformed direction
|
||||
* @see Direction#rotate(Matrix4f, Direction)
|
||||
*/
|
||||
default Direction rotateTransform(Direction facing)
|
||||
{
|
||||
return Direction.rotate(self().getMatrix(), facing);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert transformation from assuming center-block system to opposing-corner-block system
|
||||
* Converts and returns a new transformation based on this transformation from assuming a center-block system to an
|
||||
* opposing-corner-block system.
|
||||
*
|
||||
* @return a new transformation using the opposing-corner-block system
|
||||
*/
|
||||
default Transformation blockCenterToCorner()
|
||||
{
|
||||
@@ -66,7 +101,10 @@ public interface IForgeTransformation
|
||||
}
|
||||
|
||||
/**
|
||||
* convert transformation from assuming opposing-corner-block system to center-block system
|
||||
* Converts and returns a new transformation based on this transformation from assuming an opposing-corner-block
|
||||
* system to a center-block system.
|
||||
*
|
||||
* @return a new transformation using the center-block system
|
||||
*/
|
||||
default Transformation blockCornerToCenter()
|
||||
{
|
||||
@@ -74,11 +112,14 @@ public interface IForgeTransformation
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply this transformation to a different origin.
|
||||
* Can be used for switching between coordinate systems.
|
||||
* Parameter is relative to the current origin.
|
||||
* Returns a new transformation with a changed origin by applying the given parameter (which is relative to the
|
||||
* current origin). This can be used for switching between coordinate systems.
|
||||
*
|
||||
* @param origin the new origin as relative to the current origin
|
||||
* @return a new transformation with a changed origin
|
||||
*/
|
||||
default Transformation applyOrigin(Vector3f origin) {
|
||||
default Transformation applyOrigin(Vector3f origin)
|
||||
{
|
||||
Transformation transform = self();
|
||||
if (transform.isIdentity()) return Transformation.identity();
|
||||
|
||||
|
||||
@@ -24,8 +24,16 @@ import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Vector4f;
|
||||
import net.minecraft.core.Vec3i;
|
||||
|
||||
/**
|
||||
* Extension interface for {@link VertexConsumer}.
|
||||
*/
|
||||
public interface IForgeVertexConsumer
|
||||
{
|
||||
private VertexConsumer self()
|
||||
{
|
||||
return (VertexConsumer) this;
|
||||
}
|
||||
|
||||
// Copy of putBulkData, but enables tinting and per-vertex alpha
|
||||
default void putBulkData(PoseStack.Pose poseStack, BakedQuad bakedQuad, float red, float green, float blue, int packedLight, int packedOverlay, boolean readExistingColor) {
|
||||
putBulkData(poseStack, bakedQuad, red, green, blue, 1.0f, packedLight, packedOverlay, readExistingColor);
|
||||
@@ -87,7 +95,7 @@ public interface IForgeVertexConsumer
|
||||
Vector4f pos = new Vector4f(f, f1, f2, 1.0F);
|
||||
pos.transform(matrix4f);
|
||||
applyBakedNormals(normal, bytebuffer, pose.normal());
|
||||
((VertexConsumer)this).vertex(pos.x(), pos.y(), pos.z(), cr, cg, cb, ca, f9, f10, packedOverlay, lightmapCoord, normal.x(), normal.y(), normal.z());
|
||||
self().vertex(pos.x(), pos.y(), pos.z(), cr, cg, cb, ca, f9, f10, packedOverlay, lightmapCoord, normal.x(), normal.y(), normal.z());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
/**
|
||||
* Extension interfaces for {@link net.minecraftforge.api.distmarker.Dist#CLIENT client}-only classes.
|
||||
*
|
||||
* <p>Extension interfaces allow the convenient addition of methods to the target class, as the target class is patched
|
||||
* to implement the interface. Because of this, these interfaces must only be implemented by the target classes, and must
|
||||
* not be implemented manually by mods.</p>
|
||||
*
|
||||
* <p>These interfaces hold at least one method: the {@code self()} method which casts the object into the type of the
|
||||
* targeted class, to allow methods in the extension interface to reference methods from the target class. Additional
|
||||
* methods are usually {@code default} with an implementation in the interface itself, but methods may be implemented
|
||||
* in the target class instead if it requires access to (patched-in or original) fields in the instance.</p>
|
||||
*/
|
||||
@FieldsAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import net.minecraft.FieldsAreNonnullByDefault;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
Reference in new issue
Block a user