net.minecraft.entity.passive.PassiveEntity Java Examples
The following examples show how to use
net.minecraft.entity.passive.PassiveEntity.
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: MoonVillagerEntity.java From Galacticraft-Rewoven with MIT License | 6 votes |
@Override public MoonVillagerEntity createChild(PassiveEntity passiveEntity) { double d = this.random.nextDouble(); VillagerType villagerType3; if (d < 0.5D) { villagerType3 = VillagerType.forBiome(this.world.getBiome(this.getBlockPos())); } else if (d < 0.75D) { villagerType3 = this.getVillagerData().getType(); } else { villagerType3 = ((MoonVillagerEntity) passiveEntity).getVillagerData().getType(); } if (Galacticraft.MOON_VILLAGER_TYPE_REGISTRY.getId(villagerType3) == null) { if (this.random.nextBoolean() && Galacticraft.MOON_VILLAGER_TYPE_REGISTRY.getId(this.getVillagerData().getType()) != null) { villagerType3 = this.getVillagerData().getType(); } else { villagerType3 = MOON_VILLAGER_TYPE; } } MoonVillagerEntity villagerEntity = new MoonVillagerEntity(GalacticraftEntityTypes.MOON_VILLAGER, this.world, villagerType3); villagerEntity.initialize(this.world, this.world.getLocalDifficulty(villagerEntity.getBlockPos()), SpawnReason.BREEDING, null, null); return villagerEntity; }
Example #2
Source File: PumpcownEntity.java From the-hallow with MIT License | 4 votes |
@Override public PumpcownEntity createChild(PassiveEntity entity) { return HallowedEntities.PUMPCOWN.create(this.world); }
Example #3
Source File: CrowEntity.java From the-hallow with MIT License | 4 votes |
@Nullable @Override public PassiveEntity createChild(PassiveEntity entity) { return null; }
Example #4
Source File: FollowHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
@Override public void onEnable() { if(entity == null) { Stream<Entity> stream = StreamSupport .stream(MC.world.getEntities().spliterator(), true) .filter(e -> e instanceof LivingEntity) .filter(e -> !e.removed && ((LivingEntity)e).getHealth() > 0) .filter(e -> e != MC.player) .filter(e -> !(e instanceof FakePlayerEntity)); 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 MC.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()); entity = stream .min(Comparator .comparingDouble(e -> MC.player.squaredDistanceTo(e))) .orElse(null); if(entity == null) { ChatUtils.error("Could not find a valid entity."); setEnabled(false); return; } } pathFinder = new EntityPathFinder(); EVENTS.add(UpdateListener.class, this); EVENTS.add(RenderListener.class, this); ChatUtils.message("Now following " + entity.getName().getString()); }
Example #5
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 #6
Source File: RemoteViewHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
@Override public void onEnable() { // find entity if not already set if(entity == null) { Stream<Entity> stream = StreamSupport .stream(MC.world.getEntities().spliterator(), true) .filter(e -> e instanceof LivingEntity) .filter(e -> !e.removed && ((LivingEntity)e).getHealth() > 0) .filter(e -> e != MC.player) .filter(e -> !(e instanceof FakePlayerEntity)); 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 MC.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()); entity = stream .min(Comparator .comparingDouble(e -> MC.player.squaredDistanceTo(e))) .orElse(null); // check if entity was found if(entity == null) { ChatUtils.error("Could not find a valid entity."); setEnabled(false); return; } } // save old data wasInvisible = entity.isInvisibleTo(MC.player); // enable NoClip MC.player.noClip = true; // spawn fake player fakePlayer = new FakePlayerEntity(); // success message ChatUtils.message("Now viewing " + entity.getName().getString() + "."); // add listener EVENTS.add(UpdateListener.class, this); EVENTS.add(PacketOutputListener.class, this); }
Example #7
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 #8
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 #9
Source File: PassiveEntityMixin_RealTime.java From Galaxy with GNU Affero General Public License v3.0 | 4 votes |
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/PassiveEntity;setBreedingAge(I)V")) private void realTimeImpl$adjustForRealTimeGrowingUp(final PassiveEntity self, final int age) { // Subtract the one the original update method added final int diff = (int) ((RealTimeTrackingBridge) this.world).realTimeBridge$getRealTimeTicks() - 1; this.setBreedingAge(Math.min(0, age + diff)); }
Example #10
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); }
Example #11
Source File: TpAuraHack.java From Wurst7 with GNU General Public License v3.0 | votes |
@Override public void onUpdate() { ClientPlayerEntity player = MC.player; // set entity 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 MC.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()); Entity entity = stream.min(priority.getSelected().comparator).orElse(null); if(entity == null) return; WURST.getHax().autoSwordHack.setSlot(); // teleport player.updatePosition(entity.getX() + random.nextInt(3) * 2 - 2, entity.getY(), entity.getZ() + random.nextInt(3) * 2 - 2); // check cooldown if(player.getAttackCooldownProgress(0) < 1) return; // attack entity RotationUtils.Rotation rotations = RotationUtils .getNeededRotations(entity.getBoundingBox().getCenter()); WurstClient.MC.player.networkHandler .sendPacket(new PlayerMoveC2SPacket.LookOnly(rotations.getYaw(), rotations.getPitch(), MC.player.isOnGround())); MC.interactionManager.attackEntity(player, entity); player.swingHand(Hand.MAIN_HAND); }