aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorRaph Hennessy <raph.hennessy@gmail.com>2019-02-28 19:34:01 +1100
committerDaniel She <shekwancheung0528@gmail.com>2019-02-28 16:34:01 +0800
commit04f96f866d09002808c2bf6ab1f252f781751617 (patch)
treec9147b09d85660a9ea812310dbbfc25e3f2dc0cb /src/main/java
parent60fb69c2763386cf38aea12b1fa817d51125b0db (diff)
downloadRoughlyEnoughItems-04f96f866d09002808c2bf6ab1f252f781751617.tar.gz
RoughlyEnoughItems-04f96f866d09002808c2bf6ab1f252f781751617.tar.bz2
RoughlyEnoughItems-04f96f866d09002808c2bf6ab1f252f781751617.zip
Updated to 19w09a (#43)
* Update MixinContainerScreen.java * 19w09a update
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/me/shedaniel/rei/api/IDisplaySettings.java6
-rw-r--r--src/main/java/me/shedaniel/rei/api/IRecipeCategory.java23
-rw-r--r--src/main/java/me/shedaniel/rei/api/IRecipeCategoryCraftable.java6
-rw-r--r--src/main/java/me/shedaniel/rei/api/IRecipeDisplay.java20
-rw-r--r--src/main/java/me/shedaniel/rei/api/IRecipePlugin.java12
-rw-r--r--src/main/java/me/shedaniel/rei/api/ItemRegisterer.java12
-rw-r--r--src/main/java/me/shedaniel/rei/api/PluginDisabler.java10
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeHelper.java26
-rw-r--r--src/main/java/me/shedaniel/rei/api/SpeedCraftAreaSupplier.java2
-rw-r--r--src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java12
-rw-r--r--src/main/java/me/shedaniel/rei/client/ConfigHelper.java4
-rw-r--r--src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java4
-rw-r--r--src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java6
-rw-r--r--src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java6
-rw-r--r--src/main/java/me/shedaniel/rei/mixin/MixinContainerScreen.java8
15 files changed, 79 insertions, 78 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/IDisplaySettings.java b/src/main/java/me/shedaniel/rei/api/IDisplaySettings.java
index 1cb315fb2..baf5aed79 100644
--- a/src/main/java/me/shedaniel/rei/api/IDisplaySettings.java
+++ b/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);
}
diff --git a/src/main/java/me/shedaniel/rei/api/IRecipeCategory.java b/src/main/java/me/shedaniel/rei/api/IRecipeCategory.java
index 9665e6a89..ad7605ac6 100644
--- a/src/main/java/me/shedaniel/rei/api/IRecipeCategory.java
+++ b/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;
}
diff --git a/src/main/java/me/shedaniel/rei/api/IRecipeCategoryCraftable.java b/src/main/java/me/shedaniel/rei/api/IRecipeCategoryCraftable.java
index a0ffb689e..696f5b229 100644
--- a/src/main/java/me/shedaniel/rei/api/IRecipeCategoryCraftable.java
+++ b/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);
}
diff --git a/src/main/java/me/shedaniel/rei/api/IRecipeDisplay.java b/src/main/java/me/shedaniel/rei/api/IRecipeDisplay.java
index 9d390385c..df68c8486 100644
--- a/src/main/java/me/shedaniel/rei/api/IRecipeDisplay.java
+++ b/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();
+
}
diff --git a/src/main/java/me/shedaniel/rei/api/IRecipePlugin.java b/src/main/java/me/shedaniel/rei/api/IRecipePlugin.java
index 16b7be3aa..2f351ea94 100644
--- a/src/main/java/me/shedaniel/rei/api/IRecipePlugin.java
+++ b/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;
}
diff --git a/src/main/java/me/shedaniel/rei/api/ItemRegisterer.java b/src/main/java/me/shedaniel/rei/api/ItemRegisterer.java
index 43ee25d60..6e22e2097 100644
--- a/src/main/java/me/shedaniel/rei/api/ItemRegisterer.java
+++ b/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);
diff --git a/src/main/java/me/shedaniel/rei/api/PluginDisabler.java b/src/main/java/me/shedaniel/rei/api/PluginDisabler.java
index 7db97a6ed..0c9ec9eb2 100644
--- a/src/main/java/me/shedaniel/rei/api/PluginDisabler.java
+++ b/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);
}
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
index 0e1cdcf6e..3cb0e783f 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
+++ b/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();
diff --git a/src/main/java/me/shedaniel/rei/api/SpeedCraftAreaSupplier.java b/src/main/java/me/shedaniel/rei/api/SpeedCraftAreaSupplier.java
index d4db1f072..685e17f77 100644
--- a/src/main/java/me/shedaniel/rei/api/SpeedCraftAreaSupplier.java
+++ b/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 "+";
diff --git a/src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java b/src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java
index bf89e3c2e..cec5a9f90 100644
--- a/src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java
+++ b/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);
+
}
diff --git a/src/main/java/me/shedaniel/rei/client/ConfigHelper.java b/src/main/java/me/shedaniel/rei/client/ConfigHelper.java
index d31ec4b88..2e5f9b6ea 100644
--- a/src/main/java/me/shedaniel/rei/client/ConfigHelper.java
+++ b/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();
diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
index ff1e13e6b..c7750ddb3 100644
--- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
+++ b/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);
}
diff --git a/src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java b/src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java
index 6aa884b8e..6793ac6f7 100644
--- a/src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java
+++ b/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);
}
diff --git a/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java b/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java
index 2df1d9458..7f727ae4c 100644
--- a/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java
+++ b/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);
}
diff --git a/src/main/java/me/shedaniel/rei/mixin/MixinContainerScreen.java b/src/main/java/me/shedaniel/rei/mixin/MixinContainerScreen.java
index aed78d463..c2f2114ec 100644
--- a/src/main/java/me/shedaniel/rei/mixin/MixinContainerScreen.java
+++ b/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"))