From 0cce76511f51f40a5d86c2278e661e6f1782c78b Mon Sep 17 00:00:00 2001 From: 3944Realms Date: Fri, 25 Oct 2024 16:52:54 +0800 Subject: [PATCH] =?UTF-8?q?2024-10-28=20=E4=BF=AE=E5=A4=8D=E4=BA=86?= =?UTF-8?q?=E6=9C=89=E5=85=B3=E7=AE=AD=E4=B8=8D=E8=83=BD=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84BUG=20=E5=B0=86=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC=E8=B0=83=E9=AB=98=E5=87=8F=E5=B0=91=E6=8B=B4=E7=BB=B3?= =?UTF-8?q?=E6=96=AD=E8=A3=82=E7=9A=84=E5=8F=AF=E8=83=BD=E6=80=A7=202024/1?= =?UTF-8?q?0/28=20Fix=20some=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- gradle.properties | 2 +- settings.gradle | 2 ++ .../content/entities/LeashRopeArrow.java | 33 +++++++++++++++--- .../entity/projectiles/leash_rope_arrow.png | Bin 259 -> 272 bytes 5 files changed, 33 insertions(+), 6 deletions(-) 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 c2a3b372d79c0c8a531deb38bd1b3122ac976473..fac5cf5afefb921ac6dfcf34d49e2d4f4163d7c3 100644 GIT binary patch delta 20 ccmZo>n!q$cg^RH`$lZxy-8q?;6BQo;06z=|IsgCw delta 9 QcmbQh)XX$NWuoDI01qAmZ2$lO