Skip to content

Commit f3aa011

Browse files
committed
can't stop the groovin'
1 parent d553fc7 commit f3aa011

File tree

19 files changed

+280
-67
lines changed

19 files changed

+280
-67
lines changed

src/generated/resources/.cache/5bb646c3cee204f41a1b59a2c0d9083b5f7155b0

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 1.20.1 2024-09-06T10:44:11.4045918 Oreganized Block Tags
1+
// 1.20.1 2024-09-11T15:31:25.0347469 Oreganized Block Tags
22
7a2d68d81bc5ee59f9a2f4ba68ddb39bfd9c875d data/forge/tags/blocks/glass.json
33
d96b4f83e03abe39a1b97d92b7818c8f6b2e5c68 data/forge/tags/blocks/glass_panes.json
44
d062c23ad5308b7de0b2e86f6531ea724530f898 data/forge/tags/blocks/melts_lead.json
@@ -17,9 +17,10 @@ bff6697a058fddfe9e14615bc043fcb2071fd6fc data/forge/tags/blocks/storage_blocks/s
1717
7a1e2c391ad442cdc57f69ce1737207bc52bfb84 data/minecraft/tags/blocks/beacon_base_blocks.json
1818
82c03c405a971b2a7fc3fd43a9fb6c221f463ce0 data/minecraft/tags/blocks/cauldrons.json
1919
503ad75af537d0ffef02ada9fb9afb5f5cd8e83b data/minecraft/tags/blocks/doors.json
20+
0f64e9b9dc279dd460f6408313b130a37a0c9d86 data/minecraft/tags/blocks/ice.json
2021
7a2d68d81bc5ee59f9a2f4ba68ddb39bfd9c875d data/minecraft/tags/blocks/impermeable.json
2122
f7079c32fc948b65cb486bea80e2dc93d13ce577 data/minecraft/tags/blocks/mineable/axe.json
22-
5a2cdeb6fd6f03e5f1980e2b6fb22e4e4d9b4dd0 data/minecraft/tags/blocks/mineable/pickaxe.json
23+
8794e7f7fcf41783b7738503b68f535efa58d511 data/minecraft/tags/blocks/mineable/pickaxe.json
2324
84a13f81c79f0c05f8f7a8cbf1d3c25129a97179 data/minecraft/tags/blocks/mineable/shovel.json
2425
bb86ac7ab19373da790ec5711f473614e4b62d79 data/minecraft/tags/blocks/needs_iron_tool.json
2526
dc9cc2dca9fa3a28a0458ec282e3e0fe81999ee1 data/minecraft/tags/blocks/needs_stone_tool.json
@@ -31,5 +32,6 @@ a4acb3623320f801e89e3451f8b7d9e2246f99d0 data/minecraft/tags/blocks/walls.json
3132
f1dfddab1e3f2dec1e7ed1c3fbf9f6a7f261cf08 data/oreganized/tags/blocks/crystal_glass_panes.json
3233
6b73bb0ce38222c428d54ee64e82ffa1d96c64d7 data/oreganized/tags/blocks/fire_source.json
3334
597a5aa43f0ee7c4bcf4b0e44aa4dfe527557f2b data/oreganized/tags/blocks/mineable/scribe.json
35+
0f64e9b9dc279dd460f6408313b130a37a0c9d86 data/oreganized/tags/blocks/no_silktouch_using_scribe.json
3436
06c2e2e512966767a31df77e646e41c4c39e3dd3 data/oreganized/tags/blocks/silktouch_using_scribe.json
3537
3112fb4a1df2953e2c3572fa47f886bf8e5bd679 data/oreganized/tags/blocks/stone_types/glance.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"values": [
3+
"oreganized:grooved_ice",
4+
"oreganized:grooved_packed_ice",
5+
"oreganized:grooved_blue_ice"
6+
]
7+
}

src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"oreganized:molten_lead_cauldron",
3232
"oreganized:lead_door",
3333
"oreganized:lead_trapdoor",
34-
"oreganized:lead_bars"
34+
"oreganized:lead_bars",
35+
"oreganized:grooved_ice",
36+
"oreganized:grooved_packed_ice",
37+
"oreganized:grooved_blue_ice"
3538
]
3639
}

src/generated/resources/data/oreganized/loot_tables/blocks/grooved_blue_ice.json

+36-17
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,44 @@
33
"pools": [
44
{
55
"bonus_rolls": 0.0,
6-
"conditions": [
7-
{
8-
"condition": "minecraft:match_tool",
9-
"predicate": {
10-
"enchantments": [
11-
{
12-
"enchantment": "minecraft:silk_touch",
13-
"levels": {
14-
"min": 1
15-
}
16-
}
17-
]
18-
}
19-
}
20-
],
216
"entries": [
227
{
23-
"type": "minecraft:item",
24-
"name": "oreganized:grooved_blue_ice"
8+
"type": "minecraft:alternatives",
9+
"children": [
10+
{
11+
"type": "minecraft:item",
12+
"conditions": [
13+
{
14+
"condition": "minecraft:match_tool",
15+
"predicate": {
16+
"enchantments": [
17+
{
18+
"enchantment": "minecraft:silk_touch",
19+
"levels": {
20+
"min": 1
21+
}
22+
}
23+
]
24+
}
25+
}
26+
],
27+
"name": "oreganized:grooved_blue_ice"
28+
},
29+
{
30+
"type": "minecraft:item",
31+
"conditions": [
32+
{
33+
"condition": "minecraft:match_tool",
34+
"predicate": {
35+
"items": [
36+
"oreganized:scribe"
37+
]
38+
}
39+
}
40+
],
41+
"name": "minecraft:blue_ice"
42+
}
43+
]
2544
}
2645
],
2746
"rolls": 1.0

src/generated/resources/data/oreganized/loot_tables/blocks/grooved_ice.json

+36-17
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,44 @@
33
"pools": [
44
{
55
"bonus_rolls": 0.0,
6-
"conditions": [
7-
{
8-
"condition": "minecraft:match_tool",
9-
"predicate": {
10-
"enchantments": [
11-
{
12-
"enchantment": "minecraft:silk_touch",
13-
"levels": {
14-
"min": 1
15-
}
16-
}
17-
]
18-
}
19-
}
20-
],
216
"entries": [
227
{
23-
"type": "minecraft:item",
24-
"name": "oreganized:grooved_ice"
8+
"type": "minecraft:alternatives",
9+
"children": [
10+
{
11+
"type": "minecraft:item",
12+
"conditions": [
13+
{
14+
"condition": "minecraft:match_tool",
15+
"predicate": {
16+
"enchantments": [
17+
{
18+
"enchantment": "minecraft:silk_touch",
19+
"levels": {
20+
"min": 1
21+
}
22+
}
23+
]
24+
}
25+
}
26+
],
27+
"name": "oreganized:grooved_ice"
28+
},
29+
{
30+
"type": "minecraft:item",
31+
"conditions": [
32+
{
33+
"condition": "minecraft:match_tool",
34+
"predicate": {
35+
"items": [
36+
"oreganized:scribe"
37+
]
38+
}
39+
}
40+
],
41+
"name": "minecraft:ice"
42+
}
43+
]
2544
}
2645
],
2746
"rolls": 1.0

src/generated/resources/data/oreganized/loot_tables/blocks/grooved_packed_ice.json

+36-17
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,44 @@
33
"pools": [
44
{
55
"bonus_rolls": 0.0,
6-
"conditions": [
7-
{
8-
"condition": "minecraft:match_tool",
9-
"predicate": {
10-
"enchantments": [
11-
{
12-
"enchantment": "minecraft:silk_touch",
13-
"levels": {
14-
"min": 1
15-
}
16-
}
17-
]
18-
}
19-
}
20-
],
216
"entries": [
227
{
23-
"type": "minecraft:item",
24-
"name": "oreganized:grooved_packed_ice"
8+
"type": "minecraft:alternatives",
9+
"children": [
10+
{
11+
"type": "minecraft:item",
12+
"conditions": [
13+
{
14+
"condition": "minecraft:match_tool",
15+
"predicate": {
16+
"enchantments": [
17+
{
18+
"enchantment": "minecraft:silk_touch",
19+
"levels": {
20+
"min": 1
21+
}
22+
}
23+
]
24+
}
25+
}
26+
],
27+
"name": "oreganized:grooved_packed_ice"
28+
},
29+
{
30+
"type": "minecraft:item",
31+
"conditions": [
32+
{
33+
"condition": "minecraft:match_tool",
34+
"predicate": {
35+
"items": [
36+
"oreganized:scribe"
37+
]
38+
}
39+
}
40+
],
41+
"name": "minecraft:packed_ice"
42+
}
43+
]
2544
}
2645
],
2746
"rolls": 1.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"values": [
3+
"oreganized:grooved_ice",
4+
"oreganized:grooved_packed_ice",
5+
"oreganized:grooved_blue_ice"
6+
]
7+
}

src/main/java/galena/oreganized/content/item/ScribeItem.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import static galena.oreganized.index.OTags.Blocks.MINEABLE_WITH_SCRIBE;
3030
import static galena.oreganized.index.OTags.Blocks.SILKTOUCH_WITH_SCRIBE;
31+
import static galena.oreganized.index.OTags.Blocks.SILKTOUCH_WITH_SCRIBE_BLACKLIST;
3132

3233
public class ScribeItem extends Item {
3334

@@ -65,7 +66,11 @@ public float getDestroySpeed(ItemStack stack, BlockState state) {
6566
}
6667

6768
public boolean dropsLikeSilktouch(ItemStack stack, BlockState state) {
68-
return isCorrectToolForDrops(state);
69+
return isCorrectToolForDrops(state) && !shouldNotSilktouch(stack, state);
70+
}
71+
72+
private boolean shouldNotSilktouch(ItemStack stack, BlockState state) {
73+
return state.is(SILKTOUCH_WITH_SCRIBE_BLACKLIST);
6974
}
7075

7176
@Override

src/main/java/galena/oreganized/data/OBlockTags.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import static galena.oreganized.index.OTags.Blocks.ORES_LEAD;
2727
import static galena.oreganized.index.OTags.Blocks.ORES_SILVER;
2828
import static galena.oreganized.index.OTags.Blocks.SILKTOUCH_WITH_SCRIBE;
29+
import static galena.oreganized.index.OTags.Blocks.SILKTOUCH_WITH_SCRIBE_BLACKLIST;
2930
import static galena.oreganized.index.OTags.Blocks.STONE_TYPES_GLANCE;
3031
import static galena.oreganized.index.OTags.Blocks.STORAGE_BLOCKS_ELECTRUM;
3132
import static galena.oreganized.index.OTags.Blocks.STORAGE_BLOCKS_LEAD;
@@ -130,7 +131,11 @@ protected void addTags(HolderLookup.Provider provider) {
130131

131132
OBlocks.LEAD_DOOR.get(),
132133
OBlocks.LEAD_TRAPDOOR.get(),
133-
OBlocks.LEAD_BARS.get()
134+
OBlocks.LEAD_BARS.get(),
135+
136+
OBlocks.GROOVED_ICE.get(),
137+
OBlocks.GROOVED_PACKED_ICE.get(),
138+
OBlocks.GROOVED_BLUE_ICE.get()
134139
);
135140
tag(BlockTags.MINEABLE_WITH_SHOVEL).add(
136141
OBlocks.WAXED_WHITE_CONCRETE_POWDER.get(),
@@ -169,6 +174,11 @@ protected void addTags(HolderLookup.Provider provider) {
169174
.addTags(BlockTags.CAMPFIRES)
170175
.addTags(BlockTags.FIRE);
171176

177+
tag(BlockTags.ICE)
178+
.add(OBlocks.GROOVED_ICE.get())
179+
.add(OBlocks.GROOVED_PACKED_ICE.get())
180+
.add(OBlocks.GROOVED_BLUE_ICE.get());
181+
172182
var scribeMineable = tag(MINEABLE_WITH_SCRIBE)
173183
.addTags(Tags.Blocks.GLASS)
174184
.addTags(Tags.Blocks.OBSIDIAN)
@@ -205,6 +215,11 @@ protected void addTags(HolderLookup.Provider provider) {
205215
;
206216
});
207217

218+
tag(SILKTOUCH_WITH_SCRIBE_BLACKLIST)
219+
.add(OBlocks.GROOVED_ICE.get())
220+
.add(OBlocks.GROOVED_PACKED_ICE.get())
221+
.add(OBlocks.GROOVED_BLUE_ICE.get());
222+
208223
tag(SILKTOUCH_WITH_SCRIBE)
209224
.addTags(MINEABLE_WITH_SCRIBE)
210225
.addTags(BlockTags.MINEABLE_WITH_PICKAXE);

src/main/java/galena/oreganized/data/OLootTables.java

+25-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import galena.oreganized.index.OBlocks;
77
import galena.oreganized.index.OEntityTypes;
88
import galena.oreganized.index.OItems;
9+
import net.minecraft.advancements.critereon.ItemPredicate;
910
import net.minecraft.advancements.critereon.StatePropertiesPredicate;
1011
import net.minecraft.data.PackOutput;
1112
import net.minecraft.data.loot.EntityLootSubProvider;
@@ -14,6 +15,7 @@
1415
import net.minecraft.world.entity.EntityType;
1516
import net.minecraft.world.flag.FeatureFlags;
1617
import net.minecraft.world.level.block.Block;
18+
import net.minecraft.world.level.block.Blocks;
1719
import net.minecraft.world.level.block.DoorBlock;
1820
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
1921
import net.minecraft.world.level.storage.loot.LootPool;
@@ -24,6 +26,7 @@
2426
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
2527
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
2628
import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition;
29+
import net.minecraft.world.level.storage.loot.predicates.MatchTool;
2730
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
2831

2932
import java.util.List;
@@ -37,16 +40,16 @@ public class OLootTables extends LootTableProvider {
3740

3841
public OLootTables(PackOutput output) {
3942
super(output, Set.of(), List.of(
40-
new SubProviderEntry(Blocks::new, LootContextParamSets.BLOCK),
41-
new SubProviderEntry(Entities::new, LootContextParamSets.ENTITY)
43+
new SubProviderEntry(BlockLoot::new, LootContextParamSets.BLOCK),
44+
new SubProviderEntry(EntityLoot::new, LootContextParamSets.ENTITY)
4245
));
4346
}
4447

4548
@Override
4649
protected void validate(Map<ResourceLocation, LootTable> map, ValidationContext tracker) {
4750
}
4851

49-
public static class Blocks extends OBlockLootProvider {
52+
public static class BlockLoot extends OBlockLootProvider {
5053

5154
protected void generate() {
5255
//dropNothing(OBlocks.MOLTEN_LEAD);
@@ -83,9 +86,9 @@ protected void generate() {
8386
dropSelf(OBlocks.SHRAPNEL_BOMB);
8487
dropSelf(OBlocks.LEAD_BOLT_CRATE);
8588

86-
dropAsSilk(OBlocks.GROOVED_ICE);
87-
dropAsSilk(OBlocks.GROOVED_PACKED_ICE);
88-
dropAsSilk(OBlocks.GROOVED_BLUE_ICE);
89+
grooved(OBlocks.GROOVED_ICE, Blocks.ICE);
90+
grooved(OBlocks.GROOVED_BLUE_ICE, Blocks.BLUE_ICE);
91+
grooved(OBlocks.GROOVED_PACKED_ICE, Blocks.PACKED_ICE);
8992

9093
add(OBlocks.LEAD_DOOR.get(), LootTable.lootTable()
9194
.withPool(applyExplosionCondition(OBlocks.LEAD_DOOR.get(), LootPool.lootPool()
@@ -125,15 +128,29 @@ protected void generate() {
125128
}
126129
}
127130

131+
private void grooved(Supplier<Block> block, Block other) {
132+
var hasScribe = MatchTool.toolMatches(ItemPredicate.Builder.item().of(OItems.SCRIBE.get()));
133+
add(block.get(), LootTable.lootTable()
134+
.withPool(LootPool.lootPool()
135+
.setRolls(ConstantValue.exactly(1.0F))
136+
.add(AlternativesEntry.alternatives(
137+
LootItem.lootTableItem(block.get().asItem())
138+
.when(HAS_SILK_TOUCH),
139+
LootItem.lootTableItem(other.asItem())
140+
.when(hasScribe)
141+
))
142+
));
143+
}
144+
128145
@Override
129146
protected Iterable<Block> getKnownBlocks() {
130147
return Oreganized.REGISTRY_HELPER.getBlockSubHelper().getDeferredRegister().getEntries().stream().map(Supplier::get).collect(Collectors.toList());
131148
}
132149
}
133150

134-
public static class Entities extends EntityLootSubProvider {
151+
public static class EntityLoot extends EntityLootSubProvider {
135152

136-
public Entities() {
153+
public EntityLoot() {
137154
super(FeatureFlags.REGISTRY.allFlags());
138155
}
139156

0 commit comments

Comments
 (0)