mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-04 15:43:00 +00:00
Replace some recipes with a more dynamic system
This adds a new "recipe function" system, that allows transforming the result of a recipe according to some datapack-defined function. Currently, we only provide one function: computercraft:copy_components, which copies components from one of the ingredients to the result. This allows us to replace several of our existing recipes: - Turtle overlay recipes are now defined as a normal shapeless recipe that copies all (non-overlay) components from the input turtle. - Computer conversion recipes (e.g. computer -> turtle, normal -> advanced) copy all components from the input computer to the result. This is more complex (and thus more code), but also a little more flexible, which hopefully is useful for someone :).
This commit is contained in:
@@ -30,6 +30,7 @@ import dan200.computercraft.shared.peripheral.modem.wired.CableBlockEntity;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.WiredModemFullBlockEntity;
|
||||
import dan200.computercraft.shared.peripheral.modem.wireless.WirelessModemBlockEntity;
|
||||
import dan200.computercraft.shared.platform.ForgeConfigFile;
|
||||
import dan200.computercraft.shared.recipe.function.RecipeFunction;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -81,6 +82,7 @@ public final class ComputerCraft {
|
||||
public static void registerRegistries(NewRegistryEvent event) {
|
||||
event.create(new RegistryBuilder<>(ITurtleUpgrade.serialiserRegistryKey()));
|
||||
event.create(new RegistryBuilder<>(IPocketUpgrade.serialiserRegistryKey()));
|
||||
event.create(new RegistryBuilder<>(RecipeFunction.REGISTRY).sync(true));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
Reference in New Issue
Block a user