Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. public static void drawOutlinedBox(final int x, final int y, final int width, final int height, final float zLevel, final int color, final int outlineColor) { GL11.glPushMatrix(); drawSolidRect(x * 2 - 2, y * 2 - 2, (x + width) * 2 + 2, (y + height) * 2 + 2, zLevel, outlineColor); drawSolidRect(x * 2 - 1, y * 2 - 1, (x + width) * 2 + 1, (y + height) * 2 + 1, zLevel, color); GL11.glPopMatrix(); } public static void drawSolidRect(final int x, final int y, final int width, final int height, final float zLevel, final int color) { GL11.glPushMatrix(); final Color color1 = new Color(color); final Tessellator tess = Tessellator.getInstance(); GL11.glDisable(GL11.GL_TEXTURE_2D); tess.getWorldRenderer().startDrawingQuads(); tess.getWorldRenderer().setColorOpaque(color1.getRed(), color1.getGreen(), color1.getBlue()); tess.getWorldRenderer().addVertex(x, height, zLevel); tess.getWorldRenderer().addVertex(width, height, zLevel); tess.getWorldRenderer().addVertex(width, y, zLevel); tess.getWorldRenderer().addVertex(x, y, zLevel); tess.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); } Note: I am doing it totally for testing now, but can't find reason why it's rendering under.
  2. I am attempting to render progress bar and string in RenderGameOverlayEvent.Pre. No matter where I put mc.fontRendererObj.drawString(...) it always renders under bar. mc.fontRendererObj.drawString(skillCast.getName(), xPos, yPos, 0xffffff); double progress = (double) ((float) skillCast.getCastProgress() / (float) skillCast.getCastTime()); GuiHelper.drawOutlinedBox(xPos, yPos, (int) (progress * 100), 4, 1.0F, ClientReference.BOX_INNER_COLOR, ClientReference.BOX_INNER_COLOR); mc.fontRendererObj.drawString(skillCast.getName(), xPos, yPos, 0xffffff); String is being rendered first and last - still is under bar. Does FR has some totally separate rendering queue?
  3. You shouldn't use blockID in 1.8, neither in 1.7. If you did, you were doing it wrong. Use direct Block declaration reference (e.g Block myCustomBlock). As to other, there is very outlining changelog http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.8-11.14.1.1329/forge-1.8-11.14.1.1329-changelog.txt But it's mostly for global changes. Consider re-learning basic block/item setup since it has changed in 1.8: http://www.minecraftforge.net/forum/index.php/topic,26267.0.html Other than that, updating simple things is very easy.
  4. And btw (if you haven't noticed I've edited last post) this is not too fresh tut, but it works pretty well (for me). There might be new hooks for potion registry now. Try searching in mcforge source.
  5. Funny how I literally by just going deeper in code stumbled upon EnderTeleportEvent. It allows you to modify damage dealt to player after he has teleported. Damage source of this "damage" is "fall". You can check in that event if player has custom potion effect (or any other thing) and sed damage to 0. EDIT: (Widow got lagged and didn't finish writing.) As to potions - you just literally need to make new class extending potion. http://www.minecraftforge.net/wiki/Potion_Tutorial
  6. Implement new WorldProvider/ChunkProvider that will generate void world. You might find this useful: https://github.com/Jimmy04Creeper (1.7.10 Dimension tut, 1.8 is similar).
  7. I doubt that is possible without interacting directly with server property "viewDistance". Maximum range it 16*distance+16. From what I remember server only supporst distance up to 15 so anything beyond 256 is impossible for server to send to client. You could access viewDistance property (maybe reflection is enough) and edit it, but it might be autocorrecting itself (idk, there are calls to setDist in ticking method, I didn't realy looked further). How is 256 not enough?
  8. When starting up your mod you can check if other is loaded and use it's assets by modid. textures are pulled like: modid:textures/... So if you make sure that other mod has alredy registered its textures you can use them. Unless I am wrong (speculating). What's your forge version btw?
  9. Spending whole free time on coding leaves you with lack of texture stuff. I am looking for someone to cover that field. Things needed: Effect/skill icons, aswell as some GUI parts (casting bars, progress bars, action elements) and maybe particles. Textures should be in 32x32 resolution (double vanilla). To be more precise - we are talking about stun, daze, sleep, slow, etc. effect icons and skills like fireballs, novas, element-arrows, etc. Anyone knows where I can find "artists-mine" and dig up someone? Maybe here
  10. Unless something changed - THIS IS NOT how you make events. Event method should always contain ONLY Event argument. Message should be pulled from event.something and then edited.
  11. Anything realted to dealing damage requires you to subscribe to LivingHurtEvent. There you will need to check DamageSource and if it's an explosion, do check for value of this attribute (example on how to get attribute are in vanilla) and compare values (do math) and then apply new damage (cancel old one). Registering attribute should be done in EntityConstructing (instanceof EntityLivingBase). I mean - I THINK so. To register it you use something like entity.registerBaseAttribute (I don't remember exact name)
  12. http://1.bp.blogspot.com/_D_Z-D2tzi14/S8TZcKXqR-I/AAAAAAAACwg/F7AqxDrPjhg/s320/ALOT13.png[/img] I. AM. DEAD. This website is sick!
  13. I'll just write it: post whole code of your armour. Creating new local (in-method) NBT and putting values into it doesn't magically make that NBTTag be itemstack's one. You need to itemstack.nbttag = new NBT whenever it is null;
  14. My guess you are declaring it wrong. What is this doing? You simply make new NBT object, that's all. write wraped getter for NBTTag: if (stack.getTagCompound() == null) stack.tagCompound = new NBTTagCompound() return stack.getTagCompound() ;
  15. In my eyes - it's perfectly fine. Note: Use some abstract AI class instead of object and generalize methods - there must be SOME methods (like execute()) that would exist for all AI tasks. Makes things easier. Also note: you will need some instanceof checks and stuff, to not overload AI with arguments. (Unless you are certain that args received will never be too much/few). If you'd create abstraction, you couls put there abstract method load and write NBT. Then inside packet you could simply call load and write, where write would be done on server to serialize data, and then on clisnt read would read that data and construct AI task.
  16. Sry offtopic.
  17. PlayerInteractEvent has almost nothing to do with this. You need to create new Item and override method onItemRightClick then use !world.isRemote (to run code on server) and make some effect (spell). This is only casting part. To make this "button-thingy" that you actually cast skill with keyboard you will need to use KeyInputEvent and scan for input. Then with every click you will need to send packet from client (buttons are client-side) to server with SimpleNetworkWrapper. On server side you will need to have IExtendedEntityProperties that will hold some List<?> which will represent your casting queue (order of buttons clicked). Goig back to your Item (wand) - in onItemRightClick you will need to get (server side) your List<?> of buttons order clicked and deliver proper "spell" depending on what was clicked. Don't forget to clear that list and stuff. Useful stuff: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-2-customizing-packet-handling-with Edit: Oh you meant mouse order? (I understood keyboard order). Still - inside Item.class there are methods to do so. You can also use PlayerInteractEvent (sorry for 1st statement). Note: Depending on how you want to store data - per player or per wand - you can also use ItemStack's NBT, not IExtendedEntityProps. That is huge outline, we will need some code (yours) to work with.
  18. supper(mat); != super. Is this the problem?
  19. Okay, I don't know for sure, but it seems like commands are executed between POST and PRE, so as long as this works (proved with 30 tests) my queue will work fine.
  20. You are not wrong, if that is the only question.
  21. I really don't want to find a glitch weeks after I write my API so: How it goes: 1. PRE 2. TICK 3. POST 4. PRE 5. TICK 6. POST 7. Let's say I will send a command that adds something (in execute()) to some list. Command is constructed probably around (3.). When does execute() launch on server? Can execution be delayed? Why? Well, my skill queue system is strongly dependent to PRE and POST tick updates. I need to know that everytime I add something to skill queue the first "tick" that will occur which will detect new skill in queue will always have it's PRE-TICK (which calls "onStartCasting()"). Having execute() launch exacly after I call it, would make POST launch 1st (i think), but then again - commands go with mini-packets (inside mc) - they might be delayed. I could do that with simple boolean (e.g. isFresh) inside Skill class, but I am just wondering about this here (above). Anyone had fun on this field? Thanks Note: And yeah, I am looking, but CommandHandler/Manager are weird, and also I can't really make prints there.
  22. Entities. Let's say I want to catch Set<Entity> of all entities that are on my crosshair in next 50 meters (blocks), or less if I hit the wall (block). I know there is somthing that can help me, I just don't know where.
  23. You must be doing something wrong. EntityPlayerMP exists only on server side. Commands registered using FMLServerStartingEvent call execute() on server side, therefore you can cast ICS to EntityPlayerMP. Why do you need EntityClientPlayerMP? If you are looking for Client commands, they should be registered with ClientCommandHandler.instance.registerCommand(cmd);
  24. 1. Is there some special way to tick client world (WorldClient)? - WorldTickEvent is only for WorldServer. - I've been thinking about using ClientTickEvent with FMLClientHandler.instance().getClient().theWorld (or mc.theWorld, who cares how I access it), BUT: * I am concerned about when it will be called when: - On SP, if you pause game, event is still called - Will check if game is paused be enough and work in all cases? - On MP, let's take situation where I start decrementing int x = 1000 on server (WorldTickEvent) and client (ClientTickEvent) - will those BOTH end in same time (not counting critical situations)? When not? 2. EntityThrowable explodes on impact. What's the best way to get all entities around hit position in: - Cylindrical shape with height starting from Y1 to Y2. - Spherical shape. - How to tell if found entity is "visible" from hit position (e.g entity found is behind cover). 3. How to get all entities in line (like laser)? Starting from some x,y,z (in most cases eye-position, but might be mob's eyes or even block). Help appreciated Note: I am asking about pointers to existing methods (if there are any) or methods that will help writing my own or simple "doesn't exist / impossible" if there is no help from vanilla/forge side.
  25. If you are looking for anomalies then in slot[0] you have ==, but in [1] and [2] there is !=. Also, addItemStackToInventory is not quite what you are looking for (might be). In this case it will work, but I'd rather simply use slot[index] = new ItemStack(...)
×
×
  • Create New...

Important Information

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