From 86f10ceabdc8678c51cd90f394068c1aebe5585e Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:22:43 +0100 Subject: [PATCH] Start with explaining random class files. --- .../entity/EntityRidingOffsetsPre1_20_2.java | 21 +++++++++++++++++-- .../replacement/BuiltinEmptyGlyph1_12_2.java | 4 ++++ .../replacement/KeyPairResponse1_19_0.java | 4 ++-- .../PendingUpdateManager1_18_2.java | 4 ++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/entity/EntityRidingOffsetsPre1_20_2.java b/src/main/java/de/florianmichael/viafabricplus/fixes/entity/EntityRidingOffsetsPre1_20_2.java index f0f203e0..7eb1d49a 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/entity/EntityRidingOffsetsPre1_20_2.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/entity/EntityRidingOffsetsPre1_20_2.java @@ -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; } - - return 0.4D; } else if (entity instanceof ArmorStandEntity armorStandEntity) { return armorStandEntity.isMarker() ? 0D : 0.1D; } else if (entity instanceof EndermiteEntity) { diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/BuiltinEmptyGlyph1_12_2.java b/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/BuiltinEmptyGlyph1_12_2.java index fdbb05c9..a6f0126f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/BuiltinEmptyGlyph1_12_2.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/BuiltinEmptyGlyph1_12_2.java @@ -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; diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/KeyPairResponse1_19_0.java b/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/KeyPairResponse1_19_0.java index 0e422874..496e534f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/KeyPairResponse1_19_0.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/KeyPairResponse1_19_0.java @@ -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( diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/PendingUpdateManager1_18_2.java b/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/PendingUpdateManager1_18_2.java index 84cfbc4e..9d3358c1 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/PendingUpdateManager1_18_2.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/replacement/PendingUpdateManager1_18_2.java @@ -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