Add player milk item and associated features: tooltips, sound, and model
This commit is contained in:
parent
6c530c2651
commit
629ab9fba3
@ -50,6 +50,9 @@ public final class ModTooltips {
|
|||||||
if (stack.isOf(ModItems.MEP_MILK))
|
if (stack.isOf(ModItems.MEP_MILK))
|
||||||
lines.add(Text.translatable("tooltip.chipi.mep_milk"));
|
lines.add(Text.translatable("tooltip.chipi.mep_milk"));
|
||||||
|
|
||||||
|
if (stack.isOf(ModItems.PLAYER_MILK))
|
||||||
|
lines.add(Text.translatable("tooltip.chipi.player_milk"));
|
||||||
|
|
||||||
// ===== ARMOR =====
|
// ===== ARMOR =====
|
||||||
if (stack.isOf(ModItems.CHIPPER_HELMET))
|
if (stack.isOf(ModItems.CHIPPER_HELMET))
|
||||||
lines.add(Text.translatable("tooltip.chipi.chipper_helmet"));
|
lines.add(Text.translatable("tooltip.chipi.chipper_helmet"));
|
||||||
|
|||||||
@ -15,4 +15,10 @@ public class ModFoodComponents {
|
|||||||
new FoodComponent.Builder()
|
new FoodComponent.Builder()
|
||||||
.alwaysEdible()
|
.alwaysEdible()
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
public static final FoodComponent PLAYER_MILK =
|
||||||
|
new FoodComponent.Builder()
|
||||||
|
.alwaysEdible()
|
||||||
|
.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,7 @@ public class ModItemGroups {
|
|||||||
// Food
|
// Food
|
||||||
entries.add(ModItems.MEP_MILK);
|
entries.add(ModItems.MEP_MILK);
|
||||||
entries.add(ModItems.NUT);
|
entries.add(ModItems.NUT);
|
||||||
|
entries.add(ModItems.PLAYER_MILK);
|
||||||
|
|
||||||
// Armor
|
// Armor
|
||||||
entries.add(ModItems.CHIPPER_HELMET);
|
entries.add(ModItems.CHIPPER_HELMET);
|
||||||
|
|||||||
@ -89,6 +89,17 @@ public class ModItems {
|
|||||||
new MepMilkItem(new Item.Settings().maxCount(1).recipeRemainder(Items.BUCKET).food(ModFoodComponents.MEP_MILK))
|
new MepMilkItem(new Item.Settings().maxCount(1).recipeRemainder(Items.BUCKET).food(ModFoodComponents.MEP_MILK))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public static final Item PLAYER_MILK = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
new Identifier(ChipiMod.MOD_ID, "player_milk"),
|
||||||
|
new PlayerMilkItem(
|
||||||
|
new Item.Settings()
|
||||||
|
.maxCount(1)
|
||||||
|
.recipeRemainder(Items.BUCKET)
|
||||||
|
.food(ModFoodComponents.PLAYER_MILK)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// ===== ARMOR =====
|
// ===== ARMOR =====
|
||||||
|
|
||||||
public static final Item CHIPPER_HELMET = Registry.register(
|
public static final Item CHIPPER_HELMET = Registry.register(
|
||||||
|
|||||||
@ -0,0 +1,51 @@
|
|||||||
|
package net.Chipperfluff.chipi.item;
|
||||||
|
|
||||||
|
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.Items;
|
||||||
|
import net.minecraft.util.UseAction;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
|
import net.Chipperfluff.chipi.effect.ModEffects;
|
||||||
|
import net.Chipperfluff.chipi.sound.ModSounds;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
|
||||||
|
public class PlayerMilkItem extends Item {
|
||||||
|
|
||||||
|
public PlayerMilkItem(Settings settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UseAction getUseAction(ItemStack stack) {
|
||||||
|
return UseAction.DRINK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxUseTime(ItemStack stack) {
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
|
||||||
|
|
||||||
|
if (!world.isClient && user instanceof PlayerEntity player) {
|
||||||
|
world.playSound(
|
||||||
|
null,
|
||||||
|
player.getBlockPos(),
|
||||||
|
ModSounds.PLAYER_MILK_SONG,
|
||||||
|
SoundCategory.PLAYERS,
|
||||||
|
1.0f,
|
||||||
|
1.0f
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user instanceof PlayerEntity player && !player.getAbilities().creativeMode) {
|
||||||
|
return new ItemStack(Items.BUCKET);
|
||||||
|
}
|
||||||
|
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -19,6 +19,17 @@ import net.minecraft.util.Identifier;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.GameRules;
|
import net.minecraft.world.GameRules;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
|
||||||
|
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
|
||||||
|
import net.minecraft.world.gen.GenerationStep;
|
||||||
|
import net.fabricmc.fabric.api.event.player.UseEntityCallback;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.Chipperfluff.chipi.item.ModItems;
|
||||||
|
|
||||||
|
|
||||||
public final class ChipiServerEvents {
|
public final class ChipiServerEvents {
|
||||||
|
|
||||||
@ -33,7 +44,7 @@ public final class ChipiServerEvents {
|
|||||||
private ChipiServerEvents() {}
|
private ChipiServerEvents() {}
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
BiomeModifications.addFeature(
|
BiomeModifications.addFeature(
|
||||||
BiomeSelectors.foundInOverworld(),
|
BiomeSelectors.foundInOverworld(),
|
||||||
GenerationStep.Feature.UNDERGROUND_ORES,
|
GenerationStep.Feature.UNDERGROUND_ORES,
|
||||||
RegistryKey.of(
|
RegistryKey.of(
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import net.minecraft.util.Identifier;
|
|||||||
public class ModSounds {
|
public class ModSounds {
|
||||||
|
|
||||||
public static final SoundEvent MEP_MILK = register("entity.mep.milk");
|
public static final SoundEvent MEP_MILK = register("entity.mep.milk");
|
||||||
|
public static final SoundEvent PLAYER_MILK_SONG = register("player_milk_song");
|
||||||
|
|
||||||
private static SoundEvent register(String id) {
|
private static SoundEvent register(String id) {
|
||||||
Identifier identifier = new Identifier(ChipiMod.MOD_ID, id);
|
Identifier identifier = new Identifier(ChipiMod.MOD_ID, id);
|
||||||
|
|||||||
@ -2,18 +2,14 @@
|
|||||||
"death.attack.void_block": "§8%1$s stepped beyond safety — the Outside answered.",
|
"death.attack.void_block": "§8%1$s stepped beyond safety — the Outside answered.",
|
||||||
"death.attack.chipi.void_block_fire": "§c%1$s tried to save themselves.§r §8It got worse.",
|
"death.attack.chipi.void_block_fire": "§c%1$s tried to save themselves.§r §8It got worse.",
|
||||||
|
|
||||||
"itemGroup.chipi.chipi": "Chipi",
|
|
||||||
|
|
||||||
"effect.chipi.chipi_blessing": "Chipi's Blessing",
|
|
||||||
|
|
||||||
"entity.chipi.mep": "Merp :3",
|
|
||||||
|
|
||||||
"block.chipi.void_block": "Void Block",
|
"block.chipi.void_block": "Void Block",
|
||||||
"block.chipi.chipper_frame": "Chipper Frame",
|
"block.chipi.chipper_frame": "Chipper Frame",
|
||||||
"block.chipi.chipper_portal": "Chipper Portal",
|
"block.chipi.chipper_portal": "Chipper Portal",
|
||||||
"block.chipi.chipper_ore": "Chipper Ore",
|
"block.chipi.chipper_ore": "Chipper Ore",
|
||||||
"block.chipi.chipper_alloy_block": "Chipper Alloy Block",
|
"block.chipi.chipper_alloy_block": "Chipper Alloy Block",
|
||||||
|
|
||||||
|
"itemGroup.chipi.chipi": "Chipi",
|
||||||
|
|
||||||
"item.chipi.void_block": "Void Block",
|
"item.chipi.void_block": "Void Block",
|
||||||
"item.chipi.chipper_frame": "Chipper Frame",
|
"item.chipi.chipper_frame": "Chipper Frame",
|
||||||
"item.chipi.chipper_portal": "Chipper Portal",
|
"item.chipi.chipper_portal": "Chipper Portal",
|
||||||
@ -23,9 +19,6 @@
|
|||||||
"item.chipi.chipper_ingot": "Chipper Ingot",
|
"item.chipi.chipper_ingot": "Chipper Ingot",
|
||||||
"item.chipi.chipper_alloy": "Chipper Alloy",
|
"item.chipi.chipper_alloy": "Chipper Alloy",
|
||||||
"item.chipi.mep_spawn_egg": "Mep Spawn Egg",
|
"item.chipi.mep_spawn_egg": "Mep Spawn Egg",
|
||||||
|
|
||||||
"item.chipi.nut": "Nut",
|
|
||||||
"item.chipi.mep_milk": "Mep Milk",
|
|
||||||
|
|
||||||
"item.chipi.chipper_helmet": "Chipper Helmet",
|
"item.chipi.chipper_helmet": "Chipper Helmet",
|
||||||
"item.chipi.chipper_chestplate": "Chipper Chestplate",
|
"item.chipi.chipper_chestplate": "Chipper Chestplate",
|
||||||
@ -38,19 +31,20 @@
|
|||||||
"item.chipi.chipper_shovel": "Chipper Shovel",
|
"item.chipi.chipper_shovel": "Chipper Shovel",
|
||||||
"item.chipi.chipper_hoe": "Chipper Hoe",
|
"item.chipi.chipper_hoe": "Chipper Hoe",
|
||||||
|
|
||||||
|
"item.chipi.nut": "Nut",
|
||||||
|
"item.chipi.mep_milk": "Mep Milk",
|
||||||
|
"item.chipi.player_milk": "Player Milk",
|
||||||
|
|
||||||
"tooltip.chipi.void_block": "§8It hums quietly.§r §7You are not supposed to notice that.",
|
"tooltip.chipi.void_block": "§8It hums quietly.§r §7You are not supposed to notice that.",
|
||||||
"tooltip.chipi.chipper_frame": "§7Built to hold a mistake.§r §8It is doing its best.",
|
"tooltip.chipi.chipper_frame": "§7Built to hold a mistake.§r §8It is doing its best.",
|
||||||
"tooltip.chipi.chipper_portal": "§5Something on the other side noticed you.§r §8It did not look away.",
|
"tooltip.chipi.chipper_portal": "§5Something on the other side noticed you.§r §8It did not look away.",
|
||||||
"tooltip.chipi.chipper_ore": "§7Common.§r §8Suspiciously so.",
|
"tooltip.chipi.chipper_ore": "§7Common.§r §8Suspiciously so.",
|
||||||
"tooltip.chipi.chipper_alloy_block": "§7Pressed together until it stopped complaining.§r §8Mostly.",
|
"tooltip.chipi.chipper_alloy_block": "§7Pressed together until it stopped complaining.§r §8Mostly.",
|
||||||
|
|
||||||
"tooltip.chipi.nut": "§7Probably edible.§r §8Confidence not included.",
|
|
||||||
"tooltip.chipi.raw_chipper_ore": "§7Still warm to the touch.§r §8That seems unnecessary.",
|
"tooltip.chipi.raw_chipper_ore": "§7Still warm to the touch.§r §8That seems unnecessary.",
|
||||||
"tooltip.chipi.chipper_ingot": "§7Dense and stubborn.§r §8Refuses to fail politely.",
|
"tooltip.chipi.chipper_ingot": "§7Dense and stubborn.§r §8Refuses to fail politely.",
|
||||||
"tooltip.chipi.chipper_alloy": "§7Stronger than it looks.§r §8Judges you silently.",
|
"tooltip.chipi.chipper_alloy": "§7Stronger than it looks.§r §8Judges you silently.",
|
||||||
|
|
||||||
"tooltip.chipi.mep_spawn_egg": "§8It already knows where you are.§r §7Spawning is a courtesy.",
|
"tooltip.chipi.mep_spawn_egg": "§8It already knows where you are.§r §7Spawning is a courtesy.",
|
||||||
"tooltip.chipi.mep_milk": "§7Temporary comfort in liquid form.§r §8The bucket survives.",
|
|
||||||
|
|
||||||
"tooltip.chipi.chipper_helmet": "§7Heavy and awkward.§r §8Feels incomplete alone.",
|
"tooltip.chipi.chipper_helmet": "§7Heavy and awkward.§r §8Feels incomplete alone.",
|
||||||
"tooltip.chipi.chipper_chestplate": "§7Looks like armor.§r §8Does nothing by itself.",
|
"tooltip.chipi.chipper_chestplate": "§7Looks like armor.§r §8Does nothing by itself.",
|
||||||
@ -61,5 +55,9 @@
|
|||||||
"tooltip.chipi.chipper_pickaxe": "§7Fast bite on stone.§r §8Gives up immediately after.",
|
"tooltip.chipi.chipper_pickaxe": "§7Fast bite on stone.§r §8Gives up immediately after.",
|
||||||
"tooltip.chipi.chipper_axe": "§7Clean chop.§r §8Handle resents you.",
|
"tooltip.chipi.chipper_axe": "§7Clean chop.§r §8Handle resents you.",
|
||||||
"tooltip.chipi.chipper_shovel": "§7Quick dig.§r §8Gravel smells weakness.",
|
"tooltip.chipi.chipper_shovel": "§7Quick dig.§r §8Gravel smells weakness.",
|
||||||
"tooltip.chipi.chipper_hoe": "§7Turns soil fast.§r §8Blunts before the sprouts."
|
"tooltip.chipi.chipper_hoe": "§7Turns soil fast.§r §8Blunts before the sprouts.",
|
||||||
|
|
||||||
|
"tooltip.chipi.nut": "§7Probably edible.§r §8Confidence not included.",
|
||||||
|
"tooltip.chipi.mep_milk": "§7Temporary comfort in liquid form.§r §8The bucket survives.",
|
||||||
|
"tooltip.chipi.player_milk": "what the fuck did you just just put in me"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "chipi:item/player_milk"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,5 +3,10 @@
|
|||||||
"sounds": [
|
"sounds": [
|
||||||
"chipi:mep_milk"
|
"chipi:mep_milk"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"player_milk_song": {
|
||||||
|
"sounds": [
|
||||||
|
"chipi:player_milk"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
BIN
src/main/resources/assets/chipi/sounds/player_milk.ogg
Normal file
BIN
src/main/resources/assets/chipi/sounds/player_milk.ogg
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 336 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 759 B |
BIN
src/main/resources/assets/chipi/textures/block/diamond_block.png
Normal file
BIN
src/main/resources/assets/chipi/textures/block/diamond_block.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 263 B |
BIN
src/main/resources/assets/chipi/textures/item/player_milk.png
Normal file
BIN
src/main/resources/assets/chipi/textures/item/player_milk.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 339 B |
Loading…
x
Reference in New Issue
Block a user