Skip to content

Commit

Permalink
1.21.1 (but didnt test), constantiam efly
Browse files Browse the repository at this point in the history
  • Loading branch information
OLEPOSSU committed Jan 10, 2025
1 parent e213ec3 commit ef643d7
Show file tree
Hide file tree
Showing 33 changed files with 1,056 additions and 579 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'fabric-loom' version '1.5-SNAPSHOT'
id "fabric-loom" version "1.9-SNAPSHOT"
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21

archivesBaseName = project.archives_base_name
version = project.mod_version
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
org.gradle.jvmargs=-Xmx2G

# Fabric Properties (https://fabricmc.net/versions.html)
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.2
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.5

# Mod Properties
mod_version=1.0.2
Expand All @@ -13,4 +13,4 @@ archives_base_name=blackout
# Dependencies

# Meteor (https://maven.meteordev.org/)
meteor_version=0.5.6-SNAPSHOT
meteor_version=0.5.8-SNAPSHOT
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 2 additions & 1 deletion src/main/java/kassuk/addon/blackout/BlackOutModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import kassuk.addon.blackout.enums.SwingHand;
import kassuk.addon.blackout.enums.SwingState;
import kassuk.addon.blackout.enums.SwingType;
import kassuk.addon.blackout.managers.Managers;
import kassuk.addon.blackout.modules.SwingModifier;
import kassuk.addon.blackout.utils.PriorityUtils;
import kassuk.addon.blackout.utils.SettingUtils;
Expand Down Expand Up @@ -129,7 +130,7 @@ public void interactBlock(Hand hand, Vec3d blockHitVec, Direction blockDirection

public void useItem(Hand hand) {
SettingUtils.swing(SwingState.Pre, SwingType.Using, hand);
sendSequenced(s -> new PlayerInteractItemC2SPacket(hand, s));
sendSequenced(s -> new PlayerInteractItemC2SPacket(hand, s, Managers.ROTATION.lastDir[0], Managers.ROTATION.lastDir[1]));
SettingUtils.swing(SwingState.Post, SwingType.Using, hand);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kassuk/addon/blackout/hud/CatGirl.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class CatGirl extends HudElement {
.defaultValue(SideMode.Right)
.build()
);
private final Identifier catgirl = new Identifier("blackout", "catgirl.png");
private final Identifier catgirl = Identifier.of("blackout", "catgirl.png");

public static final HudElementInfo<CatGirl> INFO = new HudElementInfo<>(BlackOut.HUD_BLACKOUT, "catgirl", "It's a Cat girl what do you want", CatGirl::new);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kassuk/addon/blackout/hud/HudWaterMark.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class HudWaterMark extends HudElement {
.build()
);

private final Identifier LOGO = new Identifier("blackout", "logo.png");
private final Identifier LOGO = Identifier.of("blackout", "logo.png");

public static final HudElementInfo<HudWaterMark> INFO = new HudElementInfo<>(BlackOut.HUD_BLACKOUT, "BlackoutWatermark", "The Blackout watermark.", HudWaterMark::new);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kassuk/addon/blackout/hud/TargetHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public void render(HudRenderer renderer) {
// Health
RenderUtils.text(String.valueOf(Math.round((renderHealth) * 10) / 10f), stack, 20, 81 - mc.textRenderer.fontHeight / 2f, textColor.get().getPacked());

float barAnimation = MathHelper.lerp(mc.getTickDelta() / 10, lastHp, renderHealth);
float barAnimation = MathHelper.lerp(mc.getRenderTickCounter().getTickDelta(true) / 10, lastHp, renderHealth);

float barStart = Math.max(mc.textRenderer.getWidth(String.valueOf(Math.round((renderHealth) * 10) / 10f)),
mc.textRenderer.getWidth("36.0")) + 28;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class RotationManager {
private boolean unsent = false;
public static final List<Rotation> history = new ArrayList<>();
boolean shouldRotate = false;
private float[] next;
public float[] next;
private boolean rotated = false;
private long key = 0;

Expand Down Expand Up @@ -90,8 +90,9 @@ private void onRender(Render3DEvent event) {
timer -= event.frameTime;
if (timer > 0 && target != null && lastDir != null) {
if (SettingUtils.shouldVanillaRotate()) {
mc.player.setYaw(MathHelper.lerpAngleDegrees(mc.getTickDelta(), prevDir[0], currentDir[0]));
mc.player.setPitch(MathHelper.lerp(mc.getTickDelta(), prevDir[1], currentDir[1]));
float tickDelta = mc.getRenderTickCounter().getTickDelta(true);
mc.player.setYaw(MathHelper.lerpAngleDegrees(tickDelta, prevDir[0], currentDir[0]));
mc.player.setPitch(MathHelper.lerp(tickDelta, prevDir[1], currentDir[1]));
}
} else if (target != null) {
target = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* This file is a part the best minecraft mod called Blackout Client (https://github.com/KassuK1/Blackout-Client)
* and licensed under the GNU GENERAL PUBLIC LICENSE (check LICENCE file or https://www.gnu.org/licenses/gpl-3.0.html)
* Copyright (C) 2024 KassuK and OLEPOSSU
*/

package kassuk.addon.blackout.mixins;

import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

import java.util.Map;

/**
* @author OLEPOSSU
*/

@Mixin(NbtCompound.class)
public interface AccessorNbtCompound {
@Accessor("entries")
Map<String, NbtElement> getEntries();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

@Mixin(EntitySetHeadYawS2CPacket.class)
public interface IEntitySetHeadYawS2CPacket {
@Accessor("entity")
@Accessor("entityId")
int getId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

@Mixin(EntityStatusS2CPacket.class)
public interface IEntityStatusS2CPacket {
@Accessor("id")
@Accessor("entityId")
int getId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ public interface IInteractEntityC2SPacket {

@Accessor("entityId")
int getId();

@Accessor("type")
PlayerInteractEntityC2SPacket.InteractTypeHandler getType();
}

Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private void calculate(int index) {
pos = blocks[i];

dmg = getDmg(pos);
self = BODamageUtils.anchorDamage(mc.player, mc.player.getBoundingBox(), pos);
self = BODamageUtils.anchorDamage(mc.player, mc.player.getBoundingBox(), pos.toCenterPos(), pos, false);

if (!dmgCheck(dmg, self)) {
continue;
Expand Down Expand Up @@ -613,7 +613,7 @@ private boolean dmgCheck(double dmg, double self) {
private double getDmg(BlockPos pos) {
double highest = -1;
for (PlayerEntity target : targets) {
highest = Math.max(highest, BODamageUtils.anchorDamage(target, target.getBoundingBox(), pos));
highest = Math.max(highest, BODamageUtils.anchorDamage(target, target.getBoundingBox(), pos.toCenterPos(), pos, true));
}
return highest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ private void getDmg(BlockPos pos) {
self = -1;

targets.forEach(target -> {
double d = BODamageUtils.anchorDamage(target, extMap.containsKey(target) ? extMap.get(target) : target.getBoundingBox(), pos);
double d = BODamageUtils.anchorDamage(target, extMap.containsKey(target) ? extMap.get(target) : target.getBoundingBox(), pos.toCenterPos(), pos, true);

if (target == mc.player) self = Math.max(self, d);
else if (Friends.get().isFriend(target)) friend = Math.max(friend, d);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ private boolean isOwn(BlockPos pos) {
}

private double[][] getDmg(Vec3d vec, boolean attack) {
double self = BODamageUtils.crystal(mc.player, extPos.containsKey(mc.player) ? extPos.get(mc.player) : mc.player.getBoundingBox(), vec, ignorePos(attack), ignoreTerrain.get());
double self = BODamageUtils.crystalDamage(mc.player, extPos.containsKey(mc.player) ? extPos.get(mc.player) : mc.player.getBoundingBox(), vec, ignorePos(attack), ignoreTerrain.get());

if (suicide) return new double[][]{new double[]{self, -1, -1}, new double[]{20, 20}};

Expand All @@ -1388,7 +1388,7 @@ private double[][] getDmg(Vec3d vec, boolean attack) {
Box box = entry.getValue();
if (player.getHealth() <= 0 || player == mc.player) continue;

double dmg = BODamageUtils.crystal(player, box, vec, ignorePos(attack), ignoreTerrain.get());
double dmg = BODamageUtils.crystalDamage(player, box, vec, ignorePos(attack), ignoreTerrain.get());
if (BlockPos.ofFloored(vec).down().equals(autoMine.targetPos()))
dmg *= autoMineDamage.get();
double hp = player.getHealth() + player.getAbsorptionAmount();
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/kassuk/addon/blackout/modules/AutoMine.java
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ private float getSpeed(BlockState state, int slot, boolean speedMod) {
ItemStack stack = mc.player.getInventory().getStack(slot);
float f = mc.player.getInventory().getStack(slot).getMiningSpeedMultiplier(state);
if (f > 1.0) {
int i = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, stack);
int i = OLEPOSSUtils.getLevel(Enchantments.EFFICIENCY, stack);
if (i > 0 && !stack.isEmpty()) f += (float) (i * i + 1);
}

Expand All @@ -1101,19 +1101,19 @@ private float getSpeed(BlockState state, int slot, boolean speedMod) {

if (effectCheck.get()) {
if (StatusEffectUtil.hasHaste(mc.player)) {
f *= 1.0 + (float) (StatusEffectUtil.getHasteAmplifier(mc.player) + 1) * 0.2F;
f *= 1.0f + (StatusEffectUtil.getHasteAmplifier(mc.player) + 1) * 0.2F;
}
if (mc.player.hasStatusEffect(StatusEffects.MINING_FATIGUE)) {
f *= Math.pow(0.3, mc.player.getStatusEffect(StatusEffects.MINING_FATIGUE).getAmplifier() + 1);
f *= (float) Math.pow(0.3f, mc.player.getStatusEffect(StatusEffects.MINING_FATIGUE).getAmplifier() + 1);
}
}

if (waterCheck.get() && mc.player.isSubmergedInWater() && !EnchantmentHelper.hasAquaAffinity(mc.player)) {
f /= 5.0;
if (waterCheck.get() && mc.player.isSubmergedInWater() && !OLEPOSSUtils.hasAquaAffinity(mc.player)) {
f /= 5.0f;
}

if (onGroundCheck.get() && !mc.player.isOnGround()) {
f /= 5.0;
f /= 5.0f;
}

return f;
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/kassuk/addon/blackout/modules/AutoPvp.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
import meteordevelopment.orbit.EventHandler;
import meteordevelopment.orbit.EventPriority;
import net.minecraft.client.gui.screen.DeathScreen;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.PotionContentsComponent;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket;
import net.minecraft.potion.PotionUtil;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;

Expand Down Expand Up @@ -498,12 +499,9 @@ private boolean available(Predicate<ItemStack> predicate) {
}

private boolean isSpeed(ItemStack stack) {
for (Object instance : PotionUtil.getPotionEffects(stack).toArray()) {
StatusEffectInstance i = (StatusEffectInstance) instance;

if (i.getEffectType() == StatusEffects.SPEED) {
for (StatusEffectInstance instance : stack.getOrDefault(DataComponentTypes.POTION_CONTENTS, PotionContentsComponent.DEFAULT).getEffects()) {
if (instance.getEffectType() == StatusEffects.SPEED)
return true;
}
}
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/kassuk/addon/blackout/modules/BedAuraPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ private boolean dmgCheck() {
private double getDmg(BlockPos pos) {
double highest = -1;
for (PlayerEntity target : targets) {
highest = Math.max(highest, BODamageUtils.bedDamage(target, target.getBoundingBox(), new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), null));
highest = Math.max(highest, BODamageUtils.anchorDamage(target, target.getBoundingBox(), pos.toCenterPos(), pos, false));
}
return highest;
}
Expand All @@ -711,14 +711,14 @@ private void damageCalc(BlockPos pos) {
for (PlayerEntity target : targets) {
if (target.getHealth() <= 0) continue;

highest = Math.max(highest, BODamageUtils.bedDamage(target, target.getBoundingBox(), new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), null));
highest = Math.max(highest, BODamageUtils.anchorDamage(target, target.getBoundingBox(), pos.toCenterPos(), pos, true));
highestHP = target.getHealth() + target.getAbsorptionAmount();
}
dmg = highest;
enemyHP = highestHP;

// Self
self = BODamageUtils.bedDamage(mc.player, mc.player.getBoundingBox(), new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), null);
self = BODamageUtils.anchorDamage(mc.player, mc.player.getBoundingBox(), pos.toCenterPos(), pos, false);
selfHP = mc.player.getHealth() + mc.player.getAbsorptionAmount();

// Friend
Expand All @@ -727,7 +727,7 @@ private void damageCalc(BlockPos pos) {
for (PlayerEntity friend : friends) {
if (friend.getHealth() <= 0) continue;

highest = Math.max(highest, BODamageUtils.bedDamage(friend, friend.getBoundingBox(), new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), null));
highest = Math.max(highest, BODamageUtils.anchorDamage(friend, friend.getBoundingBox(), pos.toCenterPos(), pos, true));
highestHP = friend.getHealth() + friend.getAbsorptionAmount();
}
friend = highest;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/kassuk/addon/blackout/modules/Blocker.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ private Entity getBlocking() {
for (BlockPos pos : placePositions) {
if (!Box.from(new BlockBox(pos)).intersects(entity.getBoundingBox())) continue;

double dmg = BODamageUtils.crystal(mc.player, mc.player.getBoundingBox(), entity.getPos(), null, false);
double dmg = BODamageUtils.crystalDamage(mc.player, mc.player.getBoundingBox(), entity.getPos(), null, false);
if (dmg < lowest) {
crystal = entity;
lowest = dmg;
Expand Down Expand Up @@ -639,7 +639,7 @@ private boolean damageCheck(BlockPos blockPos, int type) {
if (!(mc.world.getBlockState(pos).getBlock() instanceof AirBlock)) continue;
if (oldVer.get() && !(mc.world.getBlockState(pos.up()).getBlock() instanceof AirBlock)) continue;

double self = BODamageUtils.crystal(mc.player, mc.player.getBoundingBox(), feet(pos), blockPos, true);
double self = BODamageUtils.crystalDamage(mc.player, mc.player.getBoundingBox(), feet(pos), blockPos, true);
if (self >= maxDmg.get()) return true;
}
}
Expand All @@ -649,7 +649,7 @@ private boolean damageCheck(BlockPos blockPos, int type) {
if (!(mc.world.getBlockState(blockPos).getBlock() instanceof AirBlock)) return false;
if (oldVer.get() && !(mc.world.getBlockState(blockPos.up()).getBlock() instanceof AirBlock)) return false;

double self = BODamageUtils.crystal(mc.player, mc.player.getBoundingBox(), feet(blockPos.up()), blockPos, true);
double self = BODamageUtils.crystalDamage(mc.player, mc.player.getBoundingBox(), feet(blockPos.up()), blockPos, true);
if (self >= maxDmg.get()) return true;
}
}
Expand Down
Loading

0 comments on commit ef643d7

Please sign in to comment.