Browse Source

Updated to 19w09a (#43)

* Update MixinContainerScreen.java

* 19w09a update
Raph Hennessy 6 years ago
parent
commit
b17231738f

+ 1 - 1
README.md

@@ -2,7 +2,7 @@
 https://minecraft.curseforge.com/projects/roughly-enough-items <br>
 This branch is a rewrite of REI
 
-**Rewrite supports only 19w02a for now**
+**Rewrite supports only 19w09a for now**
 ![](https://media.discordapp.net/attachments/480755664675667980/528908880424730636/unknown.png?width=935&height=489)
 
 #### View [here](https://github.com/shedaniel/RoughlyEnoughItems/releases) for missing features

+ 3 - 3
build.gradle

@@ -8,9 +8,9 @@ targetCompatibility = 1.8
 archivesBaseName = "RoughlyEnoughItems"
 version = "2.3.1.53"
 
-def minecraftVersion = "19w08b"
-def yarnVersion = "19w08b.6"
-def fabricVersion = "0.2.3.104"
+def minecraftVersion = "19w09a"
+def yarnVersion = "19w09a.1"
+def fabricVersion = "0.2.3.107"
 def pluginLoaderVersion = "1.14-1.0.6-8"
 
 minecraft {

+ 3 - 3
src/main/java/me/shedaniel/rei/api/IDisplaySettings.java

@@ -2,10 +2,10 @@ package me.shedaniel.rei.api;
 
 public interface IDisplaySettings<T extends IRecipeDisplay> {
     
-    public int getDisplayHeight(IRecipeCategory category);
+    int getDisplayHeight(IRecipeCategory category);
     
-    public int getDisplayWidth(IRecipeCategory category, T display);
+    int getDisplayWidth(IRecipeCategory category, T display);
     
-    public int getMaximumRecipePerPage(IRecipeCategory category);
+    int getMaximumRecipePerPage(IRecipeCategory category);
     
 }

+ 12 - 11
src/main/java/me/shedaniel/rei/api/IRecipeCategory.java

@@ -9,29 +9,30 @@ import net.minecraft.util.Identifier;
 
 import java.awt.*;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.function.Supplier;
 
 
 public interface IRecipeCategory<T extends IRecipeDisplay> {
     
-    public Identifier getIdentifier();
+    Identifier getIdentifier();
     
-    public ItemStack getCategoryIcon();
+    ItemStack getCategoryIcon();
     
-    public String getCategoryName();
+    String getCategoryName();
     
-    default public List<IWidget> setupDisplay(Supplier<T> recipeDisplaySupplier, Rectangle bounds) {
-        return Arrays.asList(new RecipeBaseWidget(bounds));
+    default List<IWidget> setupDisplay(Supplier<T> recipeDisplaySupplier, Rectangle bounds) {
+        return Collections.singletonList(new RecipeBaseWidget(bounds));
     }
     
-    default public void drawCategoryBackground(Rectangle bounds, int mouseX, int mouseY, float delta) {
+    default void drawCategoryBackground(Rectangle bounds, int mouseX, int mouseY, float delta) {
         new RecipeBaseWidget(bounds).draw(mouseX, mouseY, delta);
         DrawableHelper.drawRect(bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, RecipeViewingScreen.SUB_COLOR.getRGB());
         DrawableHelper.drawRect(bounds.x + 17, bounds.y + 21, bounds.x + bounds.width - 17, bounds.y + 33, RecipeViewingScreen.SUB_COLOR.getRGB());
     }
     
-    default public IDisplaySettings getDisplaySettings() {
+    default IDisplaySettings getDisplaySettings() {
         return new IDisplaySettings<T>() {
             @Override
             public int getDisplayHeight(IRecipeCategory category) {
@@ -50,19 +51,19 @@ public interface IRecipeCategory<T extends IRecipeDisplay> {
         };
     }
     
-    default public int getDisplayHeight() {
+    default int getDisplayHeight() {
         return getDisplaySettings().getDisplayHeight(this);
     }
     
-    default public int getDisplayWidth(T display) {
+    default int getDisplayWidth(T display) {
         return getDisplaySettings().getDisplayWidth(this, display);
     }
     
-    default public int getMaximumRecipePerPage() {
+    default int getMaximumRecipePerPage() {
         return getDisplaySettings().getMaximumRecipePerPage(this);
     }
     
-    default public boolean checkTags() {
+    default boolean checkTags() {
         return false;
     }
     

+ 3 - 3
src/main/java/me/shedaniel/rei/api/IRecipeCategoryCraftable.java

@@ -9,10 +9,10 @@ import java.util.List;
 
 public interface IRecipeCategoryCraftable<T extends IRecipeDisplay> {
     
-    public boolean canAutoCraftHere(Class<? extends Screen> screenClasses, T recipe);
+    boolean canAutoCraftHere(Class<? extends Screen> screenClasses, T recipe);
     
-    public boolean performAutoCraft(Screen gui, T recipe);
+    boolean performAutoCraft(Screen gui, T recipe);
     
-    public void registerAutoCraftButton(List<IWidget> widgets, Rectangle rectangle, IMixinContainerScreen parentScreen, T recipe);
+    void registerAutoCraftButton(List<IWidget> widgets, Rectangle rectangle, IMixinContainerScreen parentScreen, T recipe);
     
 }

+ 10 - 10
src/main/java/me/shedaniel/rei/api/IRecipeDisplay.java

@@ -10,16 +10,16 @@ import java.util.Optional;
 
 public interface IRecipeDisplay<T extends Recipe> {
     
-    public abstract Optional<T> getRecipe();
-    
-    public List<List<ItemStack>> getInput();
-    
-    public List<ItemStack> getOutput();
-    
-    default public List<List<ItemStack>> getRequiredItems() {
+    Optional<T> getRecipe();
+
+    List<List<ItemStack>> getInput();
+
+    List<ItemStack> getOutput();
+
+    default List<List<ItemStack>> getRequiredItems() {
         return Lists.newArrayList();
     }
-    
-    public Identifier getRecipeCategory();
-    
+
+    Identifier getRecipeCategory();
+
 }

+ 6 - 6
src/main/java/me/shedaniel/rei/api/IRecipePlugin.java

@@ -2,17 +2,17 @@ package me.shedaniel.rei.api;
 
 public interface IRecipePlugin {
     
-    default public void onFirstLoad(PluginDisabler pluginDisabler) {}
+    default void onFirstLoad(PluginDisabler pluginDisabler) {}
     
-    public void registerItems(ItemRegisterer itemRegisterer);
+    void registerItems(ItemRegisterer itemRegisterer);
     
-    public void registerPluginCategories(RecipeHelper recipeHelper);
+    void registerPluginCategories(RecipeHelper recipeHelper);
     
-    public void registerRecipeDisplays(RecipeHelper recipeHelper);
+    void registerRecipeDisplays(RecipeHelper recipeHelper);
     
-    public void registerSpeedCraft(RecipeHelper recipeHelper);
+    void registerSpeedCraft(RecipeHelper recipeHelper);
     
-    default public int getPriority() {
+    default int getPriority() {
         return 0;
     }
     

+ 6 - 6
src/main/java/me/shedaniel/rei/api/ItemRegisterer.java

@@ -7,22 +7,22 @@ import java.util.List;
 
 public interface ItemRegisterer {
     
-    public List<ItemStack> getItemList();
+    List<ItemStack> getItemList();
     
     @Deprecated
-    public List<ItemStack> getModifiableItemList();
+    List<ItemStack> getModifiableItemList();
     
-    public ItemStack[] getAllStacksFromItem(Item item);
+    ItemStack[] getAllStacksFromItem(Item item);
     
-    public void registerItemStack(Item afterItem, ItemStack stack);
+    void registerItemStack(Item afterItem, ItemStack stack);
     
-    default public void registerItemStack(Item afterItem, ItemStack... stacks) {
+    default void registerItemStack(Item afterItem, ItemStack... stacks) {
         for(ItemStack stack : stacks)
             if (stack != null && !stack.isEmpty())
                 registerItemStack(afterItem, stack);
     }
     
-    default public void registerItemStack(ItemStack... stacks) {
+    default void registerItemStack(ItemStack... stacks) {
         for(ItemStack stack : stacks)
             if (stack != null && !stack.isEmpty())
                 registerItemStack(null, stack);

+ 5 - 5
src/main/java/me/shedaniel/rei/api/PluginDisabler.java

@@ -4,20 +4,20 @@ import net.minecraft.util.Identifier;
 
 public interface PluginDisabler {
     
-    default public void disablePluginFunctions(Identifier plugin, PluginFunction... functions) {
+    default void disablePluginFunctions(Identifier plugin, PluginFunction... functions) {
         for(PluginFunction function : functions)
             disablePluginFunction(plugin, function);
     }
     
-    default public void enablePluginFunctions(Identifier plugin, PluginFunction... functions) {
+    default void enablePluginFunctions(Identifier plugin, PluginFunction... functions) {
         for(PluginFunction function : functions)
             enablePluginFunction(plugin, function);
     }
     
-    public void disablePluginFunction(Identifier plugin, PluginFunction function);
+    void disablePluginFunction(Identifier plugin, PluginFunction function);
     
-    public void enablePluginFunction(Identifier plugin, PluginFunction function);
+    void enablePluginFunction(Identifier plugin, PluginFunction function);
     
-    public boolean isFunctionEnabled(Identifier plugin, PluginFunction function);
+    boolean isFunctionEnabled(Identifier plugin, PluginFunction function);
     
 }

+ 13 - 13
src/main/java/me/shedaniel/rei/api/RecipeHelper.java

@@ -11,33 +11,33 @@ import java.util.Optional;
 
 public interface RecipeHelper {
     
-    public static RecipeHelper getInstance() {
+    static RecipeHelper getInstance() {
         return RoughlyEnoughItemsCore.getRecipeHelper();
     }
     
-    public int getRecipeCount();
+    int getRecipeCount();
     
-    public List<ItemStack> findCraftableByItems(List<ItemStack> inventoryItems);
+    List<ItemStack> findCraftableByItems(List<ItemStack> inventoryItems);
     
-    public void registerCategory(IRecipeCategory category);
+    void registerCategory(IRecipeCategory category);
     
-    public void registerDisplay(Identifier categoryIdentifier, IRecipeDisplay display);
+    void registerDisplay(Identifier categoryIdentifier, IRecipeDisplay display);
     
-    public Map<IRecipeCategory, List<IRecipeDisplay>> getRecipesFor(ItemStack stack);
+    Map<IRecipeCategory, List<IRecipeDisplay>> getRecipesFor(ItemStack stack);
     
-    public RecipeManager getRecipeManager();
+    RecipeManager getRecipeManager();
     
-    public List<IRecipeCategory> getAllCategories();
+    List<IRecipeCategory> getAllCategories();
     
-    public Map<IRecipeCategory, List<IRecipeDisplay>> getUsagesFor(ItemStack stack);
+    Map<IRecipeCategory, List<IRecipeDisplay>> getUsagesFor(ItemStack stack);
     
-    public Optional<SpeedCraftAreaSupplier> getSpeedCraftButtonArea(IRecipeCategory category);
+    Optional<SpeedCraftAreaSupplier> getSpeedCraftButtonArea(IRecipeCategory category);
     
-    public void registerSpeedCraftButtonArea(Identifier category, SpeedCraftAreaSupplier rectangle);
+    void registerSpeedCraftButtonArea(Identifier category, SpeedCraftAreaSupplier rectangle);
     
-    public List<SpeedCraftFunctional> getSpeedCraftFunctional(IRecipeCategory category);
+    List<SpeedCraftFunctional> getSpeedCraftFunctional(IRecipeCategory category);
     
-    public void registerSpeedCraftFunctional(Identifier category, SpeedCraftFunctional functional);
+    void registerSpeedCraftFunctional(Identifier category, SpeedCraftFunctional functional);
     
     Map<IRecipeCategory, List<IRecipeDisplay>> getAllRecipes();
     

+ 1 - 1
src/main/java/me/shedaniel/rei/api/SpeedCraftAreaSupplier.java

@@ -4,7 +4,7 @@ import java.awt.*;
 
 public interface SpeedCraftAreaSupplier {
     
-    public Rectangle get(Rectangle bounds);
+    Rectangle get(Rectangle bounds);
     
     default String getButtonText() {
         return "+";

+ 6 - 6
src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java

@@ -4,10 +4,10 @@ import net.minecraft.client.gui.Screen;
 
 public interface SpeedCraftFunctional<T extends IRecipeDisplay> {
     
-    public Class[] getFunctioningFor();
-    
-    public boolean performAutoCraft(Screen screen, T recipe);
-    
-    public boolean acceptRecipe(Screen screen, T recipe);
-    
+    Class[] getFunctioningFor();
+
+    boolean performAutoCraft(Screen screen, T recipe);
+
+    boolean acceptRecipe(Screen screen, T recipe);
+
 }

+ 2 - 2
src/main/java/me/shedaniel/rei/client/ConfigHelper.java

@@ -1,7 +1,7 @@
 package me.shedaniel.rei.client;
 
 import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import net.fabricmc.loader.FabricLoader;
+import net.fabricmc.loader.api.FabricLoader;
 
 import java.io.File;
 import java.io.FileWriter;
@@ -17,7 +17,7 @@ public class ConfigHelper {
     
     @SuppressWarnings("deprecated")
     public ConfigHelper() {
-        this.configFile = new File(FabricLoader.INSTANCE.getConfigDirectory(), "rei.json");
+        this.configFile = new File(FabricLoader.getInstance().getConfigDirectory(), "rei.json");
         this.craftableOnly = false;
         try {
             loadConfig();

+ 2 - 2
src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java

@@ -259,7 +259,7 @@ public class RecipeViewingScreen extends Screen {
     
     @Override
     public void draw(int mouseX, int mouseY, float delta) {
-        this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680);
+        this.drawGradientRect(0, 0, this.screenWidth, this.screenHeight, -1072689136, -804253680);
         if (selectedCategory != null)
             selectedCategory.drawCategoryBackground(bounds, mouseX, mouseY, delta);
         else {
@@ -282,7 +282,7 @@ public class RecipeViewingScreen extends Screen {
         GuiHelper.getLastOverlay().drawOverlay(mouseX, mouseY, delta);
         if (choosePageActivated) {
             zOffset = 500.0f;
-            this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680);
+            this.drawGradientRect(0, 0, this.screenWidth, this.screenHeight, -1072689136, -804253680);
             zOffset = 0.0f;
             recipeChoosePageWidget.draw(mouseX, mouseY, delta);
         }

+ 3 - 3
src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java

@@ -39,7 +39,7 @@ public class ConfigScreen extends Screen {
     
     @Override
     protected void onInitialized() {
-        listeners.add(entryListWidget = new ConfigEntryListWidget(client, width, height, 32, height - 32, 24));
+        listeners.add(entryListWidget = new ConfigEntryListWidget(client, screenWidth, screenHeight, 32, screenHeight - 32, 24));
         entryListWidget.configClearEntries();
         entryListWidget.configAddEntry(new ConfigEntry.CategoryTitleConfigEntry(new TranslatableTextComponent("text.rei.config.general")));
         entryListWidget.configAddEntry(new ConfigEntry.ButtonConfigEntry(new TranslatableTextComponent("text.rei.config.cheating"), new ConfigEntry.ButtonConfigEntry.ConfigEntryButtonProvider() {
@@ -315,7 +315,7 @@ public class ConfigScreen extends Screen {
                 return false;
             }
         }));
-        addButton(new ButtonWidget(width / 2 - 100, height - 26, I18n.translate("gui.done")) {
+        addButton(new ButtonWidget(screenWidth / 2 - 100, screenHeight - 26, I18n.translate("gui.done")) {
             @Override
             public void onPressed(double double_1, double double_2) {
                 try {
@@ -338,7 +338,7 @@ public class ConfigScreen extends Screen {
     public void draw(int int_1, int int_2, float float_1) {
         this.drawTextureBackground(0);
         this.entryListWidget.draw(int_1, int_2, float_1);
-        this.drawStringCentered(this.fontRenderer, I18n.translate("text.rei.config"), this.width / 2, 16, 16777215);
+        this.drawStringCentered(this.fontRenderer, I18n.translate("text.rei.config"), this.screenWidth / 2, 16, 16777215);
         super.draw(int_1, int_2, float_1);
     }
     

+ 3 - 3
src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java

@@ -29,12 +29,12 @@ public class CreditsScreen extends Screen {
     
     @Override
     protected void onInitialized() {
-        listeners.add(entryListWidget = new CreditsEntryListWidget(client, width, height, 32, height - 32, 12));
+        listeners.add(entryListWidget = new CreditsEntryListWidget(client, screenWidth, screenHeight, 32, screenHeight - 32, 12));
         entryListWidget.creditsClearEntries();
         for(String line : I18n.translate("text.rei.credit.text").split("\n"))
             entryListWidget.creditsAddEntry(new CreditsEntry(new StringTextComponent(line)));
         entryListWidget.creditsAddEntry(new CreditsEntry(new StringTextComponent("")));
-        addButton(new ButtonWidget(width / 2 - 100, height - 26, I18n.translate("gui.done")) {
+        addButton(new ButtonWidget(screenWidth / 2 - 100, screenHeight - 26, I18n.translate("gui.done")) {
             @Override
             public void onPressed(double double_1, double double_2) {
                 CreditsScreen.this.client.openScreen(parent);
@@ -48,7 +48,7 @@ public class CreditsScreen extends Screen {
         //draw
         this.drawTextureBackground(0);
         this.entryListWidget.draw(int_1, int_2, float_1);
-        this.drawStringCentered(this.fontRenderer, I18n.translate("text.rei.credits"), this.width / 2, 16, 16777215);
+        this.drawStringCentered(this.fontRenderer, I18n.translate("text.rei.credits"), this.screenWidth / 2, 16, 16777215);
         super.draw(int_1, int_2, float_1);
     }
     

+ 4 - 4
src/main/java/me/shedaniel/rei/mixin/MixinContainerScreen.java

@@ -27,9 +27,9 @@ public class MixinContainerScreen extends Screen implements IMixinContainerScree
     @Shadow
     protected int top;
     @Shadow
-    protected int containerWidth;
+    protected int width;
     @Shadow
-    protected int containerHeight;
+    protected int height;
     @Shadow
     protected Slot focusedSlot;
     @Shadow
@@ -47,12 +47,12 @@ public class MixinContainerScreen extends Screen implements IMixinContainerScree
     
     @Override
     public int rei_getContainerWidth() {
-        return containerWidth;
+        return width;
     }
     
     @Override
     public int rei_getContainerHeight() {
-        return containerHeight;
+        return height;
     }
     
     @Inject(method = "onInitialized()V", at = @At("RETURN"))