Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. 1. Player is running. 2. Stops running, but is sliding on ice. * Movement occurs, but there is no player-made acceleration. * Therefore I have to wait until I stop sliding before I can even start casting skill. - That's what I mean by acceleration. You are moving but not because someone is pushing you, knockback, or your own movement, but because there is a leftover of your speed. - Obviously I understand that I can save initial acceleration and just check if curent is bigger than initial, but that might allow caster to do "micro-steps" as long as he is in range of max acceleration. Well, unless I will update previous acceleration fields on every tick - in that case - it's perfect system. Anyway, looking at it now I might be able to have some fun with distance from point 0 (where started casting) and actually make it close to "neat". This weekend's gonna be fun
  2. Pure math mate. Example: to make bar apperar in place of health you will have to go with: Width: width/2 - 50 Height: height - 50 You will mainly want to make width and height dependent to scaled resolution. Scaled res can be drawed straight fron guiScreen or Minecraft.class
  3. Passing all irrelevant data: inside GuiScreen#drawScreen(...): this.mc.getTextureManager().bindTexture(new ResourceLocation(InitUtil.ModID + ":" + "textures/gui/myGui.png"); this.drawTexturedModalRect(xPos, yPos, xOffset, yOffset, width, height);
  4. Are you asking how to draw .png image onto screen/gui or what?
  5. I'll just note: If you can think of it in 30sec or less, I alredy did/tried that. I need something creative, or rather "from experience". *wink* Position != movement. I need to track down SOURCE of movement, not the position changes. As said in main post - the fact that player is moving doesn't mean he's accellerating. And I mostly care about acceleration. Offtopic: @deadrecon98 - I'd write this in other thread, but since this one is mine I'm personally asking you to stop writing false/impolite stuff on support forums. If you don't plan on helping, don't trash people looking for help. It happens often when you appear on forums (look at your karma). And no, this is not about this thread, I am just politely pointing out.
  6. 1. http://www.minecraftforge.net/wiki/Gui_Overlay 2. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and Note to 2: You can't just place data in some class. You need to save it per-player (unless it's a client-side stuff).
  7. Player starts casting skill, if certain movement occurs casting is interrupted. Now: Smartest way to check: - If player himself trigerred movement (movement = make acceleration, not slowing down, because that would require you to totally stop to zero before casting skill). - If something else triggered movement (knockback/water). My only idea is to save acceleration (x,y,z) every tick and compare, but how to track source? Maybe catch movement packcets, but I have no idea how. Also: i could use some light on positioning fields. there is posX, lastTickPosX, prevPosX, motionX, nextStepDistance, newPosX, damn, probably even more.
  8. 1. Renderers should be in load(). (you are good here). 2. Are you sure you know how .substring(index) works? You are taking String from 5 index to end. (That will cause bad texture naming). I am sorry, I don't see anything. My code looks very similar. ;c P.S: Be on the safe side - check for null in registerRender(Item item)
  9. Not that I know direct answer but there are few flaws in your code: if(itemstack == new ItemStack(MIMain.chisel)) You should NEVER do this. Don't declare new ItemStack. you should: if (stack != null) if (stack.getItem() == YourItemRegistry.itemChiselInstance) As to main problem: Do you know how to use Debug mode in eclipse? Place breakpoint in your event (maybe even in EACH line) follow them and say when does it crash. Last question: Are you sure you are using right event bus?
  10. Block#getBlockFromItem(Item itemIn) ItemStack.getItem() Put them together.
  11. Not enough code. Follow the stacktrace. You are probably trying to register renderer to not yet initialized item/block.
  12. Each EntityLivingBase has effectMap. This is what is available in API: (Entity is accessable from effect) protected abstract void onEffectAdded(); protected abstract void onEffectRemoved(boolean forced); protected abstract void onUpdateTickPre(); protected abstract void onUpdateTick(); protected abstract void onUpdateTickPost(); Some effects are totally out of vanilla (like curse or bleeding) and some I want to hook into it (e.g ignite). entity.setFire(seconds) is thing that gives flames animation and deals 1dmg per sec. I'd like to extend flame damage - is there a way? I was thinking of maybe setting fire and dealing (damage - 1) on my own as an extension, but that don't really satisfy me. Next: How would I go for empowering poison to deal more damage? PotionEffect only deals 1.0F. Next: Is there something I can do (without ASM, maybe during hurt event, anything?) to change DamageSource of poison - from .magic to my own MySource.poison? I have few ideas, but I'd like your opinion, maybe someone was doing this before Goals: Best performance, most manageability over effect, clear hooks, most comatybility (with whole vanilla). Note: Values of health are VERY far from vanilla. I am operating on at least 100.0F (rising with level - using modifiers to stay with vanilla). That's why I need to change those above (and want to stay compatybile). Meh, I am often overthinking the design. *.*
  13. Not familiar with given event but: you can't call .equals() when returned object is null and crafterd item is not always a Block therefore it might crash with null pointer. Solition: always use null checks, instanceof and when comparing block rather use ==. Blocks are singletons (one instance i mean).
  14. You might want to get back to this info later (when you know Forge/Java better). Since some vanilla update there is system that is based on attributes. There are SharedMonserAttributes assigned to each entity on constructon that define given entity's basi health, damage, speed values. Then there are AttributeModifiers that allow you to modify those attributes. You can use modifiers to edit vanilla health (add more). Note that for this to work WELL you need to think of it a bit and learn a lot about attribute system. For examples have a look at GoldenApple that over-heals you and potions for other modifiers like speed or regeneration. Hooking into exp and making exp-health relation is HARDER. This will require you to use PlayerTickEvent with Phase.START on Side.SERVER. You will need to check for player's exp every begining of tick and add new modifier that will make your health e.g +20, then in Phase.END you will need to remove that modifier. That way you add health before tick, and remove it after tick. During tick you health is operational (usable). You might also want to do it less that once per tick. You can add/remove modifiers every few ticks. To hold additional data about entity you will need to implement IExtendedEntityProperties and use SimpleNetworkWrapper to synchronize client-server. I have no knowledge about mob AI, maybe you couls add/remove new AI effects to existing mobs, if not then you will need to replace then with new or edit with ASM. Acessing private fields can be done with forge's ReflectionHelper. Tutorials: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with www.minecraftforge.net/forum/index.php/topic,20135.0.html http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and Hope it helps.
  15. For client there is --runDir='dir' Is there runDir arg for Dedic? (can't find one) Thanks.
  16. And it is this moment that I am 100% certain that I need to (finally) go to bed. ...I am blind... Btw. why the hell an universal (both-sided) field has getter only for client? I mean, seriously, why would you do that...
  17. So for last week i've been using: @SubscribeEvent public void onWorldTick(TickEvent.WorldTickEvent event) { for (Object o : event.world.getLoadedEntityList()) {} } And today launched Dedicated and noticed (server crashed) getLoadedEntityList() is @SideOnly(Side.CLIENT) I tried finding some similar method in WorldServer.class but anything close to one above is list by UUIDs. Anyone knows how to get all entities (or at least EntityLivingBase) in server world? - ***From world argument***
  18. public ItemStack onItemRightClick() You have to @Override parent (super) method! @Override public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) { return itemStackIn; }
  19. 1. Cancel normal char rendering. 2. Copy GuiChat class and edit it on your own. 3. Render your own chat. Everything using RenderGameOverlayEvent. Learn using events. Diesieben alredy noted this. Otherway would be: GuiNewChat actually has a singleton (inside Minecraft class), you can instead of canceling whole rendering simply do chatSingleton = yourChat. That is kinda old school (before overlay events), I don't recommend it
  20. Private fields can be used using Reflection, not ASM ;p Thare are good oracle tuts on Reflection. Have look at forge ReflectionHelper.
  21. Well, your problem is most likely elsewhere, we're gonna need your code.
  22. How are you declaring your list? protected final int top; protected final int bottom; Inside GuiScrollingList stand for number of pixels counting from top of screen for your top-border and bottom-border. Note: I was playing with it on 1.7.10. It might be different now.
  23. nbt.setFloat("POWER",power); nbt.getInteger("POWER"); Float != Integer Uhm?
  24. Yup. #Paint MAD SKILLZ Brown - rest of GUI White - visible part of list Orange - hidden part of list - a "cape" When element leaves visible part of list partially it' s being hidden behind "cape" and when it leaves visible list fully rendering stops. Lists are designed to be put from top to bottom, and only be limited by those "capes" for fake visual effect. In fact - under those capes, part of element is still being rendered. Cape border can be set in constructor (or by method directly)
  25. NOW WE ARE TALKING! I'll just need to separate EntityPlayer from EntityLivingBase. If what you are saying is everything I should know on this field updating Entities with WorldTick and player with PlayerTick will work just fine. I shall get back here with results Thanks! Solution: Use: TickEvent.PlayerTickEvent(SERVER) to update server-side START and END tick of EntityPlayer. TickEvent.WorldTickEvent(SERVER) to update server-side START and END tick of non-EntityPlayer entities. LivingUpdateEvent(SERVER) to update mid-tick (actual tick) for all EntityLivingBase. This closes thread.
×
×
  • Create New...

Important Information

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