Added mugs, cider, juice, burned juice, daffodil daisy sandwich, wheat worms, hay burgers, and hay fries

This commit is contained in:
Sollace 2021-06-21 23:49:55 +02:00
parent f824fd1a90
commit fd7ca49e3f
24 changed files with 152 additions and 5 deletions

View file

@ -0,0 +1,50 @@
package com.minelittlepony.unicopia.item;
import net.minecraft.advancement.criterion.Criteria;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsage;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.stat.Stats;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.UseAction;
import net.minecraft.world.World;
public class DrinkableItem extends Item {
public DrinkableItem(Item.Settings settings) {
super(settings);
}
@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
if (user instanceof ServerPlayerEntity) {
ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity)user;
Criteria.CONSUME_ITEM.trigger(serverPlayerEntity, stack);
serverPlayerEntity.incrementStat(Stats.USED.getOrCreateStat(this));
}
if (user instanceof PlayerEntity && !((PlayerEntity)user).abilities.creativeMode) {
stack.decrement(1);
}
return stack.isEmpty() ? new ItemStack(getRecipeRemainder()) : stack;
}
@Override
public int getMaxUseTime(ItemStack stack) {
return 32;
}
@Override
public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
return ItemUsage.consumeHeldItem(world, user, hand);
}
}

View file

@ -9,6 +9,7 @@ import com.minelittlepony.unicopia.item.toxin.UFoodComponents;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Item.Settings; import net.minecraft.item.Item.Settings;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.Items;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.FoodComponents; import net.minecraft.item.FoodComponents;
@ -57,6 +58,16 @@ public interface UItems {
Item PEGASUS_FEATHER = register("pegasus_feather", new Item(new Item.Settings().group(ItemGroup.MATERIALS))); Item PEGASUS_FEATHER = register("pegasus_feather", new Item(new Item.Settings().group(ItemGroup.MATERIALS)));
Item GRYPHON_FEATHER = register("gryphon_feather", new Item(new Item.Settings().group(ItemGroup.MATERIALS))); Item GRYPHON_FEATHER = register("gryphon_feather", new Item(new Item.Settings().group(ItemGroup.MATERIALS)));
Item DAFFODIL_DAISY_SANDWICH = register("daffodil_daisy_sandwich", new Item(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.DAFODIL_DAISY_SANDWICH)));
Item HAY_BURGER = register("hay_burger", new Item(new Item.Settings().group(ItemGroup.FOOD).maxCount(1).food(UFoodComponents.HAY_BURGER)));
Item HAY_FRIES = register("hay_fries", new Item(new Item.Settings().group(ItemGroup.FOOD).maxCount(16).food(UFoodComponents.HAY_FRIES)));
Item WHEAT_WORMS = register("wheat_worms", new Item(new Item.Settings().group(ItemGroup.MISC).maxCount(16).food(UFoodComponents.WORMS)));
Item MUG = register("mug", new Item(new Settings().group(ItemGroup.MATERIALS).maxCount(16)));
Item CIDER = register("cider", new DrinkableItem(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.CIDER).maxCount(1).recipeRemainder(MUG)));
Item JUICE = register("juice", new DrinkableItem(new Item.Settings().group(ItemGroup.FOOD).recipeRemainder(Items.GLASS_BOTTLE).maxCount(1).food(UFoodComponents.JUICE)));
Item BURNED_JUICE = register("burned_juice", new Item(new Item.Settings().group(ItemGroup.FOOD).recipeRemainder(Items.GLASS_BOTTLE).maxCount(16).food(UFoodComponents.BURNED_JUICE)));
Item GOLDEN_FEATHER = register("golden_feather", new Item(new Item.Settings().rarity(Rarity.UNCOMMON).group(ItemGroup.MATERIALS))); Item GOLDEN_FEATHER = register("golden_feather", new Item(new Item.Settings().rarity(Rarity.UNCOMMON).group(ItemGroup.MATERIALS)));
Item GOLDEN_WING = register("golden_wing", new Item(new Item.Settings().rarity(Rarity.UNCOMMON).group(ItemGroup.MATERIALS))); Item GOLDEN_WING = register("golden_wing", new Item(new Item.Settings().rarity(Rarity.UNCOMMON).group(ItemGroup.MATERIALS)));
@ -74,6 +85,7 @@ public interface UItems {
if (item instanceof BlockItem) { if (item instanceof BlockItem) {
((BlockItem)item).appendBlocks(Item.BLOCK_ITEMS, item); ((BlockItem)item).appendBlocks(Item.BLOCK_ITEMS, item);
} }
Items.MILK_BUCKET.appendStacks(null, null);
return Registry.register(Registry.ITEM, new Identifier("unicopia", name), item); return Registry.register(Registry.ITEM, new Identifier("unicopia", name), item);
} }

View file

@ -18,6 +18,7 @@ public interface Toxics {
Toxic EDIBLE = forage("edible", SAFE, FOOD); Toxic EDIBLE = forage("edible", SAFE, FOOD);
Toxic RISKY = forage("risky", FAIR, FOOD); Toxic RISKY = forage("risky", FAIR, FOOD);
Toxic MODERATE = forage("moderate", MILD, FOOD);
Toxic DANGEROUS = forage("dangerous", SEVERE, FOOD); Toxic DANGEROUS = forage("dangerous", SEVERE, FOOD);
Toxic NAUSEATING = forage("nauseating", SAFE, NAUSEA); Toxic NAUSEATING = forage("nauseating", SAFE, NAUSEA);
Toxic RADIOACTIVE = forage("radioactive", SAFE, RADIOACTIVITY); Toxic RADIOACTIVE = forage("radioactive", SAFE, RADIOACTIVITY);

View file

@ -14,8 +14,9 @@ public interface UFoodComponents {
FoodComponent HAY_BURGER = builder(3, 4).build(); FoodComponent HAY_BURGER = builder(3, 4).build();
FoodComponent HAY_FRIES = builder(1, 5).build(); FoodComponent HAY_FRIES = builder(1, 5).build();
FoodComponent SALAD = builder(4, 2).build(); FoodComponent SALAD = builder(4, 2).build();
FoodComponent CIDER = builder(4, 2).alwaysEdible().build();
FoodComponent RANDOM_FOLIAGE = builder(2, 1).build(); FoodComponent RANDOM_FOLIAGE = builder(2, 1).build();
FoodComponent JUICE = builder(2, 2).build(); FoodComponent JUICE = builder(2, 2).alwaysEdible().build();
FoodComponent BURNED_JUICE = builder(3, 1).build(); FoodComponent BURNED_JUICE = builder(3, 1).build();
FoodComponent WORMS = builder(1, 0).alwaysEdible().build(); FoodComponent WORMS = builder(1, 0).alwaysEdible().build();

View file

@ -6,6 +6,7 @@ import javax.annotation.Nullable;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
@ -28,7 +29,7 @@ abstract class MixinItem implements ToxicHolder {
@Nullable @Nullable
private FoodComponent originalFoodComponent; private FoodComponent originalFoodComponent;
@Shadow @Shadow @Mutable
private @Final FoodComponent foodComponent; private @Final FoodComponent foodComponent;
@Override @Override

View file

@ -39,6 +39,16 @@
"item.unicopia.golden_feather": "Golden Feather", "item.unicopia.golden_feather": "Golden Feather",
"item.unicopia.golden_wing": "Golden Wing", "item.unicopia.golden_wing": "Golden Wing",
"item.unicopia.mug": "Mug",
"item.unicopia.cider": "Cider",
"item.unicopia.juice": "Juice",
"item.unicopia.burned_juice": "Burned Juice",
"item.unicopia.daffodil_daisy_sandwich": "Daffodil Daisy Sandwich",
"item.unicopia.hay_burger": "Hay Burger",
"item.unicopia.hay_fries": "Hay Fries",
"item.unicopia.wheat_worms": "Wheat Worms",
"item.unicopia.pegasus_amulet": "Wings of Icarus", "item.unicopia.pegasus_amulet": "Wings of Icarus",
"item.unicopia.pegasus_amulet.lore": "Grants temporary flight to whoever wears it", "item.unicopia.pegasus_amulet.lore": "Grants temporary flight to whoever wears it",
"item.unicopia.amulet.energy": "Energy: %d / %d", "item.unicopia.amulet.energy": "Energy: %d / %d",

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/burned_juice"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "unicopia:item/mug",
"textures": {
"layer0": "unicopia:item/cider"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/daffodil_daisy_sandwich"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/hay_burger"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/hay_fries"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/juice"
}
}

View file

@ -0,0 +1,28 @@
{
"parent": "item/handheld",
"textures": {
"layer0": "unicopia:item/mug"
},
"display": {
"thirdperson_righthand": {
"rotation": [ 0, -90, -55 ],
"translation": [ 0, 4.0, 0.5 ],
"scale": [ 0.85, 0.85, 0.85 ]
},
"thirdperson_lefthand": {
"rotation": [ 0, 90, 55 ],
"translation": [ 0, 4.0, 0.5 ],
"scale": [ 0.85, 0.85, 0.85 ]
},
"firstperson_righthand": {
"rotation": [ 0, -90, 25 ],
"translation": [ 1.13, 3.2, 1.13 ],
"scale": [ 0.68, 0.68, 0.68 ]
},
"firstperson_lefthand": {
"rotation": [ 0, 90, -25 ],
"translation": [ 1.13, 3.2, 1.13 ],
"scale": [ 0.68, 0.68, 0.68 ]
}
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/wheat_worms"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

View file

@ -1,6 +1,7 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"minecraft:grass" "minecraft:grass",
"unicopia:cider"
] ]
} }

View file

@ -2,6 +2,7 @@
"replace": false, "replace": false,
"values": [ "values": [
"minecraft:allium", "minecraft:allium",
"minecraft:white_tulip" "minecraft:white_tulip",
"unicopia:burned_juice"
] ]
} }