Skip to content

Commit f398921

Browse files
Merge pull request #110 from KalWantsPizza/1.21.1-release-DataGen&FluidInit
Datagen Part 4: Air Liquefier & fixing engine recipes
2 parents 023b232 + 72f24a5 commit f398921

File tree

98 files changed

+509
-376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+509
-376
lines changed

src/generated/resources/data/creatingspace/loot_table/blocks/crystal_cluster.json

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,46 @@
33
"pools": [
44
{
55
"bonus_rolls": 0.0,
6-
"conditions": [
7-
{
8-
"condition": "minecraft:survives_explosion"
9-
}
10-
],
116
"entries": [
127
{
13-
"type": "minecraft:item",
14-
"name": "creatingspace:crystal_cluster"
8+
"type": "minecraft:alternatives",
9+
"children": [
10+
{
11+
"type": "minecraft:item",
12+
"conditions": [
13+
{
14+
"condition": "minecraft:match_tool",
15+
"predicate": {
16+
"predicates": {
17+
"minecraft:enchantments": [
18+
{
19+
"enchantments": "minecraft:silk_touch",
20+
"levels": {
21+
"min": 1
22+
}
23+
}
24+
]
25+
}
26+
}
27+
}
28+
],
29+
"name": "creatingspace:crystal_cluster"
30+
},
31+
{
32+
"type": "minecraft:item",
33+
"functions": [
34+
{
35+
"enchantment": "minecraft:fortune",
36+
"formula": "minecraft:ore_drops",
37+
"function": "minecraft:apply_bonus"
38+
},
39+
{
40+
"function": "minecraft:explosion_decay"
41+
}
42+
],
43+
"name": "creatingspace:crystal_shard"
44+
}
45+
]
1546
}
1647
],
1748
"rolls": 1.0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"type": "creatingspace:air_liquefying",
3+
"blockInFront": "minecraft:campfire",
4+
"dimension": "minecraft:overworld",
5+
"ingredients": [],
6+
"processing_time": 200,
7+
"results": [
8+
{
9+
"amount": 100,
10+
"id": "creatingspace:liquid_co2"
11+
}
12+
]
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"type": "creatingspace:air_liquefying",
3+
"blockInFront": "minecraft:air",
4+
"dimension": "minecraft:overworld",
5+
"ingredients": [],
6+
"processing_time": 200,
7+
"results": [
8+
{
9+
"amount": 100,
10+
"id": "creatingspace:liquid_oxygen"
11+
}
12+
]
13+
}

src/main/java/com/rae/creatingspace/content/datagen/CSDatagen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public static void gatherData(GatherDataEvent event) {
4141
generator.addProvider(true, new CSCrushingRecipeGen(output, lookupProvider, CreatingSpace.MODID));
4242
generator.addProvider(true, new CSMixingRecipeGen(output, lookupProvider, CreatingSpace.MODID));
4343
generator.addProvider(true, new CSWashingRecipeGen(output, lookupProvider, CreatingSpace.MODID));
44+
generator.addProvider(true, new CSAirLiquefyingRecipeGen(output, lookupProvider));
4445

4546
// event.getGenerator().addProvider(true, new RegistrateDataProvider(REGISTRATE, CreatingSpace.MODID, event));
4647
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.rae.creatingspace.content.datagen.recipe;
2+
3+
import com.rae.creatingspace.CreatingSpace;
4+
import com.rae.creatingspace.content.recipes.air_liquefying.AirLiquefyingRecipe;
5+
import com.rae.creatingspace.content.recipes.air_liquefying.AirLiquefyingRecipeParam;
6+
import com.rae.creatingspace.init.RecipeInit;
7+
import com.rae.creatingspace.init.ingameobject.FluidInit;
8+
import com.simibubi.create.api.data.recipe.ProcessingRecipeGen;
9+
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder;
10+
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
11+
import net.minecraft.core.HolderLookup;
12+
import net.minecraft.data.PackOutput;
13+
import net.minecraft.resources.ResourceLocation;
14+
15+
import java.util.concurrent.CompletableFuture;
16+
17+
public class CSAirLiquefyingRecipeGen
18+
extends ProcessingRecipeGen<
19+
AirLiquefyingRecipeParam,
20+
AirLiquefyingRecipe,
21+
AirLiquefyingRecipe.Builder<AirLiquefyingRecipe>
22+
> {
23+
24+
public CSAirLiquefyingRecipeGen(PackOutput output, CompletableFuture<HolderLookup.Provider> lookup) {
25+
super(output, lookup, CreatingSpace.MODID);
26+
}
27+
28+
@Override
29+
protected IRecipeTypeInfo getRecipeType() {
30+
return RecipeInit.AIR_LIQUEFYING;
31+
}
32+
33+
@Override
34+
protected AirLiquefyingRecipe.Builder getBuilder(ResourceLocation id) {
35+
return new AirLiquefyingRecipe.Builder<AirLiquefyingRecipe>(AirLiquefyingRecipe::new, id);
36+
}
37+
38+
{ // instance‐initializer: declare your recipes here
39+
GeneratedRecipe
40+
41+
LIQUID_O2 = create("o2_liquifying", b -> b
42+
.blockInFront(ResourceLocation.parse("minecraft:air"))
43+
.dimension(ResourceLocation.parse("minecraft:overworld"))
44+
.output(FluidInit.LIQUID_OXYGEN.get(), 100)
45+
.duration(200)
46+
),
47+
48+
LIQUID_CO2 = create("co2_liquifying", b -> b
49+
.blockInFront(ResourceLocation.parse("minecraft:campfire"))
50+
.dimension(ResourceLocation.parse("minecraft:overworld"))
51+
.output(FluidInit.LIQUID_CO2.get(), 100)
52+
.duration(200)
53+
);
54+
// …more air‐liquefying recipes…
55+
}
56+
}

src/main/java/com/rae/creatingspace/content/recipes/air_liquefying/AirLiquefyingRecipe.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ public interface Factory<R extends AirLiquefyingRecipe> extends ProcessingRecipe
122122
R create(AirLiquefyingRecipeParam params);
123123
}
124124

125-
public static class Builder<R extends AirLiquefyingRecipe> extends ProcessingRecipeBuilder<AirLiquefyingRecipeParam, R, AirLiquefyingRecipe.Builder<R>> {
125+
public static class Builder<R extends AirLiquefyingRecipe>
126+
extends ProcessingRecipeBuilder<AirLiquefyingRecipeParam, R, Builder<R>> {
127+
126128
public Builder(AirLiquefyingRecipe.Factory<R> factory, ResourceLocation recipeId) {
127129
super(factory, recipeId);
128130
}
@@ -133,12 +135,22 @@ protected AirLiquefyingRecipeParam createParams() {
133135
}
134136

135137
@Override
136-
public AirLiquefyingRecipe.Builder<R> self() {
138+
public Builder<R> self() {
139+
return this;
140+
}
141+
142+
public Builder<R> blockInFront(ResourceLocation loc) {
143+
params.blockInFront = loc;
137144
return this;
138145
}
139146

147+
public Builder<R> dimension(ResourceLocation dim) {
148+
params.dimension = dim;
149+
return this;
150+
}
140151
}
141152

153+
142154
public static class Serializer<R extends AirLiquefyingRecipe> implements RecipeSerializer<R> {
143155
private final MapCodec<R> codec;
144156
private final StreamCodec<RegistryFriendlyByteBuf, R> streamCodec;

src/main/java/com/rae/creatingspace/content/recipes/air_liquefying/AirLiquefyingRecipeParam.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class AirLiquefyingRecipeParam extends ProcessingRecipeParams {
1818
ResourceLocation.CODEC.optionalFieldOf("blockInFront", DEFAULT_EMPTY)
1919
.forGetter( r -> r.blockInFront!=null?r.blockInFront: DEFAULT_EMPTY),
2020
ResourceLocation.CODEC.optionalFieldOf("dimension", DEFAULT_EMPTY)
21-
.forGetter( r -> r.dimension!=null?r.blockInFront: DEFAULT_EMPTY)
21+
.forGetter( r -> r.dimension!=null?r.dimension: DEFAULT_EMPTY)
2222
).apply(instance, (params, blockInFront, dimension) -> {
2323
params.blockInFront = blockInFront;
2424
params.dimension = dimension;

src/main/java/com/rae/creatingspace/init/ingameobject/BlockInit.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,13 @@ public class BlockInit {
810810
.noOcclusion()
811811
.requiresCorrectToolForDrops()
812812
.lightLevel(state -> 5))
813+
.loot((lt, b) -> {
814+
HolderLookup.RegistryLookup<Enchantment> enchantmentRegistryLookup = lt.getRegistries().lookupOrThrow(Registries.ENCHANTMENT);
815+
lt.add(b,
816+
lt.createSilkTouchDispatchTable(b,
817+
lt.applyExplosionDecay(b, LootItem.lootTableItem(ItemInit.CRYSTAL_SHARD.get())
818+
.apply(ApplyBonusCount.addOreBonusCount(enchantmentRegistryLookup.getOrThrow(Enchantments.FORTUNE))))));
819+
})
813820
.item()
814821
.build()
815822
.register();

src/main/resources/data/creatingspace/forge/biome_modifier/add_nickel_moon_ore.json renamed to src/main/resources/data/creatingspace/neoforge/biome_modifier/add_nickel_moon_ore.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"type": "forge:add_features",
2+
"type": "neoforge:add_features",
33
"biomes":"#creatingspace:is_moon",
44
"features":"creatingspace:moon_nickel_ore",
55
"step":"underground_ores"

src/main/resources/data/creatingspace/forge/biome_modifier/add_nickel_overworld_ore.json renamed to src/main/resources/data/creatingspace/neoforge/biome_modifier/add_nickel_overworld_ore.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"type": "forge:add_features",
2+
"type": "neoforge:add_features",
33
"biomes":"#minecraft:is_overworld",
44
"features":"creatingspace:overworld_nickel_ore",
55
"step":"underground_ores"

0 commit comments

Comments
 (0)