Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Leclowndu93150 committed Sep 15, 2024
2 parents 0bbcb5b + 9869674 commit 55d4b77
Show file tree
Hide file tree
Showing 17 changed files with 140 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2024-09-15T11:04:48.6903023 Item Models: modjam
// 1.21.1 2024-09-15T13:58:30.925213678 Item Models: modjam
51765874ad3111adf69684269ad9a422bfbaac4a assets/modjam/models/item/aquarine_steel_block.json
e674d6859446f65b4ee805ed6e9f47d6cde82515 assets/modjam/models/item/aquarine_steel_ingot.json
098a336dd0b210f2b650174de2346a665b921edd assets/modjam/models/item/aquarine_steel_wrench.json
Expand All @@ -24,9 +24,9 @@ c78201ce0b7023d1bd6173df7f9263b243caaeb6 assets/modjam/models/item/etching_acid_
f0f9891cd57b3a66f7440a71b925348bb8ea745b assets/modjam/models/item/glass_vial.json
ded81f67ccb99458d5f971322bfe07b2bcf64129 assets/modjam/models/item/long_distance_laser.json
70e7405579c5908091d6c50ab13bb62c8a3fea61 assets/modjam/models/item/mixer.json
dab337d602d93b0a4930b69e652b1155300c6502 assets/modjam/models/item/prism_monocle.json
b1280404594f844671030bc27b7dccec112a81b6 assets/modjam/models/item/prismarine_crystal.json
464cf572aa7c1258836ba7c5ae339f19aafe0333 assets/modjam/models/item/prismarine_crystal_shard.json
0466424a99d558f8beb3c9944a82a36cabf4a2aa assets/modjam/models/item/prismarine_laser_relay.json
dab337d602d93b0a4930b69e652b1155300c6502 assets/modjam/models/item/prism_monocle.json
3a80dac2ed65f9c211115988d17e81af34d02e3d assets/modjam/models/item/rusty_gear.json
47ad5045e52edd89cd66c703ffb5858768091bcf assets/modjam/models/item/salt_water_bucket.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// 1.21.1 2024-09-15T13:53:10.911319 Recipes
6a3498b9b03ea934405ac04d33c6714f372eeb3f data/modjam/recipe/aquarine_steel_ingot.json
28cc0049f31980f965d83a5e61190c6d60ce6777 data/modjam/recipe/atlantic_gold_nugget.json
eff68d65ada7c926e4f29eae840532b396b62af9 data/modjam/recipe/crowbar.json
74069ed0dec9d6fe4262cea8462338d22dda9b2a data/modjam/recipe/diamond.json
79c93eb45499c99c1d2f5b33a3d06eebae8ee3ae data/modjam/recipe/kelp.json
212d75a5fccad42ec0cc51d1e1dfe77b53a8b988 data/modjam/recipe/netherite_ingot.json
e5b9636f08954e5acaaf6832d72ecf4e9a717ffd data/modjam/recipe/rusty_gear.json
// 1.21.1 2024-09-15T14:21:39.413901793 Recipes
79c93eb45499c99c1d2f5b33a3d06eebae8ee3ae data/modjam/recipe/aquatic_catalyst_channeling/kelp_to_air.json
fad1d5e9b634b83163fab8d4a08b49bfb9dddbde data/modjam/recipe/item_etching/emerald_to_diamond.json
379e1941645d53b15794d6b89bee0896217b8b22 data/modjam/recipe/item_transformation/iron_ingot_to_aquarine_steel_ingot.json
bbf30a82d2034849c4cbece3c51b3f6cc9f91bbc data/modjam/recipe/item_transformation/snowball_to_netherite_ingot.json
1d0609c2df64ad98c4b74b9d41cbd0a4c85257be data/modjam/recipe/mixing/anvil_atlantic_gold_nugget_to_rusty_gear.json

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "modjam:item_etching",
"duration": 0,
"ingredient": {
"item": "minecraft:emerald"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"type": "modjam:item_transformation",
"duration": 0,
"ingredient": {
"item": "minecraft:iron_ingot"
},
"purity": 0.0,
"result": {
"count": 1,
"id": "modjam:aquarine_steel_ingot"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"type": "modjam:item_transformation",
"duration": 0,
"ingredient": {
"item": "minecraft:snowball"
},
"purity": 0.0,
"result": {
"count": 1,
"id": "minecraft:netherite_ingot"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public void transmitPower(int amount) {
this.powerToTransfer = amount;
}

public void receivePower(int amount, Direction direction, BlockPos originPos) {
setPower(amount);
}

public int getMaxLaserDistance() {
return 16;
}
Expand Down Expand Up @@ -90,7 +94,7 @@ public void commonTick() {

BlockPos targetPos = worldPosition.relative(direction, distance);
if (level.getBlockEntity(targetPos) instanceof LaserBlockEntity laserBE) {
laserBE.setPower(powerToTransfer);
laserBE.receivePower(powerToTransfer, direction, worldPosition);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package com.portingdeadmods.modjam.content.recipes;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.portingdeadmods.modjam.content.recipes.utils.IngredientWithCount;
import com.portingdeadmods.modjam.content.recipes.utils.RecipeUtils;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.NonNullList;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.*;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public record ItemEtchingRecipe(IngredientWithCount ingredient, ItemStack result) implements Recipe<SingleRecipeInput> {
public record ItemEtchingRecipe(IngredientWithCount ingredient, ItemStack result, int duration) implements Recipe<SingleRecipeInput> {
public static final String NAME = "item_etching";

@Override
Expand All @@ -32,7 +35,7 @@ public boolean canCraftInDimensions(int width, int height) {
}

@Override
public @NotNull ItemStack getResultItem(HolderLookup.@NotNull Provider registries) {
public @NotNull ItemStack getResultItem(HolderLookup.@Nullable Provider registries) {
return result.copy();
}

Expand All @@ -59,13 +62,16 @@ public static class Serializer implements RecipeSerializer<ItemEtchingRecipe> {
public static final ItemEtchingRecipe.Serializer INSTANCE = new ItemEtchingRecipe.Serializer();
private static final MapCodec<ItemEtchingRecipe> MAP_CODEC = RecordCodecBuilder.mapCodec((builder) -> builder.group(
IngredientWithCount.CODEC.fieldOf("ingredient").forGetter(ItemEtchingRecipe::ingredient),
ItemStack.OPTIONAL_CODEC.fieldOf("result").forGetter(ItemEtchingRecipe::result)
ItemStack.OPTIONAL_CODEC.fieldOf("result").forGetter(ItemEtchingRecipe::result),
Codec.INT.fieldOf("duration").forGetter(ItemEtchingRecipe::duration)
).apply(builder, ItemEtchingRecipe::new));
private static final StreamCodec<RegistryFriendlyByteBuf, ItemEtchingRecipe> STREAM_CODEC = StreamCodec.composite(
IngredientWithCount.STREAM_CODEC,
ItemEtchingRecipe::ingredient,
ItemStack.OPTIONAL_STREAM_CODEC,
ItemEtchingRecipe::result,
ByteBufCodecs.INT,
ItemEtchingRecipe::duration,
ItemEtchingRecipe::new
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package com.portingdeadmods.modjam.content.recipes;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.portingdeadmods.modjam.content.recipes.utils.IngredientWithCount;
import com.portingdeadmods.modjam.content.recipes.utils.RecipeUtils;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.NonNullList;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.*;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;

public record ItemTransformationRecipe(IngredientWithCount ingredient, ItemStack result) implements Recipe<SingleRecipeInput> {
public record ItemTransformationRecipe(IngredientWithCount ingredient, ItemStack result, int duration, float purity) implements Recipe<SingleRecipeInput> {
public static final String NAME = "item_transformation";

@Override
Expand Down Expand Up @@ -59,13 +61,19 @@ public static class Serializer implements RecipeSerializer<ItemTransformationRec
public static final ItemTransformationRecipe.Serializer INSTANCE = new ItemTransformationRecipe.Serializer();
private static final MapCodec<ItemTransformationRecipe> MAP_CODEC = RecordCodecBuilder.mapCodec((builder) -> builder.group(
IngredientWithCount.CODEC.fieldOf("ingredient").forGetter(ItemTransformationRecipe::ingredient),
ItemStack.OPTIONAL_CODEC.fieldOf("result").forGetter(ItemTransformationRecipe::result)
ItemStack.OPTIONAL_CODEC.fieldOf("result").forGetter(ItemTransformationRecipe::result),
Codec.INT.fieldOf("duration").forGetter(ItemTransformationRecipe::duration),
Codec.FLOAT.fieldOf("purity").forGetter(ItemTransformationRecipe::purity)
).apply(builder, ItemTransformationRecipe::new));
private static final StreamCodec<RegistryFriendlyByteBuf, ItemTransformationRecipe> STREAM_CODEC = StreamCodec.composite(
IngredientWithCount.STREAM_CODEC,
ItemTransformationRecipe::ingredient,
ItemStack.OPTIONAL_STREAM_CODEC,
ItemTransformationRecipe::result,
ByteBufCodecs.INT,
ItemTransformationRecipe::duration,
ByteBufCodecs.FLOAT,
ItemTransformationRecipe::purity,
ItemTransformationRecipe::new
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class AquaticCatalystChannelingRecipeBuilder implements MJRecipeBuilder {
private final Ingredient ingredient;
private int powerAmount;
Expand Down Expand Up @@ -51,12 +53,22 @@ public AquaticCatalystChannelingRecipeBuilder duration(int duration) {

@Override
public @NotNull Item getResult() {
return ingredient.getItems().length > 0 ? ingredient.getItems()[0].getItem() : Items.AIR;
return Items.AIR;
}

@Override
public void save(RecipeOutput recipeOutput, ResourceLocation resourceLocation) {
AquaticCatalystChannelingRecipe recipe = new AquaticCatalystChannelingRecipe(this.ingredient, this.powerAmount, this.purity, this.duration);
recipeOutput.accept(resourceLocation, recipe, null);
}

@Override
public List<Ingredient> getIngredients() {
return List.of(this.ingredient);
}

@Override
public String getName() {
return AquaticCatalystChannelingRecipe.NAME;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class ItemEtchingRecipeBuilder implements MJRecipeBuilder {
@NotNull
private final ItemStack result;
@NotNull
private IngredientWithCount ingredient;
@NotNull private final ItemStack result;
private int duration;

private ItemEtchingRecipeBuilder(ItemStack result) {
private ItemEtchingRecipeBuilder(@NotNull ItemStack result) {
this.ingredient = IngredientWithCount.EMPTY;
this.result = result;
}
Expand All @@ -27,14 +32,15 @@ public static ItemEtchingRecipeBuilder newRecipe(ItemStack result) {
}

@Override
public @NotNull ItemEtchingRecipeBuilder unlockedBy(String s, Criterion<?> criterion) {
public @NotNull ItemEtchingRecipeBuilder unlockedBy(@NotNull String s, @NotNull Criterion<?> criterion) {
return this;
}

public ItemEtchingRecipeBuilder ingredient(IngredientWithCount ingredient) {
this.ingredient = ingredient;
return this;
}

public ItemEtchingRecipeBuilder ingredient(ItemStack ingredient) {
this.ingredient = IngredientWithCount.fromItemStack(ingredient);
return this;
Expand All @@ -45,11 +51,16 @@ public ItemEtchingRecipeBuilder ingredient(ItemLike ingredient) {
return this;
}

public final ItemEtchingRecipeBuilder ingredient(TagKey<Item> item) {
public ItemEtchingRecipeBuilder ingredient(TagKey<Item> item) {
this.ingredient = IngredientWithCount.fromItemTag(item);
return this;
}

public ItemEtchingRecipeBuilder duration(int duration) {
this.duration = duration;
return this;
}

@Override
public @NotNull ItemEtchingRecipeBuilder group(@Nullable String group) {
return this;
Expand All @@ -62,7 +73,17 @@ public final ItemEtchingRecipeBuilder ingredient(TagKey<Item> item) {

@Override
public void save(RecipeOutput recipeOutput, ResourceLocation resourceLocation) {
ItemEtchingRecipe recipe = new ItemEtchingRecipe(this.ingredient, this.result);
ItemEtchingRecipe recipe = new ItemEtchingRecipe(this.ingredient, this.result, this.duration);
recipeOutput.accept(resourceLocation, recipe, null);
}

@Override
public List<Ingredient> getIngredients() {
return List.of(this.ingredient.ingredient());
}

@Override
public String getName() {
return ItemEtchingRecipe.NAME;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class ItemTransformationRecipeBuilder implements MJRecipeBuilder {
@NotNull private IngredientWithCount ingredient;
@NotNull private final ItemStack result;
@NotNull
private final ItemStack result;
@NotNull
private IngredientWithCount ingredient;
private float purity;
private int duration;

private ItemTransformationRecipeBuilder(ItemStack result) {
this.ingredient = IngredientWithCount.EMPTY;
Expand All @@ -34,6 +41,7 @@ public ItemTransformationRecipeBuilder ingredient(IngredientWithCount ingredient
this.ingredient = ingredient;
return this;
}

public ItemTransformationRecipeBuilder ingredient(ItemStack ingredient) {
this.ingredient = IngredientWithCount.fromItemStack(ingredient);
return this;
Expand All @@ -44,11 +52,16 @@ public ItemTransformationRecipeBuilder ingredient(ItemLike ingredient) {
return this;
}

public final ItemTransformationRecipeBuilder ingredient(TagKey<Item> item) {
public ItemTransformationRecipeBuilder ingredient(TagKey<Item> item) {
this.ingredient = IngredientWithCount.fromItemTag(item);
return this;
}

public ItemTransformationRecipeBuilder purity(float purity) {
this.purity = purity;
return this;
}

@Override
public @NotNull ItemTransformationRecipeBuilder group(@Nullable String group) {
return this;
Expand All @@ -61,7 +74,17 @@ public final ItemTransformationRecipeBuilder ingredient(TagKey<Item> item) {

@Override
public void save(RecipeOutput recipeOutput, ResourceLocation resourceLocation) {
ItemTransformationRecipe recipe = new ItemTransformationRecipe(this.ingredient, this.result);
ItemTransformationRecipe recipe = new ItemTransformationRecipe(this.ingredient, this.result, this.duration, this.purity);
recipeOutput.accept(resourceLocation, recipe, null);
}

@Override
public List<Ingredient> getIngredients() {
return List.of(this.ingredient.ingredient());
}

@Override
public String getName() {
return ItemTransformationRecipe.NAME;
}
}
Loading

0 comments on commit 55d4b77

Please sign in to comment.