|
| 1 | +package spigey.asteroide.modules; |
| 2 | + |
| 3 | +import meteordevelopment.meteorclient.events.world.CollisionShapeEvent; |
| 4 | +import meteordevelopment.meteorclient.settings.EntityTypeListSetting; |
| 5 | +import meteordevelopment.meteorclient.settings.IntSetting; |
| 6 | +import meteordevelopment.meteorclient.settings.Setting; |
| 7 | +import meteordevelopment.meteorclient.settings.SettingGroup; |
| 8 | +import meteordevelopment.meteorclient.systems.modules.Module; |
| 9 | +import meteordevelopment.orbit.EventHandler; |
| 10 | +import net.minecraft.block.Blocks; |
| 11 | +import net.minecraft.entity.Entity; |
| 12 | +import net.minecraft.entity.EntityType; |
| 13 | +import net.minecraft.util.math.Vec3d; |
| 14 | +import net.minecraft.util.shape.VoxelShapes; |
| 15 | +import spigey.asteroide.AsteroideAddon; |
| 16 | + |
| 17 | +import java.util.Set; |
| 18 | + |
| 19 | +public class AntiSocialModule extends Module { |
| 20 | + public AntiSocialModule() { super(AsteroideAddon.CATEGORY, "Antisocial", "Prevents you from going near specified entities."); } |
| 21 | + private SettingGroup sgGeneral = settings.getDefaultGroup(); |
| 22 | + private Setting<Set<EntityType<?>>> entities = sgGeneral.add(new EntityTypeListSetting.Builder() |
| 23 | + .name("Entities") |
| 24 | + .description("Entities to prevent the player getting close to") |
| 25 | + .defaultValue(Set.of(net.minecraft.entity.EntityType.PLAYER)) |
| 26 | + .build() |
| 27 | + ); |
| 28 | + private Setting<Integer> distance = sgGeneral.add(new IntSetting.Builder() |
| 29 | + .name("Distance") |
| 30 | + .description("Distance in blocks to block movement in") |
| 31 | + .defaultValue(5) |
| 32 | + .build() |
| 33 | + ); |
| 34 | + |
| 35 | + @EventHandler |
| 36 | + private void onCollisionShape(CollisionShapeEvent event) { |
| 37 | + for(Entity entity : mc.world.getEntities()){ |
| 38 | + if(!entities.get().contains(entity.getType())) continue; |
| 39 | + if(mc.player == entity) continue; |
| 40 | + if(entity.squaredDistanceTo(Vec3d.ofCenter(event.pos)) > distance.get() * distance.get()) continue; |
| 41 | + event.shape = VoxelShapes.fullCube(); |
| 42 | + //mc.world.setBlockState(event.pos, Blocks.RED_STAINED_GLASS.getDefaultState()); |
| 43 | + } |
| 44 | + } |
| 45 | +} |
0 commit comments