mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Helper for later block entities loot tables.
This commit is contained in:
parent
6825fa3d4a
commit
ffb11ca5f3
3 changed files with 42 additions and 36 deletions
|
@ -454,7 +454,7 @@ f657eabc7321de0b05cf92d9ebdd6f5215a685b5 assets/actuallyadditions/models/item/wo
|
||||||
7f8e5e703d9244222706c52d7b24b299e07cb2db assets/actuallyadditions/models/item/worm.json
|
7f8e5e703d9244222706c52d7b24b299e07cb2db assets/actuallyadditions/models/item/worm.json
|
||||||
0b1ab8963077c90a5104b516eab36e56c8a07057 assets/actuallyadditions/models/item/xp_solidifier.json
|
0b1ab8963077c90a5104b516eab36e56c8a07057 assets/actuallyadditions/models/item/xp_solidifier.json
|
||||||
ecf1cc8efe1f425334e8e07a6c747641c714c92c assets/actuallyadditions/sounds.json
|
ecf1cc8efe1f425334e8e07a6c747641c714c92c assets/actuallyadditions/sounds.json
|
||||||
cfe30d630abb33959f24b3296a31a6dfe1e8fd49 data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json
|
214cf5b268cb34e55c2232cc7c694e81f388dc1f data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json
|
||||||
de3c64d6a363f8e27078d7f7df1a67e4931fd81c data/actuallyadditions/loot_tables/blocks/battery_box.json
|
de3c64d6a363f8e27078d7f7df1a67e4931fd81c data/actuallyadditions/loot_tables/blocks/battery_box.json
|
||||||
fb968dc63f2d0a467eff504f3f6ff386080e2433 data/actuallyadditions/loot_tables/blocks/bio_reactor.json
|
fb968dc63f2d0a467eff504f3f6ff386080e2433 data/actuallyadditions/loot_tables/blocks/bio_reactor.json
|
||||||
a1b62291e361451916e45a97bb499ecb1b6eb595 data/actuallyadditions/loot_tables/blocks/black_quartz_block.json
|
a1b62291e361451916e45a97bb499ecb1b6eb595 data/actuallyadditions/loot_tables/blocks/black_quartz_block.json
|
||||||
|
|
|
@ -6,34 +6,6 @@
|
||||||
"entries": [
|
"entries": [
|
||||||
{
|
{
|
||||||
"type": "minecraft:item",
|
"type": "minecraft:item",
|
||||||
"functions": [
|
|
||||||
{
|
|
||||||
"function": "minecraft:copy_name",
|
|
||||||
"source": "block_entity"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"function": "minecraft:copy_nbt",
|
|
||||||
"source": "block_entity",
|
|
||||||
"ops": [
|
|
||||||
{
|
|
||||||
"source": "Energy",
|
|
||||||
"target": "BlockEntityTag.Energy",
|
|
||||||
"op": "replace"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"function": "minecraft:copy_nbt",
|
|
||||||
"source": "block_entity",
|
|
||||||
"ops": [
|
|
||||||
{
|
|
||||||
"source": "IsPulseMode",
|
|
||||||
"target": "BlockEntityTag.IsPulseMode",
|
|
||||||
"op": "replace"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "actuallyadditions:atomic_reconstructor"
|
"name": "actuallyadditions:atomic_reconstructor"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -41,6 +13,34 @@
|
||||||
{
|
{
|
||||||
"condition": "minecraft:survives_explosion"
|
"condition": "minecraft:survives_explosion"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"functions": [
|
||||||
|
{
|
||||||
|
"function": "minecraft:copy_name",
|
||||||
|
"source": "block_entity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "minecraft:copy_nbt",
|
||||||
|
"source": "block_entity",
|
||||||
|
"ops": [
|
||||||
|
{
|
||||||
|
"source": "Energy",
|
||||||
|
"target": "BlockEntityTag.Energy",
|
||||||
|
"op": "replace"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "minecraft:copy_nbt",
|
||||||
|
"source": "block_entity",
|
||||||
|
"ops": [
|
||||||
|
{
|
||||||
|
"source": "IsPulseMode",
|
||||||
|
"target": "BlockEntityTag.IsPulseMode",
|
||||||
|
"op": "replace"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -62,13 +62,10 @@ public class LootTableGenerator extends LootTableProvider {
|
||||||
this.dropSelf(ActuallyBlocks.FIREWORK_BOX.get());
|
this.dropSelf(ActuallyBlocks.FIREWORK_BOX.get());
|
||||||
this.dropSelf(ActuallyBlocks.VERTICAL_DIGGER.get());
|
this.dropSelf(ActuallyBlocks.VERTICAL_DIGGER.get());
|
||||||
|
|
||||||
//this.dropSelf(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get());
|
dropNBT(ActuallyBlocks.ATOMIC_RECONSTRUCTOR, a ->
|
||||||
|
a.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY).copy("Energy", "BlockEntityTag.Energy"))
|
||||||
this.add(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), LootTable.lootTable()
|
.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY).copy("IsPulseMode", "BlockEntityTag.IsPulseMode"))
|
||||||
.withPool(applyExplosionCondition(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), LootPool.lootPool().setRolls(ConstantRange.exactly(1)))
|
);
|
||||||
.add(ItemLootEntry.lootTableItem(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get())
|
|
||||||
.apply(CopyName.copyName(CopyName.Source.BLOCK_ENTITY)).apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY).copy("Energy", "BlockEntityTag.Energy"))
|
|
||||||
.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY).copy("IsPulseMode", "BlockEntityTag.IsPulseMode")))));
|
|
||||||
|
|
||||||
this.dropSelf(ActuallyBlocks.ENERGIZER.get());
|
this.dropSelf(ActuallyBlocks.ENERGIZER.get());
|
||||||
this.dropSelf(ActuallyBlocks.ENERVATOR.get());
|
this.dropSelf(ActuallyBlocks.ENERVATOR.get());
|
||||||
|
@ -202,6 +199,15 @@ public class LootTableGenerator extends LootTableProvider {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void dropNBT(Supplier<Block> blockSupplier, Consumer<LootPool.Builder> lootFunctionProvider) {
|
||||||
|
LootPool.Builder lootpool = LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add(ItemLootEntry.lootTableItem(blockSupplier.get()));
|
||||||
|
lootpool.apply(CopyName.copyName(CopyName.Source.BLOCK_ENTITY));
|
||||||
|
|
||||||
|
lootFunctionProvider.accept(lootpool);
|
||||||
|
|
||||||
|
add(blockSupplier.get(), LootTable.lootTable().withPool(applyExplosionCondition(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), lootpool)));
|
||||||
|
}
|
||||||
|
|
||||||
/* // This isn't quite right :cry: fortune doesn't change it
|
/* // This isn't quite right :cry: fortune doesn't change it
|
||||||
private void registerCrystal(RegistryObject<Block> crystalCluster, RegistryObject<Item> crystalShard) {
|
private void registerCrystal(RegistryObject<Block> crystalCluster, RegistryObject<Item> crystalShard) {
|
||||||
this.registerLootTable(crystalCluster.get(), (crystal) ->
|
this.registerLootTable(crystalCluster.get(), (crystal) ->
|
||||||
|
|
Loading…
Reference in a new issue