2024/11/08
优化部分逻辑 扩展了新的箭矢 添加了使用时的音效
This commit is contained in:
parent
7f8b24beb8
commit
e236e4a718
|
|
@ -1,4 +1,4 @@
|
||||||
# 版本 0.0.3.9.8 提前介绍c[最终版本对于0.0.4] 【注意:本解釋簡繁混寫,因爲趕時間,所以並不怎麽規範,請諒解】
|
# 版本 0.0.3.9.9 提前介绍c[最终版本对于0.0.4] 【注意:本解釋簡繁混寫,因爲趕時間,所以並不怎麽規範,請諒解】
|
||||||
## 简介
|
## 简介
|
||||||
现在开始你可以用拴绳拴住玩家,也可以拴住自己了,不如尝试拴住彼此来通关我的世界吧(
|
现在开始你可以用拴绳拴住玩家,也可以拴住自己了,不如尝试拴住彼此来通关我的世界吧(
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
4. 拴绳箭最大存活时间
|
4. 拴绳箭最大存活时间
|
||||||
|
|
||||||
## 新物品 和 实体
|
## 新物品 和 实体
|
||||||
### 拴绳箭 [有普通和荧光两种箭矢]
|
### 拴绳箭 [有普通和荧光和药水三种箭矢]
|
||||||
获得飞一样的感觉(操作不当可能会摔死
|
获得飞一样的感觉(操作不当可能会摔死
|
||||||
+ 拴绳箭可以拴其它可拴LivingEntity了(
|
+ 拴绳箭可以拴其它可拴LivingEntity了(
|
||||||
### 紫水晶剪刀
|
### 紫水晶剪刀
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ mod_name=Leashed Player
|
||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=MIT
|
mod_license=MIT
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=0.0.3.9.8
|
mod_version=0.0.3.9.9
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
# This should match the base package used for the mod sources.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// 1.21 2024-11-05T22:44:13.1744327 Item Models: leashedplayer
|
// 1.21 2024-11-08T12:16:30.8995908 Item Models: leashedplayer
|
||||||
766c487fbf0c59e9045eeaf81daf583eb679b0e1 assets/leashedplayer/models/item/amethyst_shears.json
|
766c487fbf0c59e9045eeaf81daf583eb679b0e1 assets/leashedplayer/models/item/amethyst_shears.json
|
||||||
5846df9d85726428905701120ef34c9324c20faf assets/leashedplayer/models/item/bow_lra_pulling_0.json
|
5846df9d85726428905701120ef34c9324c20faf assets/leashedplayer/models/item/bow_lra_pulling_0.json
|
||||||
845a7316b86e26f88c6932d4ef2656126503727a assets/leashedplayer/models/item/bow_lra_pulling_1.json
|
845a7316b86e26f88c6932d4ef2656126503727a assets/leashedplayer/models/item/bow_lra_pulling_1.json
|
||||||
|
|
@ -9,3 +9,4 @@ bb0d76077719c83c8a8bd4346a24ea1766175125 assets/leashedplayer/models/item/fabric
|
||||||
114d3cc5832ef047403114504483c6f3ea07e77c assets/leashedplayer/models/item/leash_rope_arrow.json
|
114d3cc5832ef047403114504483c6f3ea07e77c assets/leashedplayer/models/item/leash_rope_arrow.json
|
||||||
39b631c9dacf0481bfe8b84c7e7dd5841baf4ff7 assets/leashedplayer/models/item/neoforge.json
|
39b631c9dacf0481bfe8b84c7e7dd5841baf4ff7 assets/leashedplayer/models/item/neoforge.json
|
||||||
c4748995a5fe190d20e3bd16f4b2244164ec0f83 assets/leashedplayer/models/item/spectral_leash_rope_arrow.json
|
c4748995a5fe190d20e3bd16f4b2244164ec0f83 assets/leashedplayer/models/item/spectral_leash_rope_arrow.json
|
||||||
|
c4ef06f3162fe85f152c5b4a25ecdb4c2c56f945 assets/leashedplayer/models/item/tipped_leash_rope_arrow.json
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
// 1.21 2024-10-23T13:15:06.1012494 Tags for minecraft:item mod id leashedplayer
|
// 1.21 2024-11-08T16:34:21.9849347 Tags for minecraft:item mod id leashedplayer
|
||||||
36c1cccc1dfa448620c4e9cbc4a7d73986ff9e47 data/minecraft/tags/item/arrows.json
|
63e4ad58dc8397171f84264d53dfe4fb503c7b1e data/minecraft/tags/item/arrows.json
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
// 1.21 2024-11-05T22:44:13.1744327 Languages: en_us for mod: leashedplayer
|
// 1.21 2024-11-08T21:47:39.4393293 Languages: en_us for mod: leashedplayer
|
||||||
61c2bbb33f4814254ffdcd122aab49c0cdaf3d83 assets/leashedplayer/lang/en_us.json
|
b97b093aa096d9da7d04c5776b65187091d23f5a assets/leashedplayer/lang/en_us.json
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// 1.21 2024-11-01T00:08:54.8297675 Recipes
|
// 1.21 2024-11-08T16:34:21.9849347 Recipes
|
||||||
13ebe9a580731296eb10c05d1844657d58e07cc1 data/leashedplayer/advancement/recipes/misc/amethyst_shears.json
|
13ebe9a580731296eb10c05d1844657d58e07cc1 data/leashedplayer/advancement/recipes/misc/amethyst_shears.json
|
||||||
1b45d1ad8dc73f1787c97777ad13d9771c9e0ad1 data/leashedplayer/advancement/recipes/misc/leash_rope_arrow.json
|
1b45d1ad8dc73f1787c97777ad13d9771c9e0ad1 data/leashedplayer/advancement/recipes/misc/leash_rope_arrow.json
|
||||||
04bd2d8a0c7288776da2119eb9a9f9cf694be1b6 data/leashedplayer/recipe/amethyst_shears.json
|
04bd2d8a0c7288776da2119eb9a9f9cf694be1b6 data/leashedplayer/recipe/amethyst_shears.json
|
||||||
|
|
@ -7,3 +7,4 @@ c0e05f359296d3e28573fa1b205ac44736376622 data/minecraft/advancement/recipes/misc
|
||||||
131fcbef603bfde7204d8e1ad15e4544696926bf data/minecraft/advancement/recipes/misc/spectral_leash_rope_arrow_with_leash_rope_arrow.json
|
131fcbef603bfde7204d8e1ad15e4544696926bf data/minecraft/advancement/recipes/misc/spectral_leash_rope_arrow_with_leash_rope_arrow.json
|
||||||
bb5909aa91d878c8f0ef9999881cfe89532509dd data/minecraft/recipe/spectral_leash_rope_arrow_with_glowstone_dust.json
|
bb5909aa91d878c8f0ef9999881cfe89532509dd data/minecraft/recipe/spectral_leash_rope_arrow_with_glowstone_dust.json
|
||||||
a1381da885fbedec01243c78afbb0a50ca803ee4 data/minecraft/recipe/spectral_leash_rope_arrow_with_leash_rope_arrow.json
|
a1381da885fbedec01243c78afbb0a50ca803ee4 data/minecraft/recipe/spectral_leash_rope_arrow_with_leash_rope_arrow.json
|
||||||
|
0553b07b223b84a1e4b4ce089f92b56a4d76ee84 data/minecraft/recipe/tipped_leash_rope_arrow.json
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
// 1.21 2024-11-05T22:44:13.1704334 Languages: zh_cn for mod: leashedplayer
|
// 1.21 2024-11-08T21:47:39.4379612 Languages: zh_cn for mod: leashedplayer
|
||||||
c92526831cd149866543a1c10dd6a2b59fe1b36b assets/leashedplayer/lang/zh_cn.json
|
ab838eecdadc795951fdb15fe04df7ae6cbf67af assets/leashedplayer/lang/zh_cn.json
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// 1.21 2024-11-01T00:08:54.8347648 Advancements
|
// 1.21 2024-11-08T21:47:39.4393293 Advancements
|
||||||
4d97adba079f1966090a52443bb439319f550680 data/leashedplayer/advancement/advancement_leash_arrow.json
|
4d97adba079f1966090a52443bb439319f550680 data/leashedplayer/advancement/advancement_leash_arrow.json
|
||||||
f16184b81ea35a0fbd8f2c49b085a96c32818c69 data/leashedplayer/advancement/dog_running_player.json
|
f16184b81ea35a0fbd8f2c49b085a96c32818c69 data/leashedplayer/advancement/dog_running_player.json
|
||||||
bce12ed339b3b0fded263ba039f7a4e6fcfb84ca data/leashedplayer/advancement/follow_arrow.json
|
bce12ed339b3b0fded263ba039f7a4e6fcfb84ca data/leashedplayer/advancement/follow_arrow.json
|
||||||
|
|
@ -8,3 +8,4 @@ a69a455855fb6dd8a8ac131a55099de5de45d7c4 data/leashedplayer/advancement/leash_ar
|
||||||
133f844ffafd37b9ba57cafa96350f035cac57f9 data/leashedplayer/advancement/leash_start.json
|
133f844ffafd37b9ba57cafa96350f035cac57f9 data/leashedplayer/advancement/leash_start.json
|
||||||
2d8bce7fd078f9cc6b73b77f2fbab30e6cc197f4 data/leashedplayer/advancement/leash_terminator.json
|
2d8bce7fd078f9cc6b73b77f2fbab30e6cc197f4 data/leashedplayer/advancement/leash_terminator.json
|
||||||
4b0bcf6b372f52e954edcef37a6b04435ec2b4e8 data/leashedplayer/advancement/no_leash.json
|
4b0bcf6b372f52e954edcef37a6b04435ec2b4e8 data/leashedplayer/advancement/no_leash.json
|
||||||
|
f1350976a55f2344f2f3b12f00ad8f465f400de5 data/leashedplayer/advancement/tipped_leash_arrow.json
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
// 1.21 2024-11-05T22:44:13.1684263 Languages: zh_tw for mod: leashedplayer
|
// 1.21 2024-11-08T21:47:39.4299508 Languages: zh_tw for mod: leashedplayer
|
||||||
12fe78d40c45b07ceb0b72ee9439fa132649e670 assets/leashedplayer/lang/zh_tw.json
|
dc4a7182da45af2eaa987ef614cb6b2aa1a9b5c0 assets/leashedplayer/lang/zh_tw.json
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
"advancement.leashedplayer.leashed_self.desc": "“Restrain oneself with a rope",
|
"advancement.leashedplayer.leashed_self.desc": "“Restrain oneself with a rope",
|
||||||
"advancement.leashedplayer.no_leash": "Don't tie me up",
|
"advancement.leashedplayer.no_leash": "Don't tie me up",
|
||||||
"advancement.leashedplayer.no_leash.desc": "You cannot be leashed by ANY",
|
"advancement.leashedplayer.no_leash.desc": "You cannot be leashed by ANY",
|
||||||
|
"advancement.leashedplayer.tipped_leash_arrow": "God said there should be more arrows",
|
||||||
|
"advancement.leashedplayer.tipped_leash_arrow.desc": "A dazzling array of Leash Rope arrows",
|
||||||
"creativetab.leashedplayer.leashedplayer_tab": "Leashed Player",
|
"creativetab.leashedplayer.leashedplayer_tab": "Leashed Player",
|
||||||
"effect.leashedplayer.no_leash": "No Leash",
|
"effect.leashedplayer.no_leash": "No Leash",
|
||||||
"entity.leashedplayer.kid_player": "Kid",
|
"entity.leashedplayer.kid_player": "Kid",
|
||||||
|
|
@ -41,6 +43,7 @@
|
||||||
"item.minecraft.potion.effect.no_leash": "No Leash Potion",
|
"item.minecraft.potion.effect.no_leash": "No Leash Potion",
|
||||||
"item.minecraft.splash_potion.effect.no_leash": "Splash No Leash Potion",
|
"item.minecraft.splash_potion.effect.no_leash": "Splash No Leash Potion",
|
||||||
"item.minecraft.tipped_arrow.effect.no_leash": "Arrow of No Leash",
|
"item.minecraft.tipped_arrow.effect.no_leash": "Arrow of No Leash",
|
||||||
|
"item.tipped_leash_rope_arrow.name": "Tipped Leash Rope Arrow Soaked By %1$s",
|
||||||
"jukebox_song.leashedplayer.what_does_the_fox_say": "What does the fox say?",
|
"jukebox_song.leashedplayer.what_does_the_fox_say": "What does the fox say?",
|
||||||
"leashedplayer.chat.none_heard_you": "Nobody heard your message",
|
"leashedplayer.chat.none_heard_you": "Nobody heard your message",
|
||||||
"leashedplayer.command.chat.message.talkarea.current_config": "%s 's §6TalkArea Current§7:§e %d §6blocks §f(§aPrefence§7:§e %d §ablocks§f)§r",
|
"leashedplayer.command.chat.message.talkarea.current_config": "%s 's §6TalkArea Current§7:§e %d §6blocks §f(§aPrefence§7:§e %d §ablocks§f)§r",
|
||||||
|
|
@ -68,6 +71,7 @@
|
||||||
"leashedplayer.command.motion.message.adder.successful": "§bAdd Successfully.§a%s§7:§f[§eVec§7: §a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
"leashedplayer.command.motion.message.adder.successful": "§bAdd Successfully.§a%s§7:§f[§eVec§7: §a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
||||||
"leashedplayer.command.motion.message.multiply.successful": "§bMultiply Successfully.§a%s§7:§f[§eVec§7: §a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
"leashedplayer.command.motion.message.multiply.successful": "§bMultiply Successfully.§a%s§7:§f[§eVec§7: §a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
||||||
"leashedplayer.command.motion.message.setter.successful": "§bSet Successfully.§a%s§7:§f[§eVec§7: §a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
"leashedplayer.command.motion.message.setter.successful": "§bSet Successfully.§a%s§7:§f[§eVec§7: §a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
||||||
|
"leashedplayer.lead_breaker.item.desc": "can break the link of leash",
|
||||||
"painting.leashedplayer.group_photo.author": "§9Leisure §4Time §eDock§r",
|
"painting.leashedplayer.group_photo.author": "§9Leisure §4Time §eDock§r",
|
||||||
"painting.leashedplayer.group_photo.title": "§dGroup Photo §7[§6memorable§7]§r",
|
"painting.leashedplayer.group_photo.title": "§dGroup Photo §7[§6memorable§7]§r",
|
||||||
"sound.leashedplayer.subtitle.what_does_the_fox_say": "Great Chu will rise again! Chen She will be king!"
|
"sound.leashedplayer.subtitle.what_does_the_fox_say": "Great Chu will rise again! Chen She will be king!"
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
"advancement.leashedplayer.leashed_self.desc": "用拴绳拴住自己",
|
"advancement.leashedplayer.leashed_self.desc": "用拴绳拴住自己",
|
||||||
"advancement.leashedplayer.no_leash": "勿拴我",
|
"advancement.leashedplayer.no_leash": "勿拴我",
|
||||||
"advancement.leashedplayer.no_leash.desc": "你不会被任何东西拴住",
|
"advancement.leashedplayer.no_leash.desc": "你不会被任何东西拴住",
|
||||||
|
"advancement.leashedplayer.tipped_leash_arrow": "神说要有更多箭矢",
|
||||||
|
"advancement.leashedplayer.tipped_leash_arrow.desc": "真是琳琅满目啊",
|
||||||
"creativetab.leashedplayer.leashedplayer_tab": "可拴玩家",
|
"creativetab.leashedplayer.leashedplayer_tab": "可拴玩家",
|
||||||
"effect.leashedplayer.no_leash": "禁拴",
|
"effect.leashedplayer.no_leash": "禁拴",
|
||||||
"entity.leashedplayer.kid_player": "小孩",
|
"entity.leashedplayer.kid_player": "小孩",
|
||||||
|
|
@ -41,6 +43,7 @@
|
||||||
"item.minecraft.potion.effect.no_leash": "禁拴药水",
|
"item.minecraft.potion.effect.no_leash": "禁拴药水",
|
||||||
"item.minecraft.splash_potion.effect.no_leash": "喷溅型禁拴药水",
|
"item.minecraft.splash_potion.effect.no_leash": "喷溅型禁拴药水",
|
||||||
"item.minecraft.tipped_arrow.effect.no_leash": "禁拴之箭",
|
"item.minecraft.tipped_arrow.effect.no_leash": "禁拴之箭",
|
||||||
|
"item.tipped_leash_rope_arrow.name": "用%1$s浸泡过的拴绳箭",
|
||||||
"jukebox_song.leashedplayer.what_does_the_fox_say": "狐狸是怎么叫的?",
|
"jukebox_song.leashedplayer.what_does_the_fox_say": "狐狸是怎么叫的?",
|
||||||
"leashedplayer.chat.none_heard_you": "沒有人接收到你的消息",
|
"leashedplayer.chat.none_heard_you": "沒有人接收到你的消息",
|
||||||
"leashedplayer.command.chat.message.talkarea.current_config": "%s§6目前聊天区域可见半径设置§7:§e %d §6格 §f(§a默认值§7:§e %d §a格§f)§r",
|
"leashedplayer.command.chat.message.talkarea.current_config": "%s§6目前聊天区域可见半径设置§7:§e %d §6格 §f(§a默认值§7:§e %d §a格§f)§r",
|
||||||
|
|
@ -68,6 +71,7 @@
|
||||||
"leashedplayer.command.motion.message.adder.successful": "§b添加成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
"leashedplayer.command.motion.message.adder.successful": "§b添加成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
||||||
"leashedplayer.command.motion.message.multiply.successful": "§b倍乘成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
"leashedplayer.command.motion.message.multiply.successful": "§b倍乘成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
||||||
"leashedplayer.command.motion.message.setter.successful": "§b设置成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
"leashedplayer.command.motion.message.setter.successful": "§b设置成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
||||||
|
"leashedplayer.lead_breaker.item.desc": "可以破坏拴绳链接",
|
||||||
"painting.leashedplayer.group_photo.author": "§9闲趣§4时§e坞§r",
|
"painting.leashedplayer.group_photo.author": "§9闲趣§4时§e坞§r",
|
||||||
"painting.leashedplayer.group_photo.title": "§d集体照 §7[§6纪念§7]§r",
|
"painting.leashedplayer.group_photo.title": "§d集体照 §7[§6纪念§7]§r",
|
||||||
"sound.leashedplayer.subtitle.what_does_the_fox_say": "大楚兴~ 陈胜王~~"
|
"sound.leashedplayer.subtitle.what_does_the_fox_say": "大楚兴~ 陈胜王~~"
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
"advancement.leashedplayer.leashed_self.desc": "用栓繩拴住自己",
|
"advancement.leashedplayer.leashed_self.desc": "用栓繩拴住自己",
|
||||||
"advancement.leashedplayer.no_leash": "請恁勿拴唔",
|
"advancement.leashedplayer.no_leash": "請恁勿拴唔",
|
||||||
"advancement.leashedplayer.no_leash.desc": "恁不會被任何拴住",
|
"advancement.leashedplayer.no_leash.desc": "恁不會被任何拴住",
|
||||||
|
"advancement.leashedplayer.tipped_leash_arrow": "神說要有更多箭矢",
|
||||||
|
"advancement.leashedplayer.tipped_leash_arrow.desc": "真是琳琅滿目啊",
|
||||||
"creativetab.leashedplayer.leashedplayer_tab": "可拴玩家",
|
"creativetab.leashedplayer.leashedplayer_tab": "可拴玩家",
|
||||||
"effect.leashedplayer.no_leash": "禁拴",
|
"effect.leashedplayer.no_leash": "禁拴",
|
||||||
"entity.leashedplayer.kid_player": "小孩",
|
"entity.leashedplayer.kid_player": "小孩",
|
||||||
|
|
@ -41,6 +43,7 @@
|
||||||
"item.minecraft.potion.effect.no_leash": "禁拴藥水",
|
"item.minecraft.potion.effect.no_leash": "禁拴藥水",
|
||||||
"item.minecraft.splash_potion.effect.no_leash": "噴濺型禁拴藥水",
|
"item.minecraft.splash_potion.effect.no_leash": "噴濺型禁拴藥水",
|
||||||
"item.minecraft.tipped_arrow.effect.no_leash": "禁拴之箭",
|
"item.minecraft.tipped_arrow.effect.no_leash": "禁拴之箭",
|
||||||
|
"item.tipped_leash_rope_arrow.name": "蘸有%1$s的拴繩箭",
|
||||||
"jukebox_song.leashedplayer.what_does_the_fox_say": "狐狸是怎麽叫的?",
|
"jukebox_song.leashedplayer.what_does_the_fox_say": "狐狸是怎麽叫的?",
|
||||||
"leashedplayer.chat.none_heard_you": "無人接收到你的訊息",
|
"leashedplayer.chat.none_heard_you": "無人接收到你的訊息",
|
||||||
"leashedplayer.command.chat.message.talkarea.current_config": "%s§6目前可見訊息聊天半徑設置§7:§e%d §6格 §f(§a默認值§7:§e%d §a格§f)§r",
|
"leashedplayer.command.chat.message.talkarea.current_config": "%s§6目前可見訊息聊天半徑設置§7:§e%d §6格 §f(§a默認值§7:§e%d §a格§f)§r",
|
||||||
|
|
@ -68,6 +71,7 @@
|
||||||
"leashedplayer.command.motion.message.adder.successful": "§b添加成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
"leashedplayer.command.motion.message.adder.successful": "§b添加成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
||||||
"leashedplayer.command.motion.message.multiply.successful": "§b倍乘成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
"leashedplayer.command.motion.message.multiply.successful": "§b倍乘成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
||||||
"leashedplayer.command.motion.message.setter.successful": "§b設置成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
"leashedplayer.command.motion.message.setter.successful": "§b設置成功.§a%s§7:§f[§e加速度§7:§a(§f%f§7,§f%f§7,§f%f§a)§f]§r",
|
||||||
|
"leashedplayer.lead_breaker.item.desc": "可以破壞拴繩鏈接",
|
||||||
"painting.leashedplayer.group_photo.author": "§9閑趣§4時§e塢§r",
|
"painting.leashedplayer.group_photo.author": "§9閑趣§4時§e塢§r",
|
||||||
"painting.leashedplayer.group_photo.title": "§d集體照 §7[§6紀念§7]§r",
|
"painting.leashedplayer.group_photo.title": "§d集體照 §7[§6紀念§7]§r",
|
||||||
"sound.leashedplayer.subtitle.what_does_the_fox_say": "大楚興~ 陳勝王~~"
|
"sound.leashedplayer.subtitle.what_does_the_fox_say": "大楚興~ 陳勝王~~"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "minecraft:item/tipped_arrow_head",
|
||||||
|
"layer1": "leashedplayer:item/tipped_leash_rope_arrow_base"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"parent": "leashedplayer:leash_arrow",
|
||||||
|
"criteria": {
|
||||||
|
"has_tipped_leash_arrow": {
|
||||||
|
"conditions": {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"items": "leashedplayer:amethyst_shears"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"trigger": "minecraft:inventory_changed"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"display": {
|
||||||
|
"description": {
|
||||||
|
"translate": "advancement.leashedplayer.tipped_leash_arrow.desc"
|
||||||
|
},
|
||||||
|
"frame": "goal",
|
||||||
|
"hidden": true,
|
||||||
|
"icon": {
|
||||||
|
"count": 1,
|
||||||
|
"id": "leashedplayer:tipped_leash_rope_arrow"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"translate": "advancement.leashedplayer.tipped_leash_arrow"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"requirements": [
|
||||||
|
[
|
||||||
|
"has_tipped_leash_arrow"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"sends_telemetry_event": true
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:tipped_leash_rope_arrow_recipe",
|
||||||
|
"category": "misc"
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"values": [
|
"values": [
|
||||||
"leashedplayer:leash_rope_arrow",
|
"leashedplayer:leash_rope_arrow",
|
||||||
"leashedplayer:spectral_leash_rope_arrow"
|
"leashedplayer:spectral_leash_rope_arrow",
|
||||||
|
"leashedplayer:tipped_leash_rope_arrow"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -9,13 +9,16 @@ import com.r3944realms.leashedplayer.content.items.type.ILeashRopeArrow;
|
||||||
import net.minecraft.client.renderer.item.ItemProperties;
|
import net.minecraft.client.renderer.item.ItemProperties;
|
||||||
import net.minecraft.core.component.DataComponents;
|
import net.minecraft.core.component.DataComponents;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.FastColor;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.item.alchemy.PotionContents;
|
||||||
import net.minecraft.world.item.component.ChargedProjectiles;
|
import net.minecraft.world.item.component.ChargedProjectiles;
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
|
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
|
||||||
|
import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent;
|
||||||
|
|
||||||
@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD, modid = LeashedPlayer.MOD_ID)
|
@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD, modid = LeashedPlayer.MOD_ID)
|
||||||
public class ClientEventHandler {
|
public class ClientEventHandler {
|
||||||
|
|
@ -35,10 +38,19 @@ public class ClientEventHandler {
|
||||||
|
|
||||||
}
|
}
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void RegisterRenderer(EntityRenderersEvent.RegisterRenderers event) {
|
public static void onRegisterRenderer(EntityRenderersEvent.RegisterRenderers event) {
|
||||||
event.registerEntityRenderer(ModEntityRegister.LEASH_ROPE_ARROW.get(), LeashRopeArrowRenderer::new);
|
event.registerEntityRenderer(ModEntityRegister.LEASH_ROPE_ARROW.get(), LeashRopeArrowRenderer::new);
|
||||||
event.registerEntityRenderer(ModEntityRegister.SPECTRAL_LEASH_ROPE_ARROW.get(), SpectralLeashRopeArrowRenderer::new);
|
event.registerEntityRenderer(ModEntityRegister.SPECTRAL_LEASH_ROPE_ARROW.get(), SpectralLeashRopeArrowRenderer::new);
|
||||||
event.registerEntityRenderer(ModEntityRegister.KID.get(), KidPlayerRenderer::create);
|
event.registerEntityRenderer(ModEntityRegister.KID.get(), KidPlayerRenderer::create);
|
||||||
}
|
}
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onRegisterItemColorHandlers(RegisterColorHandlersEvent.Item event) {
|
||||||
|
event.register(
|
||||||
|
(color, i) -> i > 0
|
||||||
|
? -1
|
||||||
|
: FastColor.ARGB32.opaque(color.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getColor()),
|
||||||
|
ModItemRegister.TIPPED_LEASH_ROPE_ARROW.get()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,12 @@ import com.r3944realms.leashedplayer.content.entities.LeashRopeArrow;
|
||||||
import com.r3944realms.leashedplayer.content.entities.LittlePlayer;
|
import com.r3944realms.leashedplayer.content.entities.LittlePlayer;
|
||||||
import com.r3944realms.leashedplayer.content.entities.ModEntityRegister;
|
import com.r3944realms.leashedplayer.content.entities.ModEntityRegister;
|
||||||
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
||||||
|
import com.r3944realms.leashedplayer.content.items.repcipe.ModRecipeSerializer;
|
||||||
|
import com.r3944realms.leashedplayer.content.items.repcipe.TippedLeashRopeArrowRecipe;
|
||||||
import com.r3944realms.leashedplayer.content.misc.LeadBreakItemBehavior;
|
import com.r3944realms.leashedplayer.content.misc.LeadBreakItemBehavior;
|
||||||
import com.r3944realms.leashedplayer.modInterface.PlayerLeashable;
|
import com.r3944realms.leashedplayer.modInterface.PlayerLeashable;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.data.recipes.SpecialRecipeBuilder;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.Leashable;
|
import net.minecraft.world.entity.Leashable;
|
||||||
|
|
@ -21,6 +24,8 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.alchemy.PotionBrewing;
|
import net.minecraft.world.item.alchemy.PotionBrewing;
|
||||||
import net.minecraft.world.item.alchemy.Potions;
|
import net.minecraft.world.item.alchemy.Potions;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer;
|
||||||
import net.minecraft.world.level.block.DispenserBlock;
|
import net.minecraft.world.level.block.DispenserBlock;
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
|
|
@ -29,6 +34,7 @@ import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||||
import net.neoforged.neoforge.event.brewing.RegisterBrewingRecipesEvent;
|
import net.neoforged.neoforge.event.brewing.RegisterBrewingRecipesEvent;
|
||||||
import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent;
|
import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent;
|
||||||
import net.neoforged.neoforge.event.tick.EntityTickEvent;
|
import net.neoforged.neoforge.event.tick.EntityTickEvent;
|
||||||
|
import net.neoforged.neoforge.registries.RegisterEvent;
|
||||||
|
|
||||||
|
|
||||||
public class CommonEventHandler {
|
public class CommonEventHandler {
|
||||||
|
|
@ -55,7 +61,7 @@ public class CommonEventHandler {
|
||||||
}
|
}
|
||||||
if (entity instanceof LivingEntity living) {
|
if (entity instanceof LivingEntity living) {
|
||||||
MobEffectInstance effect = living.getEffect(ModEffectRegister.NO_LEASH_EFFECT);
|
MobEffectInstance effect = living.getEffect(ModEffectRegister.NO_LEASH_EFFECT);
|
||||||
if(effect != null && effect.getDuration() > 0){
|
if(effect != null && effect.getDuration() != 0){
|
||||||
if (entity instanceof PlayerLeashable player) {
|
if (entity instanceof PlayerLeashable player) {
|
||||||
if (player.getLeashHolder() != null) {
|
if (player.getLeashHolder() != null) {
|
||||||
if (player.getLeashHolder() instanceof LeashRopeArrow arrow)
|
if (player.getLeashHolder() instanceof LeashRopeArrow arrow)
|
||||||
|
|
@ -78,13 +84,20 @@ public class CommonEventHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onCommonSetup(FMLCommonSetupEvent event) {
|
public static void onCommonSetup(FMLCommonSetupEvent event) {
|
||||||
DispenserBlock.registerProjectileBehavior(ModItemRegister.LEASH_ROPE_ARROW.get());
|
DispenserBlock.registerProjectileBehavior(ModItemRegister.LEASH_ROPE_ARROW.get());
|
||||||
|
DispenserBlock.registerProjectileBehavior(ModItemRegister.TIPPED_LEASH_ROPE_ARROW.get());
|
||||||
DispenserBlock.registerProjectileBehavior(ModItemRegister.SPECTRAL_LEASH_ROPE_ARROW.get());
|
DispenserBlock.registerProjectileBehavior(ModItemRegister.SPECTRAL_LEASH_ROPE_ARROW.get());
|
||||||
DispenserBlock.registerBehavior(ModItemRegister.AMETHYST_SHEARS.get(), new LeadBreakItemBehavior());
|
DispenserBlock.registerBehavior(ModItemRegister.AMETHYST_SHEARS.get(), new LeadBreakItemBehavior());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onEntityAttributeEvent(EntityAttributeCreationEvent event) {
|
public static void onEntityAttributeEvent(EntityAttributeCreationEvent event) {
|
||||||
event.put(ModEntityRegister.KID.get(), LittlePlayer.createAttributes().build());
|
event.put(ModEntityRegister.KID.get(), LittlePlayer.createAttributes().build());
|
||||||
}
|
}
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onRegisterEvent(RegisterEvent event) {
|
||||||
|
ModRecipeSerializer.TIPPED_LEASH_ROPE_ARROW_RECIPE = RecipeSerializer.register("tipped_leash_rope_arrow_recipe", new SimpleCraftingRecipeSerializer<>(TippedLeashRopeArrowRecipe::new));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,16 @@ import com.r3944realms.leashedplayer.content.gamerules.Server.KeepLeashNotDropTi
|
||||||
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
||||||
import com.r3944realms.leashedplayer.modInterface.ILivingEntityExtension;
|
import com.r3944realms.leashedplayer.modInterface.ILivingEntityExtension;
|
||||||
import com.r3944realms.leashedplayer.modInterface.PlayerLeashable;
|
import com.r3944realms.leashedplayer.modInterface.PlayerLeashable;
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
|
import net.minecraft.core.particles.ColorParticleOption;
|
||||||
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||||
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.sounds.SoundEvent;
|
||||||
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
|
@ -19,8 +27,10 @@ import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||||
|
import net.minecraft.world.entity.projectile.Arrow;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.item.alchemy.PotionContents;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.EntityHitResult;
|
import net.minecraft.world.phys.EntityHitResult;
|
||||||
|
|
@ -28,274 +38,423 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class LeashRopeArrow extends AbstractArrow {
|
public class LeashRopeArrow extends AbstractArrow {
|
||||||
private static final int maxLifeTime = LeashPlayerCommonConfig.TheLeashArrowMaxLifeTime.get();
|
private static final int EXPOSED_POTION_DECAY_TIME = 600;
|
||||||
protected LeashRopeArrow(EntityType<? extends AbstractArrow> entityType,Level pLevel) {
|
private static final int NO_EFFECT_COLOR = -1;
|
||||||
super(entityType, pLevel);
|
private static final EntityDataAccessor<Integer> ID_EFFECT_COLOR = SynchedEntityData.defineId(LeashRopeArrow.class, EntityDataSerializers.INT);
|
||||||
}
|
private static final byte EVENT_POTION_PUFF = 0;
|
||||||
|
private static final int maxLifeTime = LeashPlayerCommonConfig.TheLeashArrowMaxLifeTime.get();
|
||||||
|
protected LeashRopeArrow(EntityType<? extends AbstractArrow> entityType,Level pLevel) {
|
||||||
|
super(entityType, pLevel);
|
||||||
|
|
||||||
public LeashRopeArrow(EntityType<? extends AbstractArrow> entityType, double pX, double pY, double pZ, Level pLevel, ItemStack pPickupItemStack, @Nullable ItemStack pFiredFromWeapon, @Nullable ServerPlayer serverPlayer) {
|
}
|
||||||
super(entityType, pX, pY, pZ, pLevel, pPickupItemStack, pFiredFromWeapon);
|
private PotionContents getPotionContents() {
|
||||||
if(serverPlayer != null && !level().isClientSide) {
|
return this.getPickupItemStackOrigin().getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY);
|
||||||
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity(serverPlayer, (ServerLevel) level());
|
}
|
||||||
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
|
||||||
leashRopeArrow.setOwner(null);
|
public void addEffect(MobEffectInstance pEffectInstance) {
|
||||||
}
|
this.setPotionContents(this.getPotionContents().withEffectAdded(pEffectInstance));
|
||||||
((PlayerLeashable)serverPlayer).setLeashedTo(this, true);
|
}
|
||||||
|
|
||||||
|
private void setPotionContents(PotionContents pPotionContents) {
|
||||||
|
this.getPickupItemStackOrigin().set(DataComponents.POTION_CONTENTS, pPotionContents);
|
||||||
|
this.updateColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateColor() {
|
||||||
|
PotionContents potioncontents = this.getPotionContents();
|
||||||
|
this.entityData.set(ID_EFFECT_COLOR, potioncontents.equals(PotionContents.EMPTY) ? -1 : potioncontents.getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void defineSynchedData(SynchedEntityData.Builder pBuilder) {
|
||||||
|
super.defineSynchedData(pBuilder);
|
||||||
|
pBuilder.define(ID_EFFECT_COLOR, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setPickupItemStack(@NotNull ItemStack pPickupItemStack) {
|
||||||
|
super.setPickupItemStack(pPickupItemStack);
|
||||||
|
this.updateColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LeashRopeArrow(EntityType<? extends AbstractArrow> entityType, double pX, double pY, double pZ, Level pLevel, ItemStack pPickupItemStack, @Nullable ItemStack pFiredFromWeapon, @Nullable ServerPlayer serverPlayer) {
|
||||||
|
super(entityType, pX, pY, pZ, pLevel, pPickupItemStack, pFiredFromWeapon);
|
||||||
|
this.updateColor();
|
||||||
|
if(serverPlayer != null && !level().isClientSide) {
|
||||||
|
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity(serverPlayer, (ServerLevel) level());
|
||||||
|
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
||||||
|
leashRopeArrow.setOwner(null);
|
||||||
}
|
}
|
||||||
|
((PlayerLeashable)serverPlayer).setLeashedTo(this, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public LeashRopeArrow(EntityType<? extends AbstractArrow> entityType, LivingEntity pOwner, Level pLevel, ItemStack pPickupItemStack, @Nullable ItemStack pFiredFromWeapon) {
|
public LeashRopeArrow(EntityType<? extends AbstractArrow> entityType, LivingEntity pOwner, Level pLevel, ItemStack pPickupItemStack, @Nullable ItemStack pFiredFromWeapon) {
|
||||||
super(entityType, pOwner, pLevel, pPickupItemStack, pFiredFromWeapon);
|
super(entityType, pOwner, pLevel, pPickupItemStack, pFiredFromWeapon);
|
||||||
if(pOwner instanceof PlayerLeashable lPlayer && !level().isClientSide) {
|
this.updateColor();
|
||||||
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity((ServerPlayer) lPlayer, (ServerLevel) level());
|
if(pOwner instanceof PlayerLeashable lPlayer && !level().isClientSide) {
|
||||||
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity((ServerPlayer) lPlayer, (ServerLevel) level());
|
||||||
leashRopeArrow.setOwner(null);
|
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
||||||
}
|
leashRopeArrow.setOwner(null);
|
||||||
lPlayer.setLeashedTo(this, true);
|
|
||||||
}
|
}
|
||||||
|
lPlayer.setLeashedTo(this, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected @NotNull ItemStack getDefaultPickupItem() {
|
protected @NotNull ItemStack getDefaultPickupItem() {
|
||||||
return ModItemRegister.LEASH_ROPE_ARROW.get().getDefaultInstance();
|
return new ItemStack(ModItemRegister.LEASH_ROPE_ARROW.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOwner(@Nullable Entity pEntity) {
|
||||||
|
boolean isNull = pEntity == null;
|
||||||
|
this.ownerUUID = isNull ? null : pEntity.getUUID();
|
||||||
|
this.cachedOwner = isNull ? null : pEntity;
|
||||||
|
this.pickup = this.pickup == Pickup.CREATIVE_ONLY ? this.pickup : Pickup.DISALLOWED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean tryPickup(@NotNull Player pPlayer) {
|
||||||
|
//时间1.40 禁止
|
||||||
|
//时间2.240
|
||||||
|
// 如果(非仅创造拾取)
|
||||||
|
// 如果 (按Shift )
|
||||||
|
// 如果(拥有者) -> 拾取到完整箭,取消绑定(super给父类处理)
|
||||||
|
// 否则:时间仍为原需时间 ->不能获取完整的箭,重绑定(当前拥有者的Holder是否为本箭,“是”才重绑定)
|
||||||
|
// 否则: 禁止
|
||||||
|
// 否则:
|
||||||
|
// 如果 (按Shift )
|
||||||
|
// 如果(拥有者) -> 且拾取到完整箭,取消绑定
|
||||||
|
// 否则:时间仍为原需时间 ->不能获取完整的箭,重绑定
|
||||||
|
// 否则: 禁止
|
||||||
|
//时间3
|
||||||
|
// 如果(拥有者) -> 拾取到完整箭,取消绑定
|
||||||
|
// 否则:不能获取完整的箭,重绑定
|
||||||
|
|
||||||
|
if(life <= 40 ) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
@Override
|
PlayerLeashable playerLeashable = (PlayerLeashable) pPlayer;
|
||||||
public void setOwner(@Nullable Entity pEntity) {
|
if(this.getOwner() == null) {//未有Owner始终可检
|
||||||
// super.setOwner(pEntity);
|
return true;
|
||||||
boolean isNull = pEntity == null;
|
|
||||||
this.ownerUUID = isNull ? null : pEntity.getUUID();
|
|
||||||
this.cachedOwner = isNull ? null : pEntity;
|
|
||||||
this.pickup = this.pickup == Pickup.CREATIVE_ONLY ? this.pickup : Pickup.DISALLOWED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean tryPickup(@NotNull Player pPlayer) {
|
|
||||||
//时间1.40 禁止
|
|
||||||
//时间2.240
|
|
||||||
// 如果(非仅创造拾取)
|
|
||||||
// 如果 (按Shift )
|
|
||||||
// 如果(拥有者) -> 拾取到完整箭,取消绑定(super给父类处理)
|
|
||||||
// 否则:时间仍为原需时间 ->不能获取完整的箭,重绑定(当前拥有者的Holder是否为本箭,“是”才重绑定)
|
|
||||||
// 否则: 禁止
|
|
||||||
// 否则:
|
|
||||||
// 如果 (按Shift )
|
|
||||||
// 如果(拥有者) -> 且拾取到完整箭,取消绑定
|
|
||||||
// 否则:时间仍为原需时间 ->不能获取完整的箭,重绑定
|
|
||||||
// 否则: 禁止
|
|
||||||
//时间3
|
|
||||||
// 如果(拥有者) -> 拾取到完整箭,取消绑定
|
|
||||||
// 否则:不能获取完整的箭,重绑定
|
|
||||||
|
|
||||||
if(life <= 40 ) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else {
|
if(life <= 240) {
|
||||||
PlayerLeashable playerLeashable = (PlayerLeashable) pPlayer;
|
if(pPlayer.isShiftKeyDown()) {
|
||||||
if(this.getOwner() == null) {//未有Owner始终可检
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(life <= 240) {
|
|
||||||
if(pPlayer.isShiftKeyDown()) {
|
|
||||||
Entity leashDataEntity = this.getOwner() instanceof PlayerLeashable ? PlayerLeashable.getLeashDataEntity((ServerPlayer) this.getOwner(), (ServerLevel) level()) : this.getOwner();
|
|
||||||
if(this.ownedBy(pPlayer)) {
|
|
||||||
this.pickup = Pickup.ALLOWED;
|
|
||||||
if(this.equals(leashDataEntity)) playerLeashable.dropLeash(true, false);
|
|
||||||
} else {
|
|
||||||
if(life >= 120) {
|
|
||||||
Entity owner = getOwner();
|
|
||||||
if( owner != null ) {
|
|
||||||
// if(this.equals(leashDataEntity)) {
|
|
||||||
if(owner instanceof PlayerLeashable player) {
|
|
||||||
player.setLeashedTo(pPlayer, true);
|
|
||||||
} else if(owner instanceof Leashable leashable) {
|
|
||||||
leashable.setLeashedTo(pPlayer, true);
|
|
||||||
}
|
|
||||||
ItemEntity itemEntity = new ItemEntity(level(), getX(), getY(), getZ(), getOrginalItemStack());
|
|
||||||
level().addFreshEntity(itemEntity);
|
|
||||||
discard();
|
|
||||||
// }
|
|
||||||
} else return true;
|
|
||||||
} else return false;
|
|
||||||
}
|
|
||||||
} else return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Entity leashDataEntity = this.getOwner() instanceof PlayerLeashable ? PlayerLeashable.getLeashDataEntity((ServerPlayer) this.getOwner(), (ServerLevel) level()) : this.getOwner();
|
Entity leashDataEntity = this.getOwner() instanceof PlayerLeashable ? PlayerLeashable.getLeashDataEntity((ServerPlayer) this.getOwner(), (ServerLevel) level()) : this.getOwner();
|
||||||
if(this.ownedBy(pPlayer)) {
|
if(this.ownedBy(pPlayer)) {
|
||||||
this.pickup = Pickup.ALLOWED;
|
this.pickup = Pickup.ALLOWED;
|
||||||
if(this.equals(leashDataEntity)) playerLeashable.dropLeash(true, false);
|
if(this.equals(leashDataEntity)) {
|
||||||
|
pPlayer.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
||||||
|
playerLeashable.dropLeash(true, false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Entity owner = getOwner();
|
if(life >= 120) {
|
||||||
if(owner instanceof PlayerLeashable player) {
|
Entity owner = getOwner();
|
||||||
player.setLeashedTo(pPlayer, true);
|
if( owner != null ) {
|
||||||
} else if(owner instanceof Leashable leashable) {
|
// if(this.equals(leashDataEntity)) {
|
||||||
leashable.setLeashedTo(pPlayer, true);
|
if(owner instanceof PlayerLeashable player) {
|
||||||
}
|
player.setLeashedTo(pPlayer, true);
|
||||||
ItemEntity itemEntity = new ItemEntity(level(), getX(), getY(), getZ(), getOrginalItemStack());
|
pPlayer.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
level().addFreshEntity(itemEntity);
|
} else if(owner instanceof Leashable leashable) {
|
||||||
discard();
|
leashable.setLeashedTo(pPlayer, true);
|
||||||
|
pPlayer.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.tryPickup(pPlayer);
|
|
||||||
}
|
|
||||||
protected void hitOnEntityHandler(Entity pEntity) {
|
|
||||||
//NOOP
|
|
||||||
}
|
|
||||||
protected ItemStack getOrginalItemStack() {
|
|
||||||
return Items.ARROW.getDefaultInstance();
|
|
||||||
}
|
|
||||||
protected ItemStack getSelfItemStack() {
|
|
||||||
return ModItemRegister.LEASH_ROPE_ARROW.get().getDefaultInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void tickDespawn() {
|
|
||||||
this.life++;
|
|
||||||
if (this.life >= maxLifeTime) {
|
|
||||||
ItemEntity leash_rope_arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
|
||||||
this.level().addFreshEntity(leash_rope_arrow);
|
|
||||||
this.discard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onHitBlock(@NotNull BlockHitResult pResult) {
|
|
||||||
if(!level().isClientSide) {
|
|
||||||
if (getOwner() instanceof PlayerLeashable pL) {
|
|
||||||
if (this.level().getBlockState(pResult.getBlockPos()).is(BlockTags.FENCES)) {
|
|
||||||
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity((ServerPlayer) getOwner(), (ServerLevel) level());
|
|
||||||
if(leashDataEntity != null) {
|
|
||||||
pL.dropLeash(true, !(leashDataEntity instanceof LeashRopeArrow));
|
|
||||||
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
|
||||||
leashRopeArrow.setOwner(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Entity leashKnotFence = PlayerLeashable.createLeashKnotFence((ServerLevel) this.level(), pResult.getBlockPos());
|
|
||||||
ILivingEntityExtension pLL = (ILivingEntityExtension) pL;
|
|
||||||
pLL.setKeepLeashTick(GameruleRegistry.getGameruleIntValue(level(), KeepLeashNotDropTime.ID));
|
|
||||||
pL.setLeashedTo(leashKnotFence, true);
|
|
||||||
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
|
||||||
this.level().addFreshEntity(arrow);
|
|
||||||
discard();
|
|
||||||
}
|
|
||||||
} else if(getOwner() instanceof Leashable L) {
|
|
||||||
if (this.level().getBlockState(pResult.getBlockPos()).is(BlockTags.FENCES)) {
|
|
||||||
Entity leashDataEntity = this.getOwner();
|
|
||||||
if(leashDataEntity != null) {
|
|
||||||
L.dropLeash(true, false);
|
|
||||||
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
|
||||||
leashRopeArrow.setOwner(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Entity leashKnotFence = LeashFenceKnotEntity.getOrCreateKnot(this.level(), pResult.getBlockPos());
|
|
||||||
L.setLeashedTo(leashKnotFence, true);
|
|
||||||
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
|
||||||
this.level().addFreshEntity(arrow);
|
|
||||||
discard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.onHitBlock(pResult);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onHitEntity(@NotNull EntityHitResult pResult) {
|
|
||||||
if(!level().isClientSide()){
|
|
||||||
Entity entity = pResult.getEntity();
|
|
||||||
hitOnEntityHandler(entity);
|
|
||||||
if(this.getOwner() instanceof LivingEntity livingEntity ) {
|
|
||||||
MobEffectInstance effect = livingEntity.getEffect(ModEffectRegister.NO_LEASH_EFFECT);
|
|
||||||
if(effect != null && effect.getDuration() > 0) {
|
|
||||||
this.setOwner(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(entity instanceof LivingEntity livingEntity) {
|
|
||||||
if(livingEntity.equals(this.getOwner())) return;
|
|
||||||
if(this.getOwner() == null && livingEntity instanceof PlayerLeashable pL) { //发射器发出或命令生成
|
|
||||||
setOwner(livingEntity);
|
|
||||||
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity((ServerPlayer) getOwner(), (ServerLevel) level());
|
|
||||||
if(leashDataEntity != null) {
|
|
||||||
pL.dropLeash(true, !(leashDataEntity instanceof LeashRopeArrow));
|
|
||||||
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
|
||||||
leashRopeArrow.setOwner(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ILivingEntityExtension pLL = (ILivingEntityExtension) pL;
|
|
||||||
pLL.setKeepLeashTick(GameruleRegistry.getGameruleIntValue(level(), KeepLeashNotDropTime.ID));
|
|
||||||
pL.setLeashedTo(this, true);
|
|
||||||
return;
|
|
||||||
} else if (this.getOwner() instanceof PlayerLeashable pL) {
|
|
||||||
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity((ServerPlayer) getOwner(), (ServerLevel) level());
|
|
||||||
if(leashDataEntity != null) {
|
|
||||||
pL.dropLeash(true, !(leashDataEntity instanceof LeashRopeArrow));
|
|
||||||
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
|
||||||
leashRopeArrow.setOwner(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
|
||||||
ILivingEntityExtension pLL = (ILivingEntityExtension) pL;
|
|
||||||
pLL.setKeepLeashTick(GameruleRegistry.getGameruleIntValue(level(), KeepLeashNotDropTime.ID));
|
|
||||||
pL.setLeashedTo(pResult.getEntity(), true);
|
|
||||||
this.level().addFreshEntity(arrow);
|
|
||||||
discard();
|
|
||||||
} else {
|
|
||||||
if(entity instanceof Leashable leashable) {
|
|
||||||
if (getOwner() == null) {
|
|
||||||
Entity leashDataEntity = leashable.getLeashHolder();
|
|
||||||
if (leashDataEntity != null) {
|
|
||||||
leashable.dropLeash(true, !(leashDataEntity instanceof LeashRopeArrow));
|
|
||||||
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
|
||||||
leashRopeArrow.setOwner(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
leashable.setLeashedTo(this, true);
|
ItemEntity itemEntity = new ItemEntity(level(), getX(), getY(), getZ(), getOrginalItemStack());
|
||||||
this.setOwner(entity);
|
level().addFreshEntity(itemEntity);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(entity instanceof LivingEntity living) {
|
|
||||||
if(this.getOwner() != null && this.getOwner()instanceof Leashable leashable) {
|
|
||||||
leashable.setLeashedTo(living, true);
|
|
||||||
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
|
||||||
this.level().addFreshEntity(arrow);
|
|
||||||
discard();
|
discard();
|
||||||
return;
|
// }
|
||||||
}
|
} else return true;
|
||||||
}
|
} else return false;
|
||||||
ItemEntity lead = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, Items.LEAD.getDefaultInstance());
|
|
||||||
this.level().addFreshEntity(lead);
|
|
||||||
}
|
}
|
||||||
}
|
} else return false;
|
||||||
else if (entity instanceof LeashFenceKnotEntity leashKnotFence) {
|
|
||||||
if (getOwner() instanceof PlayerLeashable pL) {
|
}
|
||||||
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity((ServerPlayer) getOwner(), (ServerLevel) level());
|
else {
|
||||||
if(leashDataEntity != null) {
|
Entity leashDataEntity = this.getOwner() instanceof PlayerLeashable ? PlayerLeashable.getLeashDataEntity((ServerPlayer) this.getOwner(), (ServerLevel) level()) : this.getOwner();
|
||||||
pL.dropLeash(true, true);
|
if(this.ownedBy(pPlayer)) {
|
||||||
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
this.pickup = Pickup.ALLOWED;
|
||||||
leashRopeArrow.setOwner(null);
|
if(this.equals(leashDataEntity)) {
|
||||||
}
|
pPlayer.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
||||||
}
|
playerLeashable.dropLeash(true, false);
|
||||||
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
|
||||||
ILivingEntityExtension pLL = (ILivingEntityExtension) pL;
|
|
||||||
pLL.setKeepLeashTick(GameruleRegistry.getGameruleIntValue(level(), KeepLeashNotDropTime.ID));
|
|
||||||
pL.setLeashedTo(leashKnotFence, true);
|
|
||||||
this.level().addFreshEntity(arrow);
|
|
||||||
discard();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Entity owner = getOwner();
|
||||||
|
if(owner instanceof PlayerLeashable player) {
|
||||||
|
player.setLeashedTo(pPlayer, true);
|
||||||
|
pPlayer.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
|
} else if(owner instanceof Leashable leashable) {
|
||||||
|
leashable.setLeashedTo(pPlayer, true);
|
||||||
|
pPlayer.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
|
}
|
||||||
|
ItemEntity itemEntity = new ItemEntity(level(), getX(), getY(), getZ(), getOrginalItemStack());
|
||||||
|
level().addFreshEntity(itemEntity);
|
||||||
|
discard();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.tryPickup(pPlayer);
|
||||||
|
}
|
||||||
|
protected void hitOnEntityHandler(Entity pEntity) {
|
||||||
|
if(pEntity instanceof LivingEntity pLiving) {
|
||||||
|
super.doPostHurtEffects(pLiving);
|
||||||
|
Entity entity = this.getEffectSource();
|
||||||
|
PotionContents potioncontents = this.getPotionContents();
|
||||||
|
if (potioncontents.potion().isPresent()) {
|
||||||
|
for (MobEffectInstance mobeffectinstance : potioncontents.potion().get().value().getEffects()) {
|
||||||
|
pLiving.addEffect(
|
||||||
|
new MobEffectInstance(
|
||||||
|
mobeffectinstance.getEffect(),
|
||||||
|
Math.max(mobeffectinstance.mapDuration(p_268168_ -> p_268168_ / 8), 1),
|
||||||
|
mobeffectinstance.getAmplifier(),
|
||||||
|
mobeffectinstance.isAmbient(),
|
||||||
|
mobeffectinstance.isVisible()
|
||||||
|
),
|
||||||
|
entity
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (MobEffectInstance effectInstance : potioncontents.customEffects()) {
|
||||||
|
pLiving.addEffect(effectInstance, entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//NOOP
|
||||||
|
}
|
||||||
|
protected ItemStack getOrginalItemStack() {
|
||||||
|
return Items.ARROW.getDefaultInstance();
|
||||||
|
}
|
||||||
|
protected ItemStack getSelfItemStack() {
|
||||||
|
return ModItemRegister.LEASH_ROPE_ARROW.get().getDefaultInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tickDespawn() {
|
||||||
|
this.life++;
|
||||||
|
if (this.life >= maxLifeTime) {
|
||||||
|
ItemEntity leash_rope_arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
||||||
|
this.level().addFreshEntity(leash_rope_arrow);
|
||||||
|
this.discard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
super.tick();
|
||||||
|
if (this.level().isClientSide) {
|
||||||
|
if (this.inGround) {
|
||||||
|
if (this.inGroundTime % 5 == 0) {
|
||||||
|
this.makeParticle(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.makeParticle(2);
|
||||||
|
}
|
||||||
|
} else if (this.inGround && this.inGroundTime != 0 && !this.getPotionContents().equals(PotionContents.EMPTY) && this.inGroundTime >= 600) {
|
||||||
|
this.level().broadcastEntityEvent(this, (byte)0);
|
||||||
|
this.setPickupItemStack(new ItemStack(getSelfItemStack().getItem()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void makeParticle(int pParticleAmount) {
|
||||||
|
int i = this.getColor();
|
||||||
|
if (i != -1 && pParticleAmount > 0) {
|
||||||
|
for (int j = 0; j < pParticleAmount; j++) {
|
||||||
|
this.level()
|
||||||
|
.addParticle(
|
||||||
|
ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, i),
|
||||||
|
this.getRandomX(0.5),
|
||||||
|
this.getRandomY(),
|
||||||
|
this.getRandomZ(0.5),
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColor() {
|
||||||
|
return this.entityData.get(ID_EFFECT_COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onHitBlock(@NotNull BlockHitResult pResult) {
|
||||||
|
if(!level().isClientSide) {
|
||||||
|
if (getOwner() instanceof PlayerLeashable pL) {
|
||||||
|
if (this.level().getBlockState(pResult.getBlockPos()).is(BlockTags.FENCES)) {
|
||||||
|
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity((ServerPlayer) getOwner(), (ServerLevel) level());
|
||||||
|
if(leashDataEntity != null) {
|
||||||
|
pL.dropLeash(true, !(leashDataEntity instanceof LeashRopeArrow));
|
||||||
|
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
||||||
|
leashDataEntity.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
||||||
|
leashRopeArrow.setOwner(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Entity leashKnotFence = PlayerLeashable.createLeashKnotFence((ServerLevel) this.level(), pResult.getBlockPos());
|
||||||
|
ILivingEntityExtension pLL = (ILivingEntityExtension) pL;
|
||||||
|
pLL.setKeepLeashTick(GameruleRegistry.getGameruleIntValue(level(), KeepLeashNotDropTime.ID));
|
||||||
|
pL.setLeashedTo(leashKnotFence, true);
|
||||||
|
leashKnotFence.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
|
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
||||||
|
this.level().addFreshEntity(arrow);
|
||||||
|
discard();
|
||||||
|
}
|
||||||
|
} else if(getOwner() instanceof Leashable L) {
|
||||||
|
if (this.level().getBlockState(pResult.getBlockPos()).is(BlockTags.FENCES)) {
|
||||||
|
Entity leashDataEntity = this.getOwner();
|
||||||
|
if(leashDataEntity != null) {
|
||||||
|
leashDataEntity.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
||||||
|
L.dropLeash(true, false);
|
||||||
|
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
||||||
|
leashRopeArrow.setOwner(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Entity leashKnotFence = LeashFenceKnotEntity.getOrCreateKnot(this.level(), pResult.getBlockPos());
|
||||||
|
L.setLeashedTo(leashKnotFence, true);
|
||||||
|
leashKnotFence.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
|
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
||||||
|
this.level().addFreshEntity(arrow);
|
||||||
|
discard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onHitBlock(pResult);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onHitEntity(@NotNull EntityHitResult pResult) {
|
||||||
|
if(!level().isClientSide()){
|
||||||
|
Entity entity = pResult.getEntity();
|
||||||
|
hitOnEntityHandler(entity);
|
||||||
|
if(this.getOwner() instanceof LivingEntity livingEntity ) {
|
||||||
|
MobEffectInstance effect = livingEntity.getEffect(ModEffectRegister.NO_LEASH_EFFECT);
|
||||||
|
if(effect != null && effect.getDuration() != 0) {
|
||||||
|
livingEntity.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
||||||
|
this.setOwner(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(entity instanceof LivingEntity livingEntity) {
|
||||||
|
if(livingEntity.equals(this.getOwner())) return;
|
||||||
|
if(this.getOwner() == null && livingEntity instanceof PlayerLeashable pL) { //发射器发出或命令生成
|
||||||
|
setOwner(livingEntity);
|
||||||
|
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity((ServerPlayer) getOwner(), (ServerLevel) level());
|
||||||
|
if(leashDataEntity != null) {
|
||||||
|
pL.dropLeash(true, !(leashDataEntity instanceof LeashRopeArrow));
|
||||||
|
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
||||||
|
leashRopeArrow.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
||||||
|
leashRopeArrow.setOwner(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ILivingEntityExtension pLL = (ILivingEntityExtension) pL;
|
||||||
|
pLL.setKeepLeashTick(GameruleRegistry.getGameruleIntValue(level(), KeepLeashNotDropTime.ID));
|
||||||
|
livingEntity.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
|
pL.setLeashedTo(this, true);
|
||||||
|
return;
|
||||||
|
} else if (this.getOwner() instanceof PlayerLeashable pL) {
|
||||||
|
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity((ServerPlayer) getOwner(), (ServerLevel) level());
|
||||||
|
if(leashDataEntity != null) {
|
||||||
|
pL.dropLeash(true, !(leashDataEntity instanceof LeashRopeArrow));
|
||||||
|
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
||||||
|
leashRopeArrow.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
||||||
|
leashRopeArrow.setOwner(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
||||||
|
ILivingEntityExtension pLL = (ILivingEntityExtension) pL;
|
||||||
|
pLL.setKeepLeashTick(GameruleRegistry.getGameruleIntValue(level(), KeepLeashNotDropTime.ID));
|
||||||
|
livingEntity.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
|
pL.setLeashedTo(pResult.getEntity(), true);
|
||||||
|
this.level().addFreshEntity(arrow);
|
||||||
|
discard();
|
||||||
|
} else {
|
||||||
|
if(entity instanceof Leashable leashable) {
|
||||||
|
if (getOwner() == null) {
|
||||||
|
Entity leashDataEntity = leashable.getLeashHolder();
|
||||||
|
if (leashDataEntity != null) {
|
||||||
|
leashable.dropLeash(true, !(leashDataEntity instanceof LeashRopeArrow));
|
||||||
|
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
||||||
|
leashRopeArrow.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
||||||
|
leashRopeArrow.setOwner(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
livingEntity.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
|
leashable.setLeashedTo(this, true);
|
||||||
|
this.setOwner(entity);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(entity instanceof LivingEntity living) {
|
||||||
|
if(this.getOwner() != null && this.getOwner()instanceof Leashable leashable) {
|
||||||
|
livingEntity.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
|
leashable.setLeashedTo(living, true);
|
||||||
|
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
||||||
|
this.level().addFreshEntity(arrow);
|
||||||
|
discard();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
ItemEntity lead = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, Items.LEAD.getDefaultInstance());
|
ItemEntity lead = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, Items.LEAD.getDefaultInstance());
|
||||||
this.level().addFreshEntity(lead);
|
this.level().addFreshEntity(lead);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!level().isClientSide()) super.onHitEntity(pResult);
|
else if (entity instanceof LeashFenceKnotEntity leashKnotFence) {
|
||||||
|
if (getOwner() instanceof PlayerLeashable pL) {
|
||||||
|
Entity leashDataEntity = PlayerLeashable.getLeashDataEntity((ServerPlayer) getOwner(), (ServerLevel) level());
|
||||||
|
if(leashDataEntity != null) {
|
||||||
|
pL.dropLeash(true, true);
|
||||||
|
if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) {
|
||||||
|
leashRopeArrow.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
||||||
|
leashRopeArrow.setOwner(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
||||||
|
ILivingEntityExtension pLL = (ILivingEntityExtension) pL;
|
||||||
|
pLL.setKeepLeashTick(GameruleRegistry.getGameruleIntValue(level(), KeepLeashNotDropTime.ID));
|
||||||
|
leashKnotFence.playSound(SoundEvents.LEASH_KNOT_PLACE, 1, 1);
|
||||||
|
pL.setLeashedTo(leashKnotFence, true);
|
||||||
|
this.level().addFreshEntity(arrow);
|
||||||
|
discard();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ItemEntity lead = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, Items.LEAD.getDefaultInstance());
|
||||||
|
this.level().addFreshEntity(lead);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if(!level().isClientSide()) super.onHitEntity(pResult);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Handles an entity event received from a {@link net.minecraft.network.protocol.game.ClientboundEntityEventPacket}.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void handleEntityEvent(byte pId) {
|
||||||
|
if (pId == 0) {
|
||||||
|
int i = this.getColor();
|
||||||
|
if (i != -1) {
|
||||||
|
float f = (float)(i >> 16 & 0xFF) / 255.0F;
|
||||||
|
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
|
||||||
|
float f2 = (float)(i & 0xFF) / 255.0F;
|
||||||
|
|
||||||
|
for (int j = 0; j < 20; j++) {
|
||||||
|
this.level()
|
||||||
|
.addParticle(
|
||||||
|
ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, f, f1, f2),
|
||||||
|
this.getRandomX(0.5),
|
||||||
|
this.getRandomY(),
|
||||||
|
this.getRandomZ(0.5),
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.handleEntityEvent(pId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ import com.r3944realms.leashedplayer.LeashedPlayer;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.world.flag.FeatureFlagSet;
|
||||||
import net.minecraft.world.item.CreativeModeTab;
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.alchemy.Potion;
|
import net.minecraft.world.item.alchemy.Potion;
|
||||||
import net.minecraft.world.item.alchemy.PotionContents;
|
import net.minecraft.world.item.alchemy.PotionContents;
|
||||||
|
|
@ -46,7 +48,27 @@ public class ModCreativeTab {
|
||||||
.map(p_330083_ -> PotionContents.createItemStack(Items.LINGERING_POTION, p_330083_))
|
.map(p_330083_ -> PotionContents.createItemStack(Items.LINGERING_POTION, p_330083_))
|
||||||
.forEach(pOutput::accept);
|
.forEach(pOutput::accept);
|
||||||
}
|
}
|
||||||
|
pOutput.accept(ModItemRegister.NEOFORGE.get());
|
||||||
|
pParameters.holders()
|
||||||
|
.lookup(Registries.POTION)
|
||||||
|
.ifPresent(
|
||||||
|
pPotions -> generatePotionEffectTypes(
|
||||||
|
pOutput,
|
||||||
|
pPotions,
|
||||||
|
ModItemRegister.TIPPED_LEASH_ROPE_ARROW.get(),
|
||||||
|
CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS,
|
||||||
|
pParameters.enabledFeatures()
|
||||||
|
)
|
||||||
|
);
|
||||||
})).build());
|
})).build());
|
||||||
|
private static void generatePotionEffectTypes(
|
||||||
|
CreativeModeTab.Output pOutput, HolderLookup<Potion> pPotions, Item pItem, CreativeModeTab.TabVisibility pTabVisibility, FeatureFlagSet pRequiredFeatures
|
||||||
|
) {
|
||||||
|
pPotions.listElements()
|
||||||
|
.filter(potionReference -> potionReference.value().isEnabled(pRequiredFeatures))
|
||||||
|
.map(potionReference -> PotionContents.createItemStack(pItem, potionReference))
|
||||||
|
.forEach(itemStack -> pOutput.accept(itemStack, pTabVisibility));
|
||||||
|
}
|
||||||
public static String getCreativeMod(@NotNull String tabs) {
|
public static String getCreativeMod(@NotNull String tabs) {
|
||||||
return LEASHED_PLAYER_TAB_STRING + "." + tabs;
|
return LEASHED_PLAYER_TAB_STRING + "." + tabs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,7 @@ package com.r3944realms.leashedplayer.content.items;
|
||||||
|
|
||||||
import com.r3944realms.leashedplayer.LeashedPlayer;
|
import com.r3944realms.leashedplayer.LeashedPlayer;
|
||||||
import com.r3944realms.leashedplayer.content.entities.ModEntityRegister;
|
import com.r3944realms.leashedplayer.content.entities.ModEntityRegister;
|
||||||
import com.r3944realms.leashedplayer.content.items.type.LeadBreakerItem;
|
import com.r3944realms.leashedplayer.content.items.type.*;
|
||||||
import com.r3944realms.leashedplayer.content.items.type.LeashRopeArrowItem;
|
|
||||||
import com.r3944realms.leashedplayer.content.items.type.SpectralLeashRopeArrowItem;
|
|
||||||
import com.r3944realms.leashedplayer.content.items.type.TestItem;
|
|
||||||
import com.r3944realms.leashedplayer.datagen.provider.attributes.ModJukeboxSongs;
|
import com.r3944realms.leashedplayer.datagen.provider.attributes.ModJukeboxSongs;
|
||||||
import net.minecraft.core.component.DataComponents;
|
import net.minecraft.core.component.DataComponents;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
|
@ -13,6 +10,7 @@ import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.JukeboxSong;
|
import net.minecraft.world.item.JukeboxSong;
|
||||||
import net.minecraft.world.item.Rarity;
|
import net.minecraft.world.item.Rarity;
|
||||||
|
import net.minecraft.world.item.alchemy.PotionContents;
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.neoforged.neoforge.common.DeferredSpawnEggItem;
|
import net.neoforged.neoforge.common.DeferredSpawnEggItem;
|
||||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
|
|
@ -24,21 +22,29 @@ import java.util.function.Supplier;
|
||||||
public class ModItemRegister {
|
public class ModItemRegister {
|
||||||
public static final DeferredRegister<Item> ITEMS =
|
public static final DeferredRegister<Item> ITEMS =
|
||||||
DeferredRegister.create(BuiltInRegistries.ITEM, LeashedPlayer.MOD_ID);
|
DeferredRegister.create(BuiltInRegistries.ITEM, LeashedPlayer.MOD_ID);
|
||||||
|
|
||||||
public static final List<Supplier<Item>> ITEM_SUPPLIER = new ArrayList<>();
|
public static final List<Supplier<Item>> ITEM_SUPPLIER = new ArrayList<>();
|
||||||
|
|
||||||
public static final Supplier<Item> LEASH_ROPE_ARROW = ModItemRegister.register("leash_rope_arrow",
|
public static final Supplier<Item> LEASH_ROPE_ARROW = ModItemRegister.register("leash_rope_arrow",
|
||||||
() -> new LeashRopeArrowItem(new Item.Properties().stacksTo(16))
|
() -> new LeashRopeArrowItem(new Item.Properties().stacksTo(16))
|
||||||
);
|
);
|
||||||
public static final Supplier<Item> SPECTRAL_LEASH_ROPE_ARROW = ModItemRegister.register("spectral_leash_rope_arrow",
|
public static final Supplier<Item> SPECTRAL_LEASH_ROPE_ARROW = ModItemRegister.register("spectral_leash_rope_arrow",
|
||||||
() -> new SpectralLeashRopeArrowItem(new Item.Properties().stacksTo(16)));
|
() -> new SpectralLeashRopeArrowItem(new Item.Properties().stacksTo(16)));
|
||||||
|
|
||||||
public static final Supplier<Item> FABRIC = ModItemRegister.register("fabric",
|
public static final Supplier<Item> TIPPED_LEASH_ROPE_ARROW = ModItemRegister.register("tipped_leash_rope_arrow",
|
||||||
() -> new TestItem(new Item.Properties().stacksTo(1))
|
() -> new TippedLeashRopeArrow(new Item.Properties().stacksTo(16).component(DataComponents.POTION_CONTENTS, PotionContents.EMPTY)));
|
||||||
);
|
|
||||||
public static final Supplier<Item> AMETHYST_SHEARS = ModItemRegister.register("amethyst_shears",
|
public static final Supplier<Item> AMETHYST_SHEARS = ModItemRegister.register("amethyst_shears",
|
||||||
() -> new LeadBreakerItem(new Item.Properties().durability(100).component(DataComponents.TOOL, LeadBreakerItem.createToolProperties())
|
() -> new LeadBreakerItem(new Item.Properties().durability(100).component(DataComponents.TOOL, LeadBreakerItem.createToolProperties())
|
||||||
.stacksTo(1)));
|
.stacksTo(1)));
|
||||||
|
|
||||||
public static final Supplier<Item> KID_SPAWN_EGG = ModItemRegister.register("kid_spawn_egg",
|
public static final Supplier<Item> KID_SPAWN_EGG = ModItemRegister.register("kid_spawn_egg",
|
||||||
() -> new DeferredSpawnEggItem(ModEntityRegister.KID, 0x3F4F1F, 0x3D0D4D, new Item.Properties()));
|
() -> new DeferredSpawnEggItem(ModEntityRegister.KID, 0x3F4F1F, 0x3D0D4D, new Item.Properties()));
|
||||||
|
|
||||||
|
public static final Supplier<Item> FABRIC = ModItemRegister.register("fabric",
|
||||||
|
() -> new TestProcessBarItem(new Item.Properties().stacksTo(1))
|
||||||
|
);
|
||||||
|
|
||||||
public static final Supplier<Item> NEOFORGE = ModItemRegister.register("neoforge",
|
public static final Supplier<Item> NEOFORGE = ModItemRegister.register("neoforge",
|
||||||
() -> new Item(DistProperties(ModJukeboxSongs.FOX_MUSIC)));
|
() -> new Item(DistProperties(ModJukeboxSongs.FOX_MUSIC)));
|
||||||
public static Item.Properties DistProperties(ResourceKey<JukeboxSong> song) {
|
public static Item.Properties DistProperties(ResourceKey<JukeboxSong> song) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.r3944realms.leashedplayer.content.items.repcipe;
|
||||||
|
|
||||||
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
|
|
||||||
|
public abstract class ModRecipeSerializer<T extends Recipe<?>> implements RecipeSerializer<T> {
|
||||||
|
public static RecipeSerializer<TippedLeashRopeArrowRecipe> TIPPED_LEASH_ROPE_ARROW_RECIPE;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.r3944realms.leashedplayer.content.items.repcipe;
|
||||||
|
|
||||||
|
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.item.crafting.*;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class TippedLeashRopeArrowRecipe extends CustomRecipe {
|
||||||
|
public TippedLeashRopeArrowRecipe(CraftingBookCategory pCategory) {
|
||||||
|
super(pCategory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matches(CraftingInput pInput, @NotNull Level pLevel) {
|
||||||
|
if (pInput.width() == 3 && pInput.height() == 3) {
|
||||||
|
for (int i = 0; i < pInput.height(); i++) {
|
||||||
|
for (int j = 0; j < pInput.width(); j++) {
|
||||||
|
ItemStack itemstack = pInput.getItem(j, i);
|
||||||
|
if (itemstack.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j == 1 && i == 1) {
|
||||||
|
if (!itemstack.is(Items.LINGERING_POTION)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (!itemstack.is(ModItemRegister.LEASH_ROPE_ARROW.get())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NotNull ItemStack assemble(CraftingInput pInput, HolderLookup.@NotNull Provider pRegistries) {
|
||||||
|
ItemStack itemstack = pInput.getItem(1, 1);
|
||||||
|
if (!itemstack.is(Items.LINGERING_POTION)) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
} else {
|
||||||
|
ItemStack itemstack1 = new ItemStack(ModItemRegister.TIPPED_LEASH_ROPE_ARROW.get(), 8);
|
||||||
|
itemstack1.set(DataComponents.POTION_CONTENTS, itemstack.get(DataComponents.POTION_CONTENTS));
|
||||||
|
return itemstack1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to determine if this recipe can fit in a grid of the given width/height
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean canCraftInDimensions(int pWidth, int pHeight) {
|
||||||
|
return pWidth >= 3 && pHeight >= 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull RecipeSerializer<?> getSerializer() {
|
||||||
|
return ModRecipeSerializer.TIPPED_LEASH_ROPE_ARROW_RECIPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,8 @@ package com.r3944realms.leashedplayer.content.items.type;
|
||||||
|
|
||||||
import com.r3944realms.leashedplayer.content.entities.LeashRopeArrow;
|
import com.r3944realms.leashedplayer.content.entities.LeashRopeArrow;
|
||||||
import com.r3944realms.leashedplayer.modInterface.PlayerLeashable;
|
import com.r3944realms.leashedplayer.modInterface.PlayerLeashable;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
|
|
@ -11,6 +13,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.ShearsItem;
|
import net.minecraft.world.item.ShearsItem;
|
||||||
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
import net.minecraft.world.item.component.Tool;
|
import net.minecraft.world.item.component.Tool;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
|
@ -19,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class LeadBreakerItem extends ShearsItem {
|
public class LeadBreakerItem extends ShearsItem {
|
||||||
|
public static String HOVER_KEY = "leashedplayer.lead_breaker.item.desc";
|
||||||
public LeadBreakerItem(Properties properties) {
|
public LeadBreakerItem(Properties properties) {
|
||||||
super(properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
@ -41,6 +44,7 @@ public class LeadBreakerItem extends ShearsItem {
|
||||||
if(!entity.level().isClientSide) {
|
if(!entity.level().isClientSide) {
|
||||||
if (entity instanceof PlayerLeashable playerLeashable) {
|
if (entity instanceof PlayerLeashable playerLeashable) {
|
||||||
if (playerLeashable.isLeashed()){
|
if (playerLeashable.isLeashed()){
|
||||||
|
entity.playSound(SoundEvents.SHEEP_SHEAR, 1.0F, 1.0F);
|
||||||
playerLeashable.dropLeash(true, !(playerLeashable.getLeashHolder() instanceof LeashRopeArrow));
|
playerLeashable.dropLeash(true, !(playerLeashable.getLeashHolder() instanceof LeashRopeArrow));
|
||||||
if (playerLeashable.getLeashHolder() instanceof LeashRopeArrow leashRopeArrow) {
|
if (playerLeashable.getLeashHolder() instanceof LeashRopeArrow leashRopeArrow) {
|
||||||
leashRopeArrow.setOwner(null);
|
leashRopeArrow.setOwner(null);
|
||||||
|
|
@ -50,6 +54,7 @@ public class LeadBreakerItem extends ShearsItem {
|
||||||
} else return InteractionResult.PASS;
|
} else return InteractionResult.PASS;
|
||||||
} else if (entity instanceof Leashable leashable) {
|
} else if (entity instanceof Leashable leashable) {
|
||||||
if (leashable.isLeashed()){
|
if (leashable.isLeashed()){
|
||||||
|
entity.playSound(SoundEvents.SHEEP_SHEAR, 1.0F, 1.0F);
|
||||||
leashable.dropLeash(true, !(leashable.getLeashHolder() instanceof LeashRopeArrow));
|
leashable.dropLeash(true, !(leashable.getLeashHolder() instanceof LeashRopeArrow));
|
||||||
if (leashable.getLeashHolder() instanceof LeashRopeArrow leashRopeArrow) {
|
if (leashable.getLeashHolder() instanceof LeashRopeArrow leashRopeArrow) {
|
||||||
leashRopeArrow.setOwner(null);
|
leashRopeArrow.setOwner(null);
|
||||||
|
|
@ -68,6 +73,7 @@ public class LeadBreakerItem extends ShearsItem {
|
||||||
PlayerLeashable playerLeashable = (PlayerLeashable) pPlayer;
|
PlayerLeashable playerLeashable = (PlayerLeashable) pPlayer;
|
||||||
if (playerLeashable.isLeashed()) {
|
if (playerLeashable.isLeashed()) {
|
||||||
if(!(playerLeashable.getLeashHolder() instanceof LeashRopeArrow)) {
|
if(!(playerLeashable.getLeashHolder() instanceof LeashRopeArrow)) {
|
||||||
|
pPlayer.playSound(SoundEvents.SHEEP_SHEAR, 1.0F, 1.0F);
|
||||||
playerLeashable.dropLeash(true, true);
|
playerLeashable.dropLeash(true, true);
|
||||||
pPlayer.getItemInHand(pUsedHand).hurtAndBreak(10, pPlayer, LivingEntity.getSlotForHand(pUsedHand));
|
pPlayer.getItemInHand(pUsedHand).hurtAndBreak(10, pPlayer, LivingEntity.getSlotForHand(pUsedHand));
|
||||||
return InteractionResultHolder.success(pPlayer.getItemInHand(pUsedHand));
|
return InteractionResultHolder.success(pPlayer.getItemInHand(pUsedHand));
|
||||||
|
|
@ -76,4 +82,9 @@ public class LeadBreakerItem extends ShearsItem {
|
||||||
}
|
}
|
||||||
return super.use(pLevel, pPlayer, pUsedHand);
|
return super.use(pLevel, pPlayer, pUsedHand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void appendHoverText(@NotNull ItemStack pStack, @NotNull TooltipContext pContext, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pTooltipFlag) {
|
||||||
|
pTooltipComponents.add(Component.translatable(HOVER_KEY));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public class LeashRopeArrowItem extends ArrowItem implements ILeashRopeArrow{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Projectile asProjectile(@NotNull Level pLevel, @NotNull Position pPos, @NotNull ItemStack pStack, @NotNull Direction pDirection) {
|
public @NotNull Projectile asProjectile(@NotNull Level pLevel, @NotNull Position pPos, @NotNull ItemStack pStack, @NotNull Direction pDirection) {
|
||||||
LeashRopeArrow arrow = new LeashRopeArrow(ModEntityRegister.LEASH_ROPE_ARROW.get(), pPos.x(), pPos.y(), pPos.z(), pLevel, this.getDefaultInstance(),null, null);
|
LeashRopeArrow arrow = new LeashRopeArrow(ModEntityRegister.LEASH_ROPE_ARROW.get(), pPos.x(), pPos.y(), pPos.z(), pLevel, pStack,null, null);
|
||||||
arrow.pickup = AbstractArrow.Pickup.DISALLOWED;
|
arrow.pickup = AbstractArrow.Pickup.DISALLOWED;
|
||||||
return arrow;
|
return arrow;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class TestItem extends Item {
|
public class TestProcessBarItem extends Item {
|
||||||
public TestProcessBar testProcessBar = null;
|
public TestProcessBar testProcessBar = null;
|
||||||
public TestItem(Properties pProperties) {
|
public TestProcessBarItem(Properties pProperties) {
|
||||||
super(pProperties);
|
super(pProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.r3944realms.leashedplayer.content.items.type;
|
||||||
|
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
|
import net.minecraft.world.item.alchemy.Potion;
|
||||||
|
import net.minecraft.world.item.alchemy.PotionContents;
|
||||||
|
import net.minecraft.world.item.alchemy.Potions;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class TippedLeashRopeArrow extends LeashRopeArrowItem {
|
||||||
|
public static final String TIPPED_LEASH_ROPE_ARROW_NAME = "item.tipped_leash_rope_arrow.name";
|
||||||
|
public TippedLeashRopeArrow(Item.Properties pProperties) {
|
||||||
|
super(pProperties);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public @NotNull ItemStack getDefaultInstance() {
|
||||||
|
ItemStack itemstack = super.getDefaultInstance();
|
||||||
|
itemstack.set(DataComponents.POTION_CONTENTS, new PotionContents(Potions.POISON));
|
||||||
|
return itemstack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void appendHoverText(@NotNull ItemStack pStack, Item.@NotNull TooltipContext pContext, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pTooltipFlag) {
|
||||||
|
PotionContents potioncontents = pStack.get(DataComponents.POTION_CONTENTS);
|
||||||
|
if (potioncontents != null) {
|
||||||
|
potioncontents.addPotionTooltip(pTooltipComponents::add, 0.125F, pContext.tickRate());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public @NotNull String getDescriptionId(ItemStack pStack) {
|
||||||
|
// return Potion.getName(pStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(), this.getDescriptionId() + ".effect.");
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Component getName(@NotNull ItemStack pStack) {
|
||||||
|
Optional<Holder<Potion>> pPotion = pStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion();
|
||||||
|
String s = null,s1;
|
||||||
|
if (pPotion.isPresent()) {
|
||||||
|
s = pPotion.get().value().name;
|
||||||
|
}
|
||||||
|
boolean flag = s == null;
|
||||||
|
s1 = pPotion.flatMap(Holder::unwrapKey).map(p_331494_ -> p_331494_.location().getPath()).orElse("empty");
|
||||||
|
String potionTranslateKey = "item.minecraft.potion.effect." + (flag ? s1: s);
|
||||||
|
return Component.translatable(TIPPED_LEASH_ROPE_ARROW_NAME, Component.translatable(potionTranslateKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,7 @@ public enum ModAdvancementKey {
|
||||||
DOG_RUNNING_PLAYER("dog_running_player", LEASH_ARROW),
|
DOG_RUNNING_PLAYER("dog_running_player", LEASH_ARROW),
|
||||||
NO_LEASH("no_leash", LEASH_START),
|
NO_LEASH("no_leash", LEASH_START),
|
||||||
LEASH_TERMINATOR("leash_terminator", LEASH_START),
|
LEASH_TERMINATOR("leash_terminator", LEASH_START),
|
||||||
|
TIPPED_LEASH_ARROW("tipped_leash_arrow", LEASH_ARROW),
|
||||||
;
|
;
|
||||||
private final String Name;
|
private final String Name;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,10 @@ import com.r3944realms.leashedplayer.content.gamerules.Server.KeepLeashNotDropTi
|
||||||
import com.r3944realms.leashedplayer.content.gamerules.Server.TeleportWithLeashedPlayers;
|
import com.r3944realms.leashedplayer.content.gamerules.Server.TeleportWithLeashedPlayers;
|
||||||
import com.r3944realms.leashedplayer.content.items.ModCreativeTab;
|
import com.r3944realms.leashedplayer.content.items.ModCreativeTab;
|
||||||
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
||||||
|
import com.r3944realms.leashedplayer.content.items.type.LeadBreakerItem;
|
||||||
import com.r3944realms.leashedplayer.content.items.type.LeashRopeArrowItem;
|
import com.r3944realms.leashedplayer.content.items.type.LeashRopeArrowItem;
|
||||||
|
import com.r3944realms.leashedplayer.content.items.type.TippedLeashRopeArrow;
|
||||||
|
import com.r3944realms.leashedplayer.content.misc.LeadBreakItemBehavior;
|
||||||
import com.r3944realms.leashedplayer.content.sounds.ModSoundRegister;
|
import com.r3944realms.leashedplayer.content.sounds.ModSoundRegister;
|
||||||
import com.r3944realms.leashedplayer.datagen.provider.attributes.ModPaintingVariants;
|
import com.r3944realms.leashedplayer.datagen.provider.attributes.ModPaintingVariants;
|
||||||
import com.r3944realms.leashedplayer.utils.Enum.LanguageEnum;
|
import com.r3944realms.leashedplayer.utils.Enum.LanguageEnum;
|
||||||
|
|
@ -34,8 +37,10 @@ public enum ModLangKeyValue {
|
||||||
AMETHYST_SHEARS(ModItemRegister.AMETHYST_SHEARS, ModPartEnum.ITEM, "Amethyst Shears", "紫水晶剪刀", "紫水晶剪刀", true),
|
AMETHYST_SHEARS(ModItemRegister.AMETHYST_SHEARS, ModPartEnum.ITEM, "Amethyst Shears", "紫水晶剪刀", "紫水晶剪刀", true),
|
||||||
KID_SPAWN_EGG(ModItemRegister.KID_SPAWN_EGG, ModPartEnum.ITEM, "Kid Spawn Egg", "小孩生成蛋", "小孩生成蛋", false),
|
KID_SPAWN_EGG(ModItemRegister.KID_SPAWN_EGG, ModPartEnum.ITEM, "Kid Spawn Egg", "小孩生成蛋", "小孩生成蛋", false),
|
||||||
NEO_FORGE(ModItemRegister.NEOFORGE, ModPartEnum.ITEM, "NeoForge", "NeoForge", "NeoForge", true),
|
NEO_FORGE(ModItemRegister.NEOFORGE, ModPartEnum.ITEM, "NeoForge", "NeoForge", "NeoForge", true),
|
||||||
|
TIPPED_LEASH_ROPE_ARROW(TippedLeashRopeArrow.TIPPED_LEASH_ROPE_ARROW_NAME, ModPartEnum.ITEM, "Tipped Leash Rope Arrow Soaked By %1$s", "用%1$s浸泡过的拴绳箭", "蘸有%1$s的拴繩箭", false),
|
||||||
//ITEM_DESC
|
//ITEM_DESC
|
||||||
DESC_ITEM_LEASH_ROPE_ARROW(LeashRopeArrowItem.descKey, ModPartEnum.DESCRIPTION, "Arrows with ropes attached?","带有拴绳的箭矢?", "帶有拴繩的箭矢?", false),
|
DESC_ITEM_LEASH_ROPE_ARROW(LeashRopeArrowItem.descKey, ModPartEnum.DESCRIPTION, "Arrows with ropes attached?","带有拴绳的箭矢?", "帶有拴繩的箭矢?", false),
|
||||||
|
DESC_ITEM_LEAD_BREAKER(LeadBreakerItem.HOVER_KEY, ModPartEnum.DESCRIPTION, "can break the link of leash", "可以破坏拴绳链接", "可以破壞拴繩鏈接", false),
|
||||||
//PAINTING
|
//PAINTING
|
||||||
GROUP_PHOTO_TITLE(ModPaintingVariants.getPaintingVariantTitleKey(ModPaintingVariants.GROUP_PHOTO),ModPartEnum.TITLE, "§dGroup Photo §7[§6memorable§7]§r", "§d集体照 §7[§6纪念§7]§r", "§d集體照 §7[§6紀念§7]§r", false),
|
GROUP_PHOTO_TITLE(ModPaintingVariants.getPaintingVariantTitleKey(ModPaintingVariants.GROUP_PHOTO),ModPartEnum.TITLE, "§dGroup Photo §7[§6memorable§7]§r", "§d集体照 §7[§6纪念§7]§r", "§d集體照 §7[§6紀念§7]§r", false),
|
||||||
GROUP_PHOTO_AUTHOR(ModPaintingVariants.getPaintingVariantAuthorKey(ModPaintingVariants.GROUP_PHOTO),ModPartEnum.AUTHOR, "§9Leisure §4Time §eDock§r","§9闲趣§4时§e坞§r","§9閑趣§4時§e塢§r",false),
|
GROUP_PHOTO_AUTHOR(ModPaintingVariants.getPaintingVariantAuthorKey(ModPaintingVariants.GROUP_PHOTO),ModPartEnum.AUTHOR, "§9Leisure §4Time §eDock§r","§9闲趣§4时§e坞§r","§9閑趣§4時§e塢§r",false),
|
||||||
|
|
@ -99,6 +104,7 @@ public enum ModLangKeyValue {
|
||||||
FOLLOW_WOLF(ModAdvancementKey.DOG_RUNNING_PLAYER.getNameKey(), ModPartEnum.NAME, "It's Walking human time.", "遛“人”时间", "遛“人”時間",false),
|
FOLLOW_WOLF(ModAdvancementKey.DOG_RUNNING_PLAYER.getNameKey(), ModPartEnum.NAME, "It's Walking human time.", "遛“人”时间", "遛“人”時間",false),
|
||||||
TERMINATOR(ModAdvancementKey.LEASH_TERMINATOR.getNameKey(), ModPartEnum.NAME, "The Lead Terminator", "拴绳终结者","拴繩終結者", false),
|
TERMINATOR(ModAdvancementKey.LEASH_TERMINATOR.getNameKey(), ModPartEnum.NAME, "The Lead Terminator", "拴绳终结者","拴繩終結者", false),
|
||||||
NO_LEASH(ModAdvancementKey.NO_LEASH.getNameKey(), ModPartEnum.NAME, "Don't tie me up", "勿拴我", "請恁勿拴唔", false),
|
NO_LEASH(ModAdvancementKey.NO_LEASH.getNameKey(), ModPartEnum.NAME, "Don't tie me up", "勿拴我", "請恁勿拴唔", false),
|
||||||
|
TIPPED_LEASH_ARROW(ModAdvancementKey.TIPPED_LEASH_ARROW.getNameKey(), ModPartEnum.NAME, "God said there should be more arrows", "神说要有更多箭矢", "神說要有更多箭矢", false),
|
||||||
//ADV_DESC
|
//ADV_DESC
|
||||||
LEASH_START_DESC(ModAdvancementKey.LEASH_START.getDescKey(), ModPartEnum.DESCRIPTION, "Journey to becoming a Leash Expert", "拴绳大师之路", "拴繩大師之路", false),
|
LEASH_START_DESC(ModAdvancementKey.LEASH_START.getDescKey(), ModPartEnum.DESCRIPTION, "Journey to becoming a Leash Expert", "拴绳大师之路", "拴繩大師之路", false),
|
||||||
LEASH_LR_ARROW_DESC(ModAdvancementKey.LEASH_ARROW.getDescKey(), ModPartEnum.DESCRIPTION, "Maybe you can using it to shoot some mob?", "也许可以用它来发射生物?", "也許可以用它發射生物?", false),
|
LEASH_LR_ARROW_DESC(ModAdvancementKey.LEASH_ARROW.getDescKey(), ModPartEnum.DESCRIPTION, "Maybe you can using it to shoot some mob?", "也许可以用它来发射生物?", "也許可以用它發射生物?", false),
|
||||||
|
|
@ -109,6 +115,7 @@ public enum ModLangKeyValue {
|
||||||
FOLLOW_WOLF_DESC(ModAdvancementKey.DOG_RUNNING_PLAYER.getDescKey(), ModPartEnum.DESCRIPTION, "In the park where dogs are not allowed to be walked, the dog decided to walk the human instead", "公园不能遛狗,于是狗站起来遛人", "公園裏不許遛狗,於是狗站起來遛人",false),
|
FOLLOW_WOLF_DESC(ModAdvancementKey.DOG_RUNNING_PLAYER.getDescKey(), ModPartEnum.DESCRIPTION, "In the park where dogs are not allowed to be walked, the dog decided to walk the human instead", "公园不能遛狗,于是狗站起来遛人", "公園裏不許遛狗,於是狗站起來遛人",false),
|
||||||
NO_LEASH_DESC(ModAdvancementKey.NO_LEASH.getDescKey(), ModPartEnum.NAME, "You cannot be leashed by ANY", "你不会被任何东西拴住", "恁不會被任何拴住", false),
|
NO_LEASH_DESC(ModAdvancementKey.NO_LEASH.getDescKey(), ModPartEnum.NAME, "You cannot be leashed by ANY", "你不会被任何东西拴住", "恁不會被任何拴住", false),
|
||||||
TERMINATOR_DESC(ModAdvancementKey.LEASH_TERMINATOR.getDescKey(), ModPartEnum.DESCRIPTION, "I am Lead Terminator!", "我來终结拴绳者!", "吾將終結拴繩!", false),
|
TERMINATOR_DESC(ModAdvancementKey.LEASH_TERMINATOR.getDescKey(), ModPartEnum.DESCRIPTION, "I am Lead Terminator!", "我來终结拴绳者!", "吾將終結拴繩!", false),
|
||||||
|
TIPPED_LEASH_ARROW_DESC(ModAdvancementKey.TIPPED_LEASH_ARROW.getDescKey(), ModPartEnum.DESCRIPTION, "A dazzling array of Leash Rope arrows", "真是琳琅满目啊", "真是琳琅滿目啊", false),
|
||||||
//MOB_EFFECT
|
//MOB_EFFECT
|
||||||
NO_LEASH_EFFECT(ModEffectRegister.getEffectKey(ModEffectRegister.NO_LEASH_EFFECT.get()), ModPartEnum.NAME, "No Leash", "禁拴", "禁拴", false),
|
NO_LEASH_EFFECT(ModEffectRegister.getEffectKey(ModEffectRegister.NO_LEASH_EFFECT.get()), ModPartEnum.NAME, "No Leash", "禁拴", "禁拴", false),
|
||||||
//POTION
|
//POTION
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,18 @@ public class ModAdvancementGenerator implements AdvancementProvider.AdvancementG
|
||||||
).addCriterion("has_amethyst_shears", InventoryChangeTrigger.TriggerInstance.hasItems(ModItemRegister.AMETHYST_SHEARS.get())
|
).addCriterion("has_amethyst_shears", InventoryChangeTrigger.TriggerInstance.hasItems(ModItemRegister.AMETHYST_SHEARS.get())
|
||||||
).parent(hasLeashRopeItem).save(saver, ModAdvancementKey.LEASH_TERMINATOR.getNameWithNameSpace());
|
).parent(hasLeashRopeItem).save(saver, ModAdvancementKey.LEASH_TERMINATOR.getNameWithNameSpace());
|
||||||
|
|
||||||
|
AdvancementHolder tipped_leash_arrow = Advancement.Builder.advancement().display(
|
||||||
|
ModItemRegister.TIPPED_LEASH_ROPE_ARROW.get(),
|
||||||
|
Component.translatable(ModAdvancementKey.TIPPED_LEASH_ARROW.getNameKey()),
|
||||||
|
Component.translatable(ModAdvancementKey.TIPPED_LEASH_ARROW.getDescKey()),
|
||||||
|
null,
|
||||||
|
AdvancementType.GOAL,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
).addCriterion("has_tipped_leash_arrow", InventoryChangeTrigger.TriggerInstance.hasItems(ModItemRegister.AMETHYST_SHEARS.get())
|
||||||
|
).parent(hasLeashRopeArrow).save(saver, ModAdvancementKey.TIPPED_LEASH_ARROW.getNameWithNameSpace());
|
||||||
|
|
||||||
AdvancementHolder no_leash = Advancement.Builder.advancement().display(
|
AdvancementHolder no_leash = Advancement.Builder.advancement().display(
|
||||||
Items.BARRIER,
|
Items.BARRIER,
|
||||||
Component.translatable(ModAdvancementKey.NO_LEASH.getNameKey()),
|
Component.translatable(ModAdvancementKey.NO_LEASH.getNameKey()),
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,10 @@ public class ModItemModelProvider extends ItemModelProvider {
|
||||||
getBuilder("bow_lra_pulling_2")
|
getBuilder("bow_lra_pulling_2")
|
||||||
.parent(new ModelFile.UncheckedModelFile("item/bow"))
|
.parent(new ModelFile.UncheckedModelFile("item/bow"))
|
||||||
.texture("layer0", ResourceLocation.fromNamespaceAndPath(LeashedPlayer.MOD_ID, "item/bow_lra_pulling_2"));
|
.texture("layer0", ResourceLocation.fromNamespaceAndPath(LeashedPlayer.MOD_ID, "item/bow_lra_pulling_2"));
|
||||||
|
getBuilder("tipped_leash_rope_arrow")
|
||||||
|
.parent(new ModelFile.UncheckedModelFile("item/generated"))
|
||||||
|
.texture("layer0", ResourceLocation.withDefaultNamespace("item/tipped_arrow_head"))
|
||||||
|
.texture("layer1", ResourceLocation.fromNamespaceAndPath(LeashedPlayer.MOD_ID, "item/tipped_leash_rope_arrow_base"));
|
||||||
spawnEgg(ModItemRegister.KID_SPAWN_EGG.get());
|
spawnEgg(ModItemRegister.KID_SPAWN_EGG.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ public class ModItemTagProvider extends ItemTagsProvider {
|
||||||
protected void addTags(HolderLookup.@NotNull Provider pProvider) {
|
protected void addTags(HolderLookup.@NotNull Provider pProvider) {
|
||||||
this.tag(ItemTags.ARROWS)
|
this.tag(ItemTags.ARROWS)
|
||||||
.add(ModItemRegister.LEASH_ROPE_ARROW.get())
|
.add(ModItemRegister.LEASH_ROPE_ARROW.get())
|
||||||
.add(ModItemRegister.SPECTRAL_LEASH_ROPE_ARROW.get());
|
.add(ModItemRegister.SPECTRAL_LEASH_ROPE_ARROW.get())
|
||||||
|
.add(ModItemRegister.TIPPED_LEASH_ROPE_ARROW.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.r3944realms.leashedplayer.datagen.provider;
|
package com.r3944realms.leashedplayer.datagen.provider;
|
||||||
|
|
||||||
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
||||||
|
import com.r3944realms.leashedplayer.content.items.repcipe.TippedLeashRopeArrowRecipe;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.recipes.*;
|
import net.minecraft.data.recipes.*;
|
||||||
|
|
@ -44,6 +45,8 @@ public class ModRecipeProvider extends RecipeProvider {
|
||||||
.define('%', Items.STICK)
|
.define('%', Items.STICK)
|
||||||
.unlockedBy("has_amethyst_shard",has(Items.AMETHYST_SHARD))
|
.unlockedBy("has_amethyst_shard",has(Items.AMETHYST_SHARD))
|
||||||
.save(pRecipeOutput);
|
.save(pRecipeOutput);
|
||||||
|
SpecialRecipeBuilder.special(TippedLeashRopeArrowRecipe::new).save(pRecipeOutput,"tipped_leash_rope_arrow");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ public abstract class MixinPlayer extends LivingEntity implements PlayerLeashabl
|
||||||
float leashLengthSelf = iEntityExtension.getLeashLength();
|
float leashLengthSelf = iEntityExtension.getLeashLength();
|
||||||
leashLength = leashLengthSelf > LeashCommand.MIN_VALUE ? leashLengthSelf : LeashCommand.MIN_VALUE;
|
leashLength = leashLengthSelf > LeashCommand.MIN_VALUE ? leashLengthSelf : LeashCommand.MIN_VALUE;
|
||||||
MobEffectInstance effect = this.getEffect(ModEffectRegister.NO_LEASH_EFFECT);
|
MobEffectInstance effect = this.getEffect(ModEffectRegister.NO_LEASH_EFFECT);
|
||||||
if(effect != null && effect.getDuration() > 0) {
|
if(effect != null && effect.getDuration() != 0) {
|
||||||
if (entity instanceof LeashRopeArrow arrow)
|
if (entity instanceof LeashRopeArrow arrow)
|
||||||
arrow.setOwner(null);
|
arrow.setOwner(null);
|
||||||
this.dropLeash(true, !(entity instanceof LeashRopeArrow));
|
this.dropLeash(true, !(entity instanceof LeashRopeArrow));
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,6 @@ protected net.minecraft.world.entity.projectile.AbstractArrow life # life
|
||||||
public net.minecraft.world.effect.MobEffect <init>(Lnet/minecraft/world/effect/MobEffectCategory;I)V # MobEffect
|
public net.minecraft.world.effect.MobEffect <init>(Lnet/minecraft/world/effect/MobEffectCategory;I)V # MobEffect
|
||||||
#private -> protected
|
#private -> protected
|
||||||
protected net.minecraft.world.entity.projectile.Projectile cachedOwner # cachedOwner
|
protected net.minecraft.world.entity.projectile.Projectile cachedOwner # cachedOwner
|
||||||
protected net.minecraft.world.entity.projectile.Projectile ownerUUID # ownerUUID
|
protected net.minecraft.world.entity.projectile.Projectile ownerUUID # ownerUUID
|
||||||
|
#private -> public
|
||||||
|
public net.minecraft.world.item.alchemy.Potion name # name
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 161 B |
Loading…
Reference in New Issue
Block a user