Rolling machine port/fixes

This commit is contained in:
modmuss50 2019-08-12 15:05:49 +01:00
parent 1dd83875ef
commit 2a5708b328
23 changed files with 472 additions and 124 deletions

View file

@ -88,9 +88,12 @@ dependencies {
//Fabric api
modCompile "net.fabricmc.fabric-api:fabric-api:0.3.1+build.208"
modCompile "io.github.prospector.modmenu:ModMenu:1.5.4-85"
modCompile "io.github.prospector:modmenu:1.7.7+build.116"
modCompile "io.github.prospector.silk:SilkAPI:1.2.4-43"
modCompile "me.shedaniel:RoughlyEnoughItems:2.9.7+build.143"
modCompile ("me.shedaniel:RoughlyEnoughItems:2.9.7+build.145") {
//Thanks for moving the project breaking gradle...
exclude group: 'io.github.prospector.modmenu', module: 'ModMenu'
}
def rcVersion = 'RebornCore:RebornCore-1.14.4:+'

View file

@ -0,0 +1,84 @@
package techreborn.api.recipe.recipes;
import com.google.gson.JsonObject;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.world.World;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.ingredient.RebornIngredient;
import java.util.Collections;
import java.util.List;
public class RollingMachineRecipe extends RebornRecipe {
private ShapedRecipe shapedRecipe;
private JsonObject shaped;
public RollingMachineRecipe(RebornRecipeType<?> type, Identifier name) {
super(type, name);
}
@Override
public void deserialize(JsonObject jsonObject) {
shaped = JsonHelper.getObject(jsonObject, "shaped");
shapedRecipe = RecipeSerializer.SHAPED.read(getId(), shaped);
}
@Override
public void serialize(JsonObject jsonObject) {
jsonObject.add("shaped", shaped);
}
@Override
public DefaultedList<RebornIngredient> getRebornIngredients() {
return DefaultedList.of();
}
@Override
public List<ItemStack> getOutputs() {
return Collections.singletonList(shapedRecipe.getOutput());
}
@SuppressWarnings("deprecation")
@Override
public ItemStack getOutput() {
return shapedRecipe.getOutput();
}
@SuppressWarnings("deprecation")
@Override
public DefaultedList<Ingredient> getPreviewInputs() {
return shapedRecipe.getPreviewInputs();
}
@SuppressWarnings("deprecation")
@Override
public boolean matches(Inventory inv, World worldIn) {
return shapedRecipe.matches((CraftingInventory) inv, worldIn);
}
@SuppressWarnings("deprecation")
@Override
public ItemStack craft(Inventory inv) {
return shapedRecipe.craft((CraftingInventory) inv);
}
@SuppressWarnings("deprecation")
@Override
public boolean fits(int width, int height) {
return shapedRecipe.fits(width, height);
}
public ShapedRecipe getShapedRecipe() {
return shapedRecipe;
}
}

View file

@ -166,7 +166,7 @@ public class FusionControlComputerBlockEntity extends PowerAcceptorBlockEntity
* Tries to set current recipe based in inputs in reactor
*/
private void updateCurrentRecipe() {
for (RebornRecipe recipe : ModRecipes.FUSION_REACTOR.getRecipes(getWorld())) {
for (RebornRecipe recipe : ModRecipes.ROLLING_MACHINE.getRecipes(getWorld())) {
if (recipe.canCraft(this) && validateRecipe((FusionReactorRecipe) recipe)) {
currentRecipe = (FusionReactorRecipe) recipe;
crafingTickTime = 0;
@ -357,7 +357,7 @@ public class FusionControlComputerBlockEntity extends PowerAcceptorBlockEntity
this.neededPower = tagCompound.getInt("neededPower");
this.hasStartedCrafting = tagCompound.getBoolean("hasStartedCrafting");
if(tagCompound.containsKey("hasActiveRecipe") && tagCompound.getBoolean("hasActiveRecipe") && this.currentRecipe == null){
for (final RebornRecipe reactorRecipe : ModRecipes.FUSION_REACTOR.getRecipes(getWorld())) {
for (final RebornRecipe reactorRecipe : ModRecipes.ROLLING_MACHINE.getRecipes(getWorld())) {
if (validateRecipe((FusionReactorRecipe) reactorRecipe)) {
this.currentRecipe = (FusionReactorRecipe) reactorRecipe;
}

View file

@ -32,6 +32,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Pair;
import reborncore.api.IToolDrop;
import reborncore.api.blockentity.InventoryProvider;
@ -39,13 +40,15 @@ import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.crafting.RecipeManager;
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.RebornInventory;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.api.RollingMachineRecipe;
import techreborn.api.recipe.recipes.RollingMachineRecipe;
import techreborn.init.ModRecipes;
import techreborn.init.TRContent;
import techreborn.init.TRBlockEntities;
@ -122,7 +125,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
charge(10);
CraftingInventory craftMatrix = getCraftingMatrix();
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, world);
currentRecipe = findMatchingRecipe(craftMatrix, world);
if (currentRecipe != null) {
setIsActive(true);
if (world.getTime() % 2 == 0) {
@ -138,7 +141,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
if (!currentRecipeOutput.isEmpty() && canMake(craftMatrix)) {
if (tickTime >= Math.max((int) (runTime * (1.0 - getSpeedMultiplier())), 1)) {
currentRecipeOutput = RollingMachineRecipe.instance.findMatchingRecipeOutput(craftMatrix, world);
currentRecipeOutput = findMatchingRecipeOutput(craftMatrix, world);
if (!currentRecipeOutput.isEmpty()) {
boolean hasCrafted = false;
if (inventory.getInvStack(outputSlot).isEmpty()) {
@ -313,7 +316,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
}
public boolean canMake(CraftingInventory craftMatrix) {
ItemStack stack = RollingMachineRecipe.instance.findMatchingRecipeOutput(craftMatrix, this.world);
ItemStack stack = findMatchingRecipeOutput(craftMatrix, this.world);
if (locked) {
for (int i = 0; i < craftMatrix.getInvSize(); i++) {
ItemStack stack1 = craftMatrix.getInvStack(i);
@ -332,6 +335,27 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
return ItemUtils.isItemEqual(stack, output, true, true);
}
public List<RollingMachineRecipe> getAllRecipe(World world){
return ModRecipes.ROLLING_MACHINE.getRecipes(world);
}
public ItemStack findMatchingRecipeOutput(CraftingInventory inv, World world) {
Recipe recipe = findMatchingRecipe(inv, world);
if(recipe == null){
return ItemStack.EMPTY;
}
return recipe.getOutput();
}
public Recipe findMatchingRecipe(CraftingInventory inv, World world) {
for (RollingMachineRecipe recipe : getAllRecipe(world)) {
if (recipe.matches(inv, world)) {
return recipe;
}
}
return null;
}
@Override
public ItemStack getToolDrop(final PlayerEntity entityPlayer) {
return TRContent.Machine.ROLLING_MACHINE.getStack();
@ -382,7 +406,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
.slot(0, 30, 22).slot(1, 48, 22).slot(2, 66, 22)
.slot(3, 30, 40).slot(4, 48, 40).slot(5, 66, 40)
.slot(6, 30, 58).slot(7, 48, 58).slot(8, 66, 58)
.onCraft(inv -> this.inventory.setInvStack(1, RollingMachineRecipe.instance.findMatchingRecipeOutput(getCraftingMatrix(), this.world)))
.onCraft(inv -> this.inventory.setInvStack(1, findMatchingRecipeOutput(getCraftingMatrix(), this.world)))
.outputSlot(9, 124, 40)
.energySlot(10, 8, 70)
.syncEnergyValue().syncIntegerValue(this::getBurnTime, this::setBurnTime).syncIntegerValue(this::getLockedInt, this::setLockedInt).addInventory().create(this, syncID);

View file

@ -28,11 +28,7 @@ import net.minecraft.util.Identifier;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.RecipeManager;
import techreborn.api.recipe.recipes.BlastFurnaceRecipe;
import techreborn.api.recipe.recipes.FluidReplicatorRecipe;
import techreborn.api.recipe.recipes.FusionReactorRecipe;
import techreborn.api.recipe.recipes.IndustrialGrinderRecipe;
import techreborn.api.recipe.recipes.IndustrialSawmillRecipe;
import techreborn.api.recipe.recipes.*;
public class ModRecipes {
@ -54,5 +50,6 @@ public class ModRecipes {
public static final RebornRecipeType<RebornRecipe> VACUUM_FREEZER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:vacuum_freezer"));
public static final RebornRecipeType<FluidReplicatorRecipe> FLUID_REPLICATOR = RecipeManager.newRecipeType(FluidReplicatorRecipe.class, new Identifier("techreborn:fluid_replicator"));
public static final RebornRecipeType<FusionReactorRecipe> FUSION_REACTOR = RecipeManager.newRecipeType(FusionReactorRecipe.class, new Identifier("techreborn:fusion_reactor"));
public static final RebornRecipeType<RollingMachineRecipe> ROLLING_MACHINE = RecipeManager.newRecipeType(RollingMachineRecipe.class, new Identifier("techreborn:rolling_machine"));
}

View file

@ -1,64 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.init.recipes;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import techreborn.TechReborn;
import techreborn.init.TRContent;
/**
* Created by Prospector
*/
public class RollingMachineRecipes extends RecipeMethods {
public static void init() {
register(new Identifier(TechReborn.MOD_ID, "cupronickel_heating_coil"), TRContent.Parts.CUPRONICKEL_HEATING_COIL.getStack(3), "NCN", "C C", "NCN", 'N', "ingotNickel", 'C', "ingotCopper");
register(new Identifier(TechReborn.MOD_ID, "nichrome_heating_coil"), TRContent.Parts.NICHROME_HEATING_COIL.getStack(2), " N ", "NCN", " N ", 'N', "ingotNickel", 'C', "ingotChrome");
if (oresExist("ingotAluminum")) {
register(new Identifier(TechReborn.MOD_ID, "kanthal_heating_coil"), TRContent.Parts.KANTHAL_HEATING_COIL.getStack(3), "RRR", "CAA", "CCA", 'R', "ingotRefinedIron", 'C', "ingotChrome", 'A', "ingotAluminum");
}
if (oresExist("ingotAluminium")) {
register(new Identifier(TechReborn.MOD_ID, "kanthal_heating_coil"), TRContent.Parts.KANTHAL_HEATING_COIL.getStack(3), "RRR", "CAA", "CCA", 'R', "ingotRefinedIron", 'C', "ingotChrome", 'A', "ingotAluminium");
}
register(new Identifier(TechReborn.MOD_ID, "plateMagnalium"), TRContent.Plates.MAGNALIUM.getStack(3), "AAA", "MMM", "AAA", 'A', "ingotAluminum", 'M', "dustMagnesium");
register(new Identifier(TechReborn.MOD_ID, "rail"), getStack(Blocks.RAIL, 24), "I I", "ISI", "I I", 'I', "ingotIron", 'S', "stickWood");
register(new Identifier(TechReborn.MOD_ID, "gold_rail"), getStack(Blocks.POWERED_RAIL, 8), "I I", "ISI", "IRI", 'I', "ingotGold", 'S', "stickWood", 'R', "dustRedstone");
register(new Identifier(TechReborn.MOD_ID, "detector_rail"), getStack(Blocks.DETECTOR_RAIL, 8), "I I", "IPI", "IRI", 'I', "ingotIron", 'P', getStack(Blocks.STONE_PRESSURE_PLATE), 'R', "dustRedstone");
register(new Identifier(TechReborn.MOD_ID, "activator_rail"), getStack(Blocks.ACTIVATOR_RAIL, 8), "ISI", "IRI", "ISI", 'I', "ingotIron", 'S', "stickWood", 'R', getStack(Blocks.REDSTONE_TORCH));
register(new Identifier(TechReborn.MOD_ID, "iron_bars"), getStack(Blocks.IRON_BARS, 24), "III", "III", 'I', "ingotIron");
register(new Identifier(TechReborn.MOD_ID, "iron_door"), getStack(Blocks.IRON_DOOR, 4), "II ", "II ", "II ", 'I', "ingotIron");
register(new Identifier(TechReborn.MOD_ID, "minecart"), getStack(Items.MINECART, 2), "I I", "III", 'I', "ingotIron");
register(new Identifier(TechReborn.MOD_ID, "bucket"), getStack(Items.BUCKET, 2), "I I", "I I", " I ", 'I', "ingotIron");
register(new Identifier(TechReborn.MOD_ID, "tripwire_hook"), getStack(Blocks.TRIPWIRE_HOOK, 4), " I ", " S ", " W ", 'I', "ingotIron", 'S', "stickWood", 'W', "plankWood");
register(new Identifier(TechReborn.MOD_ID, "heavy_pressure_plate"), getStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, 2), "II ", 'I', "ingotIron");
register(new Identifier(TechReborn.MOD_ID, "light_pressure_plate"), getStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, 2), "GG ", 'G', "ingotGold");
}
static void register(Identifier resourceLocation, ItemStack output, Object... componentsObjects) {
}
}

View file

@ -25,10 +25,7 @@
package techreborn.rei;
import com.mojang.blaze3d.platform.GlStateManager;
import me.shedaniel.rei.api.DisplaySettings;
import me.shedaniel.rei.api.RecipeCategory;
import me.shedaniel.rei.api.Renderable;
import me.shedaniel.rei.api.Renderer;
import me.shedaniel.rei.api.*;
import me.shedaniel.rei.gui.renderables.RecipeRenderer;
import me.shedaniel.rei.gui.widget.RecipeBaseWidget;
import me.shedaniel.rei.gui.widget.SlotWidget;
@ -43,6 +40,7 @@ import net.minecraft.util.math.MathHelper;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.util.StringUtils;
import techreborn.init.ModRecipes;
import java.awt.*;
import java.util.Arrays;
@ -123,7 +121,7 @@ public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCate
@Override
public DisplaySettings getDisplaySettings() {
return new DisplaySettings<MachineRecipeDisplay>() {
return new DisplaySettings<MachineRecipeDisplay>() {
public int getDisplayHeight(RecipeCategory category) {
if (recipeLines == 1) {

View file

@ -25,6 +25,7 @@
package techreborn.rei;
import me.shedaniel.rei.api.REIPluginEntry;
import me.shedaniel.rei.api.RecipeDisplay;
import me.shedaniel.rei.api.RecipeHelper;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
@ -34,16 +35,16 @@ import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.RecipeManager;
import techreborn.TechReborn;
import techreborn.api.recipe.recipes.BlastFurnaceRecipe;
import techreborn.api.recipe.recipes.FluidReplicatorRecipe;
import techreborn.api.recipe.recipes.IndustrialGrinderRecipe;
import techreborn.api.recipe.recipes.IndustrialSawmillRecipe;
import techreborn.api.recipe.recipes.*;
import techreborn.init.ModRecipes;
import techreborn.init.TRContent;
import techreborn.init.TRContent.Machine;
import techreborn.rei.rollingmachine.RollingMachineCategory;
import techreborn.rei.rollingmachine.RollingMachineDisplay;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Predicate;
public class ReiPlugin implements REIPluginEntry {
@ -69,6 +70,7 @@ public class ReiPlugin implements REIPluginEntry {
iconMap.put(ModRecipes.INDUSTRIAL_SAWMILL, Machine.INDUSTRIAL_SAWMILL);
iconMap.put(ModRecipes.SCRAPBOX, TRContent.SCRAP_BOX);
iconMap.put(ModRecipes.VACUUM_FREEZER, Machine.VACUUM_FREEZER);
iconMap.put(ModRecipes.ROLLING_MACHINE, Machine.ROLLING_MACHINE);
}
@Override
@ -78,35 +80,33 @@ public class ReiPlugin implements REIPluginEntry {
@Override
public void registerPluginCategories(RecipeHelper recipeHelper) {
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.ALLOY_SMELTER));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.ASSEMBLING_MACHINE));
recipeHelper.registerCategory(new MachineRecipeCategory<BlastFurnaceRecipe>(ModRecipes.BLAST_FURNACE));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.CENTRIFUGE, 4));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.CHEMICAL_REACTOR));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.COMPRESSOR, 1));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.DISTILLATION_TOWER, 3));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.EXTRACTOR, 1));
recipeHelper.registerCategory(new MachineRecipeCategory<FluidReplicatorRecipe>(ModRecipes.FLUID_REPLICATOR, 1));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.GRINDER, 1));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.IMPLOSION_COMPRESSOR));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.INDUSTRIAL_ELECTROLYZER, 4));
recipeHelper.registerCategory(new MachineRecipeCategory<IndustrialGrinderRecipe>(ModRecipes.INDUSTRIAL_GRINDER, 3));
recipeHelper.registerCategory(new MachineRecipeCategory<IndustrialSawmillRecipe>(ModRecipes.INDUSTRIAL_SAWMILL, 3));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.SCRAPBOX));
recipeHelper.registerCategory(new MachineRecipeCategory<RebornRecipe>(ModRecipes.VACUUM_FREEZER, 1));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.ALLOY_SMELTER));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.ASSEMBLING_MACHINE));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.BLAST_FURNACE));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.CENTRIFUGE, 4));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.CHEMICAL_REACTOR));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.COMPRESSOR, 1));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.DISTILLATION_TOWER, 3));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.EXTRACTOR, 1));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.FLUID_REPLICATOR, 1));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.GRINDER, 1));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.IMPLOSION_COMPRESSOR));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.INDUSTRIAL_ELECTROLYZER, 4));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.INDUSTRIAL_GRINDER, 3));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.INDUSTRIAL_SAWMILL, 3));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.SCRAPBOX));
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.VACUUM_FREEZER, 1));
recipeHelper.registerCategory(new RollingMachineCategory(ModRecipes.ROLLING_MACHINE));
}
@Override
public void registerRecipeDisplays(RecipeHelper recipeHelper) {
RecipeManager.getRecipeTypes("techreborn").forEach(rebornRecipeType -> registerMachineRecipe(recipeHelper, rebornRecipeType));
}
}
@Override
public void registerOthers(RecipeHelper recipeHelper) {
recipeHelper.registerWorkingStations(ModRecipes.ALLOY_SMELTER.getName(),
new ItemStack[] { new ItemStack(Machine.ALLOY_SMELTER.asItem()),
new ItemStack(Machine.IRON_ALLOY_FURNACE.asItem())});
recipeHelper.registerWorkingStations(ModRecipes.ALLOY_SMELTER.getName(), new ItemStack(Machine.ALLOY_SMELTER.asItem()), new ItemStack(Machine.IRON_ALLOY_FURNACE.asItem()));
recipeHelper.registerWorkingStations(ModRecipes.BLAST_FURNACE.getName(), new ItemStack(Machine.INDUSTRIAL_BLAST_FURNACE.asItem()));
recipeHelper.registerWorkingStations(ModRecipes.CENTRIFUGE.getName(), new ItemStack(Machine.INDUSTRIAL_CENTRIFUGE.asItem()));
recipeHelper.registerWorkingStations(ModRecipes.CHEMICAL_REACTOR.getName(), new ItemStack(Machine.CHEMICAL_REACTOR.asItem()));
@ -119,14 +119,24 @@ public class ReiPlugin implements REIPluginEntry {
recipeHelper.registerWorkingStations(ModRecipes.INDUSTRIAL_ELECTROLYZER.getName(), new ItemStack(Machine.INDUSTRIAL_ELECTROLYZER.asItem()));
recipeHelper.registerWorkingStations(ModRecipes.INDUSTRIAL_SAWMILL.getName(), new ItemStack(Machine.INDUSTRIAL_SAWMILL.asItem()));
recipeHelper.registerWorkingStations(ModRecipes.VACUUM_FREEZER.getName(), new ItemStack(Machine.VACUUM_FREEZER.asItem()));
recipeHelper.registerWorkingStations(ModRecipes.ROLLING_MACHINE.getName(), new ItemStack(Machine.ROLLING_MACHINE.asItem()));
}
private <R extends RebornRecipe> void registerMachineRecipe(RecipeHelper recipeHelper, RebornRecipeType<R> recipeType){
Function<R, RecipeDisplay> recipeDisplay = r -> new MachineRecipeDisplay<>((RebornRecipe) r);
if(recipeType == ModRecipes.ROLLING_MACHINE){
recipeDisplay = r -> {
RollingMachineRecipe rollingMachineRecipe = (RollingMachineRecipe) r;
return new RollingMachineDisplay(rollingMachineRecipe.getShapedRecipe());
};
}
recipeHelper.registerRecipes(recipeType.getName(), (Predicate<Recipe>) recipe -> {
if (recipe instanceof RebornRecipe) {
return ((RebornRecipe) recipe).getRebornRecipeType() == recipeType;
}
return false;
}, recipe -> new MachineRecipeDisplay<RebornRecipe>((RebornRecipe) recipe));
}, recipeDisplay);
}
}

View file

@ -22,33 +22,40 @@
* SOFTWARE.
*/
package techreborn.api;
package techreborn.rei.rollingmachine;
import net.minecraft.inventory.CraftingInventory;
import me.shedaniel.rei.api.Renderable;
import me.shedaniel.rei.api.Renderer;
import me.shedaniel.rei.plugin.DefaultCraftingCategory;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Recipe;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.util.StringUtils;
import techreborn.api.recipe.recipes.RollingMachineRecipe;
import techreborn.rei.ReiPlugin;
public class RollingMachineCategory extends DefaultCraftingCategory {
public class RollingMachineRecipe {
public static final RollingMachineRecipe instance = new RollingMachineRecipe();
public void addShapedOreRecipe(Identifier resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
private final RebornRecipeType<RollingMachineRecipe> rebornRecipeType;
public RollingMachineCategory(RebornRecipeType<RollingMachineRecipe> rebornRecipeType) {
this.rebornRecipeType = rebornRecipeType;
}
public void addShapelessOreRecipe(Identifier resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
@Override
public Identifier getIdentifier() {
return rebornRecipeType.getName();
}
public ItemStack findMatchingRecipeOutput(CraftingInventory inv, World world) {
return ItemStack.EMPTY;
@Override
public String getCategoryName() {
return StringUtils.t(rebornRecipeType.getName().toString());
}
public Recipe findMatchingRecipe(CraftingInventory inv, World world) {
return null;
@Override
public Renderer getIcon() {
return Renderable.fromItemStack(new ItemStack(ReiPlugin.iconMap.getOrDefault(rebornRecipeType, () -> Items.DIAMOND_SHOVEL).asItem()));
}
}

View file

@ -0,0 +1,18 @@
package techreborn.rei.rollingmachine;
import me.shedaniel.rei.plugin.DefaultShapedDisplay;
import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.util.Identifier;
import techreborn.init.ModRecipes;
public class RollingMachineDisplay extends DefaultShapedDisplay {
public RollingMachineDisplay(ShapedRecipe recipe) {
super(recipe);
}
@Override
public Identifier getRecipeCategory() {
return ModRecipes.ROLLING_MACHINE.getName();
}
}

View file

@ -0,0 +1,25 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"ISI",
"IRI",
"ISI"
],
"key": {
"I": {
"item": "minecraft:iron_ingot"
},
"S": {
"item": "minecraft:stick"
},
"R": {
"item": "minecraft:redstone_torch"
}
},
"result": {
"item": "minecraft:activator_rail",
"count": 8
}
}
}

View file

@ -0,0 +1,19 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"I I",
"I I",
" I "
],
"key": {
"I": {
"item": "minecraft:iron_ingot"
}
},
"result": {
"item": "minecraft:bucket",
"count": 2
}
}
}

View file

@ -0,0 +1,22 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"NCN",
"C C",
"NCN"
],
"key": {
"N": {
"item": "techreborn:nickel_ingot"
},
"C": {
"item": "techreborn:copper_ingot"
}
},
"result": {
"item": "techreborn:cupronickel_heating_coil",
"count": 3
}
}
}

View file

@ -0,0 +1,25 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"I I",
"IPI",
"IRI"
],
"key": {
"I": {
"item": "minecraft:iron_ingot"
},
"P": {
"item": "minecraft:stone_pressure_plate"
},
"R": {
"item": "minecraft:redstone"
}
},
"result": {
"item": "minecraft:detector_rail",
"count": 8
}
}
}

View file

@ -0,0 +1,17 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"II"
],
"key": {
"I": {
"item": "minecraft:iron_ingot"
}
},
"result": {
"item": "minecraft:heavy_weighted_pressure_plate",
"count": 2
}
}
}

View file

@ -0,0 +1,18 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"III",
"III"
],
"key": {
"I": {
"item": "minecraft:iron_ingot"
}
},
"result": {
"item": "minecraft:iron_bars",
"count": 24
}
}
}

View file

@ -0,0 +1,19 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"II ",
"II ",
"II "
],
"key": {
"I": {
"item": "minecraft:iron_ingot"
}
},
"result": {
"item": "minecraft:iron_door",
"count": 4
}
}
}

View file

@ -0,0 +1,17 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"II"
],
"key": {
"I": {
"item": "minecraft:gold_ingot"
}
},
"result": {
"item": "minecraft:light_weighted_pressure_plate",
"count": 2
}
}
}

View file

@ -0,0 +1,22 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"AAA",
"MMM",
"AAA"
],
"key": {
"A": {
"item": "techreborn:aluminum_ingot"
},
"M": {
"item": "techreborn:magnesium_dust"
}
},
"result": {
"item": "techreborn:magnalium_plate",
"count": 3
}
}
}

View file

@ -0,0 +1,18 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"I I",
"III"
],
"key": {
"I": {
"item": "minecraft:iron_ingot"
}
},
"result": {
"item": "minecraft:minecart",
"count": 2
}
}
}

View file

@ -0,0 +1,22 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
" N ",
"NCN",
" N "
],
"key": {
"N": {
"item": "techreborn:nickel_ingot"
},
"C": {
"item": "techreborn:chrome_ingot"
}
},
"result": {
"item": "techreborn:nichrome_heating_coil",
"count": 2
}
}
}

View file

@ -0,0 +1,25 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"I I",
"ISI",
"IRI"
],
"key": {
"I": {
"item": "minecraft:gold_ingot"
},
"S": {
"item": "minecraft:stick"
},
"R": {
"item": "minecraft:redstone"
}
},
"result": {
"item": "minecraft:powered_rail",
"count": 8
}
}
}

View file

@ -0,0 +1,22 @@
{
"type": "techreborn:rolling_machine",
"shaped": {
"pattern": [
"I I",
"ISI",
"I I"
],
"key": {
"I": {
"item": "minecraft:iron_ingot"
},
"S": {
"item": "minecraft:stick"
}
},
"result": {
"item": "minecraft:rail",
"count": 24
}
}
}