Skip to content

Commit

Permalink
refactor(tags): cleaned ore generation tags
Browse files Browse the repository at this point in the history
  • Loading branch information
D4RKAR117 committed May 21, 2024
1 parent d554646 commit efc7299
Show file tree
Hide file tree
Showing 15 changed files with 136 additions and 52 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mod_name=Cog Works Engineering
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=PolyFormPerimeter-1.0
# The mod version. See https://semver.org/
mod_version=0.1.0
mod_version=0.1.1
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
// 1.20.6 2024-05-19T16:14:06.690821 Tags for minecraft:block mod id cog_works
e9f33059b8de90871403e988b1ef437c322ffe42 data/c/tags/blocks/ores.json
// 1.20.6 2024-05-20T18:49:15.1716355 Tags for minecraft:block mod id cog_works
e2b2434ef0a59f46205bdcc5347444cc9a3eff9b data/c/tags/blocks/ores.json
8e78287246125b0e18a4f086e00f37fc8298ae00 data/c/tags/blocks/ores/bauxite.json
49280ece99a4c033b7b2592e7caaf4a5fcd52b8f data/c/tags/blocks/ores/cobalt.json
005adf3e8dd399322ebfa268dd0456c8e3fa7e2f data/c/tags/blocks/ores/graphite.json
3c034f3c93e22ad55a8a866c121b3842ce2faec2 data/c/tags/blocks/ores/iridium.json
ffd6d649f2a2d1802403a3e37a1d8b13675ba556 data/c/tags/blocks/ores/lithium.json
32103ef4930c1b109015d7935915b3e1395ca3ec data/c/tags/blocks/ores/molybdenum.json
2a308644fd36140101992c68bb57fcb95b613e98 data/c/tags/blocks/ores/nickel.json
d3b67ae304dff1fb62d7e632ec75032c7c782f7e data/c/tags/blocks/ores/platinum.json
9f9d51638d1ea8f13ea7fbd36206eb7237cc5702 data/c/tags/blocks/ores/titanium.json
df7a2272e210bac05c0b10236534f1eca9df90c4 data/c/tags/blocks/ores/tungsten.json
0c7da0f32c0ca9d4ea3ae023e44834d2c36c762d data/minecraft/tags/blocks/mineable/pickaxe.json
0588128a1c4b038372348beb255961e587767064 data/minecraft/tags/blocks/needs_diamond_tool.json
d2c3532920241ae341318d2d1f6bee936281c5c4 data/minecraft/tags/blocks/needs_iron_tool.json
32 changes: 10 additions & 22 deletions src/generated/resources/data/c/tags/blocks/ores.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
{
"values": [
"cog_works:tungsten_ore",
"cog_works:titanium_ore",
"cog_works:cobalt_ore",
"cog_works:nickel_ore",
"cog_works:platinum_ore",
"cog_works:bauxite_ore",
"cog_works:molybdenum_ore",
"cog_works:lithium_ore",
"cog_works:iridium_ore",
"cog_works:graphite_ore",
"#minecraft:stone_ore_replaceables",
"cog_works:deepslate_tungsten_ore",
"cog_works:deepslate_titanium_ore",
"cog_works:deepslate_cobalt_ore",
"cog_works:deepslate_nickel_ore",
"cog_works:deepslate_platinum_ore",
"cog_works:deepslate_bauxite_ore",
"cog_works:deepslate_molybdenum_ore",
"cog_works:deepslate_lithium_ore",
"cog_works:deepslate_iridium_ore",
"cog_works:deepslate_graphite_ore",
"#minecraft:deepslate_ore_replaceables"
"#c:ores/bauxite",
"#c:ores/graphite",
"#c:ores/lithium",
"#c:ores/molybdenum",
"#c:ores/iridium",
"#c:ores/tungsten",
"#c:ores/titanium",
"#c:ores/cobalt",
"#c:ores/nickel",
"#c:ores/platinum"
]
}
6 changes: 6 additions & 0 deletions src/generated/resources/data/c/tags/blocks/ores/bauxite.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"cog_works:bauxite_ore",
"cog_works:deepslate_bauxite_ore"
]
}
6 changes: 6 additions & 0 deletions src/generated/resources/data/c/tags/blocks/ores/cobalt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"cog_works:cobalt_ore",
"cog_works:deepslate_cobalt_ore"
]
}
6 changes: 6 additions & 0 deletions src/generated/resources/data/c/tags/blocks/ores/graphite.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"cog_works:graphite_ore",
"cog_works:deepslate_graphite_ore"
]
}
6 changes: 6 additions & 0 deletions src/generated/resources/data/c/tags/blocks/ores/iridium.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"cog_works:iridium_ore",
"cog_works:deepslate_iridium_ore"
]
}
6 changes: 6 additions & 0 deletions src/generated/resources/data/c/tags/blocks/ores/lithium.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"cog_works:lithium_ore",
"cog_works:deepslate_lithium_ore"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"cog_works:molybdenum_ore",
"cog_works:deepslate_molybdenum_ore"
]
}
6 changes: 6 additions & 0 deletions src/generated/resources/data/c/tags/blocks/ores/nickel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"cog_works:nickel_ore",
"cog_works:deepslate_nickel_ore"
]
}
6 changes: 6 additions & 0 deletions src/generated/resources/data/c/tags/blocks/ores/platinum.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"cog_works:platinum_ore",
"cog_works:deepslate_platinum_ore"
]
}
6 changes: 6 additions & 0 deletions src/generated/resources/data/c/tags/blocks/ores/titanium.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"cog_works:titanium_ore",
"cog_works:deepslate_titanium_ore"
]
}
6 changes: 6 additions & 0 deletions src/generated/resources/data/c/tags/blocks/ores/tungsten.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"cog_works:tungsten_ore",
"cog_works:deepslate_tungsten_ore"
]
}
25 changes: 25 additions & 0 deletions src/main/java/org/darkar/cog_works/Registry.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.darkar.cog_works;

import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
Expand All @@ -24,6 +27,28 @@ public static class Blocks {

private static final DeferredRegister.Blocks DEFERRED_REGISTRY = DeferredRegister.createBlocks(MOD_ID);

public static class Tags {

public static final TagKey<Block> BAUXITE_ORES = createConventional("ores/bauxite");
public static final TagKey<Block> GRAPHITE_ORES = createConventional("ores/graphite");
public static final TagKey<Block> LITHIUM_ORES = createConventional("ores/lithium");
public static final TagKey<Block> MOLYBDENUM_ORES = createConventional("ores/molybdenum");
public static final TagKey<Block> IRIDIUM_ORES = createConventional("ores/iridium");
public static final TagKey<Block> TUNGSTEN_ORES = createConventional("ores/tungsten");
public static final TagKey<Block> TITANIUM_ORES = createConventional("ores/titanium");
public static final TagKey<Block> COBALT_ORES = createConventional("ores/cobalt");
public static final TagKey<Block> NICKEL_ORES = createConventional("ores/nickel");
public static final TagKey<Block> PLATINUM_ORES = createConventional("ores/platinum");

private static TagKey<Block> createConventional(String name) {
return TagKey.create(Registries.BLOCK, new ResourceLocation("c" ,name));
}

private static TagKey<Block> createCustom(String name) {
return TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, name));
}
}

// Tungsten Ore
public static final DeferredBlock<Block> TUNGSTEN_ORE = DEFERRED_REGISTRY.registerSimpleBlock("tungsten_ore",
BlockBehaviour.Properties.of().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.concurrent.CompletableFuture;

import static org.darkar.cog_works.CogWorks.MOD_ID;
import static org.darkar.cog_works.Registry.Blocks.Tags.*;

public class BlockTagGenerator extends BlockTagsProvider {
public BlockTagGenerator(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, @Nullable ExistingFileHelper existingFileHelper) {
Expand All @@ -20,33 +21,10 @@ public BlockTagGenerator(PackOutput output, CompletableFuture<HolderLookup.Provi

@Override
protected void addTags(HolderLookup.Provider pProvider) {
this.tag(Tags.Blocks.ORES).add(
Registry.Blocks.TUNGSTEN_ORE.get(),
Registry.Blocks.TITANIUM_ORE.get(),
Registry.Blocks.COBALT_ORE.get(),
Registry.Blocks.NICKEL_ORE.get(),
Registry.Blocks.PLATINUM_ORE.get(),
Registry.Blocks.BAUXITE_ORE.get(),
Registry.Blocks.MOLYBDENUM_ORE.get(),
Registry.Blocks.LITHIUM_ORE.get(),
Registry.Blocks.IRIDIUM_ORE.get(),
Registry.Blocks.GRAPHITE_ORE.get())
.addTag(BlockTags.STONE_ORE_REPLACEABLES);

this.tag(Tags.Blocks.ORES).add(
Registry.Blocks.DEEPSLATE_TUNGSTEN_ORE.get(),
Registry.Blocks.DEEPSLATE_TITANIUM_ORE.get(),
Registry.Blocks.DEEPSLATE_COBALT_ORE.get(),
Registry.Blocks.DEEPSLATE_NICKEL_ORE.get(),
Registry.Blocks.DEEPSLATE_PLATINUM_ORE.get(),
Registry.Blocks.DEEPSLATE_BAUXITE_ORE.get(),
Registry.Blocks.DEEPSLATE_MOLYBDENUM_ORE.get(),
Registry.Blocks.DEEPSLATE_LITHIUM_ORE.get(),
Registry.Blocks.DEEPSLATE_IRIDIUM_ORE.get(),
Registry.Blocks.DEEPSLATE_GRAPHITE_ORE.get())
.addTag(BlockTags.DEEPSLATE_ORE_REPLACEABLES);

this.tag(BlockTags.MINEABLE_WITH_PICKAXE).add(

tag(BlockTags.MINEABLE_WITH_PICKAXE).add(
Registry.Blocks.TUNGSTEN_ORE.get(),
Registry.Blocks.TITANIUM_ORE.get(),
Registry.Blocks.COBALT_ORE.get(),
Expand All @@ -69,7 +47,7 @@ protected void addTags(HolderLookup.Provider pProvider) {
Registry.Blocks.DEEPSLATE_GRAPHITE_ORE.get()
);

this.tag(BlockTags.NEEDS_IRON_TOOL).add(
tag(BlockTags.NEEDS_IRON_TOOL).add(
Registry.Blocks.COBALT_ORE.get(),
Registry.Blocks.DEEPSLATE_COBALT_ORE.get(),
Registry.Blocks.NICKEL_ORE.get(),
Expand All @@ -82,7 +60,7 @@ protected void addTags(HolderLookup.Provider pProvider) {
Registry.Blocks.DEEPSLATE_GRAPHITE_ORE.get()
);

this.tag(BlockTags.NEEDS_DIAMOND_TOOL).add(
tag(BlockTags.NEEDS_DIAMOND_TOOL).add(
Registry.Blocks.TUNGSTEN_ORE.get(),
Registry.Blocks.DEEPSLATE_TUNGSTEN_ORE.get(),
Registry.Blocks.TITANIUM_ORE.get(),
Expand All @@ -95,5 +73,28 @@ protected void addTags(HolderLookup.Provider pProvider) {
Registry.Blocks.DEEPSLATE_IRIDIUM_ORE.get()
);

tag(BAUXITE_ORES).add(Registry.Blocks.BAUXITE_ORE.get(), Registry.Blocks.DEEPSLATE_BAUXITE_ORE.get());
tag(GRAPHITE_ORES).add(Registry.Blocks.GRAPHITE_ORE.get(), Registry.Blocks.DEEPSLATE_GRAPHITE_ORE.get());
tag(LITHIUM_ORES).add(Registry.Blocks.LITHIUM_ORE.get(), Registry.Blocks.DEEPSLATE_LITHIUM_ORE.get());
tag(MOLYBDENUM_ORES).add(Registry.Blocks.MOLYBDENUM_ORE.get(), Registry.Blocks.DEEPSLATE_MOLYBDENUM_ORE.get());
tag(IRIDIUM_ORES).add(Registry.Blocks.IRIDIUM_ORE.get(), Registry.Blocks.DEEPSLATE_IRIDIUM_ORE.get());
tag(TUNGSTEN_ORES).add(Registry.Blocks.TUNGSTEN_ORE.get(), Registry.Blocks.DEEPSLATE_TUNGSTEN_ORE.get());
tag(TITANIUM_ORES).add(Registry.Blocks.TITANIUM_ORE.get(), Registry.Blocks.DEEPSLATE_TITANIUM_ORE.get());
tag(COBALT_ORES).add(Registry.Blocks.COBALT_ORE.get(), Registry.Blocks.DEEPSLATE_COBALT_ORE.get());
tag(NICKEL_ORES).add(Registry.Blocks.NICKEL_ORE.get(), Registry.Blocks.DEEPSLATE_NICKEL_ORE.get());
tag(PLATINUM_ORES).add(Registry.Blocks.PLATINUM_ORE.get(), Registry.Blocks.DEEPSLATE_PLATINUM_ORE.get());

tag(Tags.Blocks.ORES).addTags(
BAUXITE_ORES,
GRAPHITE_ORES,
LITHIUM_ORES,
MOLYBDENUM_ORES,
IRIDIUM_ORES,
TUNGSTEN_ORES,
TITANIUM_ORES,
COBALT_ORES,
NICKEL_ORES,
PLATINUM_ORES
);
}
}

0 comments on commit efc7299

Please sign in to comment.