Skip to content

Commit

Permalink
Fix #61
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Jun 15, 2024
1 parent 77bea20 commit 9d85d33
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 15 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Numismatics 1.0.7
------------------------------------------------------
Additions
- Computer Craft: Tweaked compat for vendors and brass depositors
- Common tag that all blocks have with another tag for items to make it easier to allow use of numismatics blocks/items with claims

Fixes
- Fix coins stacked above 127 visually disappearing on the client in Brass Depositors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2024-06-01T10:15:46.973855481 Create: Numismatics/Numismatics' Advancements
// 1.20.1 2024-06-15T09:57:05.592624451 Create: Numismatics/Numismatics' Advancements
8f32fb49ef81058e2e660fac983dbef2f554db38 data/numismatics/advancements/root.json
645c92e6e449889ed4cf617432fd6fa87ffe355b data/numismatics/advancements/questionable_investment.json
894790d980b33b5cc24a21937c7db72bf0af1c5a data/numismatics/advancements/money_laundering.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2024-06-01T10:15:46.973160682 Create: Numismatics/Numismatics Standard Recipes
// 1.20.1 2024-06-15T09:57:05.591802125 Create: Numismatics/Numismatics Standard Recipes
e16d9a5134c226db94bb389c44e55a8b393ca6c4 data/numismatics/recipes/crafting/brass_depositor.json
151c31385fcbf7283f380e25ee2c8fdacd6d5103 data/numismatics/recipes/crafting/orange_id_card.json
858305a3537cdcb5bb19b883e688ddb876f0473c data/numismatics/recipes/crafting/brown_id_card.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// 1.20.1 2024-06-01T10:15:46.973739917 Create: Numismatics/Numismatics' Sequenced Assembly Recipes
// 1.20.1 2024-06-15T09:57:05.592492659 Create: Numismatics/Numismatics' Sequenced Assembly Recipes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2024-06-01T10:15:46.971201845 Create: Numismatics/Registrate Provider for numismatics [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
// 1.20.1 2024-06-15T09:57:05.589915157 Create: Numismatics/Registrate Provider for numismatics [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
70c481f36a9718ac48632e6939ac6ba785be4c9e assets/numismatics/models/item/black_id_card.json
95ef415a564eba1d212053195d25b199427b94e3 assets/numismatics/blockstates/creative_vendor.json
4458283178334ae169a7cbbd1aa09067cbb99ee7 data/numismatics/tags/items/internal/dyes/green_dyes.json
Expand Down Expand Up @@ -55,6 +55,7 @@ ac8c537dfc0e6704a0abe4f47130c41b19cde231 data/numismatics/tags/items/internal/dy
790ff3c5da6a67a5de1ceb7138fa3e1c0fe97f80 data/numismatics/tags/items/internal/dyes/lime_dyes.json
d048d04208faa63f0014d614d6026a66fe118c11 data/numismatics/loot_tables/blocks/brass_depositor.json
d4b100dee3fb5ad235f06a247a4c2c0ed04d1e0d data/numismatics/tags/blocks/internal/relocation_not_supported.json
f4aefe87cb9cc08511dc226984628771538a42d9 data/numismatics/tags/blocks/numismatics_blocks.json
5f6e841fc0eae95df179de8d4b2eae325a19e015 data/numismatics/tags/items/cards.json
a2dec3b886deae84d88babd6fb1ce2997d193533 data/numismatics/tags/items/coins.json
b5533a44ad137e21ee8aab5c200f673d1e8a235f assets/numismatics/models/item/pink_id_card.json
Expand Down Expand Up @@ -84,8 +85,9 @@ d38d7d40599c66ac84ef7dd2c1635d3ba7794871 data/numismatics/tags/items/internal/nu
ad712dd2a2a7268dfa773f38a50d526952758d5c data/numismatics/tags/items/internal/dyes/cyan_dyes.json
182450e6ad4229f2959e6c50e38ef6e2ff5259d0 data/numismatics/tags/items/internal/dyes/orange_dyes.json
56973a6ce09377c8f235f46aa4d71a2a9fabf587 assets/numismatics/models/item/red_card.json
f7f43dd6d567ec8303c73b79409bc92d8b56574a assets/numismatics/blockstates/andesite_depositor.json
bdf101b181fa593ac3f92224b80c8ec45b5f046a data/numismatics/tags/items/numismatics_items.json
266d9b0eb6fdecc4bcf6da465078d059009a3b54 data/numismatics/loot_tables/blocks/blaze_banker.json
f7f43dd6d567ec8303c73b79409bc92d8b56574a assets/numismatics/blockstates/andesite_depositor.json
411b79f79547a0adcb665bf7440e8169f7dcb24e assets/numismatics/models/block/brass_depositor.json
99e3dd233c66e14a6e572e332ac8b7af1f8ed94e assets/numismatics/models/item/orange_card.json
83ce6c9d27970b4c643f0f9f3dfeb58668fca3d4 assets/numismatics/models/item/banking_guide.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"replace": false,
"values": [
"numismatics:andesite_depositor",
"numismatics:bank_terminal",
"numismatics:blaze_banker",
"numismatics:brass_depositor",
"numismatics:creative_vendor",
"numismatics:vendor"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"replace": false,
"values": [
"numismatics:andesite_depositor",
"numismatics:bank_terminal",
"numismatics:banking_guide",
"numismatics:bevel",
"numismatics:black_card",
"numismatics:black_id_card",
"numismatics:blaze_banker",
"numismatics:blue_card",
"numismatics:blue_id_card",
"numismatics:brass_depositor",
"numismatics:brown_card",
"numismatics:brown_id_card",
"numismatics:cog",
"numismatics:creative_vendor",
"numismatics:crown",
"numismatics:cyan_card",
"numismatics:cyan_id_card",
"numismatics:gray_card",
"numismatics:gray_id_card",
"numismatics:green_card",
"numismatics:green_id_card",
"numismatics:light_blue_card",
"numismatics:light_blue_id_card",
"numismatics:light_gray_card",
"numismatics:light_gray_id_card",
"numismatics:lime_card",
"numismatics:lime_id_card",
"numismatics:magenta_card",
"numismatics:magenta_id_card",
"numismatics:orange_card",
"numismatics:orange_id_card",
"numismatics:pink_card",
"numismatics:pink_id_card",
"numismatics:purple_card",
"numismatics:purple_id_card",
"numismatics:red_card",
"numismatics:red_id_card",
"numismatics:sprocket",
"numismatics:spur",
"numismatics:sun",
"numismatics:vendor",
"numismatics:white_card",
"numismatics:white_id_card",
"numismatics:yellow_card",
"numismatics:yellow_id_card"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
import dev.ithundxr.createnumismatics.Numismatics;
import dev.ithundxr.createnumismatics.multiloader.CommonTags;
import dev.ithundxr.createnumismatics.registry.NumismaticsBlocks;
import dev.ithundxr.createnumismatics.registry.NumismaticsTags;
import dev.ithundxr.createnumismatics.registry.NumismaticsTags.AllBlockTags;
import dev.ithundxr.createnumismatics.registry.NumismaticsTags.AllItemTags;
import net.minecraft.core.DefaultedRegistry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.tags.TagsProvider;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -36,10 +39,7 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

/**
* Based on {@link TagGen}
Expand All @@ -50,15 +50,16 @@ public class NumismaticsTagGen {
@SafeVarargs
public static void addOptionalTag(ResourceLocation id, TagKey<Block>... tags) {
for (TagKey<Block> tag : tags) {
OPTIONAL_TAGS.computeIfAbsent(tag, (e) -> new ArrayList<ResourceLocation>()).add(id);
OPTIONAL_TAGS.computeIfAbsent(tag, (e) -> new ArrayList<>()).add(id);
}
}
public static void generateBlockTags(RegistrateTagsProvider<Block> tags) {
// tagAppender(tags, AllBlockTags.TRACKS)
// .add(AllBlocks.TRACK.get());
addTagToAllInRegistry(tags, BuiltInRegistries.BLOCK, NumismaticsTags.AllBlockTags.NUMISMATICS_BLOCKS.tag);
CommonTags.RELOCATION_NOT_SUPPORTED.generateBoth(tags, tag -> {
tag.addTag(CommonTags.RELOCATION_NOT_SUPPORTED.tag);
});

for (TagKey<Block> tag : OPTIONAL_TAGS.keySet()) {
var appender = tagAppender(tags, tag);
for (ResourceLocation loc : OPTIONAL_TAGS.get(tag))
Expand All @@ -67,6 +68,8 @@ public static void generateBlockTags(RegistrateTagsProvider<Block> tags) {
}

public static void generateItemTags(RegistrateItemTagsProvider tags) {
addTagToAllInRegistry(tags, BuiltInRegistries.ITEM, NumismaticsTags.AllItemTags.NUMISMATICS_ITEMS.tag);

CommonTags.DYES.values().forEach(tag -> tag.generateCommon(tags));
CommonTags.IRON_NUGGETS.generateCommon(tags);
CommonTags.ZINC_NUGGETS.generateCommon(tags);
Expand Down Expand Up @@ -96,4 +99,17 @@ public static TagsProvider.TagAppender<Block> tagAppender(RegistrateTagsProvider
public static <T> TagsProvider.TagAppender<T> tagAppender(RegistrateTagsProvider<T> prov, TagKey<T> tag) {
throw new AssertionError();
}

@SuppressWarnings("unchecked")
public static <T> void addTagToAllInRegistry(RegistrateTagsProvider<T> prov, DefaultedRegistry<T> defaultedRegistry, TagKey<T> tagKey) {
T[] array = (T[]) defaultedRegistry.keySet()
.stream()
.filter(rs -> rs.getNamespace().equals(Numismatics.MOD_ID))
.sorted(Comparator.comparing(ResourceLocation::getPath))
.map(defaultedRegistry::get)
.toArray();

prov.addTag(tagKey)
.add(array);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ public enum NameSpace {


public enum AllBlockTags {
// SEMAPHORE_POLES(NameSpace.MOD, NameSpace.MOD.optionalDefault,false),
// TRACK_CASING_BLACKLIST(NameSpace.MOD, NameSpace.MOD.optionalDefault,false),
// CONDUCTOR_SPY_USABLE(NameSpace.MOD, NameSpace.MOD.optionalDefault,false) // so other mods / datapacks can make more blocks usable for conductor spies
NUMISMATICS_BLOCKS,
;

public final TagKey<Block> tag;
Expand Down Expand Up @@ -105,6 +103,7 @@ public static void register() {
}

public enum AllItemTags {
NUMISMATICS_ITEMS,
COINS,
CARDS,
ID_CARDS
Expand Down

0 comments on commit 9d85d33

Please sign in to comment.