Skip to content

Commit

Permalink
Simplify ChestMaterial codec
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jun 21, 2024
1 parent 73fd1bc commit 599dc34
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.google.common.collect.Maps;
import com.google.gson.JsonSyntaxException;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.Vec3i;
import net.minecraft.util.ExtraCodecs;
import net.minecraft.world.inventory.MenuType;
import org.cyclops.colossalchests.GeneralConfig;
import org.cyclops.colossalchests.Reference;
Expand All @@ -29,11 +29,9 @@
*/
public class ChestMaterial {

public static final Codec<ChestMaterial> CODEC = RecordCodecBuilder.create(
builder -> builder.group(
Codec.STRING.fieldOf("name").forGetter(ChestMaterial::getName)
)
.apply(builder, ChestMaterial::valueOfSafe)
public static final Codec<ChestMaterial> CODEC = ExtraCodecs.stringResolverCodec(
ChestMaterial::getName,
ChestMaterial::valueOfSafe
);

public static final List<ChestMaterial> VALUES = Lists.newArrayList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "COPPER" }
"material": "COPPER"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "DIAMOND" }
"material": "DIAMOND"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "GOLD" }
"material": "GOLD"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "IRON" }
"material": "IRON"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "OBSIDIAN" }
"material": "OBSIDIAN"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "SILVER" }
"material": "SILVER"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "WOOD" }
"material": "WOOD"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "COPPER" },
"material": "COPPER",
"minimumSize": 10
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "DIAMOND" },
"material": "DIAMOND",
"minimumSize": 10
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "GOLD" },
"material": "GOLD",
"minimumSize": 10
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "IRON" },
"material": "IRON",
"minimumSize": 10
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "OBSIDIAN" },
"material": "OBSIDIAN",
"minimumSize": 10
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "SILVER" },
"material": "SILVER",
"minimumSize": 10
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"criteria_0": {
"trigger": "colossalchests:chest_formed",
"conditions": {
"material": { "name": "WOOD" },
"material": "WOOD",
"minimumSize": 10
}
}
Expand Down

0 comments on commit 599dc34

Please sign in to comment.