Skip to content

Commit 762d13d

Browse files
committed
Merge branch 'master' into feature/packetmine-rewrite
2 parents c2244a1 + 8605116 commit 762d13d

File tree

11 files changed

+83
-218
lines changed

11 files changed

+83
-218
lines changed

common/src/main/kotlin/com/lambda/module/modules/movement/TridentBoost.kt renamed to common/src/main/java/com/lambda/mixin/items/FilledMapItemMixin.java

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Lambda
2+
* Copyright 2025 Lambda
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -15,19 +15,25 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
package com.lambda.module.modules.movement
18+
package com.lambda.mixin.items;
1919

20-
import com.lambda.module.Module
21-
import com.lambda.module.tag.ModuleTag
20+
import com.lambda.module.modules.render.MapPreview;
21+
import net.minecraft.client.item.TooltipData;
22+
import net.minecraft.item.FilledMapItem;
23+
import net.minecraft.item.Item;
24+
import net.minecraft.item.ItemStack;
25+
import org.spongepowered.asm.mixin.Mixin;
2226

23-
object TridentBoost : Module(
24-
name = "TridentBoost",
25-
description = "Boosts you with tridents",
26-
defaultTags = setOf(ModuleTag.MOVEMENT)
27-
) {
28-
@JvmStatic
29-
val tridentSpeed by setting("Speed Factor", 1.0, 0.1..3.0, 0.1, description = "Speed factor of the trident boost")
27+
import java.util.Optional;
3028

31-
@JvmStatic
32-
val forceUse by setting("Force Use", true, description = "Try to use the trident outside of water or rain")
29+
@Mixin(FilledMapItem.class)
30+
public class FilledMapItemMixin extends Item {
31+
public FilledMapItemMixin(Item.Settings settings) {
32+
super(settings);
33+
}
34+
35+
@Override
36+
public Optional<TooltipData> getTooltipData(ItemStack stack) {
37+
return Optional.of(new MapPreview.MapComponent(stack));
38+
}
3339
}

common/src/main/java/com/lambda/mixin/items/TridentMixin.java

Lines changed: 0 additions & 49 deletions
This file was deleted.

common/src/main/java/com/lambda/mixin/render/DrawContextMixin.java

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2025 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.mixin.render;
19+
20+
import com.lambda.module.modules.render.MapPreview;
21+
import net.minecraft.client.gui.tooltip.BundleTooltipComponent;
22+
import net.minecraft.client.gui.tooltip.TooltipComponent;
23+
import net.minecraft.client.item.BundleTooltipData;
24+
import net.minecraft.client.item.TooltipData;
25+
import org.spongepowered.asm.mixin.Mixin;
26+
import org.spongepowered.asm.mixin.injection.At;
27+
import org.spongepowered.asm.mixin.injection.Inject;
28+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
29+
30+
@Mixin(TooltipComponent.class)
31+
public interface TooltipComponentMixin {
32+
@Inject(method = "of(Lnet/minecraft/client/item/TooltipData;)Lnet/minecraft/client/gui/tooltip/TooltipComponent;", at = @At("HEAD"), cancellable = true)
33+
private static void of(TooltipData data, CallbackInfoReturnable<TooltipComponent> cir) {
34+
if (data instanceof BundleTooltipData) {
35+
cir.setReturnValue(new BundleTooltipComponent((BundleTooltipData)data));
36+
return;
37+
}
38+
39+
if (data instanceof MapPreview.MapComponent) {
40+
cir.setReturnValue((TooltipComponent) data);
41+
return;
42+
}
43+
44+
throw new IllegalArgumentException("Unknown TooltipComponent");
45+
}
46+
}

common/src/main/kotlin/com/lambda/module/modules/movement/RocketExtend.kt

Lines changed: 0 additions & 77 deletions
This file was deleted.

common/src/main/kotlin/com/lambda/module/modules/render/MapPreview.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.mojang.blaze3d.systems.RenderSystem
2424
import net.minecraft.client.font.TextRenderer
2525
import net.minecraft.client.gui.DrawContext
2626
import net.minecraft.client.gui.tooltip.TooltipComponent
27+
import net.minecraft.client.item.TooltipData
2728
import net.minecraft.item.FilledMapItem
2829
import net.minecraft.item.ItemStack
2930
import net.minecraft.item.map.MapState
@@ -37,18 +38,15 @@ object MapPreview : Module(
3738
) {
3839
private val background = Identifier("textures/map/map_background.png")
3940

40-
// The map component is added via the draw context mixin, thanks mojang
41-
class MapComponent(val stack: ItemStack) : TooltipComponent {
41+
class MapComponent(val stack: ItemStack) : TooltipData, TooltipComponent {
4242
val state: MapState?
4343
get() = FilledMapItem.getMapState(stack, mc.world)
4444

4545
val mapId: Int?
4646
get() = FilledMapItem.getMapId(stack)
4747

48-
override fun drawItems(fontRenderer: TextRenderer, x: Int, y: Int, context: DrawContext) {
48+
override fun drawItems(textRenderer: TextRenderer, x: Int, y: Int, context: DrawContext) {
4949
mapId?.let { id ->
50-
// Values taken from net.minecraft.client.render.item.HeldItemRenderer.renderFirstPersonMap
51-
5250
val matrices = context.matrices
5351

5452
matrices.push()
@@ -59,7 +57,9 @@ object MapPreview : Module(
5957
context.drawTexture(background, -7, -7, 0f, 0f, 142, 142, 142, 142)
6058

6159
matrices.translate(0.0, 0.0, 1.0)
60+
6261
mc.gameRenderer.mapRenderer.draw(matrices, context.vertexConsumers, id, state, true, 240)
62+
matrices.pop()
6363
}
6464
}
6565

common/src/main/resources/lambda.mixins.common.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"input.KeyboardMixin",
2020
"input.MouseMixin",
2121
"items.BarrierBlockMixin",
22-
"items.TridentMixin",
22+
"items.FilledMapItemMixin",
2323
"network.ClientConnectionMixin",
2424
"network.ClientLoginNetworkMixin",
2525
"network.ClientPlayNetworkHandlerMixin",
@@ -29,12 +29,11 @@
2929
"render.BackgroundRendererMixin",
3030
"render.BlockRenderManagerMixin",
3131
"render.CameraMixin",
32-
"render.ChatHudMixin",
3332
"render.CapeFeatureRendererMixin",
33+
"render.ChatHudMixin",
3434
"render.ChatInputSuggestorMixin",
3535
"render.ChatScreenMixin",
3636
"render.DebugHudMixin",
37-
"render.DrawContextMixin",
3837
"render.ElytraFeatureRendererMixin",
3938
"render.GameRendererMixin",
4039
"render.GlStateManagerMixin",
@@ -49,6 +48,7 @@
4948
"render.ScreenHandlerMixin",
5049
"render.SplashOverlayMixin",
5150
"render.SplashOverlayMixin$LogoTextureMixin",
51+
"render.TooltipComponentMixin",
5252
"render.VertexBufferMixin",
5353
"render.WorldRendererMixin",
5454
"world.BlockCollisionSpliteratorMixin",

fabric/src/main/resources/fabric.mod.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"schemaVersion": 1,
33
"id": "${modId}",
44
"version": "${modVersion}",
5-
"name": "Lambda",
5+
"name": "${modName}",
66
"description": "${modDescription}",
77
"authors": [
8-
"Constructor"
8+
"${modAuthors}"
99
],
1010
"contact": {
1111
"homepage": "",
1212
"sources": ""
1313
},
1414
"license": "GNU General Public License v3.0",
15-
"icon": "assets/lambda/lambda.png",
15+
"icon": "${modIcon}",
1616
"environment": "*",
1717
"entrypoints": {
1818
"client": [
@@ -23,7 +23,7 @@
2323
]
2424
},
2525
"mixins": [
26-
"lambda.mixins.common.json"
26+
"${modId}.mixins.common.json"
2727
],
2828
"depends": {
2929
"fabricloader": ">=${fabricLoaderVersion}",

0 commit comments

Comments
 (0)