- Fixed fishing nets event function

This commit is contained in:
Redeix 2025-05-11 21:14:36 -05:00
parent 83edfb98b1
commit e47e591c02
2 changed files with 59 additions and 44 deletions

View file

@ -16,6 +16,7 @@
- Fixed assembler clay recipes so they output the correct amount (Pyritie)
- Quest fixes/tweaks (Pyritie)
- Added aluminium, stainless steel, and titanium millstones (Pyritie)
- Fixed fishing nets behavior (Redeix)
## [0.9.5] - 08.05.2025
### Changes

View file

@ -153,16 +153,70 @@ function getTFGPersistentDataRoot(player)
'crayfish'
];
//tags wont work here (or at least I couldnt get it to work) so we need to manually declare each net tier.
const tiers = [
'wood',
'brass',
'rose_gold',
'sterling_silver',
'invar',
'tin_alloy',
'cupronickel',
'magnalium'
];
//Event detects if fish is right clicked with fishing net and then teleports the mob into the void, plays some actions and gives the player the proper item.
fish.forEach(fish => {
ItemEvents.entityInteracted('#forge:tools/fishing_nets', event => {
tiers.forEach(tier => {
fish.forEach(fish => {
ItemEvents.entityInteracted(`tfg:fishing_net/${tier}`, (event) => {
const {item, player, server, target} = event;
if (target.type != `tfc:${fish}`) return
server.runCommandSilent(`particle minecraft:bubble_pop ${target.x} ${target.y} ${target.z} 0.5 0.5 0.5 0.00001 10`)
server.runCommandSilent(`playsound minecraft:entity.player.splash player ${player.username} ${target.x} ${target.y} ${target.z} 2 2 1`)
server.runCommandSilent(`tp ${target.uuid} ${target.x} ${target.y - 382} ${target.z}`)
event.player.give(`tfc:food/${fish}`)
player.swing()
if (player.isCreative() == false){
item.damageValue++
if (item.damageValue >= item.maxDamage) {
server.runCommandSilent(`playsound minecraft:item.shield.break player ${player.username} ${player.x} ${player.y} ${player.z} 1 1 1`)
item.count--
}
}
})
})
//Shellfish Exception
shellfish.forEach(shellfish => {
ItemEvents.entityInteracted(`tfg:fishing_net/${tier}`, (event) => {
const {item, player, server, target} = event;
if (target.type != `tfc:${shellfish}`) return
server.runCommandSilent(`particle minecraft:bubble_pop ${target.x} ${target.y} ${target.z} 0.5 0.5 0.5 0.00001 10`)
server.runCommandSilent(`playsound minecraft:entity.player.splash player ${player.username} ${target.x} ${target.y} ${target.z} 2 2 1`)
server.runCommandSilent(`tp ${target.uuid} ${target.x} ${target.y - 382} ${target.z}`)
event.player.give('tfc:food/shellfish')
player.swing()
if (player.isCreative() == false){
item.damageValue++
if (item.damageValue >= item.maxDamage) {
server.runCommandSilent(`playsound minecraft:item.shield.break player ${player.username} ${player.x} ${player.y} ${player.z} 1 1 1`)
item.count--
}
}
})
})
//Pufferfish Exception
ItemEvents.entityInteracted(`tfg:fishing_net/${tier}`, (event) => {
const {item, player, server, target} = event;
if (target.type != `tfc:${fish}`) return
if (target.type != 'tfc:pufferfish') return
server.runCommandSilent(`particle minecraft:bubble_pop ${target.x} ${target.y} ${target.z} 0.5 0.5 0.5 0.00001 10`)
server.runCommandSilent(`playsound minecraft:entity.player.splash player ${player.username} ${target.x} ${target.y} ${target.z} 2 2 1`)
server.runCommandSilent(`tp ${target.uuid} ${target.x} ${target.y - 382} ${target.z}`)
event.player.give(`tfc:food/${fish}`)
event.player.give('minecraft:pufferfish')
player.swing()
if (player.isCreative() == false){
item.damageValue++
@ -173,44 +227,4 @@ function getTFGPersistentDataRoot(player)
}
})
})
//Shellfish Exception
shellfish.forEach(shellfish => {
ItemEvents.entityInteracted('#forge:tools/fishing_nets', event => {
const {item, player, server, target} = event;
if (target.type != `tfc:${shellfish}`) return
server.runCommandSilent(`particle minecraft:bubble_pop ${target.x} ${target.y} ${target.z} 0.5 0.5 0.5 0.00001 10`)
server.runCommandSilent(`playsound minecraft:entity.player.splash player ${player.username} ${target.x} ${target.y} ${target.z} 2 2 1`)
server.runCommandSilent(`tp ${target.uuid} ${target.x} ${target.y - 382} ${target.z}`)
event.player.give('tfc:food/shellfish')
player.swing()
if (player.isCreative() == false){
item.damageValue++
if (item.damageValue >= item.maxDamage) {
server.runCommandSilent(`playsound minecraft:item.shield.break player ${player.username} ${player.x} ${player.y} ${player.z} 1 1 1`)
item.count--
}
}
})
})
//Pufferfish Exception
ItemEvents.entityInteracted('#forge:tools/fishing_nets', event => {
const {item, player, server, target} = event;
if (target.type != 'tfc:pufferfish') return
server.runCommandSilent(`particle minecraft:bubble_pop ${target.x} ${target.y} ${target.z} 0.5 0.5 0.5 0.00001 10`)
server.runCommandSilent(`playsound minecraft:entity.player.splash player ${player.username} ${target.x} ${target.y} ${target.z} 2 2 1`)
server.runCommandSilent(`tp ${target.uuid} ${target.x} ${target.y - 382} ${target.z}`)
event.player.give('minecraft:pufferfish')
player.swing()
if (player.isCreative() == false){
item.damageValue++
if (item.damageValue >= item.maxDamage) {
server.runCommandSilent(`playsound minecraft:item.shield.break player ${player.username} ${player.x} ${player.y} ${player.z} 1 1 1`)
item.count--
}
}
})
//#endregion