diff options
| author | shedaniel <daniel@shedaniel.me> | 2019-12-24 11:31:40 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2019-12-24 11:31:40 +0800 |
| commit | 08d80d588a36598114087a79917e36e9d2cc97c3 (patch) | |
| tree | 95cde698bbf1eca2f83143d39fd206cf2dc803f2 /src/main/java/me/shedaniel/rei/plugin | |
| parent | 7d438f554c4173880a407a6bb8fc80b8a4723845 (diff) | |
| download | RoughlyEnoughItems-08d80d588a36598114087a79917e36e9d2cc97c3.tar.gz RoughlyEnoughItems-08d80d588a36598114087a79917e36e9d2cc97c3.tar.bz2 RoughlyEnoughItems-08d80d588a36598114087a79917e36e9d2cc97c3.zip | |
Finishing workstation usage and close #220
Diffstat (limited to 'src/main/java/me/shedaniel/rei/plugin')
28 files changed, 191 insertions, 191 deletions
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java b/src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java index 29551f5be..4b4140819 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java @@ -15,19 +15,19 @@ import net.fabricmc.loader.util.version.VersionParsingException; import net.minecraft.util.Identifier; public class DefaultAutoCraftingPlugin implements REIPluginV0 { - + public static final Identifier PLUGIN = new Identifier("roughlyenoughitems", "default_auto_crafting_plugin"); - + @Override public Identifier getPluginIdentifier() { return PLUGIN; } - + @Override public SemanticVersion getMinimumVersion() throws VersionParsingException { return SemanticVersion.parse("3.0-pre"); } - + @Override public void registerOthers(RecipeHelper recipeHelper) { if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) { diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java index 614f98445..feb52f347 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java @@ -55,7 +55,7 @@ import net.minecraft.util.registry.Registry; import java.util.*; public class DefaultPlugin implements REIPluginV0 { - + public static final Identifier CRAFTING = new Identifier("minecraft", "plugins/crafting"); public static final Identifier SMELTING = new Identifier("minecraft", "plugins/smelting"); public static final Identifier SMOKING = new Identifier("minecraft", "plugins/smoking"); @@ -69,25 +69,25 @@ public class DefaultPlugin implements REIPluginV0 { private static final Identifier DISPLAY_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/display.png"); private static final Identifier DISPLAY_TEXTURE_DARK = new Identifier("roughlyenoughitems", "textures/gui/display_dark.png"); private static final List<DefaultBrewingDisplay> BREWING_DISPLAYS = Lists.newArrayList(); - + public static Identifier getDisplayTexture() { return ScreenHelper.isDarkModeEnabled() ? DISPLAY_TEXTURE_DARK : DISPLAY_TEXTURE; } - + public static void registerBrewingDisplay(DefaultBrewingDisplay display) { BREWING_DISPLAYS.add(display); } - + @Override public Identifier getPluginIdentifier() { return PLUGIN; } - + @Override public SemanticVersion getMinimumVersion() throws VersionParsingException { return SemanticVersion.parse("3.0-pre"); } - + @Override public void registerEntries(EntryRegistry entryRegistry) { if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) { @@ -124,7 +124,7 @@ public class DefaultPlugin implements REIPluginV0 { entryRegistry.registerEntry(EntryStack.create(fluid)); } } - + @Override public void registerPluginCategories(RecipeHelper recipeHelper) { if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) { @@ -140,7 +140,7 @@ public class DefaultPlugin implements REIPluginV0 { recipeHelper.registerCategory(new DefaultCompostingCategory()); recipeHelper.registerCategory(new DefaultStrippingCategory()); } - + @Override public void registerRecipeDisplays(RecipeHelper recipeHelper) { if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) { @@ -194,7 +194,7 @@ public class DefaultPlugin implements REIPluginV0 { recipeHelper.registerDisplay(STRIPPING, new DefaultStrippingDisplay(new ItemStack(set.getKey()), new ItemStack(set.getValue()))); }); } - + @Override public void postRegister() { // Sit tight! This will be a fast journey! @@ -213,12 +213,12 @@ public class DefaultPlugin implements REIPluginV0 { time = System.currentTimeMillis() - time; RoughlyEnoughItemsCore.LOGGER.info("[REI] Applied Check Tags for potion in %dms.", time); } - + private void applyPotionTransformer(EntryStack stack) { if (stack.getItem() instanceof PotionItem) stack.addSetting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE); } - + @Override public void registerBounds(DisplayHelper displayHelper) { if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) { @@ -237,18 +237,18 @@ public class DefaultPlugin implements REIPluginV0 { public Class<?> getBaseSupportedClass() { return AbstractContainerScreen.class; } - + @Override public Rectangle getLeftBounds(AbstractContainerScreen<?> screen) { return new Rectangle(2, 0, ScreenHelper.getLastContainerScreenHooks().rei_getContainerLeft() - 4, MinecraftClient.getInstance().getWindow().getScaledHeight()); } - + @Override public Rectangle getRightBounds(AbstractContainerScreen<?> screen) { int startX = ScreenHelper.getLastContainerScreenHooks().rei_getContainerLeft() + ScreenHelper.getLastContainerScreenHooks().rei_getContainerWidth() + 2; return new Rectangle(startX, 0, MinecraftClient.getInstance().getWindow().getScaledWidth() - startX - 2, MinecraftClient.getInstance().getWindow().getScaledHeight()); } - + @Override public float getPriority() { return -1.0f; @@ -259,18 +259,18 @@ public class DefaultPlugin implements REIPluginV0 { public Class<?> getBaseSupportedClass() { return RecipeViewingScreen.class; } - + @Override public Rectangle getLeftBounds(RecipeViewingScreen screen) { return new Rectangle(2, 0, ((RecipeViewingScreen) screen).getBounds().x - 4, MinecraftClient.getInstance().getWindow().getScaledHeight()); } - + @Override public Rectangle getRightBounds(RecipeViewingScreen screen) { int startX = ((RecipeViewingScreen) screen).getBounds().x + ((RecipeViewingScreen) screen).getBounds().width + 2; return new Rectangle(startX, 0, MinecraftClient.getInstance().getWindow().getScaledWidth() - startX - 2, MinecraftClient.getInstance().getWindow().getScaledHeight()); } - + @Override public float getPriority() { return -1.0f; @@ -281,25 +281,25 @@ public class DefaultPlugin implements REIPluginV0 { public Class<?> getBaseSupportedClass() { return VillagerRecipeViewingScreen.class; } - + @Override public Rectangle getLeftBounds(VillagerRecipeViewingScreen screen) { return new Rectangle(2, 0, ((VillagerRecipeViewingScreen) screen).bounds.x - 4, MinecraftClient.getInstance().getWindow().getScaledHeight()); } - + @Override public Rectangle getRightBounds(VillagerRecipeViewingScreen screen) { int startX = ((VillagerRecipeViewingScreen) screen).bounds.x + ((VillagerRecipeViewingScreen) screen).bounds.width + 2; return new Rectangle(startX, 0, MinecraftClient.getInstance().getWindow().getScaledWidth() - startX - 2, MinecraftClient.getInstance().getWindow().getScaledHeight()); } - + @Override public float getPriority() { return -1.0f; } }); } - + @Override public void registerOthers(RecipeHelper recipeHelper) { if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) { @@ -322,10 +322,10 @@ public class DefaultPlugin implements REIPluginV0 { recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), SmokerScreen.class, SMOKING); recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), BlastFurnaceScreen.class, BLASTING); } - + @Override public int getPriority() { return -1; } - + } diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java b/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java index 5e50fe3f1..5c883e8be 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java @@ -19,7 +19,7 @@ import java.util.List; import java.util.function.Supplier; public class DefaultRecipeBookExclusionZones implements Supplier<List<Rectangle>> { - + @Override public List<Rectangle> get() { if (!MinecraftClient.getInstance().player.getRecipeBook().isGuiOpen() || !(MinecraftClient.getInstance().currentScreen instanceof RecipeBookProvider) || !(ScreenHelper.getLastContainerScreen().getContainer() instanceof CraftingContainer)) @@ -31,5 +31,5 @@ public class DefaultRecipeBookExclusionZones implements Supplier<List<Rectangle> l.add(new Rectangle(screenHooks.rei_getContainerLeft() - 4 - 145 - 30, screenHooks.rei_getContainerTop(), 30, size * 27)); return l; } - + } 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 d4616fcd4..94558cdd9 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 83f1b861c..7efb2c9bd 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/blasting/DefaultBlastingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingDisplay.java index 510d5eb96..889b057e4 100644 --- a/src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingDisplay.java @@ -11,11 +11,11 @@ import net.minecraft.recipe.BlastingRecipe; import net.minecraft.util.Identifier; public class DefaultBlastingDisplay extends DefaultCookingDisplay { - + public DefaultBlastingDisplay(BlastingRecipe recipe) { super(recipe); } - + @Override public Identifier getRecipeCategory() { return DefaultPlugin.BLASTING; 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 24551d382..5275af556 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/brewing/DefaultBrewingCategory.java b/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingCategory.java index 2e9273038..c08ef53c1 100644 --- a/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingCategory.java +++ b/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingCategory.java @@ -26,22 +26,22 @@ import java.util.List; import java.util.function.Supplier; public class DefaultBrewingCategory implements RecipeCategory<DefaultBrewingDisplay> { - + @Override public Identifier getIdentifier() { return DefaultPlugin.BREWING; } - + @Override public EntryStack getLogo() { return EntryStack.create(Blocks.BREWING_STAND); } - + @Override public String getCategoryName() { return I18n.translate("category.rei.brewing"); } - + @Override public List<Widget> setupDisplay(Supplier<DefaultBrewingDisplay> recipeDisplaySupplier, Rectangle bounds) { final DefaultBrewingDisplay recipeDisplay = recipeDisplaySupplier.get(); @@ -64,5 +64,5 @@ public class DefaultBrewingCategory implements RecipeCategory<DefaultBrewingDisp widgets.add(EntryWidget.create(startPoint.x + 86, startPoint.y + 35).entries(recipeDisplay.getOutput(2)).noBackground()); return widgets; } - + } diff --git a/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java index 21ca07b14..8159966fc 100644 --- a/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java @@ -20,10 +20,10 @@ import java.util.Collections; import java.util.List; public class DefaultBrewingDisplay implements RecipeDisplay { - + private EntryStack input, output; private List<EntryStack> reactant; - + public DefaultBrewingDisplay(ItemStack input, Ingredient reactant, ItemStack output) { this.input = EntryStack.create(input).setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(Formatting.YELLOW.toString() + I18n.translate("category.rei.brewing.input"))); this.reactant = new ArrayList<>(); @@ -34,22 +34,22 @@ public class DefaultBrewingDisplay implements RecipeDisplay { } this.output = EntryStack.create(output).setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(Formatting.YELLOW.toString() + I18n.translate("category.rei.brewing.result"))); } - + @Override public List<List<EntryStack>> getInputEntries() { return Lists.newArrayList(Collections.singletonList(input), reactant); } - + @Override public List<EntryStack> getOutputEntries() { return Collections.singletonList(output); } - + @Override public Identifier getRecipeCategory() { return DefaultPlugin.BREWING; } - + public List<EntryStack> getOutput(int slot) { List<EntryStack> stack = new ArrayList<>(); for (int i = 0; i < slot * 2; i++) @@ -58,7 +58,7 @@ public class DefaultBrewingDisplay implements RecipeDisplay { stack.addAll(getOutputEntries()); return stack; } - + @Override public List<List<EntryStack>> getRequiredEntries() { return getInputEntries(); 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 478ecbc0e..81edb1662 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.getCenterY() - 27); @@ -64,5 +64,5 @@ public class DefaultCampfireCategory implements RecipeCategory<DefaultCampfireDi widgets.add(EntryWidget.create(startPoint.x + 61, startPoint.y + 19).entries(recipeDisplaySupplier.get().getOutputEntries()).noBackground()); return widgets; } - + } diff --git a/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java b/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java index 351376633..a11a0c5aa 100644 --- a/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java @@ -22,17 +22,17 @@ import java.util.Optional; import java.util.stream.Collectors; public class DefaultCampfireDisplay implements RecipeDisplay { - + private List<List<EntryStack>> inputs; private List<EntryStack> output; private int cookTime; private CampfireCookingRecipe display; - + public DefaultCampfireDisplay(CampfireCookingRecipe recipe) { this(recipe.getPreviewInputs(), recipe.getOutput(), recipe.getCookTime()); this.display = recipe; } - + public DefaultCampfireDisplay(DefaultedList<Ingredient> ingredients, ItemStack output, int cookTime) { this.inputs = ingredients.stream().map(i -> { List<EntryStack> entries = new ArrayList<>(); @@ -44,34 +44,34 @@ public class DefaultCampfireDisplay implements RecipeDisplay { this.output = Collections.singletonList(EntryStack.create(output)); this.cookTime = cookTime; } - + public int getCookTime() { return cookTime; } - + @Override public Optional<Identifier> getRecipeLocation() { return Optional.ofNullable(display).map(AbstractCookingRecipe::getId); } - + @Override public List<List<EntryStack>> getInputEntries() { return inputs; } - + @Override public List<EntryStack> getOutputEntries() { return output; } - + @Override public List<List<EntryStack>> getRequiredEntries() { return inputs; } - + @Override public Identifier getRecipeCategory() { return DefaultPlugin.CAMPFIRE; } - + } diff --git a/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java b/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java index 96d3e2027..c0a9c0db0 100644 --- a/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java +++ b/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java @@ -31,22 +31,22 @@ import java.util.Map; import java.util.function.Supplier; public class DefaultCompostingCategory implements RecipeCategory<DefaultCompostingDisplay> { - + @Override public Identifier getIdentifier() { return DefaultPlugin.COMPOSTING; } - + @Override public EntryStack getLogo() { return EntryStack.create(Blocks.COMPOSTER); } - + @Override public String getCategoryName() { return I18n.translate("category.rei.composting"); } - + @Override public RecipeEntry getSimpleRenderer(DefaultCompostingDisplay recipe) { return new RecipeEntry() { @@ -54,20 +54,20 @@ public class DefaultCompostingCategory implements RecipeCategory<DefaultComposti public int getHeight() { return 10 + MinecraftClient.getInstance().textRenderer.fontHeight; } - + @Nullable @Override public QueuedTooltip getTooltip(int mouseX, int mouseY) { return null; } - + @Override public void render(Rectangle rectangle, int mouseX, int mouseY, float delta) { MinecraftClient.getInstance().textRenderer.draw(I18n.translate("text.rei.composting.page", recipe.getPage() + 1), rectangle.x + 5, rectangle.y + 6, -1); } }; } - + @Override public List<Widget> setupDisplay(Supplier<DefaultCompostingDisplay> recipeDisplaySupplier, Rectangle bounds) { List<Widget> widgets = Lists.newArrayList(); @@ -98,12 +98,12 @@ public class DefaultCompostingCategory implements RecipeCategory<DefaultComposti widgets.add(EntryWidget.create(startingPoint.x + 34, startingPoint.y + 5).entries(recipeDisplaySupplier.get().getOutputEntries()).noBackground()); return widgets; } - + @Override public int getDisplayHeight() { return 140; } - + @SuppressWarnings("deprecation") @Override public int getFixedRecipesPerPage() { 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 d799a30f5..1c9b9b0ec 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 |
