Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. Well, I have literally same thing. I am for one passing List<Effect> into arrow constructor, inside MyEntityArrow I am holding List<Effect> (server-side only, why would client need that), then simply onImpact you can get entity hit and transfer those effect from list onto entity. The list can be PotionEffect or something else, you can hold anything there actually.
  2. When you are operating on NBT - always do it on server-only. Do !world.isRemote. And yes, it might be the problem you were looking for. When in creative-mode you (as player) are allowd to edit ItemStack's NBT (the server will accept your client-sided changes on ItemStack and override server's ones with them - your client is treated as "admin" entity). Other than that - I have no idea what can be wrong. You could post more code, where else is your NBT used, maybe you are accidentaly reseting it?
  3. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and or: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html Remember: http://greyminecraftcoder.blogspot.com.au/2015/01/thread-safety-with-network-messages.html
  4. MinecraftServer.getServer().getConfigurationManager().getOppedPlayers().getGameProfileFromName(player.getName()) != null Alos this: MinecraftServer.getServer().isSinglePlayer() For SP you will want to give full perm, ay?
  5. Note: - Server has inventories of loaded players, to load offline inventory you would need to manipulate .dat on your own. - Client has only constructed EntityPlayers that are in visible range. Client doesn't know shit about players that are out of range, aside from player list (nicks) sent from server. Have in mind that your client won't always be able to get desired EntityPlayer's instance (well, you can go with nicks).
  6. What can be wrong: - Your getter/setters are broken - You are looking at wrong output (there is client AND server output) - only server side loads NBT, client one needs to be synchronized manually. - You fkd up something else Post more code (maybe you are looking in wronge place? Any ticking events that use your wallet, anything?) EDIT In loadNBT - add Syso(nbt); or Syso(properties); Is there any (your) data? (yes, you can print NBT).
  7. Because we can see your code from miles away. Please post relevant classes (Render, entity, registration).
  8. Simple answer - yes it is. (EDIT: confusion - this was the question: "if it is possible, how do i make it server-side only?") IEEP is something that is attached to Entity (in your case EntityPlayer). Since both server and client has 2 differend entities you can just make your IEEP only on server one. Remember that you will only have that value on server side - you are safe to use commands and return valu as a string in some ChatMessage. To make mod server-sided you need to put annotation in @Mod: acceptableRemoteVersions = "*"
  9. This event is fired by FML on server-side only. To open GUI with this event, you will need to send packet from it, and make packet open your gui.
  10. net.minecraftforge.client.event.GuiScreenEvent And shitload of sub-events are at your disposal. What exacly do you need? As to using events - just google it. Notes: - Register client events in client proxy - There are few event buses in mcForge - not every tutorial says that. - GuiInit is called everytime when you resize screen
  11. Custom arrow or vanilla? Should arrow effect depend on bow or arrow as an item, maybe as a skill?
  12. My GL knowledge is not very good, but for one I can tell - this surely looks like scaling problem. I've had problems like this before and the solution almost always lied in bad scaling. Try moving scaling after translation.
  13. Show full code please.
  14. PlayerEvent.HarvestCheck event? What you want to do?
  15. So basically coins (money). @SubscribeEvent public void notifyPickup(ItemPickupEvent event) { ItemStack stack = event.pickedUp.getEntityItem(); if(stack != null) { if(stack.getItem() == ITEM) { event.player.inventory.consumeInventoryItem(ITEM); } } } You could use this. Note that consume method only eats one item, you will have to make your ItemStack maxSize=1. Or, use 1st Draco's suggestion. PROBLEM I've got a question [1.8]. Some time ago I've been coding something that checks ItemStack when it's being picked up (like above). It might have been something in my code, BUT I noticed that My ItemStack couldn't store it's size. Better explanation: - There is an ItemStack inside EntityItem which stackSize should be e.g 30, yet when I did event.pickedUp.getEntityItem(); the stackSize wasn't 30 (it was, i think default value or simply 1). Could someone explain this? EDIT I've made code right away: @SubscribeEvent public void notifyPickup(ItemPickupEvent event) { ItemStack stack = event.pickedUp.getEntityItem(); if(stack != null) { if(stack.getItem() == Items.stick) { System.out.println(stack); System.out.println(stack.stackSize); } } } ItemStack can't hold any NBT (with stackSize=1), can't have stackSize (always 0xitem) and has totally nothing. 0xitem.stick@0 // I picked up 1 stick 0 0xitem.stick@0 // picked up few stick that auto-stacked into one entity in world 0 0xitem.stick@0 // threw on ground full 64 stack and picked it up 0 0 - thos are stackSizes How to get data from picked up stack? (there are some DataWatchers thing I can't bypass with my brain for now).
  16. EntityItem is the thing you pick up, it CONTAINS ItemStack which holds some Item. Now, I understand you want to remove item from game when somebody want to pick it up? So item disappears, but is not picked? Or maybe you want to not allow player to pick up item? What exacly you want?
  17. OH MY GOD. (note - previous shit I wrote was totally wrong): NBTTagList list = compound.getTagList("Spells", Constants.NBT.TAG_STRING); compound != properties This is like 3rd same mistake I see this week. How could I miss it
  18. entity.worldObj entity is Entity.class
  19. When someone can't find the problem, the problem is most likely elsewhere. Post everything related to your IEEP in pastebin or <code>. Nbt saving is almost "random", it happens when you stop game, every some time (in ticks) and few other ocasions (loggionOut). EDIT Literally, you can print NBTTag, see what you get.
  20. Post new code. You can try making prints in write/read methods (print whole NBT). EDIT NOTE For future - I've noticed you are doing side-checking in events that are only server-sided (e.g LoggedOut). Remember that not all events are sided. One more important thing is some events (tick mostly) have Phases, have that in mind.
  21. Post all your .json files for this thing (with directories). EDIT Read my "EDIT 2" in previous post if you didn't.
  22. Nothing in logs? Texture not found maybe? "TheDogePwner" WHY? WHYYYYYYYYYYYYY?!?!??! (Hint: Look at my avatar) EDIT Also, your code will crash on dedic. You can't use Minecraft.class in dedic. Start using proxies for rendering/texturing. EDIT 2 I see nothing out of ordinary (I am not really looking well to be honest) <lol that "sounded" like I'd be some creep-face>, BUT - initialize and register everything in PreInit. Do renderers and textures in Init (load). Might do the trick, idk, just common experience with those problems.
  23. net.minecraftforge.event.entity.player.PlayerEvent.Clone You sure? It might have been added in 1.8. If it is the reason, there is still better workaround than what you are doing now. Just check if you didn't import FML events (there are two PlayerEvent.class)
  24. I don't quite have time to look super-deep in your code, but for one I can tell - you are either doing very oldschool stuff, or simply learned from old tutorial. Going through all you got: - your IEEP is cool, your nbtLoad and wirte are cool. - remove your whole joined world, and whatever else stuff (like your storage-proxy) - this is the old school I've been talking about. Now what you're gonna do: Use: @SubscribeEvent public void playerClone(PlayerEvent.Clone event) { IEEP epNew = IEEP.get(event.entityPlayer); IEEP epOld = IEEP.get(event.original); //copy your data } Above will copy IEEP data from old dead entity to new one constructed after death. This is all you need, you should NEVER EVER have to call neither load or save methods in your IEEP, just make sure they work, and leave them. Note: In Clone event - don't write and read, you can transfer data directly like intFromNew = intFromOld (just saying because many do that). EDIT: To just ensure you write your stuff well - you can paste it here when you're done or have problems.
  25. event.entityItem - EntityItem event.entityItem.getEntityItem() - ItemStack event.entityItem.getEntityItem().getItem() - Item instance When you compare items you (in most cases) compare Item instances. Comparing ItemStacks is only used when item has meta/quantity.
×
×
  • Create New...

Important Information

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