فهرست منبع

Stonecutter Recipes

Unknown 6 سال پیش
والد
کامیت
e8353e0d95

+ 2 - 2
build.gradle

@@ -6,10 +6,10 @@ sourceCompatibility = 1.8
 targetCompatibility = 1.8
 
 archivesBaseName = "RoughlyEnoughItems"
-version = "2.1.0.44"
+version = "2.1.0.45"
 
 def minecraftVersion = "19w04a"
-def yarnVersion = "19w04a.1"
+def yarnVersion = "19w04a.2"
 def fabricVersion = "0.1.4.79"
 def pluginLoaderVersion = "1.14-1.0.6-8"
 

+ 1 - 1
src/main/java/me/shedaniel/rei/plugin/DefaultCampfireCategory.java

@@ -55,7 +55,7 @@ public class DefaultCampfireCategory implements IRecipeCategory<DefaultCampfireD
                 drawTexturedRect(startPoint.x + 24, startPoint.y + 19, 82, 92, width, 17);
                 String text = I18n.translate("category.rei.campfire.time", MathHelper.floor(recipeDisplay.getCookTime() / 20d));
                 int length = MinecraftClient.getInstance().fontRenderer.getStringWidth(text);
-                MinecraftClient.getInstance().fontRenderer.drawWithShadow(text, bounds.x + bounds.width - length - 4, startPoint.y + 54 - 8, -1);
+                MinecraftClient.getInstance().fontRenderer.draw(text, bounds.x + bounds.width - length - 5, startPoint.y + 54 - 8, -1);
             }
         }));
         widgets.add(new ItemSlotWidget(startPoint.x + 1, startPoint.y + 11, recipeDisplay.getInput().get(0), true, true, containerGui, true));

+ 19 - 13
src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java

@@ -13,6 +13,7 @@ import net.minecraft.client.gui.container.FurnaceGui;
 import net.minecraft.client.gui.container.SmokerGui;
 import net.minecraft.client.gui.ingame.PlayerInventoryGui;
 import net.minecraft.recipe.Recipe;
+import net.minecraft.recipe.StonecuttingRecipe;
 import net.minecraft.recipe.cooking.BlastingRecipe;
 import net.minecraft.recipe.cooking.CampfireCookingRecipe;
 import net.minecraft.recipe.cooking.SmeltingRecipe;
@@ -30,6 +31,7 @@ public class DefaultPlugin implements IRecipePlugin {
     public static final Identifier SMOKING = new Identifier("roughlyenoughitems", "plugins/smoking");
     public static final Identifier BLASTING = new Identifier("roughlyenoughitems", "plugins/blasting");
     public static final Identifier CAMPFIRE = new Identifier("roughlyenoughitems", "plugins/campfire");
+    public static final Identifier STONE_CUTTING = new Identifier("roughlyenoughitems", "plugins/stone_cutting");
     public static final Identifier BREWING = new Identifier("roughlyenoughitems", "plugins/brewing");
     
     private static final List<DefaultBrewingDisplay> BREWING_DISPLAYS = Lists.newArrayList();
@@ -45,30 +47,34 @@ public class DefaultPlugin implements IRecipePlugin {
         RecipeHelper.registerCategory(new DefaultSmokingCategory());
         RecipeHelper.registerCategory(new DefaultBlastingCategory());
         RecipeHelper.registerCategory(new DefaultCampfireCategory());
+        RecipeHelper.registerCategory(new DefaultStoneCuttingCategory());
         RecipeHelper.registerCategory(new DefaultBrewingCategory());
     }
     
     @Override
     public void registerRecipes() {
-        for(Recipe value : RecipeHelper.getRecipeManager().values())
-            if (value instanceof ShapelessRecipe)
-                RecipeHelper.registerRecipe(CRAFTING, new DefaultShapelessDisplay((ShapelessRecipe) value));
-            else if (value instanceof ShapedRecipe)
-                RecipeHelper.registerRecipe(CRAFTING, new DefaultShapedDisplay((ShapedRecipe) value));
-            else if (value instanceof SmeltingRecipe)
-                RecipeHelper.registerRecipe(SMELTING, new DefaultSmeltingDisplay((SmeltingRecipe) value));
-            else if (value instanceof SmokingRecipe)
-                RecipeHelper.registerRecipe(SMOKING, new DefaultSmokingDisplay((SmokingRecipe) value));
-            else if (value instanceof BlastingRecipe)
-                RecipeHelper.registerRecipe(BLASTING, new DefaultBlastingDisplay((BlastingRecipe) value));
-            else if (value instanceof CampfireCookingRecipe)
-                RecipeHelper.registerRecipe(CAMPFIRE, new DefaultCampfireDisplay((CampfireCookingRecipe) value));
+        for(Recipe recipe : RecipeHelper.getRecipeManager().values())
+            if (recipe instanceof ShapelessRecipe)
+                RecipeHelper.registerRecipe(CRAFTING, new DefaultShapelessDisplay((ShapelessRecipe) recipe));
+            else if (recipe instanceof ShapedRecipe)
+                RecipeHelper.registerRecipe(CRAFTING, new DefaultShapedDisplay((ShapedRecipe) recipe));
+            else if (recipe instanceof SmeltingRecipe)
+                RecipeHelper.registerRecipe(SMELTING, new DefaultSmeltingDisplay((SmeltingRecipe) recipe));
+            else if (recipe instanceof SmokingRecipe)
+                RecipeHelper.registerRecipe(SMOKING, new DefaultSmokingDisplay((SmokingRecipe) recipe));
+            else if (recipe instanceof BlastingRecipe)
+                RecipeHelper.registerRecipe(BLASTING, new DefaultBlastingDisplay((BlastingRecipe) recipe));
+            else if (recipe instanceof CampfireCookingRecipe)
+                RecipeHelper.registerRecipe(CAMPFIRE, new DefaultCampfireDisplay((CampfireCookingRecipe) recipe));
+            else if (recipe instanceof StonecuttingRecipe)
+                RecipeHelper.registerRecipe(STONE_CUTTING, new DefaultStoneCuttingDisplay((StonecuttingRecipe) recipe));
         BREWING_DISPLAYS.forEach(display -> RecipeHelper.registerRecipe(BREWING, display));
     }
     
     @Override
     public void registerSpeedCraft() {
         RecipeHelper.registerSpeedCraftButtonArea(DefaultPlugin.CAMPFIRE, null);
+        RecipeHelper.registerSpeedCraftButtonArea(DefaultPlugin.STONE_CUTTING, null);
         RecipeHelper.registerSpeedCraftButtonArea(DefaultPlugin.BREWING, null);
         RecipeHelper.registerSpeedCraftFunctional(DefaultPlugin.CRAFTING, new SpeedCraftFunctional<DefaultCraftingDisplay>() {
             @Override

+ 59 - 0
src/main/java/me/shedaniel/rei/plugin/DefaultStoneCuttingCategory.java

@@ -0,0 +1,59 @@
+package me.shedaniel.rei.plugin;
+
+import com.mojang.blaze3d.platform.GlStateManager;
+import me.shedaniel.rei.api.IRecipeCategory;
+import me.shedaniel.rei.gui.widget.IWidget;
+import me.shedaniel.rei.gui.widget.ItemSlotWidget;
+import me.shedaniel.rei.gui.widget.RecipeBaseWidget;
+import me.shedaniel.rei.listeners.IMixinContainerGui;
+import net.minecraft.block.Blocks;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.render.GuiLighting;
+import net.minecraft.client.resource.language.I18n;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.Identifier;
+import net.minecraft.util.math.MathHelper;
+
+import java.awt.*;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+public class DefaultStoneCuttingCategory implements IRecipeCategory<DefaultStoneCuttingDisplay> {
+    
+    private static final Identifier DISPLAY_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/display.png");
+    
+    @Override
+    public Identifier getIdentifier() {
+        return DefaultPlugin.STONE_CUTTING;
+    }
+    
+    @Override
+    public ItemStack getCategoryIcon() {
+        return new ItemStack(Blocks.STONECUTTER);
+    }
+    
+    @Override
+    public String getCategoryName() {
+        return I18n.translate("category.rei.stone_cutting");
+    }
+    
+    @Override
+    public List<IWidget> setupDisplay(IMixinContainerGui containerGui, DefaultStoneCuttingDisplay recipeDisplay, Rectangle bounds) {
+        Point startPoint = new Point((int) bounds.getCenterX() - 41, (int) bounds.getCenterY() - 13);
+        List<IWidget> widgets = new LinkedList<>(Arrays.asList(new RecipeBaseWidget(bounds) {
+            @Override
+            public void draw(int mouseX, int mouseY, float partialTicks) {
+                super.draw(mouseX, mouseY, partialTicks);
+                GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
+                GuiLighting.disable();
+                MinecraftClient.getInstance().getTextureManager().bindTexture(DISPLAY_TEXTURE);
+                drawTexturedRect(startPoint.x, startPoint.y, 0, 221, 82, 26);
+            }
+        }));
+        widgets.add(new ItemSlotWidget(startPoint.x + 4, startPoint.y + 5, recipeDisplay.getInput().get(0), true, true, containerGui, true));
+        widgets.add(new ItemSlotWidget(startPoint.x + 61, startPoint.y + 5, recipeDisplay.getOutput(), false, true, containerGui, true));
+        return widgets;
+    }
+    
+}

+ 56 - 0
src/main/java/me/shedaniel/rei/plugin/DefaultStoneCuttingDisplay.java

@@ -0,0 +1,56 @@
+package me.shedaniel.rei.plugin;
+
+import com.google.common.collect.Lists;
+import me.shedaniel.rei.api.IRecipeDisplay;
+import net.minecraft.item.ItemStack;
+import net.minecraft.recipe.Ingredient;
+import net.minecraft.recipe.Recipe;
+import net.minecraft.recipe.StonecuttingRecipe;
+import net.minecraft.recipe.cooking.CampfireCookingRecipe;
+import net.minecraft.util.DefaultedList;
+import net.minecraft.util.Identifier;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+public class DefaultStoneCuttingDisplay implements IRecipeDisplay {
+    
+    private List<ItemStack> inputs, output;
+    
+    public DefaultStoneCuttingDisplay(StonecuttingRecipe recipe) {
+        this(recipe.getPreviewInputs(), recipe.getOutput());
+    }
+    
+    public DefaultStoneCuttingDisplay(DefaultedList<Ingredient> ingredients, ItemStack output) {
+        this.inputs = Lists.newArrayList();
+        ingredients.stream().map(ingredient -> ingredient.getStackArray()).forEach(itemStacks -> Collections.addAll(inputs, itemStacks));
+        this.output = Arrays.asList(output);
+    }
+    
+    @Override
+    public Recipe getRecipe() {
+        return null;
+    }
+    
+    @Override
+    public List<List<ItemStack>> getInput() {
+        return Arrays.asList(inputs);
+    }
+    
+    @Override
+    public List<ItemStack> getOutput() {
+        return this.output;
+    }
+    
+    @Override
+    public Identifier getRecipeCategory() {
+        return DefaultPlugin.STONE_CUTTING;
+    }
+    
+    @Override
+    public List<List<ItemStack>> getRequiredItems() {
+        return getInput();
+    }
+    
+}

+ 3 - 2
src/main/resources/assets/roughlyenoughitems/lang/en_us.json

@@ -4,14 +4,15 @@
   "key.roughlyenoughitems.hide_keybind": "Hide/Show REI",
   "key.roughlyenoughitems.usage_keybind": "Show Uses",
   "text.rei.cheat": "Cheat",
-  "text.rei.nocheat": "§4§mCheat",
+  "text.rei.nocheat": "§c§mCheat",
   "category.rei.crafting": "Crafting",
   "category.rei.smelting": "Smelting",
   "category.rei.smelting.fuel": "§eFuel",
   "category.rei.smoking": "Smoking",
   "category.rei.blasting": "Blasting",
   "category.rei.campfire": "Campfire",
-  "category.rei.campfire.time": "%d Seconds",
+  "category.rei.campfire.time": "§8%d Seconds",
+  "category.rei.stone_cutting": "Stone Cutting",
   "category.rei.brewing": "Brewing",
   "category.rei.brewing.input": "§eOriginal Potion",
   "category.rei.brewing.reactant": "§eIngredient",

+ 1 - 1
src/main/resources/assets/roughlyenoughitems/lang/fr_fr.json

@@ -4,7 +4,7 @@
   "key.roughlyenoughitems.hide_keybind": "Masquer/afficher REI",
   "key.roughlyenoughitems.usage_keybind": "Afficher les utilisations",
   "text.rei.cheat": "Triche",
-  "text.rei.nocheat": "§4§mTriche",
+  "text.rei.nocheat": "§c§mTriche",
   "category.rei.crafting": "Fabrication",
   "category.rei.smelting": "Cuisson",
   "category.rei.smelting.fuel": "§eCombustible",

+ 4 - 1
src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json

@@ -4,12 +4,15 @@
   "key.roughlyenoughitems.hide_keybind": "隐藏/显示 REI",
   "key.roughlyenoughitems.usage_keybind": "显示用途",
   "text.rei.cheat": "作弊",
-  "text.rei.nocheat": "§4§m作弊",
+  "text.rei.nocheat": "§c§m作弊",
   "category.rei.crafting": "合成",
   "category.rei.smelting": "冶炼",
   "category.rei.smelting.fuel": "§e燃料",
   "category.rei.smoking": "烟熏",
   "category.rei.blasting": "熔炼",
+  "category.rei.campfire": "营火",
+  "category.rei.campfire.time": "§8%d 秒",
+  "category.rei.stone_cutting": "切石",
   "category.rei.brewing": "酿造",
   "category.rei.brewing.input": "§e输入药水",
   "category.rei.brewing.reactant": "§e材料",

+ 4 - 1
src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json

@@ -4,12 +4,15 @@
   "key.roughlyenoughitems.hide_keybind": "隱藏/顯示 REI",
   "key.roughlyenoughitems.usage_keybind": "顯示用途",
   "text.rei.cheat": "作弊",
-  "text.rei.nocheat": "§4§m作弊",
+  "text.rei.nocheat": "§c§m作弊",
   "category.rei.crafting": "合成",
   "category.rei.smelting": "冶煉",
   "category.rei.smelting.fuel": "§e燃料",
   "category.rei.smoking": "煙燻",
   "category.rei.blasting": "熔煉",
+  "category.rei.campfire": "營火",
+  "category.rei.campfire.time": "§8%d 秒",
+  "category.rei.stone_cutting": "切石",
   "category.rei.brewing": "釀造",
   "category.rei.brewing.input": "§e輸入藥水",
   "category.rei.brewing.reactant": "§e材料",

BIN
src/main/resources/assets/roughlyenoughitems/textures/gui/display.png