Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Numbers32

Members
  • Posts

    16
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Personal Text
    A stone bow...? How does that event work?!

Numbers32's Achievements

Tree Puncher

Tree Puncher (2/8)

2

Reputation

  1. I just wanted to say that this solved an issue that I was having with rayTrace/Cast against blocks, Thanks!
  2. When you say reduce vision, do you mean how far out the chunks are rendered, or where the fog is around the player, ie when at bedrock level, you can only see so far in front of you? If you are looking to "thicken" the fog surrounding the player, try looking at the blindness potion effect. Pun not intended.
  3. So how would you go about using this to extract block data to, say, teleport to using the x y z coords, or even spawn something like lightning, if its returning a boolean value? Would it go something like: if(canEntityBeSeen(player) == true){ //teleport/spawn entity code here? } I'm just not sure how this would work.
  4. I'm trying to accomplish something very similar, if not the exact same thing, with spawning lightning. I've tweaked Millennium3's code, but I might have accidentally a statement . Do you think you could show your "fixed" code, as something to reference? It would be greatly appreciated!!!
  5. OH OH OH... I think I figured it out... Turns out someone else had the same issue here. Oops. EDIT/UPDATE: Okay, so after some thread surfing and a few smashed keyboards, I've found a solution to my problem, and it works quite nicely, other than the fact the Lightning bolt isn't rendering. As it turns out, in the ItemBoat.java, there is code that places the boat where you are looking, within a five block radius! So all I did was copy and paste bits and pieces that I needed, changed a variable or two, etc etc. I even got it to teleport me to the block I was looking at (with some more checks and such, this could be used quite safely in survival, ie not suffocating in a wall)! For those who wish to see the code, I shall paste it here: On a final note, I'll tinker around with the code and see if I can get the bolt to actually render so the player can see it, and not just the effects of it. If anyone has any suggestions/input, I'm listening.
  6. Thanks! I'll have to tinker around with it. And now that you mention it, it very well could be intercepting me instead of where I want it to. Didn't think of that before. I'll report back later with my findings.
  7. Just a quick question that has been bugging me for the past two or so days: I've managed create and item that spawns lightning onRightClick(), and have a "cool down" before use again, something like 5 seconds. It works fine, but there is something odd that I've noticed. Whenever I right click and spawn the lightning, say 15m (blocks) away, the ground below *me* and not the block I pointed at, erupts into flame, and I get struck by lightning. Which is not the intended effect. However, whenever I am in the air (creative) the lightning strike works fine, causing the block I pointed at to erupt into flame and damage any near-by creatures in the area. What's stumped me is why it decides to inflict damage where I am standing, instead of where the actual bolt is rendering/striking. Any advice or speculation or help is greatly appreciated! As usual, my code for the Item in question: If you want, I can post the main class too, but I don't think that the issue lies there, so just let me know.
  8. Ah, this solved the problem! Thank you very much! I'll have to look into the different event buses, so I don't make the same mistake in the future.
  9. Okay, so I updated the method and if statement to: @SubscribeEvent public void OnItemPickup(EntityItemPickupEvent e){ if(e.item.getEntityItem().getItem().equals(RangerMain.plantFibers)){ System.out.println("Event fired"); } } and threw in a print line so that I could see in the console if the event did indeed fire when I picked up the item (plantFibers). I did this for the OnCraftingEvent, to have a visual of when it fired. However, when I run everything, and toss some of the item on the ground (from Creative, as there is no recipe and grass does not yet drop it), nothing happens. No line in the console that says "Event fired". When I hover over item in eclipse it brings up this: /** * This event is called when a player collides with a EntityItem on the ground. * The event can be canceled, and no further processing will be done. * * You can set the result of this event to ALLOW which will trigger the * processing of achievements, FML's event, play the sound, and kill the * entity if all the items are picked up. * * setResult(ALLOW) is the same as the old setHandled() */ How might I go about using setResult(ALLOW)?
  10. Hello again! This time I'm looking for some tips/advice/help with some events (particularly EntityItemPickupEvent). So what I am attempting to do is add some achievements to my mod, mainly when Items are crafted, and when certain items are picked up off the ground. The "onCrafted" part I have down and working. I'm having an issue with the "onItemPickup" events. The achievements for an item pickup are simply not triggering. I think that I'm doing something wrong, but just don't know what. Here is my custom Events.class: And here is the Main.class: Again, any help is much appreciated!
  11. I'm not 100% sure about the assisted flight and lighting, but you might be able to code the shoes so that when they are crafted, they have an enchantment on them, say, Feather Falling II. The only down side to this is that you can't enchant your boots (shoes) afterward unless you use the Enchanted Books. To do this, you'll want to put a onCreated method in the boots (shoes) class. Hope that helps ya!
  12. Thanks again, that seemed to fix all of the errors... But one. After I fixed the code so it would stop "yelling" at me, it was complaining that the local variable itemstack might not have been initialized. I'm assuming putting "new ItemStack(mainmod.myitem)" or even "null" as Eclipse suggessts would break it. Once again thank you for your assistance! EDIT: "ItemStack itemstack = null;" didnt break it. I put a print line on the damage of the item, and it goes up each time i use it (yay!). The only obstacle to pass is displaying the damage on the hot-bar, similar to a pickaxe or bow. You mentioned something earlier about returning it to inventory?
  13. I'm working on something similar (instead of guns I'm adding a new bow or two). I pretty much copied the vanilla bow class into one of my own that I created (NewBow.class). I recommend creating a new class for your Cannon, rather than putting it in the MainMod.class. As far as i know, that is mostly for declaring/creating new items/blocks along with recipes. This might help: This class is essentially the vanilla ItemBow.class, but you can modify it to fit your needs. With this example, the time it takes for the "bow" (or whatever) to charge (pull) can be changed, and the animations adjusted accordingly. I made something like this so that I could have multiple bows in one class, rather than 1 class per bow. I hope this makes sense. EDIT: I guess the code demonstrates what Busti was saying.
  14. Thanks! I'll try it out and see how it works. Edit: Okay, after modifying you solution to match my class I get the following error: "The operator && is undefined for the argument type(s) boolean, Object&Serializable&Comparable<?>" This is what its underlining: index < par3EntityPlayer.inventory.getSizeInventory() && (itemstack != null ? itemstack.getItem() == RangerMain.crystal_orb : 35); I'm not 100% sure why either...
  15. Here's a tutorial that I found out to come in handy with creating a rifle/gun. http://www.minecraftforge.net/wiki/Tutorials/Basic_Shooter_Item_-_Blaster_Rifle Might help you out as well.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.