
qpwoeiruty
Members-
Posts
159 -
Joined
-
Last visited
Everything posted by qpwoeiruty
-
I want to have my entity be able to break and place blocks but I am wondering how I would just go about breaking or placing anything at the moment. I see there is a breakBlock() method but I don't know how to use it correctly, or how to place a block. Any help would be appreciated, thanks.
-
Error when installing Forge: The assetDir is deprecated!
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
I am so confused. Last time I tried I got this error thing and it didn't work. Now it is working fine but nothing was downloaded when I installed so I thought it wouldn't work again. -
Error when installing Forge: The assetDir is deprecated!
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
Still the same thing. I read that I should reinstall JDK, but that had no effect either... -
Error when installing Forge: The assetDir is deprecated!
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
But I am already using the latest version... do I still need to update? -
Error when installing Forge: The assetDir is deprecated!
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
I am missing a bin folder and a .metadata folder so something isn't right. It installed too quickly and didn't download anything. -
Error when installing Forge: The assetDir is deprecated!
qpwoeiruty replied to qpwoeiruty's topic in Modder Support
Okay, I shall see what happens after installing it all. -
Error when installing Forge: The assetDir is deprecated!
qpwoeiruty posted a topic in Modder Support
I get this error when I try to install Forge. I get this error after typing "gradlew setupDecompWorkspace"... "The assetDir is deprecated! Use runDir instead! runDir set to eclipse/assets/.." If anyone knows why this happens it would be appreciated. -
Sorry I meant to say the entity's inventory that I am referring to. So I want to check when my entity's inventory closes within that entity class.
-
I have my entity class and need to check when an inventory closes, but I am not sure how to do it. Any ideas?
-
Thanks, I didn't know the skeleton used that but it sort of makes sense when you think about it. I think it should work fine for me thanks, just have to tinker some things.
-
I am trying to get my entity to swap between the two but I am not sure the best method to do this, or how to really.
-
I have a custom entity that I want to shoot the fire charge thing that the blaze shoots, I presume that it is the EntitySmallFireball but I don't understand how to do it because in the blaze class there is no attackEntityWithRangedAttack method which there is in the skeleton class for example.
-
I think it may have been because I forgot: @Override public boolean isAIEnabled() { return true; }
-
How do I make my custom zombie entity see the player from further away. I thought it was follow range but it doesn't seem to have an effect. package com.willr27.main.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveThroughVillage; import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; 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.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.DamageSource; import net.minecraft.world.World; public class EntityEnragedZombie extends EntityMob { public EntityEnragedZombie(World world) { super(world); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false)); this.setSize(0.6F, 1.8F); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(750.0D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D); } @Override public void onLivingUpdate() { super.onLivingUpdate(); } @Override public boolean attackEntityAsMob(Entity entity) { this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(10D); return entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue()); } }
-
Okay I am not sending to all anymore, but I don't understand how to implement the func_151247_a method into this: Blocklings.snw.sendTo(new MessageLevel(3), ...);
-
Well pathfinding is also a bit buggy, not sure if it is related but it could be. No worries, it isn't the end of the world... yet
-
Yeah the others work fine. It is literally just when they end up in water, no matter how, they just start to drown in water that is too deep.
-
I am trying to figure out packets and I have looked at diesieben07's tutorial on using SimpleNetworkWrapper. I believe I have everything setup correctly as in the tutorial, but I am unclear on how to send packets. I have an entity class that I am trying to sync so that my GUI can display some variables within it as text. I don't know what I am supposed to use for doing that, would it be something like this... Blocklings.network.sendToAll(message); ...where message would be my variable or am I completely wrong?
-
That's already there, I have all the required AI for the entity to swim I believe but it just isn't working.
-
Please someone I am still having trouble with this.
-
This is all of it, however a lot is probably not relevant. package com.blocklings.entity; import java.util.List; import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIFollowOwner; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInvBasic; import net.minecraft.inventory.InventoryBasic; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.pathfinding.PathEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import com.blocklings.gui.InventoryBlockling; import com.blocklings.main.Blocklings; import com.blocklings.network.CreatePacketServerSide; public class EntityBlockling extends EntityTameable implements IInvBasic{ Random random = new Random(); public int currentXP = 0; public int currentLevel = 1; public int requiredXP = 200; public double maxHealth = 2.0F; public double attackDamage = 1.0D; public double moveSpeed = 0.20D; public float moveTimer = 0.0F; public boolean moveTimerSwitch = true; public float attackTimer = 0.0F; public boolean attackTimerSwitch = true; public boolean isAttacking = false; public boolean hasSword = false; public float width = 0.5F; public float height = 0.55F; public InventoryBlockling gear; public EntityBlockling(World world) { super(world); this.setSize(this.width, this.height); this.getNavigator().setAvoidsWater(true); this.getNavigator().setCanSwim(true); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0D, false)); this.tasks.addTask(4, new EntityAIFollowOwner(this, 1.0D, 6.0F, 3.0F)); this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(7, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(3, new EntityAIOwnerHurtTarget(this)); this.setTamed(false); this.currentLevel = random.nextInt(10) + 1; this.setupGear(); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.maxHealth = 20.0D; this.attackDamage = 1.0D; this.moveSpeed = 0.20D; this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxHealth); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(this.moveSpeed); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.attackDamage); } @Override public void onLivingUpdate() { super.onLivingUpdate(); if (this.attackTimer > 0.0F) { this.attackTimer -= 1.0F; } this.hasSword = true; this.setEntitySize(); this.setBlocklingLevel(); this.calculateRequiredXP(); this.setMaxHealth(); this.setAttackDamage(); this.setMoveSpeed(); if(!this.worldObj.isRemote) { CreatePacketServerSide.sendS2CEntitySync(this); } } @Override public boolean attackEntityAsMob(Entity entity) { this.setXP(((int) this.attackDamage + random.nextInt(5) + 1) + this.currentXP); if (this.attackTimer <= 1.0F) { this.attackTimer = (float) random.nextInt(4) + 8; } return entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue()); } @Override public boolean interact(EntityPlayer entityPlayer) { ItemStack itemstack = entityPlayer.inventory.getCurrentItem(); Item yellowFlower = Item.getItemFromBlock(Blocks.yellow_flower); Item redFlower = Item.getItemFromBlock(Blocks.red_flower); Item tallFlower = Item.getItemFromBlock(Blocks.double_plant); if(itemstack != null && (itemstack.getItem() == yellowFlower || itemstack.getItem() == redFlower || itemstack.getItem() == tallFlower) && !this.isTamed() && !this.worldObj.isRemote) { if(random.nextInt(3) == 0) { this.setTamed(true); this.setPathToEntity((PathEntity) null); this.setAttackTarget((EntityLivingBase) null); this.func_152115_b(entityPlayer.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); } else { this.playTameEffect(false); this.worldObj.setEntityState(this, (byte) 6); } } if(this.func_152114_e(entityPlayer) && entityPlayer.isSneaking() && !this.worldObj.isRemote) { if(this.getCustomNameTag().length() > 0) { entityPlayer.openGui(Blocklings.modInstance, 0, this.worldObj, this.getEntityId(), 0, 0); } else { entityPlayer.openGui(Blocklings.modInstance, 0, this.worldObj, this.getEntityId(), 0, 0); } } if (this.func_152114_e(entityPlayer) && !entityPlayer.isSneaking() && !this.worldObj.isRemote) { this.aiSit.setSitting(!this.isSitting()); } return super.interact(entityPlayer); } /*@Override protected float applyArmorCalculations(DamageSource p_70655_1_, float p_70655_2_) { return 1.0F; }*/ @Override public boolean isAIEnabled() { return true; } @Override public boolean getCanSpawnHere() { int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.boundingBox.minY); int k = MathHelper.floor_double(this.posZ); int l = this.worldObj.getFullBlockLightValue(i, j, k); boolean s = this.worldObj.canBlockSeeTheSky(i, j, k); boolean b = this.worldObj.getBlock(i, j - 1, k) == Blocks.grass; List list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX + 1, posY + 1, posZ + 1).expand(16D, 512D, 16D)); return list.size() < 5 && l > 8 && b && s; } @Override public void onDeath(DamageSource ds) { super.onDeath(ds); if (gear != null && !this.worldObj.isRemote) { for (int i = 0; i < gear.getSizeInventory(); ++i) { ItemStack itemstack = gear.getStackInSlot(i); if (itemstack != null) { this.entityDropItem(itemstack, 0.0F); } } } } @Override public void onInventoryChanged(InventoryBasic var1) { } @Override public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setInteger("currentXP", this.currentXP); compound.setInteger("currentLevel", this.currentLevel); compound.setInteger("requiredXP", this.requiredXP); compound.setDouble("maxHealth", this.maxHealth); compound.setFloat("moveTimer", this.moveTimer); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.gear.getSizeInventory(); ++i) { ItemStack itemstack = this.gear.getStackInSlot(i); if (itemstack != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); itemstack.writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } compound.setTag("Items", nbttaglist); } } @Override public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); this.currentXP = compound.getInteger("currentXP"); this.currentLevel = compound.getInteger("currentLevel"); this.requiredXP = compound.getInteger("requiredXP"); this.maxHealth = compound.getDouble("maxHealth"); this.moveTimer = compound.getFloat("moveTimer"); NBTTagList nbttaglist = compound.getTagList("Items", 10); this.setupGear(); for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.gear.getSizeInventory()) { this.gear.setInventorySlotContents(j, ItemStack.loadItemStackFromNBT(nbttagcompound1)); } } } @Override public EntityAgeable createChild(EntityAgeable entityAgeable) { return null; } public void calculateRequiredXP() { this.requiredXP = (50 * (this.currentLevel * this.currentLevel) + (150 * this.currentLevel)); } public void setBlocklingLevel() { if (this.currentXP > this.requiredXP) { this.currentLevel = this.currentLevel + 1; this.calculateRequiredXP(); this.currentXP = 0; if(!this.worldObj.isRemote) { CreatePacketServerSide.sendS2CEntitySync(this); } } } public void setEntitySize() { if(this.currentLevel <= 10) { this.width = (float) (this.currentLevel * 0.14F) + 0.35F; this.height = (float) (this.currentLevel * 0.14F) + 0.4F; } else if(this.currentLevel > 10) { this.width = (float) (10 * 0.14F) + 0.35F; this.height = (float) (10 * 0.14F) + 0.4F; } setSize(this.width, this.height); } public void setMaxHealth() { if(this.currentLevel <= 10) { this.maxHealth = this.currentLevel * 2; } else if(this.currentLevel > 10) { this.maxHealth = 20; } this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxHealth); if(this.getHealth() > this.maxHealth) { this.heal(0.0F); } } public void setAttackDamage() { if(this.currentLevel <= 10) { this.attackDamage = this.currentLevel; } else if(this.currentLevel > 10) { this.attackDamage = 10; } this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(this.attackDamage); } public void setMoveSpeed() { if(this.currentLevel <= 10) { this.moveSpeed = 0.20D + ((double) this.currentLevel / 100); } else if(this.currentLevel > 10) { this.moveSpeed = 0.30D; } this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(this.moveSpeed); } private void setupGear() { InventoryBlockling gear1 = this.gear; this.gear = new InventoryBlockling("Inventory", howManySlots()); this.gear.func_110133_a(this.getCommandSenderName()); if (gear1 != null) { gear1.func_110132_b(this); int i = Math.min(gear1.getSizeInventory(), this.gear.getSizeInventory()); for (int j = 0; j < i; ++j) { ItemStack itemstack = gear1.getStackInSlot(j); if (itemstack != null) { this.gear.setInventorySlotContents(j, itemstack.copy()); } } gear1 = null; } this.gear.func_110134_a(this); } public int howManySlots() { return 22; } public int getLevel() { return this.currentLevel; } public void setLevel(int currentLevel) { this.currentLevel = currentLevel; } public int getXP() { return this.currentXP; } public void setXP(int currentXP) { this.currentXP = currentXP; } public double getMaximumHealth() { return this.maxHealth; } public void setMaximumHealth(double maxHealth) { this.maxHealth = maxHealth; } public double getAttackDamage() { return this.attackDamage; } public void setAttackDamage(double attackDamage) { this.attackDamage = attackDamage; } public int getRequiredXP() { return this.requiredXP; } public void setRequiredXP(int requiredXP) { this.requiredXP = requiredXP; } public float getAttackTimer() { return this.attackTimer; } public void setAttackTimer(float attackTimer) { this.attackTimer = attackTimer; } public boolean getHasSword() { return this.hasSword; } public void setHasSword(boolean hasSword) { this.hasSword = hasSword; } }
-
If there is any information that may be helpful please ask me.
-
Whenever I spawn my entity in water after a few seconds it will just sink to the bottom of the water and stay there until it drowns just bobbing along as if it were above the water. I don't really know why as I copied the AI straight from the wolf class and the wolves don't sink like that. Could it be to do with the fact the size of the entity changes as it grows when it levels up, I really don't know.
-
I have a button in my Gui for my entity and when I press it I want to change set the xp to 100 for example (xp being a custom variable I have within the entity class). It works when I press the button but then instantly reverts back to the original number. Is there anything wrong with this? public void actionPerformed(GuiButton button) { if(button.id == 0) { entityBlockling.setXP(100); } }
-
Would this work if I just went through all the biome ids like this: package com.blocklings.entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.world.biome.BiomeGenBase; import com.blocklings.main.Blocklings; import cpw.mods.fml.common.registry.EntityRegistry; public class RegisterBlockling { public static int biome = 0; public static void registerEntity() { createEntity(EntityBlockling.class, "entity_blockling", 0x79553A, 0x6FAE44); } public static void createEntity(Class entityClass, String entityName, int solidColour, int spotColour) { for(int i = 0; i < 1000; i++) { biome = i; } int randomID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomID); EntityRegistry.registerModEntity(entityClass, entityName, randomID, Blocklings.modInstance, 64, 1, true); EntityRegistry.addSpawn(entityName, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiome(biome)); CreateEgg(randomID, solidColour, spotColour); } private static void CreateEgg(int randomID, int solidColour, int spotColour) { EntityList.entityEggs.put(Integer.valueOf(randomID), new EntityList.EntityEggInfo(randomID, solidColour, spotColour)); } }