Skip to content

Commit

Permalink
Merge pull request #1 from Hendrix-Shen/master
Browse files Browse the repository at this point in the history
rule `shulkerTeleportFix`
  • Loading branch information
FxMorin authored May 21, 2021
2 parents 81b8a8f + 294a191 commit 1e2cf0e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/carpetfixes/CarpetFixesSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public class CarpetFixesSettings {
)
public static boolean targetBlockPermanentlyPoweredFix = true;

//By Hendrix-Shen
@Rule(
desc = "Shulkers do not teleport correctly when going through a portal.",
extra = "Fixed [MC-139265](https://bugs.mojang.com/browse/MC-139265) in 21w03a",
category = {CARPETFIXES,BACKPORT}
)
public static boolean shulkerTeleportFix = false;


/*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package carpetfixes.mixins.entityFixes;

import carpetfixes.CarpetFixesSettings;
import net.minecraft.entity.mob.ShulkerEntity;
import net.minecraft.nbt.CompoundTag;
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;

@Mixin(ShulkerEntity.class)
public class ShulkerEntity_CustomDataMixin {
@Inject(
method = "writeCustomDataToTag",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/mob/ShulkerEntity;getAttachedBlock()Lnet/minecraft/util/math/BlockPos;"
),
cancellable = true
)
private void onWriteCustomDataToTag(CompoundTag tag, CallbackInfo ci) {
if (CarpetFixesSettings.shulkerTeleportFix) {
ci.cancel();
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/carpetfixes.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dupeFixes.PistonBlock_tntDupingFixMixin",
"entityFixes.EndCrystalEntity_ExplosionChainingMixin",
"entityFixes.Entity_blockCollisionMixin",
"entityFixes.ShulkerEntity_CustomDataMixin",
"redstoneFixes.AbstractRedstoneGateBlock_repeaterPriorityMixin",
"redstoneFixes.PistonBlock_doubleRetractionMixin",
"redstoneFixes.World_ComparatorNotUpdatingMixin"
Expand Down

0 comments on commit 1e2cf0e

Please sign in to comment.