Add music discs and associated features, including recipes, sounds, and textures
@ -17,6 +17,7 @@ import net.Chipperfluff.chipi.sound.ModSounds;
|
|||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
|
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
|
||||||
import net.Chipperfluff.chipi.util.TickScheduler;
|
import net.Chipperfluff.chipi.util.TickScheduler;
|
||||||
|
import net.Chipperfluff.chipi.item.music.ModMusicDiscs;
|
||||||
|
|
||||||
public class ChipiMod implements ModInitializer {
|
public class ChipiMod implements ModInitializer {
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ public class ChipiMod implements ModInitializer {
|
|||||||
SpawnLogic.register();
|
SpawnLogic.register();
|
||||||
|
|
||||||
ModSounds.register();
|
ModSounds.register();
|
||||||
|
ModMusicDiscs.registerAll();
|
||||||
|
|
||||||
TickScheduler.init();
|
TickScheduler.init();
|
||||||
CommandHandler.register();
|
CommandHandler.register();
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package net.Chipperfluff.chipi.item;
|
|||||||
|
|
||||||
import net.Chipperfluff.chipi.ChipiMod;
|
import net.Chipperfluff.chipi.ChipiMod;
|
||||||
import net.Chipperfluff.chipi.block.ModBlocks;
|
import net.Chipperfluff.chipi.block.ModBlocks;
|
||||||
|
import net.Chipperfluff.chipi.item.music.ModMusicDiscs;
|
||||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
|
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -50,6 +51,10 @@ public class ModItemGroups {
|
|||||||
entries.add(ModItems.CHIPPER_SHOVEL);
|
entries.add(ModItems.CHIPPER_SHOVEL);
|
||||||
entries.add(ModItems.CHIPPER_HOE);
|
entries.add(ModItems.CHIPPER_HOE);
|
||||||
|
|
||||||
|
// Music discs
|
||||||
|
for (var disc : ModMusicDiscs.getAll().values()) {
|
||||||
|
entries.add(disc);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|||||||
@ -0,0 +1,67 @@
|
|||||||
|
package net.Chipperfluff.chipi.item.music;
|
||||||
|
|
||||||
|
import net.Chipperfluff.chipi.ChipiMod;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.MusicDiscItem;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.sound.SoundEvent;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ModMusicDiscs {
|
||||||
|
|
||||||
|
private static final Map<String, Item> DISCS = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
private static final MusicDiscDef[] DEFINITIONS = {
|
||||||
|
new MusicDiscDef("aa9", 7, 5, 0),
|
||||||
|
new MusicDiscDef("abc", 7, 2, 11),
|
||||||
|
new MusicDiscDef("fs", 7, 2, 0),
|
||||||
|
new MusicDiscDef("phone", 7, 2, 11),
|
||||||
|
new MusicDiscDef("wha", 7, 1, 48),
|
||||||
|
new MusicDiscDef("who", 7, 2, 27),
|
||||||
|
new MusicDiscDef("working_as_intented", 7, 3, 45)
|
||||||
|
};
|
||||||
|
|
||||||
|
private static Item registerDisc(MusicDiscDef def) {
|
||||||
|
String id = "chipi_record_" + def.name();
|
||||||
|
Identifier identifier = new Identifier(ChipiMod.MOD_ID, id);
|
||||||
|
|
||||||
|
SoundEvent sound = Registry.register(
|
||||||
|
Registries.SOUND_EVENT,
|
||||||
|
identifier,
|
||||||
|
SoundEvent.of(identifier)
|
||||||
|
);
|
||||||
|
|
||||||
|
Item item = Registry.register(
|
||||||
|
Registries.ITEM,
|
||||||
|
identifier,
|
||||||
|
new MusicDiscItem(
|
||||||
|
def.comparatorOutput(),
|
||||||
|
sound,
|
||||||
|
new Item.Settings().maxCount(1),
|
||||||
|
toTicks(def.minutes(), def.seconds())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
DISCS.put(def.name(), item);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, Item> getAll() {
|
||||||
|
return DISCS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerAll() {
|
||||||
|
for (MusicDiscDef def : DEFINITIONS) {
|
||||||
|
registerDisc(def);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int toTicks(int minutes, int seconds) {
|
||||||
|
int totalSeconds = Math.max(0, minutes) * 60 + Math.max(0, seconds);
|
||||||
|
return totalSeconds * 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package net.Chipperfluff.chipi.item.music;
|
||||||
|
|
||||||
|
public record MusicDiscDef(
|
||||||
|
String name,
|
||||||
|
int comparatorOutput,
|
||||||
|
int minutes,
|
||||||
|
int seconds
|
||||||
|
) {}
|
||||||
@ -2,12 +2,30 @@
|
|||||||
"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.",
|
||||||
|
|
||||||
|
"effect.chipi.chipi_blessing": "§bChipi's Blessing",
|
||||||
|
"effect.chipi.pregnant": "§dyou are Pregnant",
|
||||||
|
|
||||||
"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",
|
||||||
|
|
||||||
|
"item.chipi.chipi_record_aa9": "Chipi Record – Aa9",
|
||||||
|
"item.chipi.chipi_record_aa9.desc": "Chipi Record – Aa9",
|
||||||
|
"item.chipi.chipi_record_abc": "Chipi Record – Abc",
|
||||||
|
"item.chipi.chipi_record_abc.desc": "Chipi Record – Abc",
|
||||||
|
"item.chipi.chipi_record_fs": "Chipi Record – Fs",
|
||||||
|
"item.chipi.chipi_record_fs.desc": "Chipi Record – Fs",
|
||||||
|
"item.chipi.chipi_record_phone": "Chipi Record – Phone",
|
||||||
|
"item.chipi.chipi_record_phone.desc": "Chipi Record – Phone",
|
||||||
|
"item.chipi.chipi_record_wha": "Chipi Record – Wha",
|
||||||
|
"item.chipi.chipi_record_wha.desc": "Chipi Record – Wha",
|
||||||
|
"item.chipi.chipi_record_who": "Chipi Record – Who",
|
||||||
|
"item.chipi.chipi_record_who.desc": "Chipi Record – Who",
|
||||||
|
"item.chipi.chipi_record_working_as_intented": "Chipi Record – Working As Intented",
|
||||||
|
"item.chipi.chipi_record_working_as_intented.desc": "Chipi Record – Working As Intented",
|
||||||
|
|
||||||
"itemGroup.chipi.chipi": "Chipi",
|
"itemGroup.chipi.chipi": "Chipi",
|
||||||
|
|
||||||
"item.chipi.void_block": "Void Block",
|
"item.chipi.void_block": "Void Block",
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "chipi:item/chipi_record_aa9"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "chipi:item/chipi_record_abc"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "chipi:item/chipi_record_fs"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "chipi:item/chipi_record_phone"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "chipi:item/chipi_record_wha"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "chipi:item/chipi_record_who"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "chipi:item/chipi_record_working_as_intented"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,5 +8,26 @@
|
|||||||
"sounds": [
|
"sounds": [
|
||||||
"chipi:player_milk"
|
"chipi:player_milk"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"chipi_record_aa9": {
|
||||||
|
"sounds": [{ "name": "chipi:chipi_record_aa9", "stream": true }]
|
||||||
|
},
|
||||||
|
"chipi_record_abc": {
|
||||||
|
"sounds": [{ "name": "chipi:chipi_record_abc", "stream": true }]
|
||||||
|
},
|
||||||
|
"chipi_record_fs": {
|
||||||
|
"sounds": [{ "name": "chipi:chipi_record_fs", "stream": true }]
|
||||||
|
},
|
||||||
|
"chipi_record_phone": {
|
||||||
|
"sounds": [{ "name": "chipi:chipi_record_phone", "stream": true }]
|
||||||
|
},
|
||||||
|
"chipi_record_wha": {
|
||||||
|
"sounds": [{ "name": "chipi:chipi_record_wha", "stream": true }]
|
||||||
|
},
|
||||||
|
"chipi_record_who": {
|
||||||
|
"sounds": [{ "name": "chipi:chipi_record_who", "stream": true }]
|
||||||
|
},
|
||||||
|
"chipi_record_working_as_intented": {
|
||||||
|
"sounds": [{ "name": "chipi:chipi_record_working_as_intented", "stream": true }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
src/main/resources/assets/chipi/sounds/chipi_record_aa9.ogg
Normal file
BIN
src/main/resources/assets/chipi/sounds/chipi_record_abc.ogg
Normal file
BIN
src/main/resources/assets/chipi/sounds/chipi_record_fs.ogg
Normal file
BIN
src/main/resources/assets/chipi/sounds/chipi_record_phone.ogg
Normal file
BIN
src/main/resources/assets/chipi/sounds/chipi_record_wha.ogg
Normal file
BIN
src/main/resources/assets/chipi/sounds/chipi_record_who.ogg
Normal file
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 312 B |
13
src/main/resources/data/chipi/recipes/chipi_record_aa9.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"xxx",
|
||||||
|
"xyx",
|
||||||
|
"xxx"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"x": { "item": "chipi:raw_chipper_ore" },
|
||||||
|
"y": { "item": "minecraft:emerald" }
|
||||||
|
},
|
||||||
|
"result": { "item": "chipi:chipi_record_aa9" }
|
||||||
|
}
|
||||||
13
src/main/resources/data/chipi/recipes/chipi_record_abc.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"xxx",
|
||||||
|
"xyx",
|
||||||
|
"xxx"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"x": { "item": "minecraft:orange_wool" },
|
||||||
|
"y": { "item": "minecraft:emerald" }
|
||||||
|
},
|
||||||
|
"result": { "item": "chipi:chipi_record_abc" }
|
||||||
|
}
|
||||||
13
src/main/resources/data/chipi/recipes/chipi_record_fs.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"xxx",
|
||||||
|
"xyx",
|
||||||
|
"xxx"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"x": { "item": "minecraft:sweet_berries" },
|
||||||
|
"y": { "item": "minecraft:emerald" }
|
||||||
|
},
|
||||||
|
"result": { "item": "chipi:chipi_record_fs" }
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"xxx",
|
||||||
|
"xyx",
|
||||||
|
"xxx"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"x": { "item": "minecraft:iron_ingot" },
|
||||||
|
"y": { "item": "minecraft:emerald" }
|
||||||
|
},
|
||||||
|
"result": { "item": "chipi:chipi_record_phone" }
|
||||||
|
}
|
||||||
13
src/main/resources/data/chipi/recipes/chipi_record_wha.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"xxx",
|
||||||
|
"xyx",
|
||||||
|
"xxx"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"x": { "item": "chipi:chipper_alloy" },
|
||||||
|
"y": { "item": "minecraft:emerald" }
|
||||||
|
},
|
||||||
|
"result": { "item": "chipi:chipi_record_wha" }
|
||||||
|
}
|
||||||
13
src/main/resources/data/chipi/recipes/chipi_record_who.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"xxx",
|
||||||
|
"xyx",
|
||||||
|
"xxx"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"x": { "item": "minecraft:blue_wool" },
|
||||||
|
"y": { "item": "minecraft:emerald" }
|
||||||
|
},
|
||||||
|
"result": { "item": "chipi:chipi_record_who" }
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"xxx",
|
||||||
|
"xyx",
|
||||||
|
"xxx"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"x": { "item": "minecraft:glass" },
|
||||||
|
"y": { "item": "minecraft:emerald" }
|
||||||
|
},
|
||||||
|
"result": { "item": "chipi:chipi_record_working_as_intented" }
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"chipi:chipi_record_aa9",
|
||||||
|
"chipi:chipi_record_abc",
|
||||||
|
"chipi:chipi_record_fs",
|
||||||
|
"chipi:chipi_record_phone",
|
||||||
|
"chipi:chipi_record_wha",
|
||||||
|
"chipi:chipi_record_who",
|
||||||
|
"chipi:chipi_record_working_as_intented"
|
||||||
|
]
|
||||||
|
}
|
||||||