diff --git a/README.md b/README.md index 0e04db7..7b47fd7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 版本 0.0.3.9.4 提前介绍c[最终版本对于0.0.4] 【注意:本解釋簡繁混寫,因爲趕時間,所以並不怎麽規範,請諒解】 +# 版本 0.0.3.9.5 提前介绍c[最终版本对于0.0.4] 【注意:本解釋簡繁混寫,因爲趕時間,所以並不怎麽規範,請諒解】 ## 简介 现在开始你可以用拴绳拴住玩家,也可以拴住自己了,不如尝试拴住彼此来通关我的世界吧( diff --git a/gradle.properties b/gradle.properties index 068bebb..0b4fd3e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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. mod_license=MIT # The mod version. See https://semver.org/ -mod_version=0.0.3.9.4 +mod_version=0.0.3.9.5 # 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. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/settings.gradle b/settings.gradle index ada876e..dea8bfc 100644 --- a/settings.gradle +++ b/settings.gradle @@ -9,3 +9,5 @@ pluginManagement { plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' } +include 'leashedplayer_1_21_3' + diff --git a/src/main/java/com/r3944realms/leashedplayer/content/entities/LeashRopeArrow.java b/src/main/java/com/r3944realms/leashedplayer/content/entities/LeashRopeArrow.java index 2013640..a4796b2 100644 --- a/src/main/java/com/r3944realms/leashedplayer/content/entities/LeashRopeArrow.java +++ b/src/main/java/com/r3944realms/leashedplayer/content/entities/LeashRopeArrow.java @@ -172,6 +172,9 @@ public class LeashRopeArrow extends AbstractArrow { 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; @@ -186,6 +189,9 @@ public class LeashRopeArrow extends AbstractArrow { 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); @@ -215,14 +221,24 @@ public class LeashRopeArrow extends AbstractArrow { 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 != 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 != 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)); @@ -233,8 +249,12 @@ public class LeashRopeArrow extends AbstractArrow { if(entity instanceof Leashable leashable) { if (getOwner() == null) { Entity leashDataEntity = leashable.getLeashHolder(); - if (leashDataEntity != null) + if (leashDataEntity != null) { leashable.dropLeash(true, !(leashDataEntity instanceof LeashRopeArrow)); + if(leashDataEntity instanceof LeashRopeArrow leashRopeArrow) { + leashRopeArrow.setOwner(null); + } + } leashable.setLeashedTo(this, true); this.setOwner(entity); return; @@ -256,7 +276,12 @@ public class LeashRopeArrow extends AbstractArrow { 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 != null) { + pL.dropLeash(true, true); + 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)); diff --git a/src/main/resources/assets/leashedplayer/textures/entity/projectiles/leash_rope_arrow.png b/src/main/resources/assets/leashedplayer/textures/entity/projectiles/leash_rope_arrow.png index c2a3b37..fac5cf5 100644 Binary files a/src/main/resources/assets/leashedplayer/textures/entity/projectiles/leash_rope_arrow.png and b/src/main/resources/assets/leashedplayer/textures/entity/projectiles/leash_rope_arrow.png differ