ItemPhysics module

ItemPhysics: Minecraft 26.3 cheat module, full source for every implementation (1 client: OfflineClient).

1 implementationRENDER

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

OfflineClientRENDERsrc/main/java/com/jellypudding/offlineclient/modules/render/ItemPhysics.javaJava · 53 lines · 2.0 KB

Dropped items lie on the ground instead of hovering and spinning.

SettingsRandom rotation
ItemPhysics.javaJava · Minecraft 26.2 · 53 lines · 2.0 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.render;
2
3
import com.jellypudding.offlineclient.module.Category;
4
import com.jellypudding.offlineclient.module.Module;
5
import com.jellypudding.offlineclient.setting.BoolSetting;
6
import com.mojang.blaze3d.vertex.PoseStack;
7
import com.mojang.math.Axis;
8
import net.minecraft.client.renderer.entity.state.ItemEntityRenderState;
9
import net.minecraft.world.phys.AABB;
10
11
// ItemEntityRendererMixin asks this module where the drop sits and how it lies.
12
public final class ItemPhysics extends Module {
13
14
    // A model thinner than this is a flat sprite and lies on its back.
15
    private static final float FLAT_DEPTH = 0.0625f;
16
17
    // A hair off the ground. The drop must not fight the floor for depth.
18
    private static final float LIFT = 0.001f;
19
20
    // How far a drop can be turned from the one before it.
21
    private static final int SPREAD = 90;
22
23
    private final BoolSetting randomRotation = new BoolSetting("Random rotation",
24
        "Turn each drop by its own angle so a pile does not all face one way.", true);
25
26
    public ItemPhysics() {
27
        super("ItemPhysics", "Dropped items lie on the ground instead of hovering and spinning.",
28
            Category.RENDER);
29
        addSettings(randomRotation);
30
        searchTags("item", "drop", "physics");
31
    }
32
33
    // How far up the model goes to rest on the floor.
34
    public float groundOffset(ItemEntityRenderState state) {
35
        AABB box = state.item.getModelBoundingBox();
36
        return (float) (isFlat(box) ? -box.minZ : -box.minY) + LIFT;
37
    }
38
39
    // The turn is applied first. The item still lies flat once it is laid down.
40
    public void lay(PoseStack poseStack, ItemEntityRenderState state) {
41
        if (randomRotation.isOn()) {
42
            poseStack.mulPose(Axis.YP.rotationDegrees(Math.floorMod(state.seed, SPREAD)));
43
        }
44
        if (isFlat(state.item.getModelBoundingBox())) {
45
            poseStack.mulPose(Axis.XP.rotationDegrees(-90));
46
        }
47
    }
48
49
    private static boolean isFlat(AABB box) {
50
        return box.getZsize() <= FLAT_DEPTH;
51
    }
52
}
53