Skip to content

Commit

Permalink
slot
Browse files Browse the repository at this point in the history
  • Loading branch information
Jab125 committed Jan 15, 2025
1 parent cd24f24 commit 5bea287
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import org.jetbrains.annotations.Nullable;

@Deprecated(forRemoval = true)
public class LegacyArmorSlot extends LegacySlot {
private final LivingEntity owner;
private final EquipmentSlot slot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.world.item.crafting.CraftingInput;
import net.minecraft.world.item.crafting.RecipeType;

@Deprecated(forRemoval = true)
public class LegacyResultSlot extends LegacySlot {
private final CraftingContainer craftSlots;
private final Player player;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.world.Container;
import net.minecraft.world.inventory.Slot;

@Deprecated(forRemoval = true)
public class LegacySlot extends Slot {
public final int size;
public final float x;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package xyz.violaflower.legacy_tweaks.client.gui.extention;

public interface SlotExtension {
void lt$setVisualX(float x);
void lt$setVisualY(float y);
float lt$getVisualX();
float lt$getVisualY();

/// @param size size in scaled pixels
void lt$setSize(int size);
/*let's assume it's an int*/int lt$getSize();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package xyz.violaflower.legacy_tweaks.mixin.client.tweak.legacy_ui.slot;

import net.minecraft.world.inventory.Slot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import xyz.violaflower.legacy_tweaks.client.gui.extention.SlotExtension;

@Mixin(Slot.class)
public class SlotMixin implements SlotExtension {
@Unique
private float visualX;
@Unique
private float visualY;
@Unique
private int size;
@Override
public void lt$setVisualX(float x) {
this.visualX = x;
}

@Override
public void lt$setVisualY(float y) {
this.visualY = y;
}

@Override
public float lt$getVisualX() {
return this.visualX;
}

@Override
public float lt$getVisualY() {
return this.visualY;
}

@Override
public void lt$setSize(int size) {
this.size = size;
}

@Override
public int lt$getSize() {
return this.size;
}
}
1 change: 1 addition & 0 deletions src/main/resources/legacy_tweaks.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
],
"mixins": [
"client.accessor.CraftingMenuAccessor",
"client.tweak.legacy_ui.slot.SlotMixin",
"common.tweak.gameplay.EntityMixin",
"common.tweak.legacy_attack.ItemStackMixin",
"common.tweak.legacy_attack.PlayerMixin",
Expand Down

0 comments on commit 5bea287

Please sign in to comment.