From 973d2604cc8aad683cb56b84d6c136cbaf2febd6 Mon Sep 17 00:00:00 2001 From: Alex Thomson Date: Wed, 30 Jan 2019 18:39:43 +1300 Subject: [PATCH] Prefix custom mixin methods to prevent conflicts --- .../mixin/core/entity/MixinEntity_Teleport.java | 6 +++--- .../mixin/forge/entity/MixinEntity_Teleport.java | 4 ++-- .../mixin/forge/entity/passive/MixinEntityVillager.java | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/lxgaming/sledgehammer/mixin/core/entity/MixinEntity_Teleport.java b/src/main/java/io/github/lxgaming/sledgehammer/mixin/core/entity/MixinEntity_Teleport.java index 1109a41..666f5c3 100644 --- a/src/main/java/io/github/lxgaming/sledgehammer/mixin/core/entity/MixinEntity_Teleport.java +++ b/src/main/java/io/github/lxgaming/sledgehammer/mixin/core/entity/MixinEntity_Teleport.java @@ -39,7 +39,7 @@ public abstract class MixinEntity_Teleport { @Inject(method = "setPortal", at = @At(value = "HEAD"), cancellable = true) private void onSetPortal(CallbackInfo callbackInfo) { - if (shouldRemove((IMixinEntity) this)) { + if (sledgehammer$shouldRemove((IMixinEntity) this)) { callbackInfo.cancel(); } } @@ -47,7 +47,7 @@ private void onSetPortal(CallbackInfo callbackInfo) { @Inject(method = "changeDimension(I)Lnet/minecraft/entity/Entity;", at = @At(value = "HEAD")) private void onChangeDimension(int dimension, CallbackInfoReturnable callbackInfoReturnable) { IMixinEntity mixinEntity = (IMixinEntity) this; - if (shouldRemove(mixinEntity)) { + if (sledgehammer$shouldRemove(mixinEntity)) { mixinEntity.remove(); Sledgehammer.getInstance().getConfig().map(Config::getMessageCategory).map(MessageCategory::getItemTeleport).filter(StringUtils::isNotBlank).ifPresent(message -> { @@ -65,7 +65,7 @@ private void onChangeDimension(int dimension, CallbackInfoReturnable cal } } - private boolean shouldRemove(IMixinEntity mixinEntity) { + private boolean sledgehammer$shouldRemove(IMixinEntity mixinEntity) { if (!(mixinEntity instanceof Item || mixinEntity instanceof Minecart) || mixinEntity.isRemoved()) { return false; } diff --git a/src/main/java/io/github/lxgaming/sledgehammer/mixin/forge/entity/MixinEntity_Teleport.java b/src/main/java/io/github/lxgaming/sledgehammer/mixin/forge/entity/MixinEntity_Teleport.java index e406de3..3078578 100644 --- a/src/main/java/io/github/lxgaming/sledgehammer/mixin/forge/entity/MixinEntity_Teleport.java +++ b/src/main/java/io/github/lxgaming/sledgehammer/mixin/forge/entity/MixinEntity_Teleport.java @@ -40,7 +40,7 @@ public abstract class MixinEntity_Teleport { @Inject(method = "changeDimension(ILnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;", at = @At(value = "HEAD"), remap = false) private void onChangeDimension(int dimension, ITeleporter teleporter, CallbackInfoReturnable callbackInfoReturnable) { IMixinEntity mixinEntity = (IMixinEntity) this; - if (shouldRemove(mixinEntity)) { + if (sledgehammer$shouldRemove(mixinEntity)) { mixinEntity.remove(); Sledgehammer.getInstance().getConfig().map(Config::getMessageCategory).map(MessageCategory::getItemTeleport).filter(StringUtils::isNotBlank).ifPresent(message -> { @@ -58,7 +58,7 @@ private void onChangeDimension(int dimension, ITeleporter teleporter, CallbackIn } } - private boolean shouldRemove(IMixinEntity mixinEntity) { + private boolean sledgehammer$shouldRemove(IMixinEntity mixinEntity) { if (!(mixinEntity instanceof Item || mixinEntity instanceof Minecart) || mixinEntity.isRemoved()) { return false; } diff --git a/src/main/java/io/github/lxgaming/sledgehammer/mixin/forge/entity/passive/MixinEntityVillager.java b/src/main/java/io/github/lxgaming/sledgehammer/mixin/forge/entity/passive/MixinEntityVillager.java index de4fe98..a9de61d 100644 --- a/src/main/java/io/github/lxgaming/sledgehammer/mixin/forge/entity/passive/MixinEntityVillager.java +++ b/src/main/java/io/github/lxgaming/sledgehammer/mixin/forge/entity/passive/MixinEntityVillager.java @@ -59,19 +59,19 @@ public MixinEntityVillager(World worldIn, int careerId) { @Inject(method = "populateBuyingList", at = @At(value = "RETURN"), cancellable = true) private void onPopulateBuyingListReturn(CallbackInfo callbackInfo) { if (Sponge.getPluginManager().isLoaded("primitivemobs") && StringUtils.equals(((Entity) this).getType().getId(), "primitivemobs:travelingmerchant")) { - populateTravelingMerchant(); + sledgehammer$populateTravelingMerchant(); } } @Inject(method = "processInteract", at = @At(value = "HEAD"), cancellable = true) private void onProcessInteract(EntityPlayer player, EnumHand hand, CallbackInfoReturnable callbackInfoReturnable) { if (Sponge.getPluginManager().isLoaded("primitivemobs") && StringUtils.equals(((Entity) this).getType().getId(), "primitivemobs:travelingmerchant")) { - populateTravelingMerchant(); + sledgehammer$populateTravelingMerchant(); } } @SuppressWarnings("deprecation") - private void populateTravelingMerchant() { + private void sledgehammer$populateTravelingMerchant() { if (this.buyingList != null && !this.buyingList.isEmpty()) { return; }