Jump to content

hugo_the_dwarf

Members
  • Posts

    334
  • Joined

  • Last visited

Everything posted by hugo_the_dwarf

  1. This is true, but judging from his code that he posted he understood enough of java for declaring and using variables. And thus I did not need to give him the full code of how to use it, but the methods and idea to do so.
  2. So a HUD item? look at this tutorial once it gets to the GUI: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and scroll to extended entity properties
  3. Sounds like a simple java programming question, I say go learn java, but just google "instanceof" I think that will help you solve your question but a snippet of code that does what you want (you want to see if a normal tileEntity is a type of your custom one?) just use "if(World.getTileEntity(x,y,z) instanceof myTileEntityClass)" I really recommend learning more Java.
  4. You look to be on the right track, I know I was going to ask this question on here, but with some playing around I figured it out myself. here is the onItemRightClick from one of my instant consumable items. @Override public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { int type = item.getItemDamage(); ExtendPlayerRotManaStam props = ExtendPlayerRotManaStam.get(player); if (type == 0) { props.regenMana(40); --item.stackSize; } else if (type == 1) { props.regenMana(10); --item.stackSize; } return item; } type is the item damage because this item has subtypes, but you have to return the altered stack, not just true; and your code is a bit overkill, remember it passes its own instance in that method so no need to "getCurrentEquipedItem" and since you're using it no need to check if they are holding it (If you were making an onUpdate() effect and needed to hold it to activate them then yes you'd need to check) and since a stacksize is a public int you can just use the "--" operator to decrease the value no need to go farther with getting the current stacksize - 1
  5. are you grabbing an instance of the other class? "TileEntity te= getWorldObj().getTileEntity(x,y,z);" then check to see if the gotten one around your windmill is an instance of the cable and cast it to the cable "if (te instanceof CableTileEntity)CableTileEntity cable = (CableTileEntity)te;" then make calls like "cable.power += 5; windmill.power -= 5;"
  6. in your AddInformation you do it right, by making sure the tagCompound is not null, but then you forget to add that in update this should help you out: Short Story make sure yo check that there is a NBTTagCompond on your itemstack before you try anything.
  7. Wait... So you want a "Single" item that will change its tool tip info based on it's damage level? Or you want a group of items for each damage level for the lores? Just so I know what I need to say.
  8. just make sure that before you do anything with a gotten ItemStack make sure it's not null
  9. Hey thanks, nice to know the size and best practices regarding this.
  10. try moving that code into your update method like: @Override public void updateEntity() { if (!getWorldObj().isRemote) { List players = getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, this.getRenderBoundingBox().expand(range, range, range)); Iterator iterator = players.iterator(); EntityPlayer entityplayer; while (iterator.hasNext()) { entityplayer = (EntityPlayer)iterator.next(); ExtendPlayerRotManaStam props = ExtendPlayerRotManaStam.get(entityplayer); if (props.needsMana()) { if (mana > 1) { props.regenMana(1f); mana -= 1; } } } repairItemsOnPlayers(players); } } remember you want to check whenever there is a nearby player.
  11. I know I had this issue too, just weird seeing my console do that, my whole update method is inside a "if (!getWorldObj.isRemote)" so no matter what it only updates serverside, but my values don't need to be shown to the player, it just has to work in the background. That way the ClientSide version doesn't run. as it won't do anything, if you slapped a GUI or wanted it to show a value then you might want to toss some packet handling in there.
  12. Hey so I am making a mod that is Diablo related (just elements from 1-3) and some other RPG games, and the mod's intention is to let players form a team, purchase/craft a "base node" which acts as the teams main location. This base node does everything from repairing gear and restoring mana (from its own reserves) and building the base. With using the GUI a player can pick a type of block, then click offset coords to create a list of locations, When done they send the list to the server and it reads them into the tileEntity so it can start building. But I want to know (as this can get quite large if the player is very creative) how long of a string can I send across it? And if there is a problem with large packets (lag, etc) would it be better to have the client send lots of "little" packets instead?
  13. no problem, just remember there are probably other ways out there to do what you want, and they might be better.
  14. hmm... works for me just fine. @Override public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { // TODO Auto-generated method stub super.onUpdate(par1ItemStack, par2World, par3Entity, par4, par5); if (par3Entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)par3Entity; if (player.getHeldItem() != null) { if (player.getHeldItem().equals(par1ItemStack)) { System.out.println("test"); } } } }
  15. What is on like 64? the If statement? might have to do another check of if (player.getHeldItem() != null) { if (player.getHeldItem().equals(par1ItemStack)) { System.out.println("Test"); } }
  16. Ah I bet the error is null pointer exception? what is the error that the console spits out?
  17. Two ways that *I* know (there is probably more) Items have an onUpdate method (currently vanilla maps use this) @Override public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { // TODO Auto-generated method stub super.onUpdate(par1ItemStack, par2World, par3Entity, par4, par5); if (par3Entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)par3Entity; if (player.getHeldItem().equals(par1ItemStack) && player.inventory.getStackInSlot(2).equals(par1ItemStack)) { //Do stuff } } } Hotbar slots in the players inventory is 0-8 (1 to 9 left to right) now this way it runs like every tick, I normally build my own cool down system but that gets glitchy if you have many of the same item (including other players having the item) Second would be to make your own event that checks the livingUpdateEvent or a event that fits better.
  18. I'm curious on how you set an itemStacks NBT (this is how you can keep certain information privy to each item stack right?) however I keep getting null exceptions and other types of errors. How does one use this properly? If there is a good tutorial on it please link me.
  19. you may have to look into the workings of OpenGl for texture blending, I attempted to try this when I was doing a 3D game could never get it to work properly. But maybe the Modding API has something for this.
  20. Really? I had trouble with that and just copied how the Beacon tileEntity works for the AxisAlignedBB didin't know ant boundingBox would work.
  21. use shieldBugs's toggle code that he posted.
  22. and for blocks you need: tile.<unlocalizedname>.name=<what you want the user to see> so tile.mysticOre.name=Mystical Ore a few other examples are: item.itemSwordSoul.name=Soul Rend itemGroup.RoT=Rise of Tristram itemGroup is custom tabs for creative.
  23. in your block use setLightLevel(value); to make it emit light.
  24. Oh I don't want to use containers, because I don't need to alter items, but since my several attempts of using a gui without one I resorted back in hopes of it working. I found out the main issue, I was working off of the old Main class, so my changes were not being applied, quickly switched over, but now I'm not sure how to open it without a container This i'm having a bit of trouble using not sure where I set the null, I know in my block I used: @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { System.out.println("I was activated"); FMLNetworkHandler.openGui(player, Rot.instance, 0, world, x, y, z); } return true; } So it only works client side, and it returns the Gui (Yay progress) but the super needs a container if I return null I get a crash, so I need to return a new Container to calm this. And i'm just assuming but since it's client side (and everytime I open the GUI i get a log that the container was made) that this is ok? Like if they open the gui 100 times it is not going to bloat their client and cause lag? because i'm fine with just having an empty container (don't add any slots) then I can just place the buttons and controls I want and just have the interactions through that.
  25. Just a friendly bump, I've been looking over the tutorials and I still can't get it to work. Any ideas?
×
×
  • Create New...

Important Information

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