Jump to content

najib333

Members
  • Posts

    16
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

najib333's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thanks! Its working now. Was wondering, is there a way my custom entity can interact with the chest and store its items inside? Hopper can be used but is there a way to let the entity interact with the chest?
  2. Hey guys, I managed to find chest nearby a custom entity that i had made but the problem is that sometimes it work, and sometimes it doesn't. I've been figuring out what is causing the problem but have no solution to it. Here is the code: public boolean findChest() { Vec3 vec = new Vec3(this.posX, this.posY, this.posZ); xPos = vec.xCoord; yPos = vec.yCoord; zPos = vec.zCoord; for (double x = xPos-10; x < xPos+10; x++) { for (double z = zPos-10; z < zPos+10; z++) { pos = new BlockPos(x, yPos, z); if (this.worldObj.getBlockState(pos) == Blocks.chest.getDefaultState()) { PathEntity path = this.getNavigator().getPathToXYZ(x, yPos, z); this.getNavigator().setPath(path, 0.; return true; } } } return false; } public void onUpdate() { super.onUpdate(); if(findChest()) { System.out.println("Success!!"); } } It doesnt seem to go into this statement sometimes for some reason " if (this.worldObj.getBlockState(pos) == Blocks.chest.getDefaultState()) " Any kind soul that can help?
  3. Ok i managed to solved it. I spent hours learning Inventories in the EntityVillager.class and found out these method links the custom inventory: Cheers
  4. Maybe because not all blocks can be smelted? Try to check for the block first.
  5. I think that the tutorial is just for creating a new inventory. How do i change over the entities inventory instead? Im on 1.8.
  6. Hello guys, Im still trying to understand on how you make a custom GUI inventory for a custom Entity. I searched online and found and made it to work. The problem is that I can't seem to make the Entity store the items that it picks up into the custom Inventory GUI. I have tested on the Entity and it is working only to see the GUI Inventory and storing items to it but not storing picked up items. Heres my Entity class:
  7. Hello guys, Im wondering is there a way for us to find an Entity A position from another Entity, Entity B. Im working on a mod that makes Entity B keep a distance away from Entity A when its health gets below a certain amount. I tried finding the Entity position but i got null by using target.getPosition.getX,Y,Z(); where target is the EntityClass. Thanks
  8. Hello, Is there a way to move our own player by any actions like onItemUse or onItemRightClick? And is it even possible to make our player wander on its own? I know that we can make all of this on an entity but im working on an AI MOD for our player itself where it wanders around without me controlling it. Help would be appreciated. Cheers
  9. Thanks. I managed to solve it.
  10. Thanks for ur reply. I just want to know how do i check for the itemstack im currently holding. I know that we need to use the player.inventory.getCurrentItem(); I want to check for my custom item. The method returns an ItemStack. How do i check if the player is holding my Custom Item? Thanks
  11. I tried passing a boolean in my onItemUse method to my shouldExecute but it didnt read. I want it to execute when i right click on an item. Is that possible?
  12. Hello guys, Is there really a way to enable or disable certain task using items or right clicks on blocks? Im working on a MOD that uses an item to actually move my custom AI forward, sideways or backwards. Ive managed to create a class that extends EntityAIBase and is working fine. I just want to know is it possible for me to add or remove the task to my custom AI ingame by using custom items? Lets say my AI is idle, when i use an item, the ai will move 5 blocks to the front, back, right or left, either one. This is what i want. Cheers
  13. Hello people, Im new to minecraft forge modding and have found out a few tutorials on some basic stuffs like creating items and blocks. I found a code that was used to make the item do something which is onItemRightClick. I tried to do the tutorial and it doesnt work. The item that i had created does nothing when i right click it. Here is the source code: public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntitySnowball(par2World, par3EntityPlayer)); } return par1ItemStack; } I had register the items and tried it ingame and it works. But when i right click the item, nothing happens. Im using the latest ForgeGradle for Minecraft 1.8 Any solutions? Thanks
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.