Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhardcode Treecutter #7221

Open
wants to merge 2 commits into
base: mc1.20.1/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2024-09-03T11:32:11.6637155 Registrate Provider for create [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-12-22T17:16:06.8679772 Registrate Provider for create [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
60bbdf92d2ac9824ea6144955c74043a6005f79d assets/create/blockstates/acacia_window.json
6a67703c2697d81b7dc83e9d72a66f9c9ff08383 assets/create/blockstates/acacia_window_pane.json
c3ae87b62e81d8e9476eccd793bb1548d74c66a1 assets/create/blockstates/adjustable_chain_gearshift.json
Expand Down Expand Up @@ -585,8 +585,8 @@ b0d8f08968763a5f74e5cd5644377a76a9f39753 assets/create/blockstates/yellow_toolbo
fe8c497aacc641c2f01cec90bba9f19e59cc2ed2 assets/create/blockstates/yellow_valve_handle.json
e819e93fdcbe9fd9c050a052d2718ff3b3539365 assets/create/blockstates/zinc_block.json
64121dcb216381c83b4fe28aa361ea07c24c9ad0 assets/create/blockstates/zinc_ore.json
1195fdc4fb51659c921e2bbe744a35107f787aa2 assets/create/lang/en_ud.json
632d1aac7255fc0f4804f4df138ce9926134d2f9 assets/create/lang/en_us.json
5f729ba3f0557eb1c1923a091e06eee5ddf25c59 assets/create/lang/en_ud.json
bdd95ac05db0717d02e4dc34b6054e73d4eee640 assets/create/lang/en_us.json
a97e1060e00ae701a02e39cd4ef8054cf345fac4 assets/create/models/block/acacia_window.json
103e032c0b1a0a6a27c67da8c91179a564bd281c assets/create/models/block/acacia_window_pane_noside.json
fb00b627abda76ad4fea867ca57dbfadd24fffa3 assets/create/models/block/acacia_window_pane_noside_alt.json
Expand Down Expand Up @@ -4179,6 +4179,10 @@ f675c20350ed60da4878b5d6301f02c8c05624bd data/create/tags/blocks/fan_processing_
6858173c670bb593664ac3c62ded726d57d581f1 data/create/tags/blocks/fan_transparent.json
2589b135c0e96ad29076569e144528fe32ea5b39 data/create/tags/blocks/girdable_tracks.json
02c0a018f2b8540dc2f1fb420172cc716552f321 data/create/tags/blocks/movable_empty_collider.json
edf94f921781e796e4a2117a0c0d93bd9683753b data/create/tags/blocks/mushroom_stems.json
a746d54a67450dee14671aba209d794c876491ab data/create/tags/blocks/non_decaying_leaf_dist1.json
45f6a1c0b581bfb65cf0a11c4c5421b4481bdf09 data/create/tags/blocks/non_decaying_leaf_dist2.json
7c9c77e740cdcf8b608069d8a5f2375a47edf1b4 data/create/tags/blocks/non_decaying_leaf_dist3.json
4970078b49ddac1b1d500ed0469cedf42bdc3d35 data/create/tags/blocks/non_movable.json
06e13efbb7b0d09ff7ecd1a7dc45a0760b91ad67 data/create/tags/blocks/ore_override_stone.json
a5874f73c7dc0a3ae12999e6ae8abf45bc7fb9be data/create/tags/blocks/passive_boiler_heaters.json
Expand All @@ -4189,6 +4193,7 @@ a5874f73c7dc0a3ae12999e6ae8abf45bc7fb9be data/create/tags/blocks/passive_boiler_
2589b135c0e96ad29076569e144528fe32ea5b39 data/create/tags/blocks/tracks.json
1b6977d9a399cf6ee042e3f8f5e64e4d3cda5489 data/create/tags/blocks/tree_attachments.json
da739ad2160e7df4e0e5cc89587670ce5e9450c3 data/create/tags/blocks/valve_handles.json
d7e366cb3ebabc27b4c558ad4e7087379ca1d6f8 data/create/tags/blocks/vertical_plants.json
72143286fb5cb372a0696550e2eac76ca50e6fbc data/create/tags/blocks/windmill_sails.json
58987ea71d488cc48192ceb00c00aa2903e51304 data/create/tags/blocks/wrench_pickup.json
76c0522664726c09461ad4565b6fba80b4f816b2 data/create/tags/entity_types/blaze_burner_capturable.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"values": [
"minecraft:mushroom_stem",
{
"id": "quark:glow_shroom_stem",
"required": false
},
{
"id": "undergarden:indigo_mushroom_stem",
"required": false
},
{
"id": "undergarden:blood_mushroom_stem",
"required": false
},
{
"id": "undergarden:ink_mushroom_stem",
"required": false
},
{
"id": "undergarden:veil_mushroom_stem",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
{
"id": "quark:glow_shroom_block",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"values": [
"minecraft:red_mushroom_block",
{
"id": "aether_redux:cloud_cap_block",
"required": false
},
{
"id": "aether_redux:jellyshroom_jelly_block",
"required": false
},
{
"id": "deep_aether:lightcap_mushroom_block",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"values": [
"minecraft:brown_mushroom_block",
"minecraft:weeping_vines",
"minecraft:weeping_vines_plant",
"#minecraft:wart_blocks",
{
"id": "undergarden:indigo_mushroom_cap",
"required": false
},
{
"id": "undergarden:blood_mushroom_cap",
"required": false
},
{
"id": "undergarden:engorged_blood_mushroom_cap",
"required": false
},
{
"id": "undergarden:ink_mushroom_cap",
"required": false
},
{
"id": "undergarden:veil_mushroom_cap",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"values": [
"minecraft:bamboo",
"minecraft:cactus",
"minecraft:sugar_cane",
"minecraft:kelp",
"minecraft:kelp_plant",
{
"id": "gardens_of_the_dead:whistlecane",
"required": false
},
{
"id": "unusualend:chorus_cane",
"required": false
},
{
"id": "unusualend:blooming_chorus_cane",
"required": false
}
]
}
5 changes: 5 additions & 0 deletions src/main/java/com/simibubi/create/AllTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ public enum AllBlockTags {
ROOTS,

CORALS,
VERTICAL_PLANTS,
MUSHROOM_STEMS,
NON_DECAYING_LEAF_DIST1,
NON_DECAYING_LEAF_DIST2,
NON_DECAYING_LEAF_DIST3,

RELOCATION_NOT_SUPPORTED(FORGE),
WG_STONE(FORGE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,19 +487,11 @@ public static boolean isSawable(BlockState stateToBreak) {
return true;
if (TreeCutter.isRoot(stateToBreak))
return true;
Block block = stateToBreak.getBlock();
if (block instanceof BambooStalkBlock)
if (TreeCutter.isVerticalPlant(stateToBreak))
return true;
Block block = stateToBreak.getBlock();
if (block instanceof StemGrownBlock)
return true;
if (block instanceof CactusBlock)
return true;
if (block instanceof SugarCaneBlock)
return true;
if (block instanceof KelpPlantBlock)
return true;
if (block instanceof KelpBlock)
return true;
if (block instanceof ChorusPlantBlock)
return true;
if (TreeCutter.canDynamicTreeCutFrom(block))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ public enum Mods {
AET("aether"),
HH("hauntedharvest"),
VMP("vampirism"),
WSP("windswept")
WSP("windswept"),
D_AET("deep_aether"),
A_AET("ancient_aether"),
AET_R("aether_redux"),
GOTD("gardens_of_the_dead"),
UUE("unusualend"),
UG("undergarden"),
DD("deeperdarker")

;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,7 @@ public static boolean isChorus(BlockState stateAbove) {
}

public static boolean isVerticalPlant(BlockState stateAbove) {
Block block = stateAbove.getBlock();
if (block instanceof BambooStalkBlock)
return true;
if (block instanceof CactusBlock)
return true;
if (block instanceof SugarCaneBlock)
return true;
if (block instanceof KelpPlantBlock)
return true;
return block instanceof KelpBlock;
return AllBlockTags.VERTICAL_PLANTS.matches(stateAbove);
}

/**
Expand Down Expand Up @@ -302,17 +293,20 @@ public static boolean isRoot(BlockState state) {
}

public static boolean isLog(BlockState state) {
return state.is(BlockTags.LOGS) || AllTags.AllBlockTags.SLIMY_LOGS.matches(state)
|| state.is(Blocks.MUSHROOM_STEM);
return state.is(BlockTags.LOGS) || AllBlockTags.SLIMY_LOGS.matches(state)
|| AllBlockTags.MUSHROOM_STEMS.matches(state);
}

private static int nonDecayingLeafDistance(BlockState state) {
if (state.is(Blocks.RED_MUSHROOM_BLOCK))
return 2;
if (state.is(Blocks.BROWN_MUSHROOM_BLOCK))
return 3;
if (state.is(BlockTags.WART_BLOCKS) || state.is(Blocks.WEEPING_VINES) || state.is(Blocks.WEEPING_VINES_PLANT))
if (AllBlockTags.NON_DECAYING_LEAF_DIST3.matches(state)){
return 3;
}
if (AllBlockTags.NON_DECAYING_LEAF_DIST2.matches(state)){
return 2;
}
if (AllBlockTags.NON_DECAYING_LEAF_DIST1.matches(state)){
return 1;
}
return -1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,52 @@ private static void genBlockTags(RegistrateTagsProvider<Block> provIn) {
Blocks.BUBBLE_CORAL_WALL_FAN, Blocks.FIRE_CORAL_WALL_FAN, Blocks.HORN_CORAL_WALL_FAN
);

prov.tag(AllBlockTags.VERTICAL_PLANTS.tag)
.add(Blocks.BAMBOO, Blocks.CACTUS, Blocks.SUGAR_CANE, Blocks.KELP, Blocks.KELP_PLANT);

prov.tag(AllBlockTags.MUSHROOM_STEMS.tag)
.add(Blocks.MUSHROOM_STEM);

prov.tag(AllBlockTags.NON_DECAYING_LEAF_DIST2.tag)
.add(Blocks.RED_MUSHROOM_BLOCK);

prov.tag(AllBlockTags.NON_DECAYING_LEAF_DIST3.tag)
.add(Blocks.BROWN_MUSHROOM_BLOCK, Blocks.WEEPING_VINES, Blocks.WEEPING_VINES_PLANT)
.addTag(BlockTags.WART_BLOCKS);

// COMPAT

TagGen.addOptional(prov.tag(AllBlockTags.NON_MOVABLE.tag), Mods.IE, List.of(
"connector_lv", "connector_lv_relay", "connector_mv", "connector_mv_relay",
"connector_hv", "connector_hv_relay", "connector_bundled", "connector_structural",
"connector_redstone", "connector_probe", "breaker_switch"));

TagGen.addOptional(prov.tag(AllBlockTags.ROOTS.tag), Mods.TF,
List.of("root", "liveroot_block", "mangrove_root"));
TagGen.addOptional(prov.tag(AllBlockTags.ROOTS.tag), Mods.TF, List.of(
"root", "liveroot_block", "mangrove_root"));

TagGen.addOptional(prov.tag(AllBlockTags.NON_DECAYING_LEAF_DIST2.tag), Mods.AET_R, List.of(
"cloud_cap_block", "jellyshroom_jelly_block"));

TagGen.addOptional(prov.tag(AllBlockTags.NON_DECAYING_LEAF_DIST2.tag), Mods.D_AET, List.of(
"lightcap_mushroom_block"));

TagGen.addOptional(prov.tag(AllBlockTags.VERTICAL_PLANTS.tag), Mods.GOTD, List.of(
"whistlecane"));

TagGen.addOptional(prov.tag(AllBlockTags.VERTICAL_PLANTS.tag), Mods.UUE, List.of(
"chorus_cane", "blooming_chorus_cane"));

TagGen.addOptional(prov.tag(AllBlockTags.MUSHROOM_STEMS.tag), Mods.Q, List.of(
"glow_shroom_stem"));

TagGen.addOptional(prov.tag(AllBlockTags.NON_DECAYING_LEAF_DIST1.tag), Mods.Q, List.of(
"glow_shroom_block"));

TagGen.addOptional(prov.tag(AllBlockTags.MUSHROOM_STEMS.tag), Mods.UG, List.of(
"indigo_mushroom_stem", "blood_mushroom_stem", "ink_mushroom_stem", "veil_mushroom_stem"));

TagGen.addOptional(prov.tag(AllBlockTags.NON_DECAYING_LEAF_DIST3.tag), Mods.UG, List.of(
"indigo_mushroom_cap", "blood_mushroom_cap", "engorged_blood_mushroom_cap", "ink_mushroom_cap", "veil_mushroom_cap"));

// VALIDATE

Expand Down