Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. Let's say you have 2 operations - spending coins and gaining coins. You gain coins by picking them up, you spend them by clicking button in GUI in your shop. Picking up happens always on server, so what you have to do: 1. You pick up coin. 2. You save value to server-sided ExtendedPlayer (EP) and send packet to Client to update client-sided EP. Now how spending should work: 1. You click on button, which have some ID assigned that is an internal static shared value (server and client), you send packet from client to server (that will contain this ID, and for e.g the item you picked from your shop gui). 2. In Server IMessageHandler in onMessage you get EP's total coins and check if you have enough to buy given item. If you can you spend server-sided coins on it and you put given item to your inventory. 3. You send packet from server to client with new coin amount (just like in "picking up coins"). And you also have to send inventory update packet, client doesn't always get synchronized there. I know you have picking-up coded, so what is the problem? Code that handles buying please. EDIT: And yes to above - Data is saved only on SERVER, client doesn't save anything (but cache, which doesn't matter). Server is teapot, client is teacup.
  2. If your Entity holds data that is directly changing movement: - If data is set once: IAdditionalSpawnData - If data is small, but every tick: DataWatcher - If data is bigger use IMessage and IMessageHandler
  3. What? Ofc. no, you can't hide something from computer owner... (that is called malware) Why would you do that?
  4. There is no Forge for versions above 1.8.0 yet. What is your problem (aside from not knowing much about Java which I can assume from post history)? Most of common easy-stuff can be found here: http://greyminecraftcoder.blogspot.co.at/p/list-of-topics.html http://www.minecraftforge.net/forum/index.php/topic,26267.0.html
  5. Either setup problem or your mods. Run mc in IDE without mod, if it is not crashing you most likely made it crash with your mod, so it's not really random. Are you having fun aroung sounds by any chance? Tick Events? Any events actually? I'd go back to moment when it wasn't crashing, or if you don't know when that was - start debugging.
  6. AHA! Damn I am amazed I actually remembered it. There was a thread, like literally in past 24h where it was said that MC doesn't accept one-letter modids. You can't use "d" as modId - u musi have 2+ symbols. Idk if it is a problem on 1.7.10, I know it is on 1.8, check that.
  7. 1. Version? I am blind, it's 1.7.10 2. Could you use Git by any chance? 3. Post error log? You have literally one texture, and your item texture references in main file are mostly looking like this: "d:" so I assume you are talking about one which is not. 4. Chect spelling and make sure your modid is lowercase when referencing texture.
  8. @SubscribeEvent public void playerTickEvent(TickEvent.PlayerTickEvent event) { if(event.phase == Phase.START && !event.player.worldObj.isRemote) { if(event.player.isWet()) { event.player.attackEntityFrom(DamageSource.drown, 1.0F); } } } ^ more suitable code, also - ticks events are fired by FML - you need to register them using FML, not Forge bus.
  9. Where is the question? You will need IExtendedEntityProperties to store data, RenderGameOverlayEvent to draw bar - note that you will need to pick only ONE drawing phase, to not draw it several times. To catch "attacking" you will need LivingHurtEvent. Edit: Oh and use SimpleNetworkWrapper to synchonize client with server data to display proper info in your GUI.
  10. What are you doing? Full code please - in Gui you can only access your player and entities that are loaded by client thread, so entites around your player that were sent to you from server. 666TH POST
  11. 1. It's about game loop. 1tick = 50ms, in that time everything happens, updates of world, entities, tileentities, everything. If you'd look at code that initiates all those updates you would see that Forge with phase START is called 1st, then there are entity updates - so methods like onUpdate() inside entity (I like to call it MIDDLE phase or ACTUAL tick) and then END phase. Most of the time you will want to use START. 2. Not really much to talk about: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html I was learnin on this, so I'll link it: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with 3. Yeah, but important.
  12. Few things: 1. Tick event have Phases - you need to define (by if statement), START or END Phase (otherwise code will be ran twice). 2. You CAN'T use KeyBindings inside this tick event - mouse and keyboard is CLIENT side. You need to send packet that you clicked and/or unclicked key. 3. 20 tick = 1sec (you have 50=1sec and 200=5sec - wtf?) Edit: I also remember you and your problem - we alredy told you all this above.
  13. You can do the same in any other situation - declare new ItemStack and assign custom NBT to it. Kinda out of context: (above) http://www.minecraftforge.net/forum/index.php/topic,29326.msg151343.html#msg151343 The problem was adding NBT to item when pulling from Creative - I am telling here that you can do the same.
  14. Why can't you move entity on both sides? TileEntity/Entity should be readable for both sides, so as long as entity's movement has reference to it you can use it on client side and move client side entity. Same code = same movement on both sides and in case of desyncho - server will correct position (as it does for all entities). Unless I am missing you point: What do you mean: "is upside down"?
  15. For convinience, I've made myself do more explanation for maybe future-finders: There are 2 GuiScrollingLists here, lets call them left and right. GuiScrollingList was designed to be used inside screens that cover whole screen height, therefore if you want to use them on top of world-render, you are going to have to code custom thing. In left list there are 5 elements, E1, E2, E3,E4, E5. T1 is out top border, B1 is our bottom border. The renderer that actually renders elements will render only E2, E3 - because they are in visible field, and E4 - yes, WHOLE thing, not jut visible part - that's why there are those "trimming" borders - they are covering what needs to be cut, so followin that logic - you have to make them always be bigger than elementHeight OR make sure that element will go out of screen once it quits border. In right list you can see that E'2 is being rendered outside - that is because it is partially visible in "visible field", yet it passes outside visible field and even outside border, and since height of whole list in != screenHeight - you will get part of it outside boundaries.
  16. Constructor is not like other gui things you met untill this time. GuiScrollingList(Minecraft client, int width, int height, int top, int bottom, int left, int entryHeight) width and height are the size of list box. top and bottom are the "trimmers", left is the offset from position 0 starting from left of the screen. entryHeight is static forr all entries size of entry. Example: GuiScrollingList(mc, 4, this.height, 3, this.height - 2, 2, 1) --XXXX --XXXX --XXXX --OOOO --OOOO --OOOO --OOOO --XXXX --XXXX Problem with this gui is that the list itself cannot be offset in Y axis, therefore the 3rd argument must ALWAYS be the height of your screen for it to look GOOD.
  17. To do that you will need to override: @SideOnly(Side.CLIENT) public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { subItems.add(new ItemStack(itemIn, 1, 0)); } And add any kind of ItemStack with alredy set NBT tag you want. EDIT To give you wider look: onCrafted (or Created, don't remember) is called when you pull item result from crafting grid. There you could add NBT when crafting. Mentioned above getSubItems() allows you to add any number of custom ItemStacks into given tab. If you would like to have custom crafting for this item: e.g: when you put stick + stone you get bolt with NBT "stone" and if stick + iron you get bolt (same item), but with NBT "iron" you will need to make new IRecipy and handle your ItemStack creation.
  18. I don't think I understood you in best possible manner. Item#onUpdate(...) is (I think) called EVERY tick when item is inside player's inventory (desn't matter slot) and MAYBE in some other cases (idk, never was a fan of this method, so never checked). Basically what you are doing is adding enchantment over and over again. That isn't your goal, is it? You can check is ench was added and then if not - add it.
  19. Not enough info - My guess is you are making custom container, in that case: You will need to override and customize transferStackInSlot and/or mergeItemStack to fit your code (sizes of container slots).
  20. What type of communication are you talking about? If the server is running mod and plugin you can obviously exchange data between - in most cases by using reflection. If you want client to be able to receive plugin's packet directly - you would have to change some stuff on plugin side, forge packets have id put into buffer, bukkit don't (it looks different). Best way is Client Mod <-> Server Mod <-> Bukkit Plugin, safest probably. Marked bold can be done with as i said reflection or external API that both parties would use (if such exists).
  21. Those are startup events (like init, pre and post), use: @EventHandler
  22. GUIs are one above many things that will never have "do this" tutorial, that most of new coders expect to magically appear. If you undestand the nature of objects in java, can do SOME math, and understands which method is responsible for what: initGui, drawScreen, mouse and keyborad methods, the only thing left for you to do is literally look how vanilla makes things you want to have, no other way. Helpful stuff - Checking call hierarchy and type hierarchy. Hints: Use GuiScrollingList or GuiListExtended (difference: 1st is forge, 2nd - vanilla, safer to use forge) Declare GuiScrollingList inside you GuiScreen class. Initialize list in initGui() - method is called not only when you open gui, but also when you resize screen - NOTE THAT (personal trauma of few hours of searching my own mistake) put stuff inside (you will want to get data from what diesieben told you in 1st answer) and voila. Put together some code and post it or call me. To actually understand mechincs - you are better off copying part of vanilla code that uses thing you want to use and then edit it step by step, OR if you are brave enough go from scraps alone.
  23. Is it even possible to just get .json model? Or have it not-for-item/block?
  24. Item is a singleton - you cannot use static fields in it, unless thay are shared between all swords using this class. You need to use NBT to save ANY properties, or stop using static fields if you want to have shared props between instances. You probably registered second sword after 1st one and your static effectType field got changed. Sry my post doesnt make any sense after i read it again, basically post below.
  25. As I am still learning this 1.8 rendering, help is needed. Alredy figured out tess, now making dynamic models. How do I register .json model? NOT an item, NOT a block, NOT anything, just register model to be. How do I get this model to render inside Render.class (extension ofc.) at some x/y/z for given Entity3DSpell (extending Entity)? All this stuff is very complicated and takes time (mosty time), I really belive there is a simple solution. Goal: Make my Render3DSpell.class accept String from argumented "Entity3DSpell.class" and use it to find and render model registered with this string key-name. Additional questions: Making model spin? (methods) Render 3D deep glowing? Render particles behind it (like you know - fireball) - that I guess goes to entity itself, BUT - How many EntityFX is too much? I want to make nice blur behind spell.
×
×
  • Create New...

Important Information

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