mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Added items to the archaeology loot tables
This commit is contained in:
parent
d86f750efa
commit
98813fd62e
10 changed files with 179 additions and 2 deletions
|
@ -0,0 +1,30 @@
|
|||
package com.minelittlepony.unicopia.item;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BluntWeaponItem extends Item {
|
||||
private final Multimap<EntityAttribute, EntityAttributeModifier> modifiers;
|
||||
|
||||
public static final UUID KNOCKBACK_MODIFIER_ID = UUID.fromString("7b16994b-1edb-4381-be62-94317f39ec8f");
|
||||
public static final UUID LUCK_MODIFIER_ID = UUID.fromString("7b16994b-1edb-8431-be62-7f39ec94318f");
|
||||
|
||||
public BluntWeaponItem(Settings settings, Multimap<EntityAttribute, EntityAttributeModifier> modifiers) {
|
||||
super(settings);
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<EntityAttribute, EntityAttributeModifier> getAttributeModifiers(EquipmentSlot slot) {
|
||||
if (slot == EquipmentSlot.OFFHAND) {
|
||||
return modifiers;
|
||||
}
|
||||
return super.getAttributeModifiers(slot);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.unicopia.item;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.minelittlepony.unicopia.*;
|
||||
import com.minelittlepony.unicopia.block.UBlocks;
|
||||
import com.minelittlepony.unicopia.block.UWoodTypes;
|
||||
|
@ -13,6 +14,8 @@ import com.terraformersmc.terraform.boat.api.TerraformBoatType;
|
|||
import com.terraformersmc.terraform.boat.api.TerraformBoatTypeRegistry;
|
||||
import com.terraformersmc.terraform.boat.api.item.TerraformBoatItemHelper;
|
||||
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.Item.Settings;
|
||||
|
@ -80,7 +83,12 @@ public interface UItems {
|
|||
|
||||
Item PEBBLES = register("pebbles", new RacePredicatedAliasedBlockItem(UBlocks.ROCKS, new Item.Settings(), Race::canUseEarth), ItemGroups.NATURAL);
|
||||
Item ROCK = register("rock", new HeavyProjectileItem(new Item.Settings(), 3), ItemGroups.NATURAL);
|
||||
Item WEIRD_ROCK = register("weird_rock", new Item(new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item WEIRD_ROCK = register("weird_rock", new BluntWeaponItem(new Item.Settings(), ImmutableMultimap.of(
|
||||
EntityAttributes.GENERIC_LUCK, new EntityAttributeModifier(BluntWeaponItem.LUCK_MODIFIER_ID, "Weapon modifier", 9, EntityAttributeModifier.Operation.ADDITION)
|
||||
)), ItemGroups.NATURAL);
|
||||
Item TOM = register("tom", new BluntWeaponItem(new Item.Settings(), ImmutableMultimap.of(
|
||||
EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(BluntWeaponItem.KNOCKBACK_MODIFIER_ID, "Weapon modifier", 0.9, EntityAttributeModifier.Operation.ADDITION)
|
||||
)), ItemGroups.NATURAL);
|
||||
Item ROCK_STEW = register("rock_stew", new Item(new Item.Settings().food(FoodComponents.MUSHROOM_STEW)), ItemGroups.FOOD_AND_DRINK);
|
||||
|
||||
Item GREEN_APPLE_SEEDS = register("green_apple_seeds", new AliasedBlockItem(UBlocks.GREEN_APPLE_SPROUT, new Item.Settings()), ItemGroups.NATURAL);
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.minelittlepony.unicopia.ability.magic.spell.crafting.*;
|
|||
|
||||
import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
|
||||
import net.minecraft.loot.LootTable;
|
||||
import net.minecraft.loot.context.LootContextTypes;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
|
@ -48,8 +49,17 @@ public interface URecipes {
|
|||
|
||||
Identifier modId = new Identifier("unicopiamc", id.getPath());
|
||||
LootTable table = manager.getLootTable(modId);
|
||||
|
||||
if (table != LootTable.EMPTY) {
|
||||
supplier.pools(List.of(table.pools));
|
||||
if (table.getType() == LootContextTypes.ARCHAEOLOGY) {
|
||||
supplier.modifyPools(poolBuilder -> {
|
||||
for (var pool : table.pools) {
|
||||
poolBuilder.with(List.of(pool.entries));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
supplier.pools(List.of(table.pools));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
"item.unicopia.pebbles": "Pebbles",
|
||||
"item.unicopia.rock": "Rock",
|
||||
"item.unicopia.weird_rock": "Weird Rock",
|
||||
"item.unicopia.tom": "Tom",
|
||||
"item.unicopia.rock_stew": "Rock Stew",
|
||||
"item.unicopia.pinecone": "Pinecone",
|
||||
"item.unicopia.acorn": "Acorn",
|
||||
|
|
6
src/main/resources/assets/unicopia/models/item/tom.json
Normal file
6
src/main/resources/assets/unicopia/models/item/tom.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:item/tom"
|
||||
}
|
||||
}
|
BIN
src/main/resources/assets/unicopia/textures/item/tom.png
Normal file
BIN
src/main/resources/assets/unicopia/textures/item/tom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 2,
|
||||
"frames": [
|
||||
{
|
||||
"index": 0,
|
||||
"time": 1000
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"time": 2
|
||||
},
|
||||
{
|
||||
"index": 0,
|
||||
"time": 2000
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"time": 2
|
||||
},
|
||||
{
|
||||
"index": 0,
|
||||
"time": 4000
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"time": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"type": "minecraft:archaeology",
|
||||
"pools": [
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:weird_rock",
|
||||
"weight": 2
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:rock",
|
||||
"weight": 1
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:tom",
|
||||
"weight": 1
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:rock_stew",
|
||||
"weight": 1
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:pebbles",
|
||||
"weight": 1
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:archaeology/desert_well"
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"type": "minecraft:archaeology",
|
||||
"pools": [
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:meadowbrooks_staff",
|
||||
"weight": 2
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:botched_gem",
|
||||
"weight": 3
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:pegasus_feather",
|
||||
"weight": 1
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:archaeology/desert_well"
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"type": "minecraft:archaeology",
|
||||
"pools": [
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:broken_sunglasses",
|
||||
"weight": 2
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:empty_jar",
|
||||
"weight": 2
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "unicopia:music_disc_crusade",
|
||||
"weight": 1
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:archaeology/desert_well"
|
||||
}
|
Loading…
Reference in a new issue