fastbreak

This commit is contained in:
Jess H 2024-06-01 02:03:04 +01:00
parent 6e7c2db705
commit 6209ecdc6d
Signed by: UnixSystemV
GPG key ID: 9B21C50B68D67F19
6 changed files with 124 additions and 0 deletions

View file

@ -43,6 +43,7 @@ public class Setup {
new ClickGUI(),
new ElytraFly(),
new ElytraBot(),
new FastBreak(),
new Freecam(),
new Help(),
new HUD(),

View file

@ -0,0 +1,31 @@
package com.baseband.client.event.events;
import com.baseband.client.event.CancellableEvent;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
public class DamageBlockEvent extends CancellableEvent {
private BlockPos blockPos;
private EnumFacing enumFacing;
public DamageBlockEvent(BlockPos blockPos, EnumFacing enumFacing) {
this.blockPos = blockPos;
this.enumFacing = enumFacing;
}
public BlockPos getBlockPos() {
return this.blockPos;
}
public void setBlockPos(BlockPos blockPos) {
this.blockPos = blockPos;
}
public EnumFacing getEnumFacing() {
return this.enumFacing;
}
public void setEnumFacing(EnumFacing enumFacing) {
this.enumFacing = enumFacing;
}
}

View file

@ -0,0 +1,52 @@
package com.baseband.client.feature.world;
import com.baseband.client.event.events.DamageBlockEvent;
import com.baseband.client.feature.Feature;
import com.baseband.client.feature.category.World;
import com.baseband.client.mixins.IPlayerControllerMP;
import com.baseband.client.registry.annotation.Config;
import net.minecraft.network.play.client.CPacketPlayerDigging;
import net.minecraft.util.EnumHand;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@World
public class FastBreak extends Feature {
@Override
public String toString() {
return "FastBreak";
}
@Config("Mode")
Mode mode = Mode.Damage;
enum Mode {
Damage,
Packet
}
@Override
public void onEveryTick() {
//Hot
if (enabled && !notIngame()) {
text = this + "§7 [" + mode.toString() + "]";
} else {
text = toString();
}
}
public void damageBlock(DamageBlockEvent event) {
if (mode == Mode.Packet) {
mc.player.swingArm(EnumHand.MAIN_HAND);
mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, event.getBlockPos(), event.getEnumFacing()));
mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, event.getBlockPos(), event.getEnumFacing()));
event.setCancelled(true);
}
if (mode == Mode.Damage && ((IPlayerControllerMP) mc.playerController).getDamage() >= 0.7f) {
((IPlayerControllerMP) mc.playerController).setDamage(1.0f);
}
}
}

View file

@ -0,0 +1,14 @@
package com.baseband.client.mixins;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(PlayerControllerMP.class)
public interface IPlayerControllerMP {
@Accessor("curBlockDamageMP")
float getDamage();
@Accessor("curBlockDamageMP")
void setDamage(float damage);
}

View file

@ -0,0 +1,24 @@
package com.baseband.client.mixins;
import com.baseband.client.BaseBand;
import com.baseband.client.event.events.DamageBlockEvent;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
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.CallbackInfoReturnable;
@Mixin(PlayerControllerMP.class)
public class MixinPlayerControllerMP {
@Inject(method = { "onPlayerDamageBlock(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z" }, at = { @At("HEAD") }, cancellable = true)
private void onPlayerDamageBlock(final BlockPos posBlock, final EnumFacing directionFacing, final CallbackInfoReturnable<Boolean> callbackInfoReturnable) {
DamageBlockEvent event = new DamageBlockEvent(posBlock, directionFacing);
BaseBand.eventManager.publish(event);
if (event.isCancelled()) {
callbackInfoReturnable.setReturnValue(false);
}
}
}

View file

@ -10,12 +10,14 @@
"IRenderManager",
"ISPacketExplosion",
"ITimer",
"IPlayerControllerMP",
"MixinEntityPlayerSP",
"MixinEntityRender",
"MixinFMLNetworkRegistry",
"MixinGuiEditSign",
"MixinGuiNewChat",
"MixinNetworkManager",
"MixinPlayerControllerMP",
"MixinScreenshotHelper"
]
}