From c82c92d05d560044fd342ac5ffee2bfd1346fa52 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:01:17 +0800 Subject: [PATCH 1/3] Fix gradle plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由于一些未知原因,gradle的插件下载会在Cotton仓库后停止,即使是在github action上。因此调换一下位置 --- settings.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 1c7b37b6..8acc86d1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,13 +17,14 @@ pluginManagement { url("https://maven.hendrixshen.top") } + gradlePluginPortal() + maven { name("Cotton") url("https://server.bbkr.space/artifactory/libs-release") } mavenCentral() - gradlePluginPortal() } } From 8cbcfbcc8ae41e8d81241d337a28555d5a7dd161 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:02:32 +0800 Subject: [PATCH 2/3] ZombieVillager convert data sync --- .../MixinZombieVillagerEntity.java | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/plusls/MasaGadget/mixin/generic/autoSyncEntityData/MixinZombieVillagerEntity.java b/src/main/java/com/plusls/MasaGadget/mixin/generic/autoSyncEntityData/MixinZombieVillagerEntity.java index a35c63a8..f1a7ac51 100644 --- a/src/main/java/com/plusls/MasaGadget/mixin/generic/autoSyncEntityData/MixinZombieVillagerEntity.java +++ b/src/main/java/com/plusls/MasaGadget/mixin/generic/autoSyncEntityData/MixinZombieVillagerEntity.java @@ -8,6 +8,7 @@ import net.minecraft.world.entity.monster.ZombieVillager; import net.minecraft.world.level.Level; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -15,11 +16,19 @@ @Mixin(ZombieVillager.class) public abstract class MixinZombieVillagerEntity extends Zombie { - public MixinZombieVillagerEntity(EntityType entityType, Level level) { super(entityType, level); } + @Shadow + public abstract boolean isConverting(); + + @Shadow + protected abstract int getConversionProgress(); + + @Shadow + private int villagerConversionTime; + @Inject(method = "handleEntityEvent", at = @At(value = "RETURN")) private void syncVillagerData(byte status, CallbackInfo ci) { if (!Configs.autoSyncEntityData || @@ -32,4 +41,28 @@ private void syncVillagerData(byte status, CallbackInfo ci) { PcaSyncProtocol.cancelSyncEntity(); } } + + @Inject(method = "tick", at = @At(value = "RETURN")) + private void syncConvertingData(CallbackInfo ci) { + //#if MC > 11904 + if (this.level().isClientSide() && this.isAlive() && this.isConverting()) { + //#elseif MC > 11701 + //$$ if (this.getLevel().isClientSide() && this.isAlive() && this.isConverting()) { + //#else + //$$ if (this.level.isClientSide() && this.isAlive() && this.isConverting()) { + //#endif + int i = this.getConversionProgress(); + this.villagerConversionTime -= i; + if (this.villagerConversionTime <= 0) { + // 如果这里为负,应该是没有同步数据 + if (!Configs.autoSyncEntityData || + Minecraft.getInstance().hasSingleplayerServer() || + !PcaSyncProtocol.enable) { + return; + } + PcaSyncProtocol.syncEntity(this.getId()); + PcaSyncProtocol.cancelSyncEntity(); + } + } + } } From 7b00761ba452e6b84391d4832ab9aed0c4de5259 Mon Sep 17 00:00:00 2001 From: Hendrix-Shen Date: Sat, 23 Sep 2023 12:20:34 +0800 Subject: [PATCH 3/3] Fix gradle plugin again Signed-off-by: Hendrix-Shen --- settings.gradle | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/settings.gradle b/settings.gradle index 8acc86d1..5d20f3fc 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,8 @@ pluginManagement { repositories { mavenLocal() + mavenCentral() + gradlePluginPortal() maven { name("Fabric") @@ -17,14 +19,10 @@ pluginManagement { url("https://maven.hendrixshen.top") } - gradlePluginPortal() - maven { name("Cotton") url("https://server.bbkr.space/artifactory/libs-release") } - - mavenCentral() } }