Start with explaining random class files.

This commit is contained in:
FlorianMichael 2023-12-27 22:22:43 +01:00
parent 180ce79ca7
commit 86f10ceabd
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
4 changed files with 29 additions and 4 deletions

View File

@ -36,8 +36,19 @@ import net.minecraft.util.math.MathHelper;
import net.raphimc.vialoader.util.VersionEnum;
import org.joml.Vector3f;
/**
* Minecraft 1.20.2 changed the calculation of the mounted height offset for all entities, this class contains the old
* values for all entities. This class is used for 1.20.1 and lower.
*/
public class EntityRidingOffsetsPre1_20_2 {
/**
* Returns the mounted height offset for the given entity and passenger. This method is used for 1.20.1 and lower.
*
* @param entity The entity to get the mounted height offset for.
* @param passenger The passenger of the entity.
* @return The mounted height offset.
*/
public static Vector3f getMountedHeightOffset(final Entity entity, final Entity passenger) {
float yOffset = entity.getHeight() * 0.75F;
@ -141,13 +152,19 @@ public class EntityRidingOffsetsPre1_20_2 {
return new Vector3f(0, yOffset, 0);
}
/**
* Returns the height offset for the given entity. This method is used for 1.20.1 and lower.
*
* @param entity The entity to get the height offset for.
* @return The height offset.
*/
public static double getHeightOffset(final Entity entity) {
if (entity instanceof AllayEntity || entity instanceof VexEntity) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
return 0D;
}
} else {
return 0.4D;
}
} else if (entity instanceof ArmorStandEntity armorStandEntity) {
return armorStandEntity.isMarker() ? 0D : 0.1D;
} else if (entity instanceof EndermiteEntity) {

View File

@ -25,6 +25,10 @@ import net.minecraft.client.font.RenderableGlyph;
import java.util.function.Function;
/**
* Implementation of a blank glyph for 1.12.2 and lower since those versions don't draw a white rectangle for empty
* glyphs but instead just skip them. See {@link de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.MixinFontStorage} for more information.
*/
public enum BuiltinEmptyGlyph1_12_2 implements Glyph {
INSTANCE;

View File

@ -23,8 +23,8 @@ import com.mojang.authlib.yggdrasil.response.KeyPairResponse;
import java.nio.ByteBuffer;
/*
This class is part of the AuthLib, we are overwriting this class to add a new field.
/**
* This class is part of the AuthLib, we are overwriting this class to add the {@link #publicKeySignature} field.
*/
public record KeyPairResponse1_19_0(

View File

@ -25,6 +25,10 @@ import net.minecraft.client.network.PendingUpdateManager;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.math.BlockPos;
/**
* No-op implementation of {@link PendingUpdateManager} for 1.18.2 and lower since those versions don't have the
* {@link PendingUpdateManager} class.
*/
public class PendingUpdateManager1_18_2 extends PendingUpdateManager {
@Override