Create/src/main/java/com/simibubi/create/AllRecipes.java
simibubi ee46359ce4 Contraptions revisited
- Fixed Mechanical Piston & Bearing not disassembling when broken
- Mechanical Bearing can now generate rotation with tagged blocks
- Encased Fan can now generate rotation above fire
- Added Splashing recipe type
- Encased Fans with water now extinguish entities
- Drills now hurt entities in front of them depending on their speed
- Fixed some culling issues on rendered constructs
2019-09-12 14:32:11 +02:00

63 lines
2.1 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.contraptions.receivers.SplashingRecipe;
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),
SPLASHING(() -> {
return new ProcessingRecipeSerializer<>(SplashingRecipe::new);
}, Types.SPLASHING),
;
public static class Types {
public static IRecipeType<CrushingRecipe> CRUSHING = register("crushing");
public static IRecipeType<SplashingRecipe> SPLASHING = register("splashing");
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));
}
}
}