[Change] Add Flight Duration to Rockets from Village Loot (#309)
This commit is contained in:
parent
a199db3769
commit
b37f3a6ba5
2 changed files with 13 additions and 1 deletions
|
@ -138,6 +138,10 @@
|
|||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"function": "minecraft:set_nbt",
|
||||
"tag": "{Fireworks:{Flight:3b}}"
|
||||
},
|
||||
{
|
||||
"add": false,
|
||||
"count": {
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.betterx.betterend.registry.EndItems;
|
|||
import org.betterx.betterend.registry.EndTemplates;
|
||||
import org.betterx.betterend.util.LootTableUtil;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
@ -15,6 +16,7 @@ import net.minecraft.world.level.storage.loot.entries.LootItem;
|
|||
import net.minecraft.world.level.storage.loot.functions.EnchantWithLevelsFunction;
|
||||
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
|
||||
import net.minecraft.world.level.storage.loot.functions.SetItemDamageFunction;
|
||||
import net.minecraft.world.level.storage.loot.functions.SetNbtFunction;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
|
||||
import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition;
|
||||
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
|
||||
|
@ -26,11 +28,15 @@ import net.fabricmc.fabric.api.datagen.v1.provider.SimpleFabricLootTableProvider
|
|||
import java.util.function.BiConsumer;
|
||||
|
||||
public class EndChestLootTableProvider extends SimpleFabricLootTableProvider {
|
||||
private final CompoundTag FIREWORK_ROCKET_TAG = new CompoundTag();
|
||||
|
||||
public EndChestLootTableProvider(
|
||||
FabricDataOutput output
|
||||
) {
|
||||
super(output, LootContextParamSets.CHEST);
|
||||
CompoundTag FIREWORKS_TAG = new CompoundTag();
|
||||
FIREWORK_ROCKET_TAG.put("Fireworks", FIREWORKS_TAG);
|
||||
FIREWORKS_TAG.putByte("Flight", (byte) 3);
|
||||
}
|
||||
|
||||
|
||||
|
@ -316,7 +322,9 @@ public class EndChestLootTableProvider extends SimpleFabricLootTableProvider {
|
|||
).add(LootItem
|
||||
.lootTableItem(Items.FIREWORK_ROCKET)
|
||||
.setWeight(8)
|
||||
.apply(SetItemCountFunction.setCount(UniformGenerator.between(4, 8)))
|
||||
.apply(SetNbtFunction.setTag(FIREWORK_ROCKET_TAG))
|
||||
.apply(SetItemCountFunction
|
||||
.setCount(UniformGenerator.between(4, 8)))
|
||||
)
|
||||
.when(LootItemRandomChanceCondition.randomChance(chance));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue