inventive uses of attributes
This commit is contained in:
parent
6cd03fab06
commit
507ed6b7e5
7 changed files with 87 additions and 28 deletions
|
@ -21,7 +21,9 @@ public class ModuleManager
|
|||
new ModulesList(),
|
||||
new ChatSpammer(),
|
||||
new Rotation(),
|
||||
new AutoJump()
|
||||
new AutoJump(),
|
||||
new Reach(),
|
||||
new AntiPowderSnow()
|
||||
/*new Timer()*/
|
||||
);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package me.kawaiizenbo.moonlight.module.modules;
|
||||
|
||||
import me.kawaiizenbo.moonlight.module.Category;
|
||||
import me.kawaiizenbo.moonlight.module.Module;
|
||||
|
||||
public class AntiPowderSnow extends Module
|
||||
{
|
||||
public AntiPowderSnow()
|
||||
{
|
||||
super("Anti Powder Snow", "Allows the player to walk on powder snow.", Category.PLAYER);
|
||||
}
|
||||
}
|
|
@ -2,19 +2,43 @@ package me.kawaiizenbo.moonlight.module.modules;
|
|||
|
||||
import me.kawaiizenbo.moonlight.module.Category;
|
||||
import me.kawaiizenbo.moonlight.module.Module;
|
||||
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
|
||||
public class Reach extends Module
|
||||
{
|
||||
DoubleSetting blockRange = new DoubleSetting("Block Range", 4.5, 1, 10, 1);
|
||||
DoubleSetting entityRange = new DoubleSetting("Entity Range", 3.0, 1, 10, 1);
|
||||
double oldBe = 4.5;
|
||||
double oldEe = 3.0;
|
||||
|
||||
public Reach()
|
||||
{
|
||||
super("Reach", "Extends player reach.", Category.PLAYER);
|
||||
super("Reach", "Extends player interaction distance.", Category.MOVEMENT);
|
||||
settings.add(blockRange);
|
||||
settings.add(entityRange);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
super.onEnable();
|
||||
// this will be completed in 1.20.5, as a new attribute will be added to make this trivial.
|
||||
// mc.player.getAbilities().
|
||||
super.onEnable();
|
||||
oldBe = mc.player.getAttributeInstance(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE).getBaseValue();
|
||||
oldEe = mc.player.getAttributeInstance(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE).getBaseValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
mc.player.getAttributeInstance(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(blockRange.value);
|
||||
mc.player.getAttributeInstance(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE).setBaseValue(entityRange.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
super.onDisable();
|
||||
mc.player.getAttributeInstance(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(oldBe);
|
||||
mc.player.getAttributeInstance(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE).setBaseValue(oldEe);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,38 +5,38 @@ import me.kawaiizenbo.moonlight.module.Module;
|
|||
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
|
||||
import me.kawaiizenbo.moonlight.util.MathUtils;
|
||||
import net.minecraft.entity.MovementType;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class Speed extends Module
|
||||
{
|
||||
float oldSpeed;
|
||||
double old = 0.1;
|
||||
|
||||
DoubleSetting speed = new DoubleSetting("Speed", 2, 0.1, 10, 1);
|
||||
DoubleSetting speed = new DoubleSetting("Speed", 1.4, 0.1, 10, 1);
|
||||
public Speed()
|
||||
{
|
||||
super("Speed", "Allows you to move faster. (Deprecated)", Category.MOVEMENT);
|
||||
super("Speed", "Allows you to move faster.", Category.MOVEMENT);
|
||||
settings.add(speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMotion(MovementType type, Vec3d movement)
|
||||
public void onEnable()
|
||||
{
|
||||
// this is a little janky but it works, will find a better solution later
|
||||
if (mc.player.forwardSpeed == 0 && mc.player.sidewaysSpeed == 0 && mc.player.isOnGround())
|
||||
{
|
||||
mc.player.setVelocity(0, 0, 0);
|
||||
}
|
||||
Vec3d move = new Vec3d(mc.player.getX() - mc.player.prevX, 0, mc.player.getZ() - mc.player.prevZ).multiply(20);
|
||||
double mps = Math.abs(MathUtils.length2D(move));
|
||||
double normal = mc.player.isSprinting() ? 5.61 : 4.31;
|
||||
if (mps > normal * speed.value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (mc.player.isOnGround())
|
||||
{
|
||||
mc.player.setVelocity(mc.player.getVelocity().x * speed.value, 0, mc.player.getVelocity().z * speed.value);
|
||||
}
|
||||
super.onEnable();
|
||||
old = mc.player.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED).getBaseValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
mc.player.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED).setBaseValue(speed.value/10d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
super.onDisable();
|
||||
mc.player.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED).setBaseValue(old);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue