net.minecraft.client.world.ClientWorld Java Examples
The following examples show how to use
net.minecraft.client.world.ClientWorld.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayerEspHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void onUpdate() { PlayerEntity player = MC.player; ClientWorld world = MC.world; players.clear(); Stream<AbstractClientPlayerEntity> stream = world.getPlayers() .parallelStream().filter(e -> !e.removed && e.getHealth() > 0) .filter(e -> e != player) .filter(e -> !(e instanceof FakePlayerEntity)) .filter(e -> Math.abs(e.getY() - MC.player.getY()) <= 1e6); if(filterSleeping.isChecked()) stream = stream.filter(e -> !e.isSleeping()); if(filterInvisible.isChecked()) stream = stream.filter(e -> !e.isInvisible()); players.addAll(stream.collect(Collectors.toList())); }
Example #2
Source File: Protocol_1_10.java From multiconnect with MIT License | 6 votes |
private static Entity changeEntityType(Entity entity, EntityType<?> newType) { ClientWorld world = (ClientWorld) entity.world; Entity destEntity = newType.create(world); if (destEntity == null) { return entity; } // copy the entity destEntity.fromTag(entity.toTag(new CompoundTag())); destEntity.trackedX = entity.trackedX; destEntity.trackedY = entity.trackedY; destEntity.trackedZ = entity.trackedZ; // replace entity in world and exchange entity id int entityId = entity.getEntityId(); world.removeEntity(entityId); destEntity.setEntityId(entityId); world.addEntity(entityId, destEntity); // exchange data tracker (this may be part of a series of data tracker updates, need the same data tracker instance) DataTrackerManager.transferDataTracker(entity, destEntity); return destEntity; }
Example #3
Source File: DrippingCrudeOilParticle.java From Galacticraft-Rewoven with MIT License | 5 votes |
public DrippingCrudeOilParticle(ClientWorld world, double x, double y, double z, double velX, double velY, double velZ) { super(world, x, y, z, velX, velY, velZ); setSprite(MinecraftClient.getInstance().getItemRenderer().getModels().getSprite(Blocks.ACACIA_LOG.asItem())); this.scale *= 0.25f; this.velocityX = 0.0f; this.velocityY = -0.6f; this.velocityZ = 0.0f; this.colorRed = 42f / 255f; this.colorGreen = 42f / 255f; this.colorBlue = 42f / 255f; this.colorAlpha = 229f / 255f; this.maxAge = (int) (64.0D / (Math.random() * 0.8D + 0.2D)); }
Example #4
Source File: EnderStorageCPH.java From EnderStorage with MIT License | 5 votes |
private void handleTilePacket(ClientWorld world, PacketCustom packet, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileFrequencyOwner) { ((TileFrequencyOwner) tile).readFromPacket(packet); } }
Example #5
Source File: FMLPlayMessages.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
public static void handle(SpawnEntity msg, PacketContext context) { PatchworkNetworking.enqueueWork(context.getTaskQueue(), () -> { EntityType<?> type = Registry.ENTITY_TYPE.get(msg.typeId); if (type.equals(Registry.ENTITY_TYPE.get(Registry.ENTITY_TYPE.getDefaultId()))) { throw new RuntimeException(String.format("Could not spawn entity (id %d) with unknown type at (%f, %f, %f)", msg.entityId, msg.posX, msg.posY, msg.posZ)); } ClientWorld world = MinecraftClient.getInstance().world; Entity entity = ((ClientEntitySpawner<?>) type).customClientSpawn(msg, world); if (entity == null) { return; } entity.updateTrackedPosition(msg.posX, msg.posY, msg.posZ); entity.updatePositionAndAngles(msg.posX, msg.posY, msg.posZ, (msg.yaw * 360) / 256.0F, (msg.pitch * 360) / 256.0F); entity.setHeadYaw((msg.headYaw * 360) / 256.0F); entity.setYaw((msg.headYaw * 360) / 256.0F); entity.setEntityId(msg.entityId); entity.setUuid(msg.uuid); world.addEntity(msg.entityId, entity); entity.setVelocity(msg.velX / 8000.0, msg.velY / 8000.0, msg.velZ / 8000.0); if (entity instanceof IEntityAdditionalSpawnData) { ((IEntityAdditionalSpawnData) entity).readSpawnData(msg.buf); } }); }
Example #6
Source File: MixinClientWorld.java From multiconnect with MIT License | 5 votes |
@Inject(method = "setBlockStateWithoutNeighborUpdates", at = @At("HEAD"), cancellable = true) private void onSetBlockWithoutNeighborUpdates(BlockPos pos, BlockState state, CallbackInfo ci) { if (ConnectionInfo.protocolVersion <= Protocols.V1_12_2) { ((ClientWorld) (Object) this).setBlockState(pos, state); ci.cancel(); } }
Example #7
Source File: Particles_1_12_2.java From multiconnect with MIT License | 5 votes |
private FootprintParticle(TextureManager textureManager, ClientWorld world, double x, double y, double z) { super(world, x, y, z, 0, 0, 0); this.textureManager = textureManager; this.velocityX = 0; this.velocityY = 0; this.velocityZ = 0; }
Example #8
Source File: DrippingFuelParticle.java From Galacticraft-Rewoven with MIT License | 5 votes |
public DrippingFuelParticle(ClientWorld world, double x, double y, double z, double velX, double velY, double velZ) { super(world, x, y, z, velX, velY, velZ); setSprite(MinecraftClient.getInstance().getItemRenderer().getModels().getSprite(Blocks.ACACIA_LOG.asItem())); this.scale *= 0.25f; this.velocityX = 0.0f; this.velocityY = -0.6f; this.velocityZ = 0.0f; this.colorRed = 146f / 255f; this.colorGreen = 140f / 255f; this.colorBlue = 74f / 255f; this.colorAlpha = 213f / 255f; this.maxAge = (int) (64.0D / (Math.random() * 0.8D + 0.2D)); }
Example #9
Source File: MinecraftClientMixin.java From the-hallow with MIT License | 5 votes |
@Redirect(method = "joinWorld(Lnet/minecraft/client/world/ClientWorld;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;reset(Lnet/minecraft/client/gui/screen/Screen;)V", ordinal = 0)) private void redirectReset_joinWorld(MinecraftClient client, Screen screen, ClientWorld world) { if (world.getDimension().getType() == HallowedDimensions.THE_HALLOW) { reset(new HallowedLoadingScreen()); } else { reset(screen); } }
Example #10
Source File: RadarHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; ClientWorld world = MC.world; entities.clear(); Stream<Entity> stream = StreamSupport.stream(world.getEntities().spliterator(), true) .filter(e -> !e.removed && e != player) .filter(e -> !(e instanceof FakePlayerEntity)) .filter(e -> e instanceof LivingEntity) .filter(e -> ((LivingEntity)e).getHealth() > 0); if(filterPlayers.isChecked()) stream = stream.filter(e -> !(e instanceof PlayerEntity)); if(filterSleeping.isChecked()) stream = stream.filter(e -> !(e instanceof PlayerEntity && ((PlayerEntity)e).isSleeping())); if(filterMonsters.isChecked()) stream = stream.filter(e -> !(e instanceof Monster)); if(filterAnimals.isChecked()) stream = stream.filter( e -> !(e instanceof AnimalEntity || e instanceof AmbientEntity || e instanceof WaterCreatureEntity)); if(filterInvisible.isChecked()) stream = stream.filter(e -> !e.isInvisible()); entities.addAll(stream.collect(Collectors.toList())); }
Example #11
Source File: Particles_1_12_2.java From multiconnect with MIT License | 4 votes |
@Override public Particle createParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { return new FootprintParticle(MinecraftClient.getInstance().getTextureManager(), world, x, y, z); }
Example #12
Source File: EnderStorageCPH.java From EnderStorage with MIT License | 4 votes |
private void handleTankTilePacket(ClientWorld world, BlockPos pos, PacketCustom packet) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEnderTank) { ((TileEnderTank) tile).sync(packet); } }
Example #13
Source File: ClientPlayerEntityMixin.java From spark with GNU General Public License v3.0 | 4 votes |
public ClientPlayerEntityMixin(ClientWorld clientWorld_1, GameProfile gameProfile_1) { super(clientWorld_1, gameProfile_1); }
Example #14
Source File: MixinClientWorld.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
@Inject(method = "<init>", at = @At(value = "TAIL")) private void postConstruct(CallbackInfo info) { WorldEvents.onWorldLoad((ClientWorld) (Object) this); }
Example #15
Source File: SuspendParticleAccessor.java From multiconnect with MIT License | 4 votes |
@Invoker("<init>") static SuspendParticle constructor(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { return MixinHelper.fakeInstance(); }
Example #16
Source File: TriggerBotHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private boolean isCorrectEntity(Entity entity) { ClientPlayerEntity player = MC.player; ClientWorld world = MC.world; double rangeSq = Math.pow(range.getValue(), 2); Stream<LivingEntity> stream = Stream.of(entity) .filter(e -> e instanceof LivingEntity).map(e -> (LivingEntity)e) .filter(e -> !e.removed && e.getHealth() > 0) .filter(e -> player.squaredDistanceTo(e) <= rangeSq) .filter(e -> e != player) .filter(e -> !(e instanceof FakePlayerEntity)) .filter(e -> !WURST.getFriends().contains(e.getEntityName())); if(filterPlayers.isChecked()) stream = stream.filter(e -> !(e instanceof PlayerEntity)); if(filterSleeping.isChecked()) stream = stream.filter(e -> !(e instanceof PlayerEntity && ((PlayerEntity)e).isSleeping())); if(filterFlying.getValue() > 0) stream = stream.filter(e -> { if(!(e instanceof PlayerEntity)) return true; Box box = e.getBoundingBox(); box = box.union(box.offset(0, -filterFlying.getValue(), 0)); return world.doesNotCollide(box); }); if(filterMonsters.isChecked()) stream = stream.filter(e -> !(e instanceof Monster)); if(filterPigmen.isChecked()) stream = stream.filter(e -> !(e instanceof ZombifiedPiglinEntity)); if(filterEndermen.isChecked()) stream = stream.filter(e -> !(e instanceof EndermanEntity)); if(filterAnimals.isChecked()) stream = stream.filter( e -> !(e instanceof AnimalEntity || e instanceof AmbientEntity || e instanceof WaterCreatureEntity)); if(filterBabies.isChecked()) stream = stream.filter(e -> !(e instanceof PassiveEntity && ((PassiveEntity)e).isBaby())); if(filterPets.isChecked()) stream = stream .filter(e -> !(e instanceof TameableEntity && ((TameableEntity)e).isTamed())) .filter(e -> !(e instanceof HorseBaseEntity && ((HorseBaseEntity)e).isTame())); if(filterVillagers.isChecked()) stream = stream.filter(e -> !(e instanceof VillagerEntity)); if(filterGolems.isChecked()) stream = stream.filter(e -> !(e instanceof GolemEntity)); if(filterInvisible.isChecked()) stream = stream.filter(e -> !e.isInvisible()); return stream.findFirst().isPresent(); }
Example #17
Source File: CrackParticleAccessor.java From multiconnect with MIT License | 4 votes |
@Invoker("<init>") static CrackParticle constructor(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, ItemStack stack) { return MixinHelper.fakeInstance(); }
Example #18
Source File: Particles_1_12_2.java From multiconnect with MIT License | 4 votes |
@Override public Particle createParticle(BlockStateParticleEffect type, ClientWorld world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { return new OldBlockDustParticle(world, x, y, z, xSpeed, ySpeed, zSpeed, type.getBlockState()); }
Example #19
Source File: Particles_1_12_2.java From multiconnect with MIT License | 4 votes |
public OldBlockDustParticle(ClientWorld world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, BlockState state) { super(world, x, y, z, xSpeed, ySpeed, zSpeed, state); velocityX = xSpeed; velocityY = ySpeed; velocityZ = zSpeed; }
Example #20
Source File: Particles_1_12_2.java From multiconnect with MIT License | 4 votes |
@Override public Particle createParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { return CrackParticleAccessor.constructor(world, x, y, z, xSpeed, ySpeed, zSpeed, new ItemStack(Blocks.SNOW_BLOCK)); }
Example #21
Source File: Particles_1_12_2.java From multiconnect with MIT License | 4 votes |
@Override public Particle createParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { SuspendParticle particle = SuspendParticleAccessor.constructor(world, x, y, z, xSpeed, ySpeed, zSpeed); particle.setSprite(sprite); return particle; }
Example #22
Source File: MixinOtherClientPlayerEntity.java From multiconnect with MIT License | 4 votes |
public MixinOtherClientPlayerEntity(ClientWorld world, GameProfile gameProfile) { super(world, gameProfile); }
Example #23
Source File: MobSpawnEspHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private void scan() { int minX = chunk.getPos().getStartX(); int minY = 0; int minZ = chunk.getPos().getStartZ(); int maxX = chunk.getPos().getEndX(); int maxY = 255; int maxZ = chunk.getPos().getEndZ(); ClientWorld world = MC.world; ArrayList<BlockPos> blocks = new ArrayList<>(); for(int x = minX; x <= maxX; x++) for(int y = minY; y <= maxY; y++) for(int z = minZ; z <= maxZ; z++) { BlockPos pos = new BlockPos(x, y, z); BlockState state = world.getBlockState(pos); if(state.getMaterial().blocksMovement()) continue; if(!state.getFluidState().isEmpty()) continue; BlockState stateDown = world.getBlockState(pos.down()); if(!stateDown.allowsSpawning(world, pos.down(), EntityType.ZOMBIE)) continue; blocks.add(pos); } if(Thread.interrupted()) return; red.addAll(blocks.stream() .filter(pos -> world.getLightLevel(LightType.BLOCK, pos) < 8) .filter(pos -> world.getLightLevel(LightType.SKY, pos) < 8) .collect(Collectors.toList())); if(Thread.interrupted()) return; yellow.addAll(blocks.stream().filter(pos -> !red.contains(pos)) .filter(pos -> world.getLightLevel(LightType.BLOCK, pos) < 8) .collect(Collectors.toList())); doneScanning = true; }
Example #24
Source File: ClientPlayerEntityMixin.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
public ClientPlayerEntityMixin(WurstClient wurst, ClientWorld clientWorld_1, GameProfile gameProfile_1) { super(clientWorld_1, gameProfile_1); }
Example #25
Source File: ClientPlayerInteractionManagerMixin.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
@Shadow public abstract ActionResult interactBlock( ClientPlayerEntity clientPlayerEntity_1, ClientWorld clientWorld_1, Hand hand_1, BlockHitResult blockHitResult_1);
Example #26
Source File: KillauraHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; ClientWorld world = MC.world; if(player.getAttackCooldownProgress(0) < 1) return; double rangeSq = Math.pow(range.getValue(), 2); Stream<LivingEntity> stream = StreamSupport .stream(MC.world.getEntities().spliterator(), true) .filter(e -> e instanceof LivingEntity).map(e -> (LivingEntity)e) .filter(e -> !e.removed && e.getHealth() > 0) .filter(e -> player.squaredDistanceTo(e) <= rangeSq) .filter(e -> e != player) .filter(e -> !(e instanceof FakePlayerEntity)) .filter(e -> !WURST.getFriends().contains(e.getEntityName())); if(filterPlayers.isChecked()) stream = stream.filter(e -> !(e instanceof PlayerEntity)); if(filterSleeping.isChecked()) stream = stream.filter(e -> !(e instanceof PlayerEntity && ((PlayerEntity)e).isSleeping())); if(filterFlying.getValue() > 0) stream = stream.filter(e -> { if(!(e instanceof PlayerEntity)) return true; Box box = e.getBoundingBox(); box = box.union(box.offset(0, -filterFlying.getValue(), 0)); return world.doesNotCollide(box); }); if(filterMonsters.isChecked()) stream = stream.filter(e -> !(e instanceof Monster)); if(filterPigmen.isChecked()) stream = stream.filter(e -> !(e instanceof ZombifiedPiglinEntity)); if(filterEndermen.isChecked()) stream = stream.filter(e -> !(e instanceof EndermanEntity)); if(filterAnimals.isChecked()) stream = stream.filter( e -> !(e instanceof AnimalEntity || e instanceof AmbientEntity || e instanceof WaterCreatureEntity)); if(filterBabies.isChecked()) stream = stream.filter(e -> !(e instanceof PassiveEntity && ((PassiveEntity)e).isBaby())); if(filterPets.isChecked()) stream = stream .filter(e -> !(e instanceof TameableEntity && ((TameableEntity)e).isTamed())) .filter(e -> !(e instanceof HorseBaseEntity && ((HorseBaseEntity)e).isTame())); if(filterVillagers.isChecked()) stream = stream.filter(e -> !(e instanceof VillagerEntity)); if(filterGolems.isChecked()) stream = stream.filter(e -> !(e instanceof GolemEntity)); if(filterInvisible.isChecked()) stream = stream.filter(e -> !e.isInvisible()); target = stream.min(priority.getSelected().comparator).orElse(null); renderTarget = target; if(target == null) return; WURST.getHax().autoSwordHack.setSlot(); WURST.getRotationFaker() .faceVectorPacket(target.getBoundingBox().getCenter()); }
Example #27
Source File: KillauraLegitHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; ClientWorld world = MC.world; if(player.getAttackCooldownProgress(0) < 1) return; double rangeSq = Math.pow(range.getValue(), 2); Stream<LivingEntity> stream = StreamSupport .stream(MC.world.getEntities().spliterator(), true) .filter(e -> e instanceof LivingEntity).map(e -> (LivingEntity)e) .filter(e -> !e.removed && e.getHealth() > 0) .filter(e -> player.squaredDistanceTo(e) <= rangeSq) .filter(e -> e != player) .filter(e -> !(e instanceof FakePlayerEntity)) .filter(e -> !WURST.getFriends().contains(e.getEntityName())); if(filterPlayers.isChecked()) stream = stream.filter(e -> !(e instanceof PlayerEntity)); if(filterSleeping.isChecked()) stream = stream.filter(e -> !(e instanceof PlayerEntity && ((PlayerEntity)e).isSleeping())); if(filterFlying.getValue() > 0) stream = stream.filter(e -> { if(!(e instanceof PlayerEntity)) return true; Box box = e.getBoundingBox(); box = box.union(box.offset(0, -filterFlying.getValue(), 0)); return world.doesNotCollide(box); }); if(filterMonsters.isChecked()) stream = stream.filter(e -> !(e instanceof Monster)); if(filterPigmen.isChecked()) stream = stream.filter(e -> !(e instanceof ZombifiedPiglinEntity)); if(filterEndermen.isChecked()) stream = stream.filter(e -> !(e instanceof EndermanEntity)); if(filterAnimals.isChecked()) stream = stream.filter( e -> !(e instanceof AnimalEntity || e instanceof AmbientEntity || e instanceof WaterCreatureEntity)); if(filterBabies.isChecked()) stream = stream.filter(e -> !(e instanceof PassiveEntity && ((PassiveEntity)e).isBaby())); if(filterPets.isChecked()) stream = stream .filter(e -> !(e instanceof TameableEntity && ((TameableEntity)e).isTamed())) .filter(e -> !(e instanceof HorseBaseEntity && ((HorseBaseEntity)e).isTame())); if(filterVillagers.isChecked()) stream = stream.filter(e -> !(e instanceof VillagerEntity)); if(filterGolems.isChecked()) stream = stream.filter(e -> !(e instanceof GolemEntity)); if(filterInvisible.isChecked()) stream = stream.filter(e -> !e.isInvisible()); target = stream.min(priority.getSelected().comparator).orElse(null); if(target == null) return; WURST.getHax().autoSwordHack.setSlot(); // face entity if(!faceEntityClient(target)) return; // attack entity MC.interactionManager.attackEntity(player, target); player.swingHand(Hand.MAIN_HAND); }
Example #28
Source File: ClickAuraHack.java From Wurst7 with GNU General Public License v3.0 | votes |
private void attack() { // set entity ClientPlayerEntity player = MC.player; ClientWorld world = MC.world; if(player.getAttackCooldownProgress(0) < 1) return; double rangeSq = Math.pow(range.getValue(), 2); Stream<LivingEntity> stream = StreamSupport .stream(MC.world.getEntities().spliterator(), true) .filter(e -> e instanceof LivingEntity).map(e -> (LivingEntity)e) .filter(e -> !e.removed && e.getHealth() > 0) .filter(e -> player.squaredDistanceTo(e) <= rangeSq) .filter(e -> e != player) .filter(e -> !(e instanceof FakePlayerEntity)) .filter(e -> !WURST.getFriends().contains(e.getEntityName())); if(filterPlayers.isChecked()) stream = stream.filter(e -> !(e instanceof PlayerEntity)); if(filterSleeping.isChecked()) stream = stream.filter(e -> !(e instanceof PlayerEntity && ((PlayerEntity)e).isSleeping())); if(filterFlying.getValue() > 0) stream = stream.filter(e -> { if(!(e instanceof PlayerEntity)) return true; Box box = e.getBoundingBox(); box = box.union(box.offset(0, -filterFlying.getValue(), 0)); return world.doesNotCollide(box); }); if(filterMonsters.isChecked()) stream = stream.filter(e -> !(e instanceof Monster)); if(filterPigmen.isChecked()) stream = stream.filter(e -> !(e instanceof ZombifiedPiglinEntity)); if(filterEndermen.isChecked()) stream = stream.filter(e -> !(e instanceof EndermanEntity)); if(filterAnimals.isChecked()) stream = stream.filter( e -> !(e instanceof AnimalEntity || e instanceof AmbientEntity || e instanceof WaterCreatureEntity)); if(filterBabies.isChecked()) stream = stream.filter(e -> !(e instanceof PassiveEntity && ((PassiveEntity)e).isBaby())); if(filterPets.isChecked()) stream = stream .filter(e -> !(e instanceof TameableEntity && ((TameableEntity)e).isTamed())) .filter(e -> !(e instanceof HorseBaseEntity && ((HorseBaseEntity)e).isTame())); if(filterVillagers.isChecked()) stream = stream.filter(e -> !(e instanceof VillagerEntity)); if(filterGolems.isChecked()) stream = stream.filter(e -> !(e instanceof GolemEntity)); if(filterInvisible.isChecked()) stream = stream.filter(e -> !e.isInvisible()); LivingEntity target = stream.min(priority.getSelected().comparator).orElse(null); if(target == null) return; WURST.getHax().autoSwordHack.setSlot(); // face entity Rotation rotation = RotationUtils .getNeededRotations(target.getBoundingBox().getCenter()); PlayerMoveC2SPacket.LookOnly packet = new PlayerMoveC2SPacket.LookOnly( rotation.getYaw(), rotation.getPitch(), MC.player.isOnGround()); MC.player.networkHandler.sendPacket(packet); // attack entity MC.interactionManager.attackEntity(player, target); player.swingHand(Hand.MAIN_HAND); }