Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class EntityCreepino extends EntityMob implements IRangedAttackMob
- {
- private static final DataParameter<Integer> SPOT_COLOR = EntityDataManager.<Integer>createKey(EntitysheepGunner.class, DataSerializers.VARINT);
- private static final String[] TEXTURES = new String[] {"textures/entity/creepino/creepino_white.png", "textures/entity/creepino/creepino_red.png"};
- private final String[] TexturesArray = new String[3];
- private String texturePrefix;
- private static final String[] TEXTURES_ABBR = new String[] {"cw", "cr"};
- World world = null;
- public EntityCreepino(World var1)
- {
- super(var1);
- world = var1;
- experienceValue = 5;
- this.isImmuneToFire = false;
- addRandomArmor();
- setNoAI(!true);
- this.tasks.addTask(0, new EntityAISwimming(this));
- this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
- this.tasks.addTask(8, new EntityAILookIdle(this));
- this.tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
- this.tasks.addTask(3, new EntityAIAttackMelee(this, 1.0D, false));
- this.tasks.addTask(4, new EntityAILeapAtTarget(this, 0.8F));
- this.targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
- this.targetTasks.addTask(6, new EntityAINearestAttackableTarget(this, EntityChicken.class, true));
- this.targetTasks.addTask(5, new EntityAIHurtByTarget(this, false));
- this.tasks.addTask(1, new EntityAILookIdle(this));
- this.tasks.addTask(1, new EntityAIWander(this, 0.8D));
- this.tasks.addTask(1, new EntityAIAttackRanged(this, 1.25D, 20, 10.0F));
- }
- public void setSpot(int variant)
- {
- this.dataManager.set(SPOT_COLOR, Integer.valueOf(variant));
- }
- public int getSpot()
- {
- return ((Integer)this.dataManager.get(SPOT_COLOR)).intValue();
- }
- protected void entityInit()
- {
- super.entityInit();
- this.dataManager.register(SPOT_COLOR, Integer.valueOf(0));
- }
- public void writeEntityToNBT(NBTTagCompound compound)
- {
- super.writeEntityToNBT(compound);
- compound.setInteger("Variant", this.getSpot());
- }
- public void readEntityFromNBT(NBTTagCompound compound)
- {
- super.readEntityFromNBT(compound);
- this.setSpot(compound.getInteger("Variant"));
- }
- private void resetTexturePrefix()
- {
- this.texturePrefix = null;
- }
- @SideOnly(Side.CLIENT)
- private void setTexturePaths()
- {
- int i = this.getSpot();
- int j = (i & 255) % 7;
- int k = ((i & 65280) >> 8) % 5;
- this.TexturesArray[0] = TexturesArray[j];
- this.texturePrefix = "creepino/" + TEXTURES_ABBR[j] + TEXTURES[k];
- }
- @SideOnly(Side.CLIENT)
- public String[] getVariantTexturePaths()
- {
- if (this.texturePrefix == null)
- {
- this.setTexturePaths();
- }
- return this.TexturesArray;
- }
- @SideOnly(Side.CLIENT)
- public String getTexture()
- {
- if (this.texturePrefix == null)
- {
- this.setTexturePaths();
- }
- return this.texturePrefix;
- }
- protected void applyEntityAttributes(){
- super.applyEntityAttributes();
- this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.15D);
- this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(12D);
- if(this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE)!=null)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(1.5D);
- }
- protected void addRandomArmor(){
- }
- public void onLivingUpdate() {
- super.onLivingUpdate();
- World par1World = this.world;
- int par2 = (int) this.posX;
- int par3 = (int) this.posY;
- int par4 = (int) this.posZ;
- Random par5Random = this.rand;
- if(true)
- for (int l = 0; l < 6; ++l)
- {
- double d0 = (double)((float)par2 + par5Random.nextFloat());
- double d1 = (double)((float)par3 + par5Random.nextFloat());
- double d2 = (double)((float)par4 + par5Random.nextFloat());
- double d3 = 0.0D;
- double d4 = 0.0D;
- double d5 = 0.0D;
- int i1 = par5Random.nextInt(2) * 2 - 1;
- d3 = ((double)par5Random.nextFloat() - 0.5D) * 0.49999999850988386D;
- d4 = ((double)par5Random.nextFloat() - 0.5D) * 0.49999999850988386D;
- d5 = ((double)par5Random.nextFloat() - 0.5D) * 0.49999999850988386D;
- par1World.spawnParticle(EnumParticleTypes.SLIME, d0, d1, d2, d3, d4, d5);
- }
- }
- public void attackEntityWithRangedAttack(EntityLivingBase target, float flval){
- EntityArrowCustom entityarrow = new EntityArrowCustom(this.world, this);
- double d0 = target.posY + (double)target.getEyeHeight() - 1.1;
- double d1 = target.posX - this.posX;
- double d2 = d0 - entityarrow.posY;
- double d3 = target.posZ - this.posZ;
- float f = MathHelper.sqrt(d1 * d1 + d3 * d3) * 0.2F;
- entityarrow.setThrowableHeading(d1, d2 + (double)f, d3, 1.6F, 12.0F);
- this.world.spawnEntity(entityarrow);
- }
- @Override
- protected Item getDropItem()
- {
- return new ItemStack(ItemHandler.Essence, 3, 3).getItem();
- }
- @Override
- protected net.minecraft.util.SoundEvent getAmbientSound()
- {
- return (net.minecraft.util.SoundEvent)net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("meepersplus:creepinoScreech"));
- }
- @Override
- protected net.minecraft.util.SoundEvent getHurtSound()
- {
- return (net.minecraft.util.SoundEvent)net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("meepersplus:creepinoHurt"));
- }
- @Override
- protected net.minecraft.util.SoundEvent getDeathSound()
- {
- return (net.minecraft.util.SoundEvent)net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("meepersplus:creepinoDeath"));
- }
- @Override
- public void onStruckByLightning(EntityLightningBolt entityLightningBolt){
- super.onStruckByLightning(entityLightningBolt);
- int i = (int)this.posX;
- int j = (int)this.posY;
- int k = (int)this.posZ;
- Entity entity = this;
- j += 1;
- entity.motionY += 0.5;
- entity.setFire(1);
- }
- @Override
- public void fall(float l, float d){
- super.fall(l,d);
- int i = (int)this.posX;
- int j = (int)this.posY;
- int k = (int)this.posZ;
- super.fall(l,d);
- Entity entity = this;
- }
- @Override
- public void onDeath(DamageSource source){
- super.onDeath(source);
- int i = (int)this.posX;
- int j = (int)this.posY;
- int k = (int)this.posZ;
- Entity entity = this;
- }
- @Override
- protected boolean processInteract(EntityPlayer entity, EnumHand hand) {
- super.processInteract(entity,hand);
- int i = (int)this.posX;
- int j = (int)this.posY;
- int k = (int)this.posZ;
- return true;
- }
- @Override
- protected float getSoundVolume()
- {
- return 1.0F;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment