diff options
author | Juuz <6596629+Juuxel@users.noreply.github.com> | 2021-06-05 00:13:59 +0300 |
---|---|---|
committer | Juuz <6596629+Juuxel@users.noreply.github.com> | 2021-06-05 00:14:22 +0300 |
commit | a1bb6316f2d6ecc0019e00438b4cf724dde68f73 (patch) | |
tree | 05edeedca30fa5a5a50085b594244aa66ef569cc /src/main/java | |
parent | 1aba27451ce4b95dc7a832938998c9d1581eee97 (diff) | |
download | LibGui-a1bb6316f2d6ecc0019e00438b4cf724dde68f73.tar.gz LibGui-a1bb6316f2d6ecc0019e00438b4cf724dde68f73.tar.bz2 LibGui-a1bb6316f2d6ecc0019e00438b4cf724dde68f73.zip |
Switch from accessor to AW, fixes #113
Accessors would be preferred but there is a mixin bug/regression
that prevents me from modifying final fields with accessors unless I do
some concerning hacky code.
Diffstat (limited to 'src/main/java')
3 files changed, 4 insertions, 25 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java b/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java index aa6ae36..f51bcad 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/ValidatedSlot.java @@ -7,7 +7,6 @@ import net.minecraft.screen.slot.Slot; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; -import io.github.cottonmc.cotton.gui.impl.access.SlotAccessor; import io.github.cottonmc.cotton.gui.widget.WItemSlot; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -170,13 +169,12 @@ public class ValidatedSlot extends Slot { if (this.visible != visible) { this.visible = visible; - SlotAccessor accessor = (SlotAccessor) this; if (visible) { - accessor.setX(originalX); - accessor.setY(originalY); + x = originalX; + y = originalY; } else { - accessor.setX(-100000); - accessor.setY(-100000); + x = -100000; + y = -100000; } } } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/access/SlotAccessor.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/access/SlotAccessor.java deleted file mode 100644 index 4b4644c..0000000 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/access/SlotAccessor.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.github.cottonmc.cotton.gui.impl.access; - -import net.minecraft.screen.slot.Slot; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(Slot.class) -public interface SlotAccessor { - @Accessor("x") - void setX(int x); - - @Accessor("y") - void setY(int y); -} diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/access/package-info.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/access/package-info.java deleted file mode 100644 index 8f391fd..0000000 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/access/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Internal implementation classes. - */ -package io.github.cottonmc.cotton.gui.impl.access; |