1212import net .minecraft .world .inventory .Slot ;
1313import net .minecraft .world .item .component .ItemLore ;
1414import org .jspecify .annotations .NonNull ;
15+ import org .spongepowered .asm .mixin .Final ;
1516import org .spongepowered .asm .mixin .Mixin ;
17+ import org .spongepowered .asm .mixin .Shadow ;
1618import org .spongepowered .asm .mixin .Unique ;
1719import org .spongepowered .asm .mixin .injection .At ;
1820import org .spongepowered .asm .mixin .injection .Inject ;
2729import static de .rettichlp .ucutils .UCUtils .storage ;
2830import static java .lang .Integer .parseInt ;
2931import static java .util .regex .Pattern .compile ;
30- import static net .minecraft .client .gui .screens .inventory .BookEditScreen .BACKGROUND_TEXTURE_HEIGHT ;
31- import static net .minecraft .client .gui .screens .inventory .BookEditScreen .BACKGROUND_TEXTURE_WIDTH ;
3232import static net .minecraft .core .component .DataComponents .LORE ;
3333import static net .minecraft .network .chat .Component .literal ;
3434import static net .minecraft .world .inventory .ContainerInput .PICKUP ;
3535
3636@ Mixin (AbstractContainerScreen .class )
3737public abstract class AbstractContainerScreenMixin <T extends AbstractContainerMenu > extends Screen implements MenuAccess <T > {
3838
39+ @ Shadow
40+ @ Final
41+ protected int imageWidth ;
42+
43+ @ Shadow
44+ @ Final
45+ protected int imageHeight ;
46+
3947 protected AbstractContainerScreenMixin (Component title ) {
4048 super (title );
4149 }
@@ -56,9 +64,9 @@ protected AbstractContainerScreenMixin(Component title) {
5664 int ingredient2StoredAmount = getStoredAmount (this , 13 );
5765 int ingredient3StoredAmount = getStoredAmount (this , 15 );
5866
59- int x = (this .width - BACKGROUND_TEXTURE_WIDTH ) / 2 ;
60- int y = (this .height - BACKGROUND_TEXTURE_HEIGHT ) / 2 ;
61- int buttonX = x + BACKGROUND_TEXTURE_WIDTH + 2 ;
67+ int x = (this .width - this . imageWidth ) / 2 ;
68+ int y = (this .height - this . imageHeight ) / 2 ;
69+ int buttonX = x + this . imageWidth + 2 ;
6270
6371 // render button right to the inventory
6472 Button button = new Button .Builder (literal ("➤" ), _ -> commandService .sendCommand ("f " + ingredient1StoredAmount + "x Wirkstoff | " + ingredient2StoredAmount + "x Trägerstoff | " + ingredient3StoredAmount + "x Zusatzstoff" ))
0 commit comments