Skip to content

Commit

Permalink
can't stop the groovin'
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle committed Sep 11, 2024
1 parent d553fc7 commit f3aa011
Show file tree
Hide file tree
Showing 19 changed files with 280 additions and 67 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2024-09-06T10:44:11.4045918 Oreganized Block Tags
// 1.20.1 2024-09-11T15:31:25.0347469 Oreganized Block Tags
7a2d68d81bc5ee59f9a2f4ba68ddb39bfd9c875d data/forge/tags/blocks/glass.json
d96b4f83e03abe39a1b97d92b7818c8f6b2e5c68 data/forge/tags/blocks/glass_panes.json
d062c23ad5308b7de0b2e86f6531ea724530f898 data/forge/tags/blocks/melts_lead.json
Expand All @@ -17,9 +17,10 @@ bff6697a058fddfe9e14615bc043fcb2071fd6fc data/forge/tags/blocks/storage_blocks/s
7a1e2c391ad442cdc57f69ce1737207bc52bfb84 data/minecraft/tags/blocks/beacon_base_blocks.json
82c03c405a971b2a7fc3fd43a9fb6c221f463ce0 data/minecraft/tags/blocks/cauldrons.json
503ad75af537d0ffef02ada9fb9afb5f5cd8e83b data/minecraft/tags/blocks/doors.json
0f64e9b9dc279dd460f6408313b130a37a0c9d86 data/minecraft/tags/blocks/ice.json
7a2d68d81bc5ee59f9a2f4ba68ddb39bfd9c875d data/minecraft/tags/blocks/impermeable.json
f7079c32fc948b65cb486bea80e2dc93d13ce577 data/minecraft/tags/blocks/mineable/axe.json
5a2cdeb6fd6f03e5f1980e2b6fb22e4e4d9b4dd0 data/minecraft/tags/blocks/mineable/pickaxe.json
8794e7f7fcf41783b7738503b68f535efa58d511 data/minecraft/tags/blocks/mineable/pickaxe.json
84a13f81c79f0c05f8f7a8cbf1d3c25129a97179 data/minecraft/tags/blocks/mineable/shovel.json
bb86ac7ab19373da790ec5711f473614e4b62d79 data/minecraft/tags/blocks/needs_iron_tool.json
dc9cc2dca9fa3a28a0458ec282e3e0fe81999ee1 data/minecraft/tags/blocks/needs_stone_tool.json
Expand All @@ -31,5 +32,6 @@ a4acb3623320f801e89e3451f8b7d9e2246f99d0 data/minecraft/tags/blocks/walls.json
f1dfddab1e3f2dec1e7ed1c3fbf9f6a7f261cf08 data/oreganized/tags/blocks/crystal_glass_panes.json
6b73bb0ce38222c428d54ee64e82ffa1d96c64d7 data/oreganized/tags/blocks/fire_source.json
597a5aa43f0ee7c4bcf4b0e44aa4dfe527557f2b data/oreganized/tags/blocks/mineable/scribe.json
0f64e9b9dc279dd460f6408313b130a37a0c9d86 data/oreganized/tags/blocks/no_silktouch_using_scribe.json
06c2e2e512966767a31df77e646e41c4c39e3dd3 data/oreganized/tags/blocks/silktouch_using_scribe.json
3112fb4a1df2953e2c3572fa47f886bf8e5bd679 data/oreganized/tags/blocks/stone_types/glance.json
7 changes: 7 additions & 0 deletions src/generated/resources/data/minecraft/tags/blocks/ice.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"values": [
"oreganized:grooved_ice",
"oreganized:grooved_packed_ice",
"oreganized:grooved_blue_ice"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"oreganized:molten_lead_cauldron",
"oreganized:lead_door",
"oreganized:lead_trapdoor",
"oreganized:lead_bars"
"oreganized:lead_bars",
"oreganized:grooved_ice",
"oreganized:grooved_packed_ice",
"oreganized:grooved_blue_ice"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,44 @@
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "oreganized:grooved_blue_ice"
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"name": "oreganized:grooved_blue_ice"
},
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"items": [
"oreganized:scribe"
]
}
}
],
"name": "minecraft:blue_ice"
}
]
}
],
"rolls": 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,44 @@
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "oreganized:grooved_ice"
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"name": "oreganized:grooved_ice"
},
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"items": [
"oreganized:scribe"
]
}
}
],
"name": "minecraft:ice"
}
]
}
],
"rolls": 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,44 @@
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "oreganized:grooved_packed_ice"
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"name": "oreganized:grooved_packed_ice"
},
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"items": [
"oreganized:scribe"
]
}
}
],
"name": "minecraft:packed_ice"
}
]
}
],
"rolls": 1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"values": [
"oreganized:grooved_ice",
"oreganized:grooved_packed_ice",
"oreganized:grooved_blue_ice"
]
}
7 changes: 6 additions & 1 deletion src/main/java/galena/oreganized/content/item/ScribeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import static galena.oreganized.index.OTags.Blocks.MINEABLE_WITH_SCRIBE;
import static galena.oreganized.index.OTags.Blocks.SILKTOUCH_WITH_SCRIBE;
import static galena.oreganized.index.OTags.Blocks.SILKTOUCH_WITH_SCRIBE_BLACKLIST;

public class ScribeItem extends Item {

Expand Down Expand Up @@ -65,7 +66,11 @@ public float getDestroySpeed(ItemStack stack, BlockState state) {
}

public boolean dropsLikeSilktouch(ItemStack stack, BlockState state) {
return isCorrectToolForDrops(state);
return isCorrectToolForDrops(state) && !shouldNotSilktouch(stack, state);
}

private boolean shouldNotSilktouch(ItemStack stack, BlockState state) {
return state.is(SILKTOUCH_WITH_SCRIBE_BLACKLIST);
}

@Override
Expand Down
17 changes: 16 additions & 1 deletion src/main/java/galena/oreganized/data/OBlockTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import static galena.oreganized.index.OTags.Blocks.ORES_LEAD;
import static galena.oreganized.index.OTags.Blocks.ORES_SILVER;
import static galena.oreganized.index.OTags.Blocks.SILKTOUCH_WITH_SCRIBE;
import static galena.oreganized.index.OTags.Blocks.SILKTOUCH_WITH_SCRIBE_BLACKLIST;
import static galena.oreganized.index.OTags.Blocks.STONE_TYPES_GLANCE;
import static galena.oreganized.index.OTags.Blocks.STORAGE_BLOCKS_ELECTRUM;
import static galena.oreganized.index.OTags.Blocks.STORAGE_BLOCKS_LEAD;
Expand Down Expand Up @@ -130,7 +131,11 @@ protected void addTags(HolderLookup.Provider provider) {

OBlocks.LEAD_DOOR.get(),
OBlocks.LEAD_TRAPDOOR.get(),
OBlocks.LEAD_BARS.get()
OBlocks.LEAD_BARS.get(),

OBlocks.GROOVED_ICE.get(),
OBlocks.GROOVED_PACKED_ICE.get(),
OBlocks.GROOVED_BLUE_ICE.get()
);
tag(BlockTags.MINEABLE_WITH_SHOVEL).add(
OBlocks.WAXED_WHITE_CONCRETE_POWDER.get(),
Expand Down Expand Up @@ -169,6 +174,11 @@ protected void addTags(HolderLookup.Provider provider) {
.addTags(BlockTags.CAMPFIRES)
.addTags(BlockTags.FIRE);

tag(BlockTags.ICE)
.add(OBlocks.GROOVED_ICE.get())
.add(OBlocks.GROOVED_PACKED_ICE.get())
.add(OBlocks.GROOVED_BLUE_ICE.get());

var scribeMineable = tag(MINEABLE_WITH_SCRIBE)
.addTags(Tags.Blocks.GLASS)
.addTags(Tags.Blocks.OBSIDIAN)
Expand Down Expand Up @@ -205,6 +215,11 @@ protected void addTags(HolderLookup.Provider provider) {
;
});

tag(SILKTOUCH_WITH_SCRIBE_BLACKLIST)
.add(OBlocks.GROOVED_ICE.get())
.add(OBlocks.GROOVED_PACKED_ICE.get())
.add(OBlocks.GROOVED_BLUE_ICE.get());

tag(SILKTOUCH_WITH_SCRIBE)
.addTags(MINEABLE_WITH_SCRIBE)
.addTags(BlockTags.MINEABLE_WITH_PICKAXE);
Expand Down
33 changes: 25 additions & 8 deletions src/main/java/galena/oreganized/data/OLootTables.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import galena.oreganized.index.OBlocks;
import galena.oreganized.index.OEntityTypes;
import galena.oreganized.index.OItems;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.advancements.critereon.StatePropertiesPredicate;
import net.minecraft.data.PackOutput;
import net.minecraft.data.loot.EntityLootSubProvider;
Expand All @@ -14,6 +15,7 @@
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
import net.minecraft.world.level.storage.loot.LootPool;
Expand All @@ -24,6 +26,7 @@
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition;
import net.minecraft.world.level.storage.loot.predicates.MatchTool;
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;

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

public OLootTables(PackOutput output) {
super(output, Set.of(), List.of(
new SubProviderEntry(Blocks::new, LootContextParamSets.BLOCK),
new SubProviderEntry(Entities::new, LootContextParamSets.ENTITY)
new SubProviderEntry(BlockLoot::new, LootContextParamSets.BLOCK),
new SubProviderEntry(EntityLoot::new, LootContextParamSets.ENTITY)
));
}

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

public static class Blocks extends OBlockLootProvider {
public static class BlockLoot extends OBlockLootProvider {

protected void generate() {
//dropNothing(OBlocks.MOLTEN_LEAD);
Expand Down Expand Up @@ -83,9 +86,9 @@ protected void generate() {
dropSelf(OBlocks.SHRAPNEL_BOMB);
dropSelf(OBlocks.LEAD_BOLT_CRATE);

dropAsSilk(OBlocks.GROOVED_ICE);
dropAsSilk(OBlocks.GROOVED_PACKED_ICE);
dropAsSilk(OBlocks.GROOVED_BLUE_ICE);
grooved(OBlocks.GROOVED_ICE, Blocks.ICE);
grooved(OBlocks.GROOVED_BLUE_ICE, Blocks.BLUE_ICE);
grooved(OBlocks.GROOVED_PACKED_ICE, Blocks.PACKED_ICE);

add(OBlocks.LEAD_DOOR.get(), LootTable.lootTable()
.withPool(applyExplosionCondition(OBlocks.LEAD_DOOR.get(), LootPool.lootPool()
Expand Down Expand Up @@ -125,15 +128,29 @@ protected void generate() {
}
}

private void grooved(Supplier<Block> block, Block other) {
var hasScribe = MatchTool.toolMatches(ItemPredicate.Builder.item().of(OItems.SCRIBE.get()));
add(block.get(), LootTable.lootTable()
.withPool(LootPool.lootPool()
.setRolls(ConstantValue.exactly(1.0F))
.add(AlternativesEntry.alternatives(
LootItem.lootTableItem(block.get().asItem())
.when(HAS_SILK_TOUCH),
LootItem.lootTableItem(other.asItem())
.when(hasScribe)
))
));
}

@Override
protected Iterable<Block> getKnownBlocks() {
return Oreganized.REGISTRY_HELPER.getBlockSubHelper().getDeferredRegister().getEntries().stream().map(Supplier::get).collect(Collectors.toList());
}
}

public static class Entities extends EntityLootSubProvider {
public static class EntityLoot extends EntityLootSubProvider {

public Entities() {
public EntityLoot() {
super(FeatureFlags.REGISTRY.allFlags());
}

Expand Down
Loading

0 comments on commit f3aa011

Please sign in to comment.