Flywheel/src/main/java/com/simibubi/create/AllRecipes.java
simibubi efcdd3c03e The Crushing Wheel
- Crushing wheels can now apply recipes to contained items
- Added a new generic recipe type for processing
- Improved Crushing Wheel model
- Improved gui models of large wheels
- Improved gui models of harvesters and drills
- Added several crushing recipes
- Fixed Water wheel updating rotation speeds incosistently
2019-08-22 15:52:15 +02:00

58 lines
1.8 KiB
Java

package com.simibubi.create;
import java.util.function.Supplier;
import com.simibubi.create.modules.contraptions.base.ProcessingRecipeSerializer;
import com.simibubi.create.modules.contraptions.receivers.CrushingRecipe;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunUpgradeRecipe;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
import net.minecraftforge.event.RegistryEvent;
public enum AllRecipes {
Placement_Handgun_Upgrade(BuilderGunUpgradeRecipe.Serializer::new, IRecipeType.CRAFTING),
Crushing(() -> {
return new ProcessingRecipeSerializer<>(CrushingRecipe::new);
}, Types.CRUSHING),
;
public static class Types {
public static IRecipeType<CrushingRecipe> CRUSHING = register("crushing");
static <T extends IRecipe<?>> IRecipeType<T> register(final String key) {
return Registry.register(Registry.RECIPE_TYPE, new ResourceLocation(key), new IRecipeType<T>() {
public String toString() {
return key;
}
});
}
}
public IRecipeSerializer<?> serializer;
public Supplier<IRecipeSerializer<?>> supplier;
public IRecipeType<? extends IRecipe<? extends IInventory>> type;
private AllRecipes(Supplier<IRecipeSerializer<?>> supplier,
IRecipeType<? extends IRecipe<? extends IInventory>> type) {
this.supplier = supplier;
this.type = type;
}
public static void register(RegistryEvent.Register<IRecipeSerializer<?>> event) {
for (AllRecipes r : AllRecipes.values()) {
r.serializer = r.supplier.get();
ResourceLocation location = new ResourceLocation(Create.ID, r.name().toLowerCase());
event.getRegistry().register(r.serializer.setRegistryName(location));
}
}
}