From c79365588281b6526243b998c78d578dd31cab26 Mon Sep 17 00:00:00 2001 From: F0X Date: Thu, 25 Mar 2021 22:21:11 +0100 Subject: [PATCH] Do not the overwrite --- .../mixin/EnderDragonEntityMixin.java | 20 ++++++++++++++++++ .../mixin/WitherEntityMixin.java | 20 ++++++++++++++++++ .../mixin/client/bossbar/BossBarMixin.java | 16 -------------- .../EnderDragonEntityRendererMixin.java | 21 ------------------- .../bossbar/WitherEntityRendererMixin.java | 21 ------------------- .../resources/abstractmethods.mixins.json | 7 +++---- 6 files changed, 43 insertions(+), 62 deletions(-) create mode 100644 src/main/java/net/legacyfabric/abstractmethods/mixin/EnderDragonEntityMixin.java create mode 100644 src/main/java/net/legacyfabric/abstractmethods/mixin/WitherEntityMixin.java delete mode 100644 src/main/java/net/legacyfabric/mixin/client/bossbar/BossBarMixin.java delete mode 100644 src/main/java/net/legacyfabric/mixin/client/bossbar/EnderDragonEntityRendererMixin.java delete mode 100644 src/main/java/net/legacyfabric/mixin/client/bossbar/WitherEntityRendererMixin.java diff --git a/src/main/java/net/legacyfabric/abstractmethods/mixin/EnderDragonEntityMixin.java b/src/main/java/net/legacyfabric/abstractmethods/mixin/EnderDragonEntityMixin.java new file mode 100644 index 0000000..5ae1cfc --- /dev/null +++ b/src/main/java/net/legacyfabric/abstractmethods/mixin/EnderDragonEntityMixin.java @@ -0,0 +1,20 @@ +package net.legacyfabric.abstractmethods.mixin; + +import net.minecraft.entity.boss.BossBarProvider; +import net.minecraft.entity.boss.dragon.EnderDragonEntity; +import net.minecraft.entity.mob.MobEntity; +import net.minecraft.text.Text; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(EnderDragonEntity.class) +public abstract class EnderDragonEntityMixin extends MobEntity implements BossBarProvider { + public EnderDragonEntityMixin(World world) { + super(world); + } + + @Override + public Text title() { + return getName(); + } +} diff --git a/src/main/java/net/legacyfabric/abstractmethods/mixin/WitherEntityMixin.java b/src/main/java/net/legacyfabric/abstractmethods/mixin/WitherEntityMixin.java new file mode 100644 index 0000000..5d247b3 --- /dev/null +++ b/src/main/java/net/legacyfabric/abstractmethods/mixin/WitherEntityMixin.java @@ -0,0 +1,20 @@ +package net.legacyfabric.abstractmethods.mixin; + +import net.minecraft.entity.boss.BossBarProvider; +import net.minecraft.entity.boss.WitherEntity; +import net.minecraft.entity.mob.HostileEntity; +import net.minecraft.text.Text; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(WitherEntity.class) +public abstract class WitherEntityMixin extends HostileEntity implements BossBarProvider { + public WitherEntityMixin(World world) { + super(world); + } + + @Override + public Text title() { + return getName(); + } +} diff --git a/src/main/java/net/legacyfabric/mixin/client/bossbar/BossBarMixin.java b/src/main/java/net/legacyfabric/mixin/client/bossbar/BossBarMixin.java deleted file mode 100644 index ff159ed..0000000 --- a/src/main/java/net/legacyfabric/mixin/client/bossbar/BossBarMixin.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.legacyfabric.mixin.client.bossbar; - -import net.minecraft.entity.boss.BossBar; -import net.minecraft.entity.boss.BossBarProvider; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - -@Mixin(BossBar.class) -public class BossBarMixin { - /** - * @author blucobalt - * @reason overwrite the method that causes the "abstractmethoderror crash" to do nothing - */ - @Overwrite - public static void update(BossBarProvider provider, boolean bl) {} -} diff --git a/src/main/java/net/legacyfabric/mixin/client/bossbar/EnderDragonEntityRendererMixin.java b/src/main/java/net/legacyfabric/mixin/client/bossbar/EnderDragonEntityRendererMixin.java deleted file mode 100644 index 96c4dc6..0000000 --- a/src/main/java/net/legacyfabric/mixin/client/bossbar/EnderDragonEntityRendererMixin.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.legacyfabric.mixin.client.bossbar; - -import net.minecraft.client.render.entity.EnderDragonEntityRenderer; -import net.minecraft.entity.boss.dragon.EnderDragonEntity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import static net.minecraft.entity.boss.BossBar.*; - -@Mixin(EnderDragonEntityRenderer.class) -public class EnderDragonEntityRendererMixin { - @Inject(method = "render", at = @At("TAIL")) - private void render(EnderDragonEntity dragon, double d, double e, double f, float g, float h, CallbackInfo ci) { - bossHealth = dragon.getHealth() / dragon.getMaxHealth(); - field_4189 = 100; - bossName = dragon.getName().asFormattedString(); - field_4191 = true; - } -} diff --git a/src/main/java/net/legacyfabric/mixin/client/bossbar/WitherEntityRendererMixin.java b/src/main/java/net/legacyfabric/mixin/client/bossbar/WitherEntityRendererMixin.java deleted file mode 100644 index ad2246a..0000000 --- a/src/main/java/net/legacyfabric/mixin/client/bossbar/WitherEntityRendererMixin.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.legacyfabric.mixin.client.bossbar; - -import net.minecraft.client.render.entity.WitherEntityRenderer; -import net.minecraft.entity.boss.WitherEntity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import static net.minecraft.entity.boss.BossBar.*; - -@Mixin(WitherEntityRenderer.class) -public class WitherEntityRendererMixin { - @Inject(method = "render", at = @At("TAIL")) - private void render(WitherEntity wither, double d, double e, double f, float g, float h, CallbackInfo ci) { - bossHealth = wither.getHealth() / wither.getMaxHealth(); - field_4189 = 100; - bossName = wither.getName().asFormattedString(); - field_4191 = true; - } -} diff --git a/src/main/resources/abstractmethods.mixins.json b/src/main/resources/abstractmethods.mixins.json index 75cb908..668ced6 100644 --- a/src/main/resources/abstractmethods.mixins.json +++ b/src/main/resources/abstractmethods.mixins.json @@ -1,13 +1,12 @@ { "required": true, - "package": "net.legacyfabric.mixin", + "package": "net.legacyfabric.abstractmethods.mixin", "compatibilityLevel": "JAVA_8", "injectors": { "defaultRequire": 1 }, "mixins": [ - "client.bossbar.BossBarMixin", - "client.bossbar.EnderDragonEntityRendererMixin", - "client.bossbar.WitherEntityRendererMixin" + "EnderDragonEntityMixin", + "WitherEntityMixin" ] }