Add LibCD Support (#1851)

* First ugly commit for LibCD support

* fix all the ugly hacks, add rolling machine + fluid gen recipes

* be a bit more lenient with fluid generator names

* add test script, fix a few bugs

* get rid of ShapedRecipeSerializer stuff that's no longer needed

* Add a warning to the sample script
This commit is contained in:
Meredith Espinosa 2019-10-11 13:30:26 -07:00 committed by Mark J
parent bfce163c99
commit 989e4601af
12 changed files with 801 additions and 0 deletions

View file

@ -26,10 +26,13 @@ package techreborn.api.recipe.recipes;
import com.google.gson.JsonObject;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.ingredient.RebornIngredient;
import techreborn.blockentity.machine.multiblock.IndustrialBlastFurnaceBlockEntity;
public class BlastFurnaceRecipe extends RebornRecipe {
@ -39,6 +42,11 @@ public class BlastFurnaceRecipe extends RebornRecipe {
public BlastFurnaceRecipe(RebornRecipeType<?> type, Identifier name) {
super(type, name);
}
public BlastFurnaceRecipe(RebornRecipeType<?> type, Identifier name, DefaultedList<RebornIngredient> ingredients, DefaultedList<ItemStack> outputs, int power, int time, int heat) {
super(type, name, ingredients, outputs, power, time);
this.heat = heat;
}
public int getHeat() {
return heat;

View file

@ -27,10 +27,14 @@ package techreborn.api.recipe.recipes;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import reborncore.common.crafting.RebornFluidRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.ingredient.RebornIngredient;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;
import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity;
import techreborn.utils.FluidUtils;
@ -41,6 +45,14 @@ public class FluidReplicatorRecipe extends RebornFluidRecipe {
super(type, name);
}
public FluidReplicatorRecipe(RebornRecipeType<?> type, Identifier name, DefaultedList<RebornIngredient> ingredients, DefaultedList<ItemStack> outputs, int power, int time) {
super(type, name, ingredients, outputs, power, time);
}
public FluidReplicatorRecipe(RebornRecipeType<?> type, Identifier name, DefaultedList<RebornIngredient> ingredients, DefaultedList<ItemStack> outputs, int power, int time, FluidInstance fluid) {
super(type, name, ingredients, outputs, power, time, fluid);
}
@Override
public Tank getTank(BlockEntity be) {
FluidReplicatorBlockEntity blockEntity = (FluidReplicatorBlockEntity) be;

View file

@ -27,10 +27,13 @@ package techreborn.api.recipe.recipes;
import com.google.gson.JsonObject;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.ingredient.RebornIngredient;
import techreborn.blockentity.fusionReactor.FusionControlComputerBlockEntity;
/**
@ -45,6 +48,12 @@ public class FusionReactorRecipe extends RebornRecipe {
public FusionReactorRecipe(RebornRecipeType<?> type, Identifier name) {
super(type, name);
}
public FusionReactorRecipe(RebornRecipeType<?> type, Identifier name, DefaultedList<RebornIngredient> ingredients, DefaultedList<ItemStack> outputs, int power, int time, int startE, int minSize) {
super(type, name, ingredients, outputs, power, time);
this.startE = startE;
this.minSize = minSize;
}
public int getStartEnergy () {
return startE;

View file

@ -25,9 +25,13 @@
package techreborn.api.recipe.recipes;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier;
import reborncore.common.crafting.RebornFluidRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.ingredient.RebornIngredient;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;
import techreborn.blockentity.machine.multiblock.IndustrialGrinderBlockEntity;
@ -37,6 +41,14 @@ public class IndustrialGrinderRecipe extends RebornFluidRecipe {
super(type, name);
}
public IndustrialGrinderRecipe(RebornRecipeType<?> type, Identifier name, DefaultedList<RebornIngredient> ingredients, DefaultedList<ItemStack> outputs, int power, int time) {
super(type, name, ingredients, outputs, power, time);
}
public IndustrialGrinderRecipe(RebornRecipeType<?> type, Identifier name, DefaultedList<RebornIngredient> ingredients, DefaultedList<ItemStack> outputs, int power, int time, FluidInstance fluid) {
super(type, name, ingredients, outputs, power, time, fluid);
}
@Override
public Tank getTank(BlockEntity be) {
IndustrialGrinderBlockEntity blockEntity = (IndustrialGrinderBlockEntity) be;

View file

@ -25,9 +25,13 @@
package techreborn.api.recipe.recipes;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier;
import reborncore.common.crafting.RebornFluidRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.ingredient.RebornIngredient;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;
import techreborn.blockentity.machine.multiblock.IndustrialSawmillBlockEntity;
@ -37,6 +41,14 @@ public class IndustrialSawmillRecipe extends RebornFluidRecipe {
super(type, name);
}
public IndustrialSawmillRecipe(RebornRecipeType<?> type, Identifier name, DefaultedList<RebornIngredient> ingredients, DefaultedList<ItemStack> outputs, int power, int time) {
super(type, name, ingredients, outputs, power, time);
}
public IndustrialSawmillRecipe(RebornRecipeType<?> type, Identifier name, DefaultedList<RebornIngredient> ingredients, DefaultedList<ItemStack> outputs, int power, int time, FluidInstance fluid) {
super(type, name, ingredients, outputs, power, time, fluid);
}
@Override
public Tank getTank(BlockEntity be) {
IndustrialSawmillBlockEntity blockEntity = (IndustrialSawmillBlockEntity) be;

View file

@ -51,6 +51,11 @@ public class RollingMachineRecipe extends RebornRecipe {
super(type, name);
}
public RollingMachineRecipe(RebornRecipeType<?> type, Identifier name, ShapedRecipe recipe) {
super(type, name);
this.shapedRecipe = recipe;
}
@Override
public void deserialize(JsonObject jsonObject) {
if(jsonObject.has("shaped")) {
@ -69,6 +74,7 @@ public class RollingMachineRecipe extends RebornRecipe {
RecipeSerializer.SHAPED.write(byteBuf, shapedRecipe);
}
@Override
public void deserialize(PacketByteBuf byteBuf) {
Identifier identifier = new Identifier(byteBuf.readString(byteBuf.readInt()));