Jump to content

hugo_the_dwarf

Members
  • Posts

    334
  • Joined

  • Last visited

Everything posted by hugo_the_dwarf

  1. Yeah I'm going with the Event for at least adding to killed mobs (by players) if I happen to add some items I'll have to look into loot tables to at least add it to vanilla chests and the like. Now it's just getting some of my randomness code to play nice, moving all this old crap code to 1.10.2 is quite the test. Now that I can see "I could do this better" as some of my systems where just downright poor (200+ line IF, ELSE IF blocks) making maintenance just a nightmare.
  2. Logic is pretty complex So I'll probably stick with the event handler. As the Monster's Cap "Level" and "Is_boss" effects what's dropped, and how many items to drop it then rolls for each "item" to drop if it's a resource (stick, glass bottle, redstone dust, glowstone, emerald, gold, etc) or equipment. picking from lists with ranges (if monster level between x and y return resource/equipment list) then grabs a random one from the list. repeats until all items are picked (there is also a fail chance, so if the monster could drop 6 it might drop only 2 items + default drop list (rotten flesh, bone, etc)
  3. Now my old way of doing it was getting the entities drops list, changing it, then jamming it back it when it died aka "LivingDeathEvent" However there is another event which looks a bit better "LivingDropsEvent" But now there is this business of Loot Tables. Is it still better to create my own loot manager to roll and calculate what item to drop and special Capabilities props Or somehow attach my own custom lootTable to all entities that have my capability then apply special props changes on the items in the list. I'd rather go the route of LivingDropsEvent and my own loot manager, as I've never dealt with the new Loot Table system at all. And my mod is to work with entities and items from vanilla and any other mod
  4. Stop while you're ahead, this has nothing to do with the threads issue.
  5. Looks like an error on line 31 of your blockInit class RunecraftBlocks.init(); look at that line and or post the block init method in that class
  6. Do a quick search of nothing aasdfgsagdsa That's Eclipse just highlighting your search for you for all found instances. I'm going to look for a better way to tell Eclipse to clear the search results Remove your matches in the search view, that will remove the highlighting. I.e., click the button with the two X's in the search view. If you cannot see that view, navigate to window -> show view -> Search
  7. Dracos18s is correct. I ran into this same issue this is how I use it in two different ways (Entities and Items) @SubscribeEvent public void onAddCapabilitiesEntity(AttachCapabilitiesEvent<Entity> e) { if (canHaveAttributes(e.getObject())) { EntityLivingBase ent = (EntityLivingBase) e.getObject(); if (ent instanceof EntityPlayer) e.addCapability(CapPlayerExtraProvider.KEY, new CapPlayerExtraProvider(ent)); e.addCapability(CapAttributeProvider.KEY, new CapAttributeProvider(ent)); } } @SubscribeEvent public void onAddCapabilitiesItemStack(AttachCapabilitiesEvent<Item> e) { if (canHaveAttributes(e.getObject())) { e.addCapability(CapAttributeProvider.KEY, new CapAttributeProvider(e.getObject())); } } public static boolean canHaveAttributes(Entity entity) { if (entity instanceof EntityLivingBase) return true; return false; } public static boolean canHaveAttributes(Item item) { if ((item instanceof ItemTool || item instanceof ItemSword || item instanceof ItemBow || item instanceof ItemArmor || item instanceof ItemShield)) return true; return false; }
  8. Most likely in the "toolTip.add()" while the "sneak" key is not pressed it could render "Press " localized.key.name or something, would make it more dynamic
  9. Only commenting to ask, since the vanilla "mainInventory" array stored in the InventoryPlayer only holds 36 ItemStacks (not counting the 4 armor slots, and 1 offhand) What if the player had picked up enough items that weighed nothing (feathers) and filled the inventory. Even if the player had enough carry limit left they still wouldn't be able to pick up anymore. I guess the event "PlayerEvent.ItemPickupEvent" could be used to magically move a picked up item to a new "weighted" inventory but that still leaves to question that the hotbar (first 9 slots of the mainInventory) needs to be able to have items picked up/moved to.
  10. What's the CustomValues class/object?
  11. this may be basic, but you registered the event right?
  12. Try just accessing the "e.getToolTip().add(String);" directly instead of holding a new instance. if (e.getItemStack().getItem() instanceof ItemBlock) { e.getToolTip().add("Weigth: "+CustomValues.BLOCKWEIGHT.get(Block.getBlockFromItem(e.getItemStack().getItem()))); } else if (e.getItemStack().getItem() instanceof Item) { e.getToolTip().add("Weigth: "+CustomValues.BLOCKWEIGHT.get(e.getItemStack().getItem())); } EDIT: If still nothing, then it's potentially the data wasn't found "client-side"
  13. Well if you never break out of a While loop, or the condition never becomes false (thus breaking naturally) that loop will run forever. And since your code ran on the main thread, you had created a lock as it would loop forever. Try to avoid using While loops if you can, and if you must or feel you must. Always ensure there is an exit strategy
  14. PRE-Edit: Wow ninja'd twice I use this for my mod to display "Stats" since I deal quite a bit with vanilla items, and if they are the correct extended class, other modded items too. You can probably still get away with using the itemStacks NBT data to store your values, and read them when that event fires. it's suggested to use Capabilities now for ItemStacks, which I had a grand time trying to figure out how to sync them correctly from server to client. I chose a more clunky way, another person went ahead and got some IContainerListeners working which works 100% better than what I did. Choonster posted that thread in mine as well.
  15. InputEvent.KeyInputEvent?
  16. Are there consequences? Other than the fact the player is sucked down the Y levels unexpectedly which if you're not in a super flat world, could be sucked into blocks. And die. else if (!worldIn.isRemote && playerIn.isSneaking()) { EntityAetherOrb entitythrowable = new EntityAetherOrb(worldIn, playerIn); playerIn.posY = 0; // Don't do this playerIn.posY = 6.8; // or This entitythrowable.func_184538_a(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 0.001F, 0.0F); entitythrowable.addVelocity(0.0, -0.1, 0.0); worldIn.spawnEntityInWorld(entitythrowable); } Matryoshika has given you the correct fix for this issue. When dealing with any POSTITION change if you want it to be "Relative" it should always be: newPos = oldPos + offSet; using things like you did of "newPos = offSet" is magically force it to that coord.
  17. Someone tell me that code is wrong? looks wrong to me try something more or less like this.. Main Mod class My Event Manager (you don't have to make a manager, this is just my chosen design) One of the Event Classes
  18. you can try ItemStack hand = p.inventory.getCurrentItem();
  19. Yeah that's an information issue then. See when you save and load a world the server knows what all the data is. But when a client (player) joins pretty much everything is a clean slate. Why TileEntites and Capabilities need packets to update a client(player) because vanilla MC doesn't handle custom data for us. But if you're just looking for "as long as it's got some power" you could have the block/tileEntity output a redstone signal? that should auto-sync between server and client and you could go off of that. But i'm 99% sure you will need the server to send some data to the client so the GUI can work correctly. Pre-Edit: @Animefan8888 I didn't know you could use a container to also transfer additional information.
  20. Oh, Sorry. I don't think you need a Capability for what you're trying to do. Sorry if my suggestion lead you astray. I was hoping some info for using a IContainerListener would have helped. As your desired result is: Holding Item A Click on Item B (in inventory) Magic happens?? Perhaps someone more versed will see this. Apologies for not being helpful
  21. Normally you have to have the server update a client on "custom" data. Inventories and such are handled nicely thanks to Containers. But any other variables that are stored in a tileEntity, Capability, etc. You will need a packet to send to the player with the info. I can help you understand packets if you wish. But there are quite a few documents around already that does a good job explaining them.| EDIT: That is i'm understanding that the "Amount of Power" is not showing correctly and it's not a "No picture is drawing" aka "Power = 0" when machine does indeed have power EDIT2: Is it a drawing issue, or Information issue?
  22. ItemStack hand = p.getActiveItemStack(); if(hand.getItem() != null) { The error is a null exception right? See you get an ItemStack "hand" which is player.getActiveItemStack() the error you made is you reach into the object to check to see if it's null. Which is a no no you should have: ItemStack hand = p.getActiveItemStack(); if(hand) != null) { When checking for "nulls" you check the direct object you got, reaching in to check is a big no. So your full method should look like: @SubscribeEvent public void onRightClick(PlayerInteractEvent e) { EntityPlayer p = e.getEntityPlayer(); ItemStack hand = p.getActiveItemStack(); if(hand != null) //Check to make sure the ItemStack gotten is not null. { if(hand.getItem() == _Items.cell_phone) // this is correct, well as long as you registered the item #cell_phone correctly { p.setFire(5); //Honestly I prefer Console.out().Println("Am I holding a Phone?!?"); rather than directly causing things to happen } } }
  23. Do you have packets that the tileEntity sends to the player when they activate it sending how much "power" it has?
  24. Right, Thanks. Woke up not too long ago, some critical thinking is still trying to boot up.
  25. Well if you're looking for a item replacing another item via clicking. Tick Event won't cover that. You'd need something that would trigger with a "On Inventory" or "On Slot(container)" change that would know what the old and new ItemStack was for a Slot This may not be 100% related, but it's close http://www.minecraftforge.net/forum/index.php?topic=42833.0 It's to do with Capabilities for ItemStacks, but I believe it can be easily applied to what you're trying to accomplish, yes it makes use of attaching a IContainerListener but that's so you can detect when something changes. EDIT: Well i guess you COULD use the tick event, but you'd have to store the old instance after each tick so you can compare and "See" the differences Slot[6] was apple, next tick Slot[6] is now a cookie, do logic. But then of course you're scanning the Player inventory 2x each tick (old inv state you saved previous tick, and current inventory current tick) could take a bit of processing to run those two loops every tick
×
×
  • Create New...

Important Information

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