
MikeDark
Members-
Posts
54 -
Joined
-
Last visited
Everything posted by MikeDark
-
How to spend my coal in campfire without having items?
MikeDark replied to MikeDark's topic in Modder Support
use coal. Sorry for my bad english, I'm not fluent :p -
How to spend my coal in campfire without having items?
MikeDark replied to MikeDark's topic in Modder Support
I like to do my campfire be spending coal without having items to burn -
I'm doing a mod called Scoutcraft, and I am finishing my campfire, but is missing just one detail that I am not able to do, do spend the fuel without having items to be processed, please help me ... My TileEntity: package mike.scoutcraft.tileentity; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import mike.scoutcraft.blocks.Fogueira; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityFogueira extends TileEntity implements ISidedInventory { private String localizeName; private static final int[] slots_top = new int[] {0,}; private static final int[] slots_bottom = new int[] {2, 1}; private static final int[] slots_sides = new int[] {1}; private ItemStack[] slots = new ItemStack[3]; public int fogueiraSpeed = 300; public int power; public int maxPower = 51200; public int cookTime; @SideOnly(Side.CLIENT) public int getFogueiraProgressScaled(int i) { return this.cookTime * i / this.fogueiraSpeed; } @SideOnly(Side.CLIENT) public int getpowerRemainingScaled(int i) { return this.power * i / this.maxPower; } public int getSizeInventory(){ return this.slots.length; } public String getInventoryName(){ return this.hasCustomInventoryName() ? this.localizeName : "container.Fogueira"; } public boolean hasCustomInventoryName(){ return this.localizeName != null && this.localizeName.length() > 0; } public void setGuiDisplayName(String displayName) { this.localizeName = displayName; } @Override public void closeInventory() { } @Override public ItemStack decrStackSize(int i, int j) { if(this.slots[i] != null){ ItemStack itemstack; if(this.slots[i].stackSize <= j){ itemstack = this.slots[i]; this.slots[i] = null; return itemstack; }else{ itemstack = this.slots[i].splitStack(j); if(this.slots[i].stackSize == 0){ this.slots[i] = null; } return itemstack; } } return null; } @Override public int getInventoryStackLimit() { return 64; } @Override public ItemStack getStackInSlot(int i) { return this.slots[i]; } @Override public ItemStack getStackInSlotOnClosing(int i) { if(this.slots[i] != null){ ItemStack itemstack = this.slots[i]; this.slots[i] = null; return itemstack; } return null; } public void readFromNBT(NBTTagCompound nbt){ super.readFromNBT(nbt); NBTTagList nbttaglist = nbt.getTagList("Items", 10); this.slots = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.getCompoundTagAt(i); byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.slots.length) { this.slots[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } this.power = nbt.getShort("power"); this.cookTime = nbt.getShort("CookTime"); if (nbt.hasKey("CustomName")) { this.localizeName = nbt.getString("CustomName"); } } public void writeToNBT(NBTTagCompound nbt){ super.writeToNBT(nbt); nbt.setShort("power", (short)this.power); nbt.setShort("CookTime", (short)this.cookTime); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.slots.length; ++i) { if (this.slots[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); this.slots[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } nbt.setTag("Items", nbttaglist); if (this.hasCustomInventoryName()) { nbt.setString("CustomName", this.localizeName); } } public boolean hasPower(){ return this.power > 0; } public boolean isFogueira(){ return this.cookTime > 0; } public void updateEntity(){ boolean flag = this.hasPower(); boolean flag1= false; if(hasPower() && this.isFogueira()) { this.power--; } if(!worldObj.isRemote) { if (this.hasItemPower(this.slots[1]) && this.power < (this.maxPower - this.getItempower(this.slots[1]))) { this.power += getItempower(this.slots[1]); if(this.slots[1] != null) { flag1 = true; this.slots[1].stackSize--; if(this.slots[1].stackSize == 0) { this.slots[1] = this.slots[1].getItem().getContainerItem(this.slots[1]); } } } if (hasPower() && canSmelt()) { cookTime++; if (this.cookTime == this.fogueiraSpeed) { this.cookTime = 0; this.smeltItem(); flag1 = true; } }else{ cookTime = 0; } if (flag != this.isFogueira()) { flag1 = true; Fogueira.updateFogueiraBlockState(this.isFogueira(), this.worldObj, this.xCoord, this.yCoord, this.zCoord); } if(this.cookTime > 0){ flag1 = true; Fogueira.updateFogueiraBlockState(this.isFogueira(), this.worldObj, this.xCoord, this.yCoord, this.zCoord); }else{ flag1 = true; Fogueira.updateFogueiraBlockState(this.isFogueira(), this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } if (flag1) { this.markDirty(); } } private boolean canSmelt(){ if (slots[0] == null) { return false; } ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]); if (itemstack == null) { return false; } if (slots[2] == null) { return true; } if (!slots[2].isItemEqual(itemstack)) { return false; } if (slots[2].stackSize < getInventoryStackLimit() && slots[2].stackSize < slots[2].getMaxStackSize()) { return true; }else{ return slots[2].stackSize < itemstack.getMaxStackSize(); } } public void smeltItem(){ if(this.canSmelt()){ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]); if(this.slots[2] == null){ this.slots[2] = itemstack.copy(); }else if(this.slots[2].isItemEqual(itemstack)){ this.slots[2].stackSize += itemstack.stackSize; } this.slots[0].stackSize--; if(this.slots[0].stackSize <= 0){ this.slots[0] = null; } } } public static int getItempower(ItemStack itemstack){ if(itemstack == null){ return 0; }else{ Item item = itemstack.getItem(); if(item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) { Block block = Block.getBlockFromItem(item);; if(block == Blocks.sapling) return 100; if(block == Blocks.coal_block) return 14400; if(block == Blocks.log) return 200; if(block == Blocks.log2) return 200; if(block == Blocks.planks) return 50; if(block == Blocks.wooden_slab)return 150; if(block == Blocks.wooden_pressure_plate)return 150; if(block == Blocks.wooden_door)return 150; if(block == Blocks.wooden_button)return 150; } if(item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; if(item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; if(item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; if(itemstack.getItem() == Items.coal) return 1600; if(item == Items.stick) return 100; if(item == Items.lava_bucket) return 20000; if(item == Items.blaze_rod) return 2400; return GameRegistry.getFuelValue(itemstack); } } public static boolean hasItemPower(ItemStack itemstack){ return getItempower(itemstack) > 0; } @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return i == 2 ? false : (i == 1 ? hasItemPower(itemstack) : true); } @Override public boolean isUseableByPlayer(EntityPlayer entityplayer) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : entityplayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; } @Override public void openInventory() { } @Override public void setInventorySlotContents(int i, ItemStack itemstack) { this.slots[i] = itemstack; if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()){ itemstack.stackSize = this.getInventoryStackLimit(); } } @Override public boolean canExtractItem(int i, ItemStack itemstack, int j) { return j != 0 || i != 1 || itemstack.getItem() == Items.bucket; } @Override public boolean canInsertItem(int i, ItemStack itemstack, int j) { return this.isItemValidForSlot(i, itemstack); } @Override public int[] getAccessibleSlotsFromSide(int arg0) { return arg0 == 0 ? slots_bottom : (arg0 == 1 ? slots_top : slots_sides); } }
-
As I put the following code is probably wrong since my monster did not attack ... public void onUpdate(Entity entity, DamageSource par1DamageSource, int par2){ super.onUpdate(); if(entity instanceof EntityPlayer) { entity.attackEntityFrom(par1DamageSource, par2); } }
-
friend did not quite understand, this command suggested by you does not exist ...
-
I would make my flying mob attack colliding with the player, but I can not do since we can not use artificial intelligence because the movements do not work if I use, so I used a code that makes my death attack, but did not work and he is flying out there... Part of my class attack death: @Override public void attackEntity(Entity entity, float arg1) { this.arrowHitTimer++; if (this.arrowHitTimer == 20) { if(entity instanceof EntityPlayer) { Vec3 look = this.getLookVec(); if(!(arg1 <= 2)){ EntityWitherSkull var3 = new EntityWitherSkull(this.worldObj, this, 1, 1, 1); var3.setPosition(this.posX + look.xCoord * 1, this.posY + look.yCoord * 1, this.posZ + look.zCoord * 1); var3.accelerationX = look.xCoord * 0.1; var3.accelerationY = look.yCoord * 0.1; var3.accelerationZ = look.zCoord * 0.1; this.worldObj.spawnEntityInWorld(var3); this.arrowHitTimer = -40; }else{ this.arrowHitTimer = -20; attackEntityAsMob(entity); } } } } } Part of my class attack ghost: public void attackEntity(Entity entity, float arg1) { this.arrowHitTimer++; if (this.arrowHitTimer == 20) { if(entity instanceof EntityPlayer) { this.arrowHitTimer = -20; attackEntityAsMob(entity); } } } My Ghost Class: package mike.bathicraft.mob; import mike.bathicraft.entity.EntityFlyingMob; import mike.bathicraft.items.GerenciadorDeItems; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIFleeSun; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIRestrictSun; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityWitherSkull; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; public class EntityFantasma extends EntityFlyingMob { public int courseChangeCooldown; public double waypointX; public double waypointY; public double waypointZ; public EntityFantasma(World world) { super(world); this.setSize(0.9F, 1.9F); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.4D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(15.0D); } protected Item getDropItem(){ return Items.iron_ingot; } protected void dropRareDrop(int par1){ switch (this.rand.nextInt(3)){ case 0: this.dropItem(Items.iron_sword, 1); } } @Override protected void updateEntityActionState() { double var1 = this.waypointX - this.posX; double var3 = this.waypointY - this.posY; double var5 = this.waypointZ - this.posZ; double var7 = var1 * var1 + var3 * var3 + var5 * var5; if (var7 < 1.0D || var7 > 3600.0D) { this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); } if (this.courseChangeCooldown-- <= 0) { this.courseChangeCooldown += this.rand.nextInt(5) + 2; var7 = (double)MathHelper.sqrt_double(var7); if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, var7)) { this.motionX += var1 / var7 * 0.1D; this.motionY += var3 / var7 * 0.1D; this.motionZ += var5 / var7 * 0.1D; } else { this.waypointX = this.posX; this.waypointY = this.posY; this.waypointZ = this.posZ; } } this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI; } private boolean isCourseTraversable(double par1, double par3, double par5, double par7) { double var9 = (this.waypointX - this.posX) / par7; double var11 = (this.waypointY - this.posY) / par7; double var13 = (this.waypointZ - this.posZ) / par7; AxisAlignedBB var15 = this.boundingBox.copy(); for (int var16 = 1; (double)var16 < par7; ++var16) { var15.offset(var9, var11, var13); if (!this.worldObj.getCollidingBoundingBoxes(this, var15).isEmpty()) { return false; } } return true; } public void attackEntity(Entity entity, float arg1) { this.arrowHitTimer++; if (this.arrowHitTimer == 20) { if(entity instanceof EntityPlayer) { this.arrowHitTimer = -20; attackEntityAsMob(entity); } } } } My Flying Mob Class: package mike.bathicraft.entity; import net.minecraft.block.Block; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.monster.EntityMob; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class EntityFlyingMob extends EntityMob{ public EntityFlyingMob(World world) { super(world); } protected void fall(float par1) {} /** * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround */ protected void updateFallState(double par1, boolean par3) {} /** * Moves the entity based on the specified heading. Args: strafe, forward */ public void moveEntityWithHeading(float par1, float par2) { if (this.isInWater()) { this.moveFlying(par1, par2, 0.02F); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.800000011920929D; this.motionY *= 0.800000011920929D; this.motionZ *= 0.800000011920929D; } else if (this.handleLavaMovement()) { this.moveFlying(par1, par2, 0.02F); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.5D; this.motionY *= 0.5D; this.motionZ *= 0.5D; } else { float var3 = 0.91F; if (this.onGround) { var3 = 0.54600006F; Block var4 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); } float var8 = 0.16277136F / (var3 * var3 * var3); this.moveFlying(par1, par2, this.onGround ? 0.1F * var8 : 0.02F); var3 = 0.91F; if (this.onGround) { var3 = 0.54600006F; Block var5 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); } this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= (double)var3; this.motionY *= (double)var3; this.motionZ *= (double)var3; } this.prevLimbSwingAmount = this.limbSwingAmount; double var10 = this.posX - this.prevPosX; double var9 = this.posZ - this.prevPosZ; float var7 = MathHelper.sqrt_double(var10 * var10 + var9 * var9) * 4.0F; if (var7 > 1.0F) { var7 = 1.0F; } this.limbSwingAmount += (var7 - this.limbSwingAmount) * 0.4F; this.limbSwing += this.limbSwingAmount; } /** * returns true if this entity is by a ladder, false otherwise */ public boolean isOnLadder() { return false; } }
-
I would like to make a monster that attacks you physically flying, but the eclipse don't open the references classes, and researching on the internet just find codes from older versions and end up not working, and extending to EntityFlying can not set the caused damage... My Ghost Class: package mike.bathicraft.mob; import mike.bathicraft.items.GerenciadorDeItems; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIFleeSun; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIRestrictSun; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class EntityFantasma extends EntityMob { public EntityFantasma(World world) { super(world); this.setSize(0.9F, 1.9F); this.experienceValue = 5; this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 12.0F)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.4D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(15.0D); } protected boolean isAIEnabled() { return true; } protected Item getDropItem(){ return Items.iron_ingot; } protected void dropRareDrop(int par1){ switch (this.rand.nextInt(3)){ case 0: this.dropItem(Items.iron_sword, 1); } } public boolean doesEntityNotTriggerPressurePlate() { return true; } protected void updateFallState(double par1, boolean par3) {} protected void fall(float par1) {} protected boolean canTriggerWalking() { return false; } }
-
Different method of attack according to the distance
MikeDark replied to MikeDark's topic in Modder Support
please help me, I need to finish is part of programming to continue my mod -
Different method of attack according to the distance
MikeDark replied to MikeDark's topic in Modder Support
I've been looking, I saw some things up, but to add to my mob, nothing happened... -
I am wanting to make my mob at a distance of up to 6 blocks attack colliding with the player and starting from 6 blocks begin to Wither Skulls attack, but I can not, but I don't know and need help of you... My Grim Reaper Entity Class: package mike.bathicraft.mob; import mike.bathicraft.items.GerenciadorDeItems; import mike.bathicraft.lib.Strings; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.boss.BossStatus; import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityLargeFireball; import net.minecraft.entity.projectile.EntityWitherSkull; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; public class EntityCeifador extends EntityMob implements IBossDisplayData{ private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0F, true); public EntityCeifador(World world) { super(world); isImmuneToFire = true; this.setSize(0.9F, 1.9F); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(26.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.45D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(2000.0D); } public void onLivingUpdate() { super.onLivingUpdate(); BossStatus.setBossStatus(this, true); } protected Item getDropItem(){ return GerenciadorDeItems.EssenciaDaMorte; } protected void dropRareDrop(int par1){ switch (this.rand.nextInt(3)){ case 0: this.dropItem(GerenciadorDeItems.EssenciaDaMorte, 12); } } protected String getLivingSound() { return "bathicraft:"; } protected String getHurtSound() { return "bathicraft:"; } protected String getDeathSound() { return "bathicraft:"; } protected void playStepSound(int par1, int par2, int par3, int par4) { this.worldObj.playSoundAtEntity(this, null, 0.15F, 1.0F); } public ItemStack getHeldItem() { return heldItem; } private static final ItemStack heldItem = new ItemStack(GerenciadorDeItems.Gadanha, 1); @Override public void attackEntity(Entity entity, float arg1) { this.arrowHitTimer++; if (this.arrowHitTimer == 20) { if(entity instanceof EntityPlayer) { Vec3 look = this.getLookVec(); EntityWitherSkull var3 = new EntityWitherSkull(this.worldObj, this, 1, 1, 1); var3.setPosition(this.posX + look.xCoord * 1, this.posY + look.yCoord * 1, this.posZ + look.zCoord * 1); var3.accelerationX = look.xCoord * 0.1; var3.accelerationY = look.yCoord * 0.1; var3.accelerationZ = look.zCoord * 0.1; this.worldObj.spawnEntityInWorld(var3); this.arrowHitTimer = -40; } }else { } } }
-
Entity Class: package mike.bathicraft.mob; import mike.bathicraft.items.GerenciadorDeItems; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IRangedAttackMob; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIArrowAttack; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityLargeFireball; import net.minecraft.entity.projectile.EntitySmallFireball; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; public class EntityMage extends EntityMob implements IRangedAttackMob{ private int explosionStrength = 1; private Entity targetedEntity = null; public EntityMage(World world) { super(world); isImmuneToFire = true; this.setSize(0.9F, 1.9F); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIArrowAttack(this, 0.25F, 20, 10.0F)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 12.0F)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.4D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(120.0D); } protected boolean isAIEnabled() { return true; } @Override protected boolean isValidLightLevel() { return true; } @Override public boolean getCanSpawnHere() { return true; } public ItemStack getHeldItem() { return heldItem; } private static final ItemStack heldItem = new ItemStack(GerenciadorDeItems.CetroDeFogo, 1); protected Item getDropItem(){ return Items.blaze_powder; } protected void dropRareDrop(int par1){ switch (this.rand.nextInt(3)){ case 0: this.dropItem(GerenciadorDeItems.CetroDeFogo, 1); } } protected void playStepSound(int par1, int par2, int par3, int par4) { this.worldObj.playSoundAtEntity(this, null, 0.15F, 1.0F); } @Override public void attackEntityWithRangedAttack(EntityLivingBase entity, float arg1) { Vec3 look = this.getLookVec(); EntityLargeFireball var3 = new EntityLargeFireball(this.worldObj, this, 1, 1, 1); var3.setPosition(this.posX + look.xCoord * 1, this.posY + look.yCoord * 1, this.posZ + look.zCoord * 1); var3.accelerationX = look.xCoord * 0.3; var3.accelerationY = look.yCoord * 0.3; var3.accelerationZ = look.zCoord * 0.3; this.worldObj.spawnEntityInWorld(var3); } }
-
I recorded: http://youtu.be/iDZ7lLgi7YQ
-
I fix and now my body is firing fireballs, but after he started shooting for a part he did not "upgrade" and is always there to shoot, but if I get away and return back, he start shoot for one only direction, it returns with bug @Override public void attackEntityWithRangedAttack(EntityLivingBase entity, float arg1) { Vec3 look = this.getLookVec(); EntityLargeFireball var3 = new EntityLargeFireball(this.worldObj, this, 1, 1, 1); var3.setPosition(this.posX + look.xCoord * 1, this.posY + look.yCoord * 1, this.posZ + look.zCoord * 1); var3.accelerationX = look.xCoord * 0.3; var3.accelerationY = look.yCoord * 0.3; var3.accelerationZ = look.zCoord * 0.3; this.worldObj.spawnEntityInWorld(var3); }
-
and how I could change to the entity that will make the attack, i tried to change some parts,however at the end, just did not work
-
I used the following code, and it worked almost perfectly, the only problem is, the fireballs instead of being out of the mob are coming out of my player @Override public void attackEntityWithRangedAttack(EntityLivingBase entity, float arg1) { Vec3 look = entity.getLookVec(); EntityLargeFireball fireball2 = new EntityLargeFireball(worldObj); fireball2.setPosition(entity.posX + look.xCoord * 5, entity.posY + look.yCoord * 5, entity.posZ + look.zCoord * 5); fireball2.accelerationX = look.xCoord * 0.4; fireball2.accelerationY = look.yCoord * 0.4; fireball2.accelerationZ = look.zCoord * 0.4; this.worldObj.spawnEntityInWorld(fireball2); }
-
after spawn the mage, he simply ignored me, didn't even tried to attack me
-
sorry I had copied the wrong part of the code to post already updated it
-
I tried to adapt this code: pprotected void attackEntity(Entity entity, float f) { if (f < 10F) { double d = entity.posX - posX; double d1 = entity.posZ - posZ; if (attackTime == 0) { EntitySnowball entitysnowball = new EntitySnowball(worldObj, this); double d2 = (entity.posY + (double)entity.getEyeHeight()) - 1.1000000238418579D - entitysnowball.posY; float f1 = MathHelper.sqrt_double(d * d + d1 * d1) * 0.2F; worldObj.playSoundAtEntity(this, "random.bow", 1.0F, 1.0F / (rand.nextFloat() * 0.4F + 0.8F)); worldObj.spawnEntityInWorld(entitysnowball); entitysnowball.setThrowableHeading(d, d2 + (double)f1, d1, 1.6F, 12F); attackTime = 10; } rotationYaw = (float)((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F; hasAttacked = true; } }
-
I deleted the codes they were not working, I tried to adapt a part of the blaze and also Snowman replacing the snowball by fireball
-
I'm creating a mage that shoots balls of fire, however I can not do it and need your help, please help me ... My Entity Class: package mike.bathicraft.mob; import mike.bathicraft.items.GerenciadorDeItems; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIArrowAttack; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityLargeFireball; import net.minecraft.entity.projectile.EntitySmallFireball; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; public class EntityMage extends EntityMob{ public EntityMage(World world) { super(world); isImmuneToFire = true; this.setSize(0.9F, 1.9F); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 12.0F)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.4D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(120.0D); } protected boolean isAIEnabled() { return true; } @Override protected boolean isValidLightLevel() { return true; } @Override public boolean getCanSpawnHere() { return true; } public ItemStack getHeldItem() { return heldItem; } private static final ItemStack heldItem = new ItemStack(GerenciadorDeItems.CetroDeFogo, 1); protected Item getDropItem(){ return Items.blaze_powder; } protected void dropRareDrop(int par1){ switch (this.rand.nextInt(3)){ case 0: this.dropItem(GerenciadorDeItems.CetroDeFogo, 1); } } protected void playStepSound(int par1, int par2, int par3, int par4) { this.worldObj.playSoundAtEntity(this, null, 0.15F, 1.0F); } }
-
Even after you have entered all the codes my mob continues without animation ... http://pastebin.com/Uyntr8dg