diff --git a/kubejs/data/trofers/trophies.json b/kubejs/data/trofers/trophies.json new file mode 100644 index 00000000..0ab923d6 --- /dev/null +++ b/kubejs/data/trofers/trophies.json @@ -0,0 +1,111 @@ +{ + "wilden_guardian": { + "folder": "ars", + "entity": "ars_nouveau:wilden_guardian", + "name": "entity.ars_nouveau.wilden_guardian", + "accent_color": "#ff822f", + "effects": {"sound": {"id": "ars_nouveau:ignis_death"}} + }, + "wilden_hunter": { + "folder": "ars", + "entity": "ars_nouveau:wilden_hunter", + "name": "entity.ars_nouveau.wilden_hunter", + "accent_color": "#fafafa", + "effects": {"sound": {"id": "ars_nouveau:deepling_idle"}} + }, + "wilden_stalker": { + "folder": "ars", + "entity": "ars_nouveau:wilden_stalker", + "name": "entity.ars_nouveau.wilden_stalker", + "accent_color": "#6b6348", + "effects": {"sound": {"id": "ars_nouveau:ignis_death"}} + }, + "archevoker": { + "folder": "irons_spellbooks", + "entity": "irons_spellbooks:archevoker", + "name": "entity.irons_spellbooks.archevoker", + "accent_color": "#2e2235", + "effects": {"sound": {"id": "ars_nouveau:ignis_death"}}, + "tag": { + "HandItems": [{"count": 1, "id": "irons_spellbooks:evoker_spell_book"},{}], + "ArmorItems": [ + { "count": 1, "id": "irons_spellbooks:archevoker_boots" }, + { "count": 1, "id": "irons_spellbooks:archevoker_leggings" }, + { "count": 1, "id": "irons_spellbooks:archevoker_chestplate" }, + { "count": 1, "id": "irons_spellbooks:archevoker_helmet" } + ] + } + }, + "cryomancer": { + "folder": "irons_spellbooks", + "entity": "irons_spellbooks:cryomancer", + "name": "entity.irons_spellbooks.cryomancer", + "accent_color": "#fafafa", + "effects": {"sound": {"id": "ars_nouveau:ignis_death"}}, + "tag": { + "HandItems": [{"count": 1, "id": "irons_spellbooks:ice_staff"},{}], + "ArmorItems": [ + { "count": 1, "id": "irons_spellbooks:cryomancer_boots" }, + { "count": 1, "id": "irons_spellbooks:cryomancer_leggings" }, + { "count": 1, "id": "irons_spellbooks:cryomancer_chestplate" }, + { "count": 1, "id": "irons_spellbooks:cryomancer_helmet" } + ] + } + }, + "pyromancer": { + "folder": "irons_spellbooks", + "entity": "irons_spellbooks:pyromancer", + "name": "entity.irons_spellbooks.pyromancer", + "accent_color": "#570001", + "effects": {"sound": {"id": "ars_nouveau:ignis_death"}}, + "tag": { + "HandItems": [{"count": 1, "id": "irons_spellbooks:pyrium_staff"},{}], + "ArmorItems": [ + { "count": 1, "id": "irons_spellbooks:pyromancer_boots" }, + { "count": 1, "id": "irons_spellbooks:pyromancer_leggings" }, + { "count": 1, "id": "irons_spellbooks:pyromancer_chestplate" }, + { "count": 1, "id": "irons_spellbooks:pyromancer_helmet" } + ] + } + }, + "priest": { + "folder": "irons_spellbooks", + "entity": "irons_spellbooks:priest", + "name": "entity.irons_spellbooks.priest", + "accent_color": "#2e2235", + "effects": {"sound": {"id": "ars_nouveau:ignis_death"}}, + "tag": { + "HandItems": [{"count": 1, "id": "irons_spellbooks:graybeard_staff"},{}], + "ArmorItems": [ + { "count": 1, "id": "irons_spellbooks:priest_boots" }, + { "count": 1, "id": "irons_spellbooks:priest_leggings" }, + { "count": 1, "id": "irons_spellbooks:priest_chestplate" }, + { "count": 1, "id": "irons_spellbooks:priest_helmet" } + ] + } + }, + "necromancer": { + "folder": "irons_spellbooks", + "entity": "irons_spellbooks:necromancer", + "name": "entity.irons_spellbooks.necromancer", + "accent_color": "#442f23", + "effects":{"sound":{"id": "ars_nouveau:ignis_death"}}, + "tag":{ "ArmorItems": [{},{},{},{"count": 1, "id": "irons_spellbooks:tarnished_helmet"}]} + }, + "ancient_knight": { + "folder": "irons_spellbooks", + "entity": "irons_spellbooks:citadel_keeper", + "name": "entity.irons_spellbooks.citadel_keeper", + "accent_color": "#593f50", + "effects":{"sound":{"id": "ars_nouveau:ignis_death"}}, + "tag":{"HandItems": [{"count": 1, "id": "irons_spellbooks:keeper_flamberge"},{}]} + }, + "apothecarist": { + "folder": "irons_spellbooks", + "entity": "irons_spellbooks:apothecarist", + "name": "entity.irons_spellbooks.apothecarist", + "accent_color": "#593f50", + "effects":{"sound":{"id": "ars_nouveau:ignis_death"}}, + "tag":{"ArmorItems":[{},{},{"count": 1, "id":"irons_spellbooks:plagued_chestplate"},{}]} + } +} diff --git a/kubejs/server_scripts/beheading.js b/kubejs/server_scripts/beheading.js new file mode 100644 index 00000000..47ef4054 --- /dev/null +++ b/kubejs/server_scripts/beheading.js @@ -0,0 +1,23 @@ +EntityEvents.death("player", (event) => { + //console.log("player morto"); + + let { entity, source } = event; + + //console.log(`tentativo di drop: minecraft:player_head[minecraft:profile="${entity.name.string}"]`); + + //dropchance in percentage + let dropChance = 0.5 + + // console.log("UCCISORE:" + source.getType()); + let attacker = source.actual; + + // Controlla se la causa della morte รจ un altro giocatore + if (attacker.isPlayer() && Math.random() < dropChance) { + let myEntity = event.level.createEntity('item'); + myEntity.item = Item.of(`minecraft:player_head[minecraft:profile="${entity.name.string}"]`); + myEntity.x = entity.x; + myEntity.y = entity.y; + myEntity.z = entity.z; + myEntity.spawn(); + } +}); diff --git a/kubejs/server_scripts/trophies.js b/kubejs/server_scripts/trophies.js new file mode 100644 index 00000000..d9076a7b --- /dev/null +++ b/kubejs/server_scripts/trophies.js @@ -0,0 +1,133 @@ +ServerEvents.generateData('after_mods', event => { + // Carico il file compatto + const trophies = JsonIO.read('kubejs/data/trofers/trophies.json'); + + let drops = { + "neoforge:conditions": [ + { + "type": "neoforge:mod_loaded", + "modid": "cataclysm" + } + ], + "conditions": [ + { "condition": "minecraft:killed_by_player" }, + { "condition": "trofers:random_trophy_chance" } + ], + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": ["cataclysm"] + } + ], + "trophies": {}, + "trophy_base": "trofers:small_plate" + }; + + + /** + + JSON temeplate + + "": { + "folder": "", + "entity": "mod:nome", + "name": "entity.mod.nome", + "accent_color": "#ffffff", + "effects": {"sound": {"id": "ars_nouveau:ignis_death"}}, + "nbt": "{OnGround:1b,Act:1,Phase:0}", + "display": {"scale": 0.25, "offset":[0.0, 0.0, 2.0]}, + "tag": { + "HandItems": [{"count": 1, "id": "irons_spellbooks:pyrium_staff"},{}], + "ArmorItems": [ + { "count": 1, "id": "irons_spellbooks:archevoker_boots" }, + { "count": 1, "id": "irons_spellbooks:archevoker_leggings" }, + { "count": 1, "id": "irons_spellbooks:archevoker_chestplate" }, + { "count": 1, "id": "irons_spellbooks:archevoker_helmet" } + ] + } + } + + */ + // Loop su ogni trofeo + Object.entries(trophies).forEach(([id, data]) => { + // Creiamo un nome univoco e valido per il trofeo + // Esempio: "cataclysm_ender_golem" + const trophy_name = `${data.folder}/${id}`; + + let trophy = { + colors: { + base: "#606060", + accent: data.accent_color + }, + entity: { + id: data.entity + }, + name: { + color: data.accent_color, + translate: "trophy.trofers.composed", + with: [ + { + translate: data.name + } + ] + } + }; + + // alcune variabili con un default + if(data.display){ + trophy.display = data.display; + }else{ + trophy.display = {"scale": 0.25}; + } + + if(data.nbt){ + trophy.entity.nbt = data.nbt; + } + + if(data.effects){ + trophy.effects = data.effects; + } + + if(data.tag){ + trophy.entity.tag = data.tag; + } + + // Salva il JSON nella cartella trofei di Trofers, usando il nome univoco + event.json(`trofers:trofers/trophies/${trophy_name}`, trophy); + + // Aggiungi il trofeo alla lista dei drop, usando il nome univoco + drops.trophies[data.entity] = `trofers:${trophy_name}`; + }); + + + // Scrivo il file completo per tutti i mob drop + event.json(`trofers:trofers/entity_drops/mod_drops`, drops); +}); + +// add a description on how the trophies are dropped +// I only added it on the generic small plate that is the one that normally drops +RecipeViewerEvents.addInformation('item', event => { + event.add('trofers:small_plate', [ + 'Each enemy has a low chance of dropping its trophy upon death.' + ]); +}) + +// added all the recipe for plate conversion in the stonecutter +ServerEvents.recipes(event => { + const trophies = JsonIO.read('kubejs/data/trofers/trophies.json'); + + Object.entries(trophies).forEach(([id, data]) => { + const trophy_name = `${data.folder}/${id}`; + + const trophy_type = ['small_plate','small_pillar','medium_plate','medium_pillar','large_plate','large_pillar']; + + trophy_type.forEach(input => { + trophy_type.forEach(output => { + if(input!=output){ + event.stonecutting(`trofers:${input}[trofers:trophy="trofers:${trophy_name}"]`, `trofers:${output}[trofers:trophy="trofers:${trophy_name}"]`); + } + }); + }); + }); + +});