Skip to content

Commit 6bb125c

Browse files
committed
Inexorable prevents slowdowns caused by blocks, like sweet berry bushes. Implements #600
1 parent 931f867 commit 6bb125c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/de/dafuqs/spectrum/mixin/PlayerEntityMixin.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import net.minecraft.world.item.enchantment.*;
3636
import net.minecraft.world.level.*;
3737
import net.minecraft.world.level.block.state.*;
38+
import net.minecraft.world.phys.*;
3839
import org.spongepowered.asm.mixin.*;
3940
import org.spongepowered.asm.mixin.injection.*;
4041
import org.spongepowered.asm.mixin.injection.callback.*;
@@ -63,6 +64,14 @@ protected PlayerEntityMixin(EntityType<? extends LivingEntity> entityType, Level
6364
@Unique
6465
public SpectrumFishingBobberEntity fishingBobber;
6566

67+
@Inject(method = "makeStuckInBlock", at = @At("HEAD"), cancellable = true)
68+
public void makeStuckInBlock(BlockState state, Vec3 motionMultiplier, CallbackInfo ci) {
69+
if (InexorableHelper.isArmorActive((Player) (Object) this)) {
70+
ci.cancel();
71+
}
72+
super.makeStuckInBlock(state, motionMultiplier);
73+
}
74+
6675
@WrapOperation(method = "getDestroySpeed", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Inventory;getDestroySpeed(Lnet/minecraft/world/level/block/state/BlockState;)F"))
6776
private float spectrum$modifygetBlockBreakingSpeed(Inventory inventory, BlockState state, Operation<Float> original) {
6877
ItemStack stack = inventory.items.get(inventory.selected);

0 commit comments

Comments
 (0)