Skip to content

Commit

Permalink
0.10.2 - Minecraft 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayBox committed Jul 6, 2024
1 parent 6f98ab0 commit 63834fc
Show file tree
Hide file tree
Showing 32 changed files with 1,675 additions and 94 deletions.
2 changes: 1 addition & 1 deletion 1.20.1/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ minecraft_version=1.20.1
parchment_version=2023.09.03

# Plugin Properties
plugin_version=0.10.1
plugin_version=0.10.2
maven_group=com.shaybox.rusher
archives_base_name=shays-rusher-plugin
36 changes: 21 additions & 15 deletions 1.20.1/src/main/java/com/shaybox/rusher/modules/AntiCrawl.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ public class AntiCrawl extends ToggleableModule {

/* Minecraft */
private final Minecraft minecraft = Minecraft.getInstance();
private final Level level = this.minecraft.level;
private final LocalPlayer player = this.minecraft.player;
private final MultiPlayerGameMode gameMode = this.minecraft.gameMode;
private final IMixinMultiPlayerGameMode gameModeMixin = (IMixinMultiPlayerGameMode) this.gameMode;

/* Settings */
private final BooleanSetting packetOnly = new BooleanSetting("PacketMine", false);
Expand All @@ -41,47 +37,57 @@ public AntiCrawl() {

@Subscribe
private void onPacket(EventPacket.Receive event) {
if (this.level == null || this.player == null || this.gameMode == null) return;
final Level level = this.minecraft.level;
final LocalPlayer player = this.minecraft.player;
final MultiPlayerGameMode gameMode = this.minecraft.gameMode;
if (level == null || player == null || gameMode == null) return;

final Packet<?> packet = event.getPacket();

// Start breaking the block your head is in if the block your feet are in starts to get mined to keep you from crawling
if (this.pearlPhase.getValue() && packet instanceof ClientboundBlockDestructionPacket destructionPacket) {
final BlockPos playerFeetPos = this.player.blockPosition();
final BlockPos playerFeetPos = player.blockPosition();
final BlockPos playerHeadPos = playerFeetPos.offset(0, 1, 0);
final BlockPos blockPos = destructionPacket.getPos();
final BlockState blockState = this.level.getBlockState(blockPos);
final BlockState blockState = level.getBlockState(blockPos);
final Block block = blockState.getBlock();
if (!blockPos.equals(playerFeetPos) || block.equals(Blocks.AIR)) return;

this.gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
}
}

@Subscribe
private void onPlayerUpdate(EventPlayerUpdate event) {
if (this.level == null || this.player == null || this.gameMode == null) return;
final Level level = this.minecraft.level;
final LocalPlayer player = this.minecraft.player;
final MultiPlayerGameMode gameMode = this.minecraft.gameMode;
final IMixinMultiPlayerGameMode gameModeMixin = (IMixinMultiPlayerGameMode) gameMode;
if (level == null || player == null || gameMode == null) return;

final BlockPos destroyBlockPos = this.gameModeMixin.getDestroyBlockPos();
final BlockPos destroyBlockPos = gameModeMixin.getDestroyBlockPos();
final BlockPos playerFeetPos = player.blockPosition();

// Finish vanilla breaking the block in your head to keep you from crawling
if (this.pearlPhase.getValue() && !this.packetOnly.getValue()) {
final BlockPos playerHeadPos = playerFeetPos.offset(0, 1, 0);
final BlockState blockState = this.level.getBlockState(playerHeadPos);
final BlockState blockState = level.getBlockState(playerHeadPos);
final Block block = blockState.getBlock();

if (destroyBlockPos.equals(playerHeadPos) && !block.equals(Blocks.AIR)) {
this.gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
}
}

// Finish vanilla breaking the block above your head to stop you from crawling
if (this.crawlBreak.getValue() && this.player.isVisuallyCrawling()) {
if (this.crawlBreak.getValue() && player.isVisuallyCrawling()) {
final BlockPos playerHeadPos = playerFeetPos.offset(0, 1, 0);

if (!destroyBlockPos.equals(playerHeadPos)) this.gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
else if (!this.packetOnly.getValue()) this.gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
if (!destroyBlockPos.equals(playerHeadPos)) {
gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
} else if (!this.packetOnly.getValue()) {
gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
import org.rusherhack.client.api.RusherHackAPI;
import org.rusherhack.client.api.events.render.EventRender2D;
import org.rusherhack.client.api.feature.hud.HudElement;
import org.rusherhack.client.api.feature.hud.TextHudElement;
import org.rusherhack.client.api.feature.module.IModule;
import org.rusherhack.client.api.feature.module.ToggleableModule;
import org.rusherhack.client.api.render.IRenderer2D;
import org.rusherhack.client.api.render.font.IFontRenderer;
import org.rusherhack.client.api.system.IHudManager;
import org.rusherhack.client.api.ui.theme.IThemeManager;
import org.rusherhack.core.event.listener.EventListener;
import org.rusherhack.core.event.stage.Stage;
import org.rusherhack.core.event.subscribe.Subscribe;
import org.rusherhack.core.feature.IFeatureManager;
import org.rusherhack.core.setting.BooleanSetting;
import org.rusherhack.core.setting.EnumSetting;
import org.rusherhack.core.setting.NumberSetting;
Expand All @@ -36,23 +38,20 @@ public class Durability101 implements EventListener {
/* RusherHackAPI Managers & Screens */
private final IHudManager hudManager = RusherHackAPI.getHudManager();
private final IThemeManager themeManager = RusherHackAPI.getThemeManager();
private final IFeatureManager<IModule> moduleManager = RusherHackAPI.getModuleManager();
private final Screen hudEditorScreen = themeManager.getHudEditorScreen();
private final ToggleableModule hudModule = (ToggleableModule) moduleManager.getFeature("Hud").orElseThrow();

/* Armor Hud Element & Settings */
private final HudElement armor = hudManager.getFeature("Armor").orElseThrow();
private final EnumSetting<?> axis = (EnumSetting<?>) armor.getSetting("Axis");
private final EnumSetting<?> durability = (EnumSetting<?>) armor.getSetting("Durability");
private final BooleanSetting hotbarLock = (BooleanSetting) armor.getSetting("HotbarLock");
private final BooleanSetting autoAdjust = (BooleanSetting) hotbarLock.getSubSetting("AutoAdjust");

/* Custom Settings */
private final BooleanSetting durability101 = new BooleanSetting("Durability101", "Durability101 Mod for Armor HUD", false);
private final BooleanSetting unbreaking = new BooleanSetting("Unbreaking", "Estimates Unbreaking Durability", false);
private final NumberSetting<Integer> yOffset = new NumberSetting<>("Y Offset", "Manual Y Offset", 0, -15, 15);

/* Temporary */
private final TextHudElement watermark = (TextHudElement) hudManager.getFeature("Watermark").orElseThrow();

/* Initialize */
public Durability101() {
this.durability101.addSubSettings(this.unbreaking, this.yOffset);
Expand All @@ -61,7 +60,7 @@ public Durability101() {

@Override
public boolean isListening() {
return this.armor.isToggled() && this.durability101.getValue();
return this.hudModule.isToggled() && this.armor.isToggled() && this.durability101.getValue();
}

@Subscribe(priority = -10000, stage = Stage.ALL)
Expand Down
2 changes: 1 addition & 1 deletion 1.20.2/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ minecraft_version=1.20.2
parchment_version=2023.12.10

# Plugin Properties
plugin_version=0.10.1
plugin_version=0.10.2
maven_group=com.shaybox.rusher
archives_base_name=shays-rusher-plugin
36 changes: 21 additions & 15 deletions 1.20.2/src/main/java/com/shaybox/rusher/modules/AntiCrawl.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ public class AntiCrawl extends ToggleableModule {

/* Minecraft */
private final Minecraft minecraft = Minecraft.getInstance();
private final Level level = this.minecraft.level;
private final LocalPlayer player = this.minecraft.player;
private final MultiPlayerGameMode gameMode = this.minecraft.gameMode;
private final IMixinMultiPlayerGameMode gameModeMixin = (IMixinMultiPlayerGameMode) this.gameMode;

/* Settings */
private final BooleanSetting packetOnly = new BooleanSetting("PacketMine", false);
Expand All @@ -41,47 +37,57 @@ public AntiCrawl() {

@Subscribe
private void onPacket(EventPacket.Receive event) {
if (this.level == null || this.player == null || this.gameMode == null) return;
final Level level = this.minecraft.level;
final LocalPlayer player = this.minecraft.player;
final MultiPlayerGameMode gameMode = this.minecraft.gameMode;
if (level == null || player == null || gameMode == null) return;

final Packet<?> packet = event.getPacket();

// Start breaking the block your head is in if the block your feet are in starts to get mined to keep you from crawling
if (this.pearlPhase.getValue() && packet instanceof ClientboundBlockDestructionPacket destructionPacket) {
final BlockPos playerFeetPos = this.player.blockPosition();
final BlockPos playerFeetPos = player.blockPosition();
final BlockPos playerHeadPos = playerFeetPos.offset(0, 1, 0);
final BlockPos blockPos = destructionPacket.getPos();
final BlockState blockState = this.level.getBlockState(blockPos);
final BlockState blockState = level.getBlockState(blockPos);
final Block block = blockState.getBlock();
if (!blockPos.equals(playerFeetPos) || block.equals(Blocks.AIR)) return;

this.gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
}
}

@Subscribe
private void onPlayerUpdate(EventPlayerUpdate event) {
if (this.level == null || this.player == null || this.gameMode == null) return;
final Level level = this.minecraft.level;
final LocalPlayer player = this.minecraft.player;
final MultiPlayerGameMode gameMode = this.minecraft.gameMode;
final IMixinMultiPlayerGameMode gameModeMixin = (IMixinMultiPlayerGameMode) gameMode;
if (level == null || player == null || gameMode == null) return;

final BlockPos destroyBlockPos = this.gameModeMixin.getDestroyBlockPos();
final BlockPos destroyBlockPos = gameModeMixin.getDestroyBlockPos();
final BlockPos playerFeetPos = player.blockPosition();

// Finish vanilla breaking the block in your head to keep you from crawling
if (this.pearlPhase.getValue() && !this.packetOnly.getValue()) {
final BlockPos playerHeadPos = playerFeetPos.offset(0, 1, 0);
final BlockState blockState = this.level.getBlockState(playerHeadPos);
final BlockState blockState = level.getBlockState(playerHeadPos);
final Block block = blockState.getBlock();

if (destroyBlockPos.equals(playerHeadPos) && !block.equals(Blocks.AIR)) {
this.gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
}
}

// Finish vanilla breaking the block above your head to stop you from crawling
if (this.crawlBreak.getValue() && this.player.isVisuallyCrawling()) {
if (this.crawlBreak.getValue() && player.isVisuallyCrawling()) {
final BlockPos playerHeadPos = playerFeetPos.offset(0, 1, 0);

if (!destroyBlockPos.equals(playerHeadPos)) this.gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
else if (!this.packetOnly.getValue()) this.gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
if (!destroyBlockPos.equals(playerHeadPos)) {
gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
} else if (!this.packetOnly.getValue()) {
gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
import org.rusherhack.client.api.RusherHackAPI;
import org.rusherhack.client.api.events.render.EventRender2D;
import org.rusherhack.client.api.feature.hud.HudElement;
import org.rusherhack.client.api.feature.hud.TextHudElement;
import org.rusherhack.client.api.feature.module.IModule;
import org.rusherhack.client.api.feature.module.ToggleableModule;
import org.rusherhack.client.api.render.IRenderer2D;
import org.rusherhack.client.api.render.font.IFontRenderer;
import org.rusherhack.client.api.system.IHudManager;
import org.rusherhack.client.api.ui.theme.IThemeManager;
import org.rusherhack.core.event.listener.EventListener;
import org.rusherhack.core.event.stage.Stage;
import org.rusherhack.core.event.subscribe.Subscribe;
import org.rusherhack.core.feature.IFeatureManager;
import org.rusherhack.core.setting.BooleanSetting;
import org.rusherhack.core.setting.EnumSetting;
import org.rusherhack.core.setting.NumberSetting;
Expand All @@ -37,23 +39,20 @@ public class Durability101 implements EventListener {
/* RusherHackAPI Managers & Screens */
private final IHudManager hudManager = RusherHackAPI.getHudManager();
private final IThemeManager themeManager = RusherHackAPI.getThemeManager();
private final IFeatureManager<IModule> moduleManager = RusherHackAPI.getModuleManager();
private final Screen hudEditorScreen = themeManager.getHudEditorScreen();
private final ToggleableModule hudModule = (ToggleableModule) moduleManager.getFeature("Hud").orElseThrow();

/* Armor Hud Element & Settings */
private final HudElement armor = hudManager.getFeature("Armor").orElseThrow();
private final EnumSetting<?> axis = (EnumSetting<?>) armor.getSetting("Axis");
private final EnumSetting<?> durability = (EnumSetting<?>) armor.getSetting("Durability");
private final BooleanSetting hotbarLock = (BooleanSetting) armor.getSetting("HotbarLock");
private final BooleanSetting autoAdjust = (BooleanSetting) hotbarLock.getSubSetting("AutoAdjust");

/* Custom Settings */
private final BooleanSetting durability101 = new BooleanSetting("Durability101", "Durability101 Mod for Armor HUD", false);
private final BooleanSetting unbreaking = new BooleanSetting("Unbreaking", "Estimates Unbreaking Durability", false);
private final NumberSetting<Integer> yOffset = new NumberSetting<>("Y Offset", "Manual Y Offset", 0, -15, 15);

/* Temporary */
private final TextHudElement watermark = (TextHudElement) hudManager.getFeature("Watermark").orElseThrow();

/* Initialize */
public Durability101() {
this.durability101.addSubSettings(this.unbreaking, this.yOffset);
Expand All @@ -62,7 +61,7 @@ public Durability101() {

@Override
public boolean isListening() {
return this.armor.isToggled() && this.durability101.getValue();
return this.hudModule.isToggled() && this.armor.isToggled() && this.durability101.getValue();
}

@Subscribe(priority = -10000, stage = Stage.ALL)
Expand Down
2 changes: 1 addition & 1 deletion 1.20.4/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ minecraft_version=1.20.4
parchment_version=2024.04.14

# Plugin Properties
plugin_version=0.10.1
plugin_version=0.10.2
maven_group=com.shaybox.rusher
archives_base_name=shays-rusher-plugin
36 changes: 21 additions & 15 deletions 1.20.4/src/main/java/com/shaybox/rusher/modules/AntiCrawl.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ public class AntiCrawl extends ToggleableModule {

/* Minecraft */
private final Minecraft minecraft = Minecraft.getInstance();
private final Level level = this.minecraft.level;
private final LocalPlayer player = this.minecraft.player;
private final MultiPlayerGameMode gameMode = this.minecraft.gameMode;
private final IMixinMultiPlayerGameMode gameModeMixin = (IMixinMultiPlayerGameMode) this.gameMode;

/* Settings */
private final BooleanSetting packetOnly = new BooleanSetting("PacketMine", false);
Expand All @@ -41,47 +37,57 @@ public AntiCrawl() {

@Subscribe
private void onPacket(EventPacket.Receive event) {
if (this.level == null || this.player == null || this.gameMode == null) return;
final Level level = this.minecraft.level;
final LocalPlayer player = this.minecraft.player;
final MultiPlayerGameMode gameMode = this.minecraft.gameMode;
if (level == null || player == null || gameMode == null) return;

final Packet<?> packet = event.getPacket();

// Start breaking the block your head is in if the block your feet are in starts to get mined to keep you from crawling
if (this.pearlPhase.getValue() && packet instanceof ClientboundBlockDestructionPacket destructionPacket) {
final BlockPos playerFeetPos = this.player.blockPosition();
final BlockPos playerFeetPos = player.blockPosition();
final BlockPos playerHeadPos = playerFeetPos.offset(0, 1, 0);
final BlockPos blockPos = destructionPacket.getPos();
final BlockState blockState = this.level.getBlockState(blockPos);
final BlockState blockState = level.getBlockState(blockPos);
final Block block = blockState.getBlock();
if (!blockPos.equals(playerFeetPos) || block.equals(Blocks.AIR)) return;

this.gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
}
}

@Subscribe
private void onPlayerUpdate(EventPlayerUpdate event) {
if (this.level == null || this.player == null || this.gameMode == null) return;
final Level level = this.minecraft.level;
final LocalPlayer player = this.minecraft.player;
final MultiPlayerGameMode gameMode = this.minecraft.gameMode;
final IMixinMultiPlayerGameMode gameModeMixin = (IMixinMultiPlayerGameMode) gameMode;
if (level == null || player == null || gameMode == null) return;

final BlockPos destroyBlockPos = this.gameModeMixin.getDestroyBlockPos();
final BlockPos destroyBlockPos = gameModeMixin.getDestroyBlockPos();
final BlockPos playerFeetPos = player.blockPosition();

// Finish vanilla breaking the block in your head to keep you from crawling
if (this.pearlPhase.getValue() && !this.packetOnly.getValue()) {
final BlockPos playerHeadPos = playerFeetPos.offset(0, 1, 0);
final BlockState blockState = this.level.getBlockState(playerHeadPos);
final BlockState blockState = level.getBlockState(playerHeadPos);
final Block block = blockState.getBlock();

if (destroyBlockPos.equals(playerHeadPos) && !block.equals(Blocks.AIR)) {
this.gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
}
}

// Finish vanilla breaking the block above your head to stop you from crawling
if (this.crawlBreak.getValue() && this.player.isVisuallyCrawling()) {
if (this.crawlBreak.getValue() && player.isVisuallyCrawling()) {
final BlockPos playerHeadPos = playerFeetPos.offset(0, 1, 0);

if (!destroyBlockPos.equals(playerHeadPos)) this.gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
else if (!this.packetOnly.getValue()) this.gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
if (!destroyBlockPos.equals(playerHeadPos)) {
gameMode.startDestroyBlock(playerHeadPos, Direction.DOWN);
} else if (!this.packetOnly.getValue()) {
gameMode.continueDestroyBlock(playerHeadPos, Direction.DOWN);
}
}
}

Expand Down
Loading

0 comments on commit 63834fc

Please sign in to comment.