|
| 1 | +package anticope.rejects.modules; |
| 2 | + |
| 3 | +import anticope.rejects.MeteorRejectsAddon; |
| 4 | +import meteordevelopment.meteorclient.events.world.TickEvent; |
| 5 | +import meteordevelopment.meteorclient.settings.DoubleSetting; |
| 6 | +import meteordevelopment.meteorclient.settings.Setting; |
| 7 | +import meteordevelopment.meteorclient.settings.SettingGroup; |
| 8 | +import meteordevelopment.meteorclient.systems.modules.Module; |
| 9 | +import net.minecraft.entity.attribute.EntityAttributes; |
| 10 | +import net.minecraft.entity.passive.HappyGhastEntity; |
| 11 | +import meteordevelopment.orbit.EventHandler; |
| 12 | + |
| 13 | +public class HappyGhastSpeed extends Module { |
| 14 | + private final SettingGroup sgGeneral = settings.getDefaultGroup(); |
| 15 | + |
| 16 | + private final Setting<Double> flyingSpeed = sgGeneral.add(new DoubleSetting.Builder() |
| 17 | + .name("flying-speed") |
| 18 | + .description("Flying speed for the Happy Ghast you are riding.") |
| 19 | + .defaultValue(0.25) |
| 20 | + .min(0.01) |
| 21 | + .sliderMax(1.0) |
| 22 | + .build() |
| 23 | + ); |
| 24 | + |
| 25 | + private final Setting<Double> movementSpeed = sgGeneral.add(new DoubleSetting.Builder() |
| 26 | + .name("movement-speed") |
| 27 | + .description("Movement speed for the Happy Ghast you are riding.") |
| 28 | + .defaultValue(0.25) |
| 29 | + .min(0.01) |
| 30 | + .sliderMax(1.0) |
| 31 | + .build() |
| 32 | + ); |
| 33 | + |
| 34 | + private final Setting<Double> cameraDistance = sgGeneral.add(new DoubleSetting.Builder() |
| 35 | + .name("camera-distance") |
| 36 | + .description("Camera distance for the Happy Ghast you are riding.") |
| 37 | + .defaultValue(14.0) |
| 38 | + .min(1.0) |
| 39 | + .sliderMax(50.0) |
| 40 | + .build() |
| 41 | + ); |
| 42 | + |
| 43 | + public HappyGhastSpeed() { |
| 44 | + super(MeteorRejectsAddon.CATEGORY, "happy-ghast-speed", "Customizes speed and camera distance for the Happy Ghast you are riding."); |
| 45 | + } |
| 46 | + |
| 47 | + @EventHandler |
| 48 | + private void onTick(TickEvent.Post event) { |
| 49 | + if (mc.player == null) return; |
| 50 | + if (!(mc.player.getVehicle() instanceof HappyGhastEntity ghast)) return; |
| 51 | + |
| 52 | + // Only modify the ghast the player is riding (client-side only) |
| 53 | + if (ghast.getAttributeInstance(EntityAttributes.FLYING_SPEED) != null) { |
| 54 | + ghast.getAttributeInstance(EntityAttributes.FLYING_SPEED).setBaseValue(flyingSpeed.get()); |
| 55 | + } |
| 56 | + if (ghast.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED) != null) { |
| 57 | + ghast.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).setBaseValue(movementSpeed.get()); |
| 58 | + } |
| 59 | + if (ghast.getAttributeInstance(EntityAttributes.CAMERA_DISTANCE) != null) { |
| 60 | + ghast.getAttributeInstance(EntityAttributes.CAMERA_DISTANCE).setBaseValue(cameraDistance.get()); |
| 61 | + } |
| 62 | + } |
| 63 | +} |
0 commit comments