private boolean checkValidity(final EntityLivingBase entity) { if (entity == this.mc.thePlayer) { return false; } if (!entity.isEntityAlive()) { return false; } if (this.mc.thePlayer.getDistanceToEntity(entity) > this.range) { return false; } if (!(entity instanceof EntityPlayer)) { return (this.monsters && entity instanceof EntityMob) || (this.animals && (entity instanceof EntityAnimal || entity instanceof EntitySquid)) || (this.bats && entity instanceof EntityBat); } if (this.players) { final EntityPlayer player = (EntityPlayer)entity; return (this.friend && FriendManager.isFriend(player.getName())) || (!FriendManager.isFriend(player.getName()) && (!this.noArmor || this.hasArmor(player))); } return false; }
public Color getEntityColor() { if ((entity instanceof EntityAnimal)) { return Color.white; } if ((entity instanceof EntityMob)) { return Color.red; } if ((entity instanceof EntitySlime)) { return Color.green; } if ((entity instanceof EntityVillager)) { return new Color(245, 245, 220); } if ((entity instanceof EntityBat)) { return Color.BLACK; } if ((entity instanceof EntitySquid)) { return Color.PINK; } return Color.white; }
private void explodeBats(World world, int posX, int posY, int posZ, int side, boolean enhanced) { int x = posX + (side == 4?-1:(side == 5?1:0)); int z = posZ + (side == 2?-1:(side == 3?1:0)); int y = posY + (side == 0?-1:(side == 1?1:0)); if(side == 1 && !world.getBlock(x, posY, z).getMaterial().isSolid()) { --y; } int NUM_BATS = enhanced?14:10; for(int i = 0; i < NUM_BATS; ++i) { EntityBat bat = new EntityBat(world); NBTTagCompound nbtBat = bat.getEntityData(); nbtBat.setBoolean("WITCNoDrops", true); bat.setLocationAndAngles((double)x, (double)y, (double)z, 0.0F, 0.0F); //LeRioN fix if (!EventUtils.isInPrivate(world, x, y, z)) super.worldObj.spawnEntityInWorld(bat); } ParticleEffect.LARGE_EXPLODE.send(SoundEffect.MOB_ENDERMEN_PORTAL, world, 0.5D + (double)x, 0.5D + (double)y, 0.5D + (double)z, 3.0D, 3.0D, 16); }
private boolean isValidTarget(Entity e) { if (e == null) return false; else if (e instanceof EntityPlayer) { EntityPlayer p = ((EntityPlayer) e); if (p.capabilities.isCreativeMode) return false; else { if (kPlayers) return true; else if (!kTeam) return false; RivalRebelsPlayer rrp = RivalRebels.round.rrplayerlist.getForName(((EntityPlayer) e).getCommandSenderName()); if (rrp == null) return kTeam; if (rrp.rrteam == RivalRebelsTeam.NONE) return !p.getCommandSenderName().equals(username); if (rrp.rrteam != team) return kTeam; else return false; } } else return (kMobs && (e instanceof EntityRhodes || (e instanceof EntityMob && !(e instanceof EntityAnimal) && !(e instanceof EntityBat) && !(e instanceof EntityVillager) && !(e instanceof EntitySquid)) || e instanceof EntityGhast)); }
@SubscribeEvent public void spawnHandler(LivingSpawnEvent.CheckSpawn event) { if((!(event.getEntity() instanceof EntityPlayer))&&(!(event.getWorld().isRemote))) { if(ScarecrowTracking.get(event.getWorld()).inRange(event.getEntity())) { if(event.getWorld().getBlockState(event.getEntity().getPosition()).getBlock()==Blocks.FARMLAND) { event.setResult(Result.DENY); } if(event.getEntity() instanceof EntityBat) { event.setResult(Result.DENY); // I hate bats } } } }
@SuppressWarnings("unchecked") @Override public void uncontainedEffect(int x, int y, int z, World world, EntityPlayer player) { super.uncontainedEffect(x, y, z, world, player); Vec3 cornerstone = Vec3.createVectorHelper(x,y,z); List<Entity> playerMPs = world.loadedEntityList; for (int i = 0; i < playerMPs.size();i++) { Entity entity = playerMPs.get(i); if (entity instanceof EntityLivingBase) { if (!(entity instanceof EntityPlayer) && !(entity instanceof EntityBat) && !(entity instanceof EntityChicken)) { Vec3 location = Vec3.createVectorHelper(entity.posX,entity.posY,entity.posZ); if (location.distanceTo(cornerstone) < 100) { entity.motionY += 3.0F; } } } } }
public BiomeGenBioZone(int id) { super(id); this.theBiomeDecorator.generateLakes = true; this.theBiomeDecorator.treesPerChunk = 4; this.spawnableMonsterList.clear(); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 100, 4, 4)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityZertum.class, 100, 4, 4)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 5, 1, 5)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 5, 1, 5)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 5, 1, 5)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 5, 1, 5)); }
public BiomeGenDarkLand(int id) { super(id); this.waterColorMultiplier = 0x666600; this.theBiomeDecorator.treesPerChunk = 1; this.theBiomeDecorator.grassPerChunk = 1; this.theBiomeDecorator.flowersPerChunk = -999; this.theBiomeDecorator.generateLakes = true; this.spawnableMonsterList.clear(); this.spawnableCreatureList.clear(); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityDarkZertum.class, 100, 4, 4)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 60, 1, 5)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityMagmaCube.class, 1, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 20, 2, 3)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityGhast.class, 20, 1, 2)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityKurr.class, 10, 2, 2)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4)); }
public BiomeGenBlueNile(int id) { super(id); //topBlock = (byte)ModBlocks.nileGrass.blockID; //fillerBlock = (byte)ModBlocks.nileDirt.blockID; this.waterColorMultiplier = 0x003333; this.theBiomeDecorator.treesPerChunk = 9; this.theBiomeDecorator.grassPerChunk = 3; this.theBiomeDecorator.flowersPerChunk = 2; this.theBiomeDecorator.generateLakes = true; this.spawnableMonsterList.clear(); this.spawnableCreatureList.add(new SpawnListEntry(EntityZertum.class, 100, 4, 4)); this.spawnableCreatureList.add(new SpawnListEntry(EntityBat.class, 5, 1, 5)); this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 5, 1, 5)); this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 5, 1, 5)); this.spawnableCreatureList.add(new SpawnListEntry(EntityPig.class, 5, 1, 5)); }
public BiomeGenDarkLand(int id) { super(id); //topBlock = (byte)ModBlocks.nileGrass.blockID; //fillerBlock = (byte)ModBlocks.nileDirt.blockID; this.waterColorMultiplier = 0x666600; this.theBiomeDecorator.treesPerChunk = 1; this.theBiomeDecorator.grassPerChunk = 1; this.theBiomeDecorator.flowersPerChunk = -999; this.theBiomeDecorator.generateLakes = true; this.spawnableMonsterList.clear(); this.spawnableCreatureList.add(new SpawnListEntry(EntityDarkZertum.class, 100, 4, 4)); this.spawnableCreatureList.add(new SpawnListEntry(EntityBat.class, 5, 1, 5)); this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 5, 1, 5)); this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 5, 1, 5)); this.spawnableCreatureList.add(new SpawnListEntry(EntityPig.class, 5, 1, 5)); }
public BiomeGenBioZone(int id) { super(id); this.theBiomeDecorator.generateLakes = true; this.theBiomeDecorator.treesPerChunk = 4; this.spawnableMonsterList.clear(); this.addFlower(ModBlocks.nileBlueFlower.getDefaultState(), 90); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 100, 4, 4)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 5, 1, 5)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 5, 1, 5)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 5, 1, 5)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 5, 1, 5)); }
public BiomeGenDarkLand(int id) { super(id); this.waterColorMultiplier = 0x666600; this.theBiomeDecorator.treesPerChunk = 1; this.theBiomeDecorator.grassPerChunk = 1; this.theBiomeDecorator.flowersPerChunk = -999; this.addFlower(ModBlocks.nileBlackFlower.getDefaultState(), 100); this.theBiomeDecorator.generateLakes = true; this.spawnableMonsterList.clear(); this.spawnableCreatureList.clear(); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 60, 1, 5)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityMagmaCube.class, 1, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 20, 2, 3)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityGhast.class, 20, 1, 2)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4)); }
@SubscribeEvent public void onDeath(LivingDeathEvent event) { if (!event.entityLiving.worldObj.isRemote) { EntityLivingBase entity = event.entityLiving; if (entity instanceof EntityBat) { if (((EntityBat) entity).worldObj.rand.nextInt(100) < 80) { EntityItem batWing = new EntityItem(((EntityBat) entity).worldObj, ((EntityBat) entity).posX, ((EntityBat) entity).posY, ((EntityBat) entity).posZ, new ItemStack(ModItems.materials)); ((EntityBat) entity).worldObj.spawnEntityInWorld(batWing); } } else if (entity instanceof EntitySquid) { if (((EntitySquid) entity).worldObj.rand.nextInt(100) < 60) { EntityItem tentacle = new EntityItem(((EntitySquid) entity).worldObj, ((EntitySquid) entity).posX, ((EntitySquid) entity).posY, ((EntitySquid) entity).posZ, new ItemStack(ModItems.materials, 1, 4)); ((EntitySquid) entity).worldObj.spawnEntityInWorld(tentacle); } } } }
@SubscribeEvent public void batSpawnEvent(LivingSpawnEvent event) { EntityLivingBase entity = event.entityLiving; int rand = new Random().nextInt(5); switch (rand){ case 0: if (entity instanceof EntityBat) { event.setCanceled(true); } break; default: break; } }
@Override public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { if (!par1World.isRemote) { if (par5Entity instanceof EntityPlayer) { ((EntityPlayer)par5Entity).addExhaustion(0.02F); } if ((par5Entity instanceof EntityChicken || par5Entity instanceof EntityBat) && (new Random().nextDouble() < 0.025)) { par5Entity.attackEntityFrom(DamageSource.drown, 1); } } }
@Override public void update() { if (!world.isRemote) { if (Config.spawnSkeletons && world.getDifficulty() != EnumDifficulty.PEACEFUL && world.rand.nextDouble() < Config.skeletonSpawnRate) { List<EntityLiving> mobs = world.getEntitiesWithinAABB(EntityLiving.class, getBB().grow(7), input -> input instanceof IMob); if (mobs.size() < 5) { double chance = world.rand.nextDouble(); EntityLiving living = chance < 0.5? new EntitySkeleton(world) : new EntityBat(world); living.setPositionAndRotation(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, world.rand.nextFloat() * 360, 0); if (living.getCanSpawnHere()) { world.spawnEntity(living); } } } } }
public static void addDefaultEntries(){ PneumaticRegistry.getInstance().addHackable(Blocks.tnt, HackableTNT.class); PneumaticRegistry.getInstance().addHackable(Blocks.mob_spawner, HackableMobSpawner.class); PneumaticRegistry.getInstance().addHackable(Blocks.lever, HackableLever.class); PneumaticRegistry.getInstance().addHackable(Blocks.stone_button, HackableButton.class); PneumaticRegistry.getInstance().addHackable(Blocks.wooden_button, HackableButton.class); PneumaticRegistry.getInstance().addHackable(Blocks.wooden_door, HackableDoor.class); PneumaticRegistry.getInstance().addHackable(Blocks.tripwire_hook, HackableTripwire.class); PneumaticRegistry.getInstance().addHackable(Blocks.dispenser, HackableDispenser.class); PneumaticRegistry.getInstance().addHackable(Blocks.dropper, HackableDispenser.class); PneumaticRegistry.getInstance().addHackable(Blockss.securityStation, HackableSecurityStation.class); PneumaticRegistry.getInstance().addHackable(Blocks.monster_egg, HackableTripwire.class); PneumaticRegistry.getInstance().addHackable(Blocks.noteblock, HackableNoteblock.class); PneumaticRegistry.getInstance().addHackable(Blocks.jukebox, HackableJukebox.class); PneumaticRegistry.getInstance().addHackable(EntityCreeper.class, HackableCreeper.class); PneumaticRegistry.getInstance().addHackable(EntityTameable.class, HackableTameable.class); PneumaticRegistry.getInstance().addHackable(EntityCow.class, HackableCow.class); PneumaticRegistry.getInstance().addHackable(EntityCaveSpider.class, HackableCaveSpider.class); PneumaticRegistry.getInstance().addHackable(EntityBlaze.class, HackableBlaze.class); PneumaticRegistry.getInstance().addHackable(EntityGhast.class, HackableGhast.class); PneumaticRegistry.getInstance().addHackable(EntityWitch.class, HackableWitch.class); PneumaticRegistry.getInstance().addHackable(EntityLiving.class, HackableLivingDisarm.class); PneumaticRegistry.getInstance().addHackable(EntityEnderman.class, HackableEnderman.class); PneumaticRegistry.getInstance().addHackable(EntityBat.class, HackableBat.class); }
public static void addDefaultEntries() { IPneumaticHelmetRegistry manager = PneumaticRegistry.getInstance().getHelmetRegistry(); manager.addHackable(Blocks.TNT, HackableTNT.class); manager.addHackable(Blocks.MOB_SPAWNER, HackableMobSpawner.class); manager.addHackable(Blocks.LEVER, HackableLever.class); manager.addHackable(Blocks.STONE_BUTTON, HackableButton.class); manager.addHackable(Blocks.WOODEN_BUTTON, HackableButton.class); manager.addHackable(Blocks.OAK_DOOR, HackableDoor.class); manager.addHackable(Blocks.SPRUCE_DOOR, HackableDoor.class); manager.addHackable(Blocks.BIRCH_DOOR, HackableDoor.class); manager.addHackable(Blocks.JUNGLE_DOOR, HackableDoor.class); manager.addHackable(Blocks.ACACIA_DOOR, HackableDoor.class); manager.addHackable(Blocks.DARK_OAK_DOOR, HackableDoor.class); manager.addHackable(Blocks.TRIPWIRE_HOOK, HackableTripwire.class); manager.addHackable(Blocks.DISPENSER, HackableDispenser.class); manager.addHackable(Blocks.DROPPER, HackableDispenser.class); manager.addHackable(Blockss.SECURITY_STATION, HackableSecurityStation.class); manager.addHackable(Blocks.MONSTER_EGG, HackableSilverfish.class); manager.addHackable(Blocks.NOTEBLOCK, HackableNoteblock.class); manager.addHackable(Blocks.JUKEBOX, HackableJukebox.class); manager.addHackable(EntityCreeper.class, HackableCreeper.class); manager.addHackable(EntityTameable.class, HackableTameable.class); manager.addHackable(EntityCow.class, HackableCow.class); manager.addHackable(EntityCaveSpider.class, HackableCaveSpider.class); manager.addHackable(EntityBlaze.class, HackableBlaze.class); manager.addHackable(EntityGhast.class, HackableGhast.class); manager.addHackable(EntityWitch.class, HackableWitch.class); manager.addHackable(EntityLiving.class, HackableLivingDisarm.class); manager.addHackable(EntityEnderman.class, HackableEnderman.class); manager.addHackable(EntityBat.class, HackableBat.class); }
/** * Checks if the specified entity is a passive * * @param e The entity * @return Whether or not the entity is a passive */ public static boolean isPassive(Entity e) { if (e instanceof EntityPigZombie) return !isAngry((EntityPigZombie) e); if (e instanceof EntityIronGolem) return !isAngry((EntityIronGolem) e); if (e instanceof EntityPolarBear) return !isAngry((EntityPolarBear) e); if (e instanceof EntityAnimal) return true; if (e instanceof EntitySquid) return true; if (e instanceof EntityBat) return true; if (e instanceof EntityVillager) return true; if (e instanceof EntitySnowman) return true; return false; }
protected BiomeGenBase(int id) { this.minHeight = height_Default.rootHeight; this.maxHeight = height_Default.variation; this.temperature = 0.5F; this.rainfall = 0.5F; this.waterColorMultiplier = 16777215; this.spawnableMonsterList = Lists.<BiomeGenBase.SpawnListEntry>newArrayList(); this.spawnableCreatureList = Lists.<BiomeGenBase.SpawnListEntry>newArrayList(); this.spawnableWaterCreatureList = Lists.<BiomeGenBase.SpawnListEntry>newArrayList(); this.spawnableCaveCreatureList = Lists.<BiomeGenBase.SpawnListEntry>newArrayList(); this.enableRain = true; this.worldGeneratorTrees = new WorldGenTrees(false); this.worldGeneratorBigTree = new WorldGenBigTree(false); this.worldGeneratorSwamp = new WorldGenSwamp(); this.biomeID = id; biomeList[id] = this; this.theBiomeDecorator = this.createBiomeDecorator(); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityRabbit.class, 10, 3, 3)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 10, 4, 4)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 10, 4, 4)); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 8, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 100, 4, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityEnderman.class, 10, 1, 4)); this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); }
protected void rotateCorpse(EntityBat bat, float p_77043_2_, float p_77043_3_, float partialTicks) { if (!bat.getIsBatHanging()) { GlStateManager.translate(0.0F, MathHelper.cos(p_77043_2_ * 0.3F) * 0.1F, 0.0F); } else { GlStateManager.translate(0.0F, -0.1F, 0.0F); } super.rotateCorpse(bat, p_77043_2_, p_77043_3_, partialTicks); }
/** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) { if (((EntityBat)entityIn).getIsBatHanging()) { float f = (180F / (float)Math.PI); this.batHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); this.batHead.rotateAngleY = (float)Math.PI - p_78087_4_ / (180F / (float)Math.PI); this.batHead.rotateAngleZ = (float)Math.PI; this.batHead.setRotationPoint(0.0F, -2.0F, 0.0F); this.batRightWing.setRotationPoint(-3.0F, 0.0F, 3.0F); this.batLeftWing.setRotationPoint(3.0F, 0.0F, 3.0F); this.batBody.rotateAngleX = (float)Math.PI; this.batRightWing.rotateAngleX = -0.15707964F; this.batRightWing.rotateAngleY = -((float)Math.PI * 2F / 5F); this.batOuterRightWing.rotateAngleY = -1.7278761F; this.batLeftWing.rotateAngleX = this.batRightWing.rotateAngleX; this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; this.batOuterLeftWing.rotateAngleY = -this.batOuterRightWing.rotateAngleY; } else { float f1 = (180F / (float)Math.PI); this.batHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); this.batHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); this.batHead.rotateAngleZ = 0.0F; this.batHead.setRotationPoint(0.0F, 0.0F, 0.0F); this.batRightWing.setRotationPoint(0.0F, 0.0F, 0.0F); this.batLeftWing.setRotationPoint(0.0F, 0.0F, 0.0F); this.batBody.rotateAngleX = ((float)Math.PI / 4F) + MathHelper.cos(p_78087_3_ * 0.1F) * 0.15F; this.batBody.rotateAngleY = 0.0F; this.batRightWing.rotateAngleY = MathHelper.cos(p_78087_3_ * 1.3F) * (float)Math.PI * 0.25F; this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; this.batOuterRightWing.rotateAngleY = this.batRightWing.rotateAngleY * 0.5F; this.batOuterLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY * 0.5F; } }
protected Biome(Biome.BiomeProperties properties) { this.biomeName = properties.biomeName; this.baseHeight = properties.baseHeight; this.heightVariation = properties.heightVariation; this.temperature = properties.temperature; this.rainfall = properties.rainfall; this.waterColor = properties.waterColor; this.enableSnow = properties.enableSnow; this.enableRain = properties.enableRain; this.baseBiomeRegName = properties.baseBiomeRegName; this.theBiomeDecorator = this.createBiomeDecorator(); this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntitySheep.class, 12, 4, 4)); this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityPig.class, 10, 4, 4)); this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityChicken.class, 10, 4, 4)); this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityCow.class, 8, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySpider.class, 100, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityZombie.class, 95, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityZombieVillager.class, 5, 1, 1)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySkeleton.class, 100, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityCreeper.class, 100, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySlime.class, 100, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEnderman.class, 10, 1, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityWitch.class, 5, 1, 1)); this.spawnableWaterCreatureList.add(new Biome.SpawnListEntry(EntitySquid.class, 10, 4, 4)); this.spawnableCaveCreatureList.add(new Biome.SpawnListEntry(EntityBat.class, 10, 8, 8)); }
protected void rotateCorpse(EntityBat entityLiving, float p_77043_2_, float p_77043_3_, float partialTicks) { if (entityLiving.getIsBatHanging()) { GlStateManager.translate(0.0F, -0.1F, 0.0F); } else { GlStateManager.translate(0.0F, MathHelper.cos(p_77043_2_ * 0.3F) * 0.1F, 0.0F); } super.rotateCorpse(entityLiving, p_77043_2_, p_77043_3_, partialTicks); }
/** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { if (((EntityBat)entityIn).getIsBatHanging()) { this.batHead.rotateAngleX = headPitch * 0.017453292F; this.batHead.rotateAngleY = (float)Math.PI - netHeadYaw * 0.017453292F; this.batHead.rotateAngleZ = (float)Math.PI; this.batHead.setRotationPoint(0.0F, -2.0F, 0.0F); this.batRightWing.setRotationPoint(-3.0F, 0.0F, 3.0F); this.batLeftWing.setRotationPoint(3.0F, 0.0F, 3.0F); this.batBody.rotateAngleX = (float)Math.PI; this.batRightWing.rotateAngleX = -0.15707964F; this.batRightWing.rotateAngleY = -((float)Math.PI * 2F / 5F); this.batOuterRightWing.rotateAngleY = -1.7278761F; this.batLeftWing.rotateAngleX = this.batRightWing.rotateAngleX; this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; this.batOuterLeftWing.rotateAngleY = -this.batOuterRightWing.rotateAngleY; } else { this.batHead.rotateAngleX = headPitch * 0.017453292F; this.batHead.rotateAngleY = netHeadYaw * 0.017453292F; this.batHead.rotateAngleZ = 0.0F; this.batHead.setRotationPoint(0.0F, 0.0F, 0.0F); this.batRightWing.setRotationPoint(0.0F, 0.0F, 0.0F); this.batLeftWing.setRotationPoint(0.0F, 0.0F, 0.0F); this.batBody.rotateAngleX = ((float)Math.PI / 4F) + MathHelper.cos(ageInTicks * 0.1F) * 0.15F; this.batBody.rotateAngleY = 0.0F; this.batRightWing.rotateAngleY = MathHelper.cos(ageInTicks * 1.3F) * (float)Math.PI * 0.25F; this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; this.batOuterRightWing.rotateAngleY = this.batRightWing.rotateAngleY * 0.5F; this.batOuterLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY * 0.5F; } }
public Biome(Biome.BiomeProperties properties) { this.biomeName = properties.biomeName; this.baseHeight = properties.baseHeight; this.heightVariation = properties.heightVariation; this.temperature = properties.temperature; this.rainfall = properties.rainfall; this.waterColor = properties.waterColor; this.enableSnow = properties.enableSnow; this.enableRain = properties.enableRain; this.baseBiomeRegName = properties.baseBiomeRegName; this.theBiomeDecorator = this.createBiomeDecorator(); this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntitySheep.class, 12, 4, 4)); this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityPig.class, 10, 4, 4)); this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityChicken.class, 10, 4, 4)); this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityCow.class, 8, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySpider.class, 100, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityZombie.class, 100, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySkeleton.class, 100, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityCreeper.class, 100, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySlime.class, 100, 4, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEnderman.class, 10, 1, 4)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityWitch.class, 5, 1, 1)); this.spawnableWaterCreatureList.add(new Biome.SpawnListEntry(EntitySquid.class, 10, 4, 4)); this.spawnableCaveCreatureList.add(new Biome.SpawnListEntry(EntityBat.class, 10, 8, 8)); this.addDefaultFlowers(); }
public static void onPreInit() { PossessHandler.registerHandler(new BlazeHandler()); PossessHandler.registerHandler(new ChickenHandler()); PossessHandler.registerHandler(new CreeperHandler()); PossessHandler.registerHandler(new DragonHandler()); PossessHandler.registerHandler(new EndermanHandler()); PossessHandler.registerHandler(new FlyingHandler(EntityFlying.class, new ResourceLocation(Possessed.MODID, "flying"))); PossessHandler.registerHandler(new FlyingHandler(EntityBat.class, new ResourceLocation(Possessed.MODID, "bat_flying"))); PossessHandler.registerHandler(new FlyingHandler(EntityBlaze.class, new ResourceLocation(Possessed.MODID, "blaze_flying"))); PossessHandler.registerHandler(new GhastHandler()); PossessHandler.registerHandler(new GrassEatHandler(EntityCow.class, new ResourceLocation(Possessed.MODID, "cow_grass"))); PossessHandler.registerHandler(new GrassEatHandler(EntityChicken.class, new ResourceLocation(Possessed.MODID, "chicken_grass"))); PossessHandler.registerHandler(new GrassEatHandler(EntityPig.class, new ResourceLocation(Possessed.MODID, "pig_grass"))); PossessHandler.registerHandler(new GrassEatHandler(EntityHorse.class, new ResourceLocation(Possessed.MODID, "horse_grass"))); PossessHandler.registerHandler(new GuardianHandler()); PossessHandler.registerHandler(new IronGolemHandler()); PossessHandler.registerHandler(new OcelotHandler()); PossessHandler.registerHandler(new PolarBearHandler()); PossessHandler.registerHandler(new RabbitHandler()); PossessHandler.registerHandler(new SheepHandler()); PossessHandler.registerHandler(new ShulkerHandler()); PossessHandler.registerHandler(new SkeletonHandler()); PossessHandler.registerHandler(new SlimeHandler()); PossessHandler.registerHandler(new SnowmanHandler()); PossessHandler.registerHandler(new SpiderHandler()); PossessHandler.registerHandler(new SquidHandler()); PossessHandler.registerHandler(new WaterMobHandler()); PossessHandler.registerHandler(new WitherHandler()); PossessHandler.registerHandler(new ZombieHandler()); }
private Entity findTarget() { Iterator iter = worldObj.loadedEntityList.iterator(); Entity target = null; double priority = 0; while(iter.hasNext()) { Entity e = (Entity) iter.next(); if (e != this && !e.isDead && (!(e instanceof EntityLivingBase) || ((EntityLivingBase)e).getHealth()>0) && (!(e instanceof EntityRhodes) || (RivalRebels.rhodesFF && (RivalRebels.rhodesCC || ((EntityRhodes)e).colorType != colorType))) && !( e instanceof EntityThrowable || e instanceof EntityInanimate || e instanceof EntityItem || e instanceof EntityAnimal || e instanceof EntityVillager || e instanceof EntityBat || e instanceof EntitySquid || e instanceof EntityBoat || e instanceof EntityMinecart)) { double prio = getPriority(e)-getDistanceToEntity(e); if (prio > priority) { target = e; priority = prio; } } } return target; }
@Hook("biomesoplenty.common.item.ItemJarEmpty#func_111207_a") public static Hook.Result itemInteractionForEntity(ItemJarEmpty empty, ItemStack stack, EntityPlayer player, EntityLivingBase target, EnumHand hand) { if (Always.isServer() && target.getClass() == EntityBat.class) { target.setDead(); stack.setCount(stack.getCount() - 1); ItemStack batJar = new ItemStack(BOPItems.jar_filled, 1, FOREST_BAT.ordinal()); EntityItem batJarEntity = new EntityItem(player.world, player.posX, player.posY, player.posZ, batJar); player.world.spawnEntity(batJarEntity); if (!(player instanceof FakePlayer)) batJarEntity.onCollideWithPlayer(player); return Hook.Result.TRUE; } return Hook.Result.VOID; }
public static void releaseBat(ItemStack stack, World world, EntityPlayer player, Vec3d releasePoint) { EntityBat bat = new EntityBat(world); bat.setLocationAndAngles(releasePoint.x, releasePoint.y, releasePoint.z, MathHelper.wrapDegrees(world.rand.nextFloat() * 360.0F), 0.0F); world.spawnEntity(bat); bat.playLivingSound(); if (stack.hasDisplayName()) bat.setCustomNameTag(stack.getDisplayName()); }