aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/plugin
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-01-16 16:10:19 +0800
committershedaniel <daniel@shedaniel.me>2020-01-16 16:10:19 +0800
commitb4be45e414504afb49910d766bebcd00f55b052b (patch)
tree05c36b311681a120c0e3c85131531a159fbc59c2 /src/main/java/me/shedaniel/rei/plugin
parent01e8ede4fc41f6f113ae623044c3a4e98ed81eb4 (diff)
downloadRoughlyEnoughItems-b4be45e414504afb49910d766bebcd00f55b052b.tar.gz
RoughlyEnoughItems-b4be45e414504afb49910d766bebcd00f55b052b.tar.bz2
RoughlyEnoughItems-b4be45e414504afb49910d766bebcd00f55b052b.zip
3.3.11
Diffstat (limited to 'src/main/java/me/shedaniel/rei/plugin')
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultCategoryHandler.java12
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java2
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java6
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java10
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingDisplay.java20
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingCategory.java16
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java2
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/stonecutting/DefaultStoneCuttingDisplay.java16
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/stripping/DefaultStrippingCategory.java12
9 files changed, 48 insertions, 48 deletions
diff --git a/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultCategoryHandler.java b/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultCategoryHandler.java
index 94558cdd9..d4616fcd4 100644
--- a/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultCategoryHandler.java
+++ b/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultCategoryHandler.java
@@ -29,11 +29,11 @@ import net.minecraft.util.PacketByteBuf;
import java.util.List;
public class DefaultCategoryHandler implements AutoTransferHandler {
-
+
public static boolean canUseMovePackets() {
return ClientSidePacketRegistry.INSTANCE.canServerReceive(RoughlyEnoughItemsNetwork.MOVE_ITEMS_PACKET);
}
-
+
@Override
public Result handle(Context context) {
if (!(context.getRecipe() instanceof TransferRecipeDisplay))
@@ -54,14 +54,14 @@ public class DefaultCategoryHandler implements AutoTransferHandler {
return Result.createFailed("error.rei.not.on.server");
if (!context.isActuallyCrafting())
return Result.createSuccessful();
-
+
context.getMinecraft().openScreen(containerScreen);
if (containerScreen instanceof RecipeBookProvider)
((RecipeBookGuiHooks) ((RecipeBookProvider) containerScreen).getRecipeBookGui()).rei_getGhostSlots().reset();
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeIdentifier(recipe.getRecipeCategory());
buf.writeBoolean(Screen.hasShiftDown());
-
+
buf.writeInt(input.size());
for (List<EntryStack> stacks : input) {
buf.writeInt(stacks.size());
@@ -75,12 +75,12 @@ public class DefaultCategoryHandler implements AutoTransferHandler {
ClientSidePacketRegistry.INSTANCE.sendToServer(RoughlyEnoughItemsNetwork.MOVE_ITEMS_PACKET, buf);
return Result.createSuccessful();
}
-
+
@Override
public double getPriority() {
return -10;
}
-
+
public IntList hasItems(List<List<EntryStack>> inputs) {
// Create a clone of player's inventory, and count
DefaultedList<ItemStack> copyMain = DefaultedList.of();
diff --git a/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java b/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java
index 7efb2c9bd..83f1b861c 100644
--- a/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java
+++ b/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java
@@ -73,7 +73,7 @@ public class DefaultRecipeBookHandler implements AutoTransferHandler {
}
return Result.createNotApplicable();
}
-
+
@Override
public double getPriority() {
return -20;
diff --git a/src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java b/src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java
index 5275af556..24551d382 100644
--- a/src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java
+++ b/src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java
@@ -9,15 +9,15 @@ import net.minecraft.item.Item;
import net.minecraft.recipe.Ingredient;
public class BrewingRecipe {
-
+
public final Item input;
public final Ingredient ingredient;
public final Item output;
-
+
public BrewingRecipe(Item object_1, Ingredient ingredient_1, Item object_2) {
this.input = object_1;
this.ingredient = ingredient_1;
this.output = object_2;
}
-
+
} \ No newline at end of file
diff --git a/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java b/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java
index 98692590d..f3080a60d 100644
--- a/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java
+++ b/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java
@@ -27,22 +27,22 @@ import java.util.List;
import java.util.function.Supplier;
public class DefaultCampfireCategory implements RecipeCategory<DefaultCampfireDisplay> {
-
+
@Override
public Identifier getIdentifier() {
return DefaultPlugin.CAMPFIRE;
}
-
+
@Override
public EntryStack getLogo() {
return EntryStack.create(Blocks.CAMPFIRE);
}
-
+
@Override
public String getCategoryName() {
return I18n.translate("category.rei.campfire");
}
-
+
@Override
public List<Widget> setupDisplay(Supplier<DefaultCampfireDisplay> recipeDisplaySupplier, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
@@ -59,7 +59,7 @@ public class DefaultCampfireCategory implements RecipeCategory<DefaultCampfireDi
MinecraftClient.getInstance().textRenderer.draw(text, bounds.x + bounds.width - length - 5, bounds.y + 5, ScreenHelper.isDarkModeEnabled() ? 0xFFBBBBBB : 0xFF404040);
}
}));
- widgets.add(new RecipeArrowWidget(startPoint.x + 24, startPoint.y + 8, true));
+ widgets.add(RecipeArrowWidget.create(new Point(startPoint.x + 24, startPoint.y + 8), true));
widgets.add(EntryWidget.create(startPoint.x + 1, startPoint.y + 1).entries(recipeDisplaySupplier.get().getInputEntries().get(0)));
widgets.add(EntryWidget.create(startPoint.x + 61, startPoint.y + 9).entries(recipeDisplaySupplier.get().getOutputEntries()).noBackground());
return widgets;
diff --git a/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingDisplay.java
index 1c9b9b0ec..d799a30f5 100644
--- a/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingDisplay.java
+++ b/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingDisplay.java
@@ -16,12 +16,12 @@ import java.util.*;
import java.util.stream.Collectors;
public class DefaultCompostingDisplay implements RecipeDisplay {
-
+
private List<EntryStack> order, allItems;
private Map<ItemConvertible, Float> inputMap;
private List<EntryStack> output;
private int page;
-
+
public DefaultCompostingDisplay(int page, List<ItemConvertible> order, Map<ItemConvertible, Float> inputMap, List<ItemConvertible> allItems, ItemStack[] output) {
this.page = page;
this.order = order.stream().map(EntryStack::create).collect(Collectors.toList());
@@ -29,11 +29,11 @@ public class DefaultCompostingDisplay implements RecipeDisplay {
this.output = Arrays.asList(output).stream().map(EntryStack::create).collect(Collectors.toList());
this.allItems = allItems.stream().map(EntryStack::create).collect(Collectors.toList());
}
-
+
public int getPage() {
return page;
}
-
+
@Override
public List<List<EntryStack>> getInputEntries() {
List<List<EntryStack>> lists = new ArrayList<>();
@@ -42,28 +42,28 @@ public class DefaultCompostingDisplay implements RecipeDisplay {
}
return lists;
}
-
+
public Map<ItemConvertible, Float> getInputMap() {
return inputMap;
}
-
+
@Override
public List<EntryStack> getOutputEntries() {
return output;
}
-
+
@Override
public Identifier getRecipeCategory() {
return DefaultPlugin.COMPOSTING;
}
-
+
@Override
public List<List<EntryStack>> getRequiredEntries() {
return Collections.singletonList(allItems);
}
-
+
public List<EntryStack> getItemsByOrder() {
return order;
}
-
+
}
diff --git a/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingCategory.java b/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingCategory.java
index 693d79019..6f7514ead 100644
--- a/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingCategory.java
+++ b/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingCategory.java
@@ -34,13 +34,13 @@ public class DefaultCookingCategory implements TransferRecipeCategory<DefaultCoo
private Identifier identifier;
private EntryStack logo;
private String categoryName;
-
+
public DefaultCookingCategory(Identifier identifier, EntryStack logo, String categoryName) {
this.identifier = identifier;
this.logo = logo;
this.categoryName = categoryName;
}
-
+
@Override
public void renderRedSlots(List<Widget> widgets, Rectangle bounds, DefaultCookingDisplay display, IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
@@ -50,7 +50,7 @@ public class DefaultCookingCategory implements TransferRecipeCategory<DefaultCoo
}
RenderSystem.translatef(0, 0, -400);
}
-
+
@Override
public List<Widget> setupDisplay(Supplier<DefaultCookingDisplay> recipeDisplaySupplier, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
@@ -65,15 +65,15 @@ public class DefaultCookingCategory implements TransferRecipeCategory<DefaultCoo
String text = I18n.translate("category.rei.cooking.xp", recipeDisplaySupplier.get().getXp());
int length = MinecraftClient.getInstance().textRenderer.getStringWidth(text);
MinecraftClient.getInstance().textRenderer.draw(text, bounds.x + bounds.width - length - 5, bounds.y + 5, ScreenHelper.isDarkModeEnabled() ? 0xFFBBBBBB : 0xFF404040);
-
+
}
}));
- widgets.add(new RecipeArrowWidget(startPoint.x + 24, startPoint.y + 8, true));
+ widgets.add(RecipeArrowWidget.create(new Point(startPoint.x + 24, startPoint.y + 8), true));
widgets.add(EntryWidget.create(startPoint.x + 1, startPoint.y + 1).entries(recipeDisplaySupplier.get().getInputEntries().get(0)));
widgets.add(EntryWidget.create(startPoint.x + 61, startPoint.y + 9).entries(recipeDisplaySupplier.get().getOutputEntries()).noBackground());
return widgets;
}
-
+
@Override
public RecipeEntry getSimpleRenderer(DefaultCookingDisplay recipe) {
return SimpleRecipeEntry.create(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getOutputEntries());
@@ -88,12 +88,12 @@ public class DefaultCookingCategory implements TransferRecipeCategory<DefaultCoo
public Identifier getIdentifier() {
return identifier;
}
-
+
@Override
public EntryStack getLogo() {
return logo;
}
-
+
@Override
public String getCategoryName() {
return I18n.translate(categoryName);
diff --git a/src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java b/src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java
index 12cf78071..085d64592 100644
--- a/src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java
+++ b/src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java
@@ -99,7 +99,7 @@ public class DefaultInformationCategory implements RecipeCategory<DefaultInforma
public List<Widget> setupDisplay(Supplier<DefaultInformationDisplay> recipeDisplaySupplier, Rectangle bounds) {
DefaultInformationDisplay display = recipeDisplaySupplier.get();
List<Widget> widgets = Lists.newArrayList();
- widgets.add(new LabelWidget(new Point(bounds.getCenterX(), bounds.y + 3), display.getName().asFormattedString()).noShadow().color(ScreenHelper.isDarkModeEnabled() ? 0xFFBBBBBB : 0xFF404040));
+ widgets.add(LabelWidget.create(new Point(bounds.getCenterX(), bounds.y + 3), display.getName().asFormattedString()).noShadow().color(ScreenHelper.isDarkModeEnabled() ? 0xFFBBBBBB : 0xFF404040));
widgets.add(EntryWidget.create(bounds.getCenterX() - 8, bounds.y + 15).entries(display.getEntryStacks()));
Rectangle rectangle = new Rectangle(bounds.getCenterX() - (bounds.width / 2), bounds.y + 35, bounds.width, bounds.height - 40);
widgets.add(new SlotBaseWidget(rectangle));
diff --git a/src/main/java/me/shedaniel/rei/plugin/stonecutting/DefaultStoneCuttingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/stonecutting/DefaultStoneCuttingDisplay.java
index 384d4b31d..1d567d79d 100644
--- a/src/main/java/me/shedaniel/rei/plugin/stonecutting/DefaultStoneCuttingDisplay.java
+++ b/src/main/java/me/shedaniel/rei/plugin/stonecutting/DefaultStoneCuttingDisplay.java
@@ -22,16 +22,16 @@ import java.util.Optional;
import java.util.stream.Collectors;
public class DefaultStoneCuttingDisplay implements RecipeDisplay {
-
+
private List<List<EntryStack>> inputs;
private List<EntryStack> output;
private StonecuttingRecipe display;
-
+
public DefaultStoneCuttingDisplay(StonecuttingRecipe recipe) {
this(recipe.getPreviewInputs(), recipe.getOutput());
this.display = recipe;
}
-
+
public DefaultStoneCuttingDisplay(DefaultedList<Ingredient> ingredients, ItemStack output) {
this.inputs = ingredients.stream().map(i -> {
List<EntryStack> entries = new ArrayList<>();
@@ -42,27 +42,27 @@ public class DefaultStoneCuttingDisplay implements RecipeDisplay {
}).collect(Collectors.toList());
this.output = Collections.singletonList(EntryStack.create(output));
}
-
+
@Override
public Optional<Identifier> getRecipeLocation() {
return Optional.ofNullable(display).map(CuttingRecipe::getId);
}
-
+
@Override
public List<List<EntryStack>> getInputEntries() {
return inputs;
}
-
+
@Override
public List<EntryStack> getOutputEntries() {
return output;
}
-
+
@Override
public Identifier getRecipeCategory() {
return DefaultPlugin.STONE_CUTTING;
}
-
+
@Override
public List<List<EntryStack>> getRequiredEntries() {
return getInputEntries();
diff --git a/src/main/java/me/shedaniel/rei/plugin/stripping/DefaultStrippingCategory.java b/src/main/java/me/shedaniel/rei/plugin/stripping/DefaultStrippingCategory.java
index fab5dd6aa..4c0a05e37 100644
--- a/src/main/java/me/shedaniel/rei/plugin/stripping/DefaultStrippingCategory.java
+++ b/src/main/java/me/shedaniel/rei/plugin/stripping/DefaultStrippingCategory.java
@@ -24,22 +24,22 @@ import java.util.List;
import java.util.function.Supplier;
public class DefaultStrippingCategory implements RecipeCategory<DefaultStrippingDisplay> {
-
+
@Override
public Identifier getIdentifier() {
return DefaultPlugin.STRIPPING;
}
-
+
@Override
public EntryStack getLogo() {
return EntryStack.create(Items.IRON_AXE);
}
-
+
@Override
public String getCategoryName() {
return I18n.translate("category.rei.stripping");
}
-
+
@Override
public List<Widget> setupDisplay(Supplier<DefaultStrippingDisplay> recipeDisplaySupplier, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 13);
@@ -55,10 +55,10 @@ public class DefaultStrippingCategory implements RecipeCategory<DefaultStripping
widgets.add(EntryWidget.create(startPoint.x + 61, startPoint.y + 5).entry(recipeDisplaySupplier.get().getOut()).noBackground());
return widgets;
}
-
+
@Override
public int getDisplayHeight() {
return 36;
}
-
+
}