-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand Avoid with more features (renamed to Prevent) (#432)
* Expand Avoid with more features * Renamed Avoid to Prevent * Added an option for dragon eggs, and void * Added mixin cancelling particles from spawning when clicking the egg * Fix typo
- Loading branch information
1 parent
84a5f3b
commit f4f99ec
Showing
5 changed files
with
66 additions
and
19 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/main/java/com/lambda/mixin/world/MixinBlockDragonEgg.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.lambda.mixin.world; | ||
|
||
import com.lambda.client.module.modules.movement.Prevent; | ||
import net.minecraft.block.BlockDragonEgg; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
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(BlockDragonEgg.class) | ||
public class MixinBlockDragonEgg { | ||
@Inject(method = "teleport", at = @At("HEAD"), cancellable = true) | ||
public void onTeleport(World worldIn, BlockPos pos, CallbackInfo ci) { | ||
// if prevent is enabled, and the dragon egg setting is toggled, cancel the "teleport" function, so no particles spawn | ||
if (Prevent.INSTANCE.isEnabled() && Prevent.INSTANCE.getDragonEgg()) { | ||
ci.cancel(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
src/main/kotlin/com/lambda/client/module/modules/movement/Avoid.kt
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
src/main/kotlin/com/lambda/client/module/modules/movement/Prevent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.lambda.client.module.modules.movement | ||
|
||
import com.lambda.client.event.events.PacketEvent | ||
import com.lambda.client.module.Category | ||
import com.lambda.client.module.Module | ||
import com.lambda.client.util.threads.safeListener | ||
import net.minecraft.init.Blocks | ||
import net.minecraft.network.play.client.CPacketPlayerDigging | ||
import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock | ||
|
||
object Prevent : Module( | ||
name = "Prevent", | ||
description = "Prevents contact with certain objects", | ||
category = Category.MOVEMENT | ||
) { | ||
val fire by setting("Fire", true, description = "Prevents you from touching fire by making the hitbox solid") | ||
val cactus by setting("Cactus", true, description = "Prevents you from taking cactus damage by slightly expanding its hitbox") | ||
val unloaded by setting("Unloaded Chunks", true, description = "Prevents you from entering unloaded chunks") | ||
val void by setting("Void", true, description = "Prevents you from entering Y levels below zero") | ||
val dragonEgg by setting("Dragon Egg", true, description = "Prevents you from teleporting dragon eggs") | ||
|
||
init { | ||
safeListener<PacketEvent.Send> { | ||
if (dragonEgg) { | ||
when (it.packet) { | ||
is CPacketPlayerTryUseItemOnBlock -> { | ||
if (world.getBlockState(it.packet.pos).block == Blocks.DRAGON_EGG) it.cancel() | ||
} | ||
|
||
is CPacketPlayerDigging -> { | ||
if (world.getBlockState(it.packet.position).block == Blocks.DRAGON_EGG) it.cancel() | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters