Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Izzy Axel

Forge Modder
  • Joined

  • Last visited

Everything posted by Izzy Axel

  1. Yep it's being called. event.entityLiving.worldObj.isRemote is not evaluating true though. Scratch that edit, it does work inverted or when removed, however it crashes and corrupts the world when you take damage while wearing the armor at night.
  2. Yes, is there any specific phase it has to be registered in? I did preinit.
  3. Just to be sure I tried it the other way, neither way is working with any damage type. The particles nor the console message. Also the armor is only supposed to give off particles if its in the Overworld, and it's night. Additionally, I'm doing 4 if statements because I want to make the individual pieces give off particles, and doing it as 1 conditional wouldn't tell me which one evaluated true. public class MythrilArmorParticles { @SubscribeEvent public void spawnArmorParticles(LivingHurtEvent event) { //WorldServer overworldInst = MinecraftServer.getServer().worldServers[0]; EntityLivingBase entity = event.entityLiving; if(event.entityLiving.worldObj.isRemote && !event.entityLiving.worldObj.isDaytime()) for (int i = 1; i < 4; i++) { Item entArmor = entity.getEquipmentInSlot(i).getItem(); if(entArmor instanceof ItemMithrilHelmet) for (int j = 0; j < 4; ++j) { event.entityLiving.worldObj.spawnParticle("suspend", entity.posX, entity.posY, entity.posZ, 1.0D, 1.0D, 1.0D); System.out.println("particle"); } if(entArmor instanceof ItemMithrilChestplate) for (int j = 0; j < 4; ++j) event.entityLiving.worldObj.spawnParticle("suspend", entity.posX, entity.posY + 0.6D, entity.posZ, 1.0D, 1.0D, 1.0D); if(entArmor instanceof ItemMithrilLeggings) for (int j = 0; j < 4; ++j) event.entityLiving.worldObj.spawnParticle("suspend", entity.posX, entity.posY + 0.4D, entity.posZ, 1.0D, 1.0D, 1.0D); if(entArmor instanceof ItemMithrilBoots) for (int j = 0; j < 4; ++j) event.entityLiving.worldObj.spawnParticle("suspend", entity.posX, entity.posY + 0.2D, entity.posZ, 1.0D, 1.0D, 1.0D); } } }
  4. SSP has been running on an internal server for a while now for starters, and I solved this in another thread, if I try to do Minecraft.getMinecraft().theWorld, nothing I do using it works, such as isDaytime always evaluates to true. So no, doing it this way is not crashing the client, and doing it the old way isn't working, so...yeah. Also yeah I just figured out that you can access entityLiving through event. Oops.
  5. Ok, how would I get the entity to act on from inside the new event class? https://gist.github.com/izzyaxel/cc78f0e1a74495321555
  6. Ok this is the first time using Forge event subscriptions, how am I supposed to do this, am I doing this completely wrong? (this is in the main class) @SubscribeEvent public void LivingHurtEvent(EntityLivingBase entity, DamageSource source, float amount) { }
  7. I can't find anything in the source or the forum search about spawning particle effects from armor. The armor class is implementing ISpecialArmor, if that helps. This is what I've been trying to make work: public class ItemMithrilLeggings extends ItemArmor implements ISpecialArmor { public ItemMithrilLeggings(ArmorMaterial armorMat, CreativeTabs tab, int renderIndex, int slot) { super(armorMat, renderIndex, slot); setUnlocalizedName("mithrilLeggings"); setTextureName(Reference.MODID + ":" + getUnlocalizedName().substring(5)); setCreativeTab(tab); setMaxDamage(2456); maxStackSize = 1; } @Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { ArmorProperties mithLeg = new ArmorProperties(3, 1, 167); WorldServer overworldInst = MinecraftServer.getServer().worldServers[0]; Random rand = new Random(); if(overworldInst != null) if(overworldInst.isDaytime()) mithLeg.AbsorbMax = 167; else mithLeg.AbsorbMax = 217; for (int i = 0; i < 10; i++) overworldInst.spawnParticle("suspend", player.posX + (rand.nextDouble() + 0.8D) * 0.5D, player.posY + (rand.nextDouble() * 0.5D), player.posZ + (rand.nextDouble() + 0.8D) * 0.5D, 200.0D, 200.0D, 200.0D); return mithLeg; } @Override public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot){return 0;} @Override public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { this.setDamage(stack, stack.getItemDamage() - damage); } }
  8. Since SSP runs on an internal server, do you need to do this for both SSP and SMP? Edit: yes, yes this is the case, the detection is working fine now. And here's the working method for future reference: @Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { ArmorProperties mithChest = new ArmorProperties(4, 1, 250); WorldServer overworldInst = MinecraftServer.getServer().worldServers[0]; if(overworldInst != null) if(overworldInst.isDaytime()) mithChest.AbsorbMax = 250; else mithChest.AbsorbMax = 500; return mithChest; } Now the problems remaining on the armor are: it isn't taking damage, it doesn't show up in the armor section of the HUD, it causes rendering issues with the armor slots in the player inventory.
  9. Something's not right with the day/night detection, the AbsorbMax isn't switching. Edit: I added console outputs to the conditional, it's saying "day" when its night, so isDaytime is always evaluating true.
  10. Ok, I think I see how ArmorPropeties is supposed to work. Where's an example of AbsorbRatio and AbsorbMax though? I'm not sure what to put here. PS once I've done this, putting a piece in makes the other armor slots go black. Only the boots add armor points on the HUD as well. Update: After some testing, it's not switching between the two ArmorProperties, and it's not getting damaged when I take damage. Here's one of the armor classes: public class ItemMithrilBoots extends ItemArmor implements ISpecialArmor { public ItemMithrilBoots(ArmorMaterial armorMat, int renderIndex, int slot) { super(armorMat, renderIndex, slot); setUnlocalizedName("mithrilBoots"); setTextureName(Reference.MODID + ":" + getUnlocalizedName().substring(5)); setCreativeTab(Main.artificeauguryTab); setMaxDamage(2456); maxStackSize = 1; } @Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { ArmorProperties mithBoot = new ArmorProperties(2, 1, 250); WorldClient worldInst = Minecraft.getMinecraft().theWorld; if(worldInst != null) if(worldInst.isDaytime()) mithBoot.AbsorbMax = 250; else mithBoot.AbsorbMax = 300; return mithBoot; } @Override public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot){return 0;} @Override public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { this.setDamage(stack, stack.getItemDamage() - damage); } }
  11. Seems like using reflection is easier and cleaner, but ok. I still don't know how to check for the conditions every few ticks though. Also I'm not sure how I should be using the ArmorProperites override (I assume this is the one you were referring to) from implementing ISpecialArmor to dynamically change them.
  12. For mithril, the protection array of the armor increases at night, for orichalcum the damage and mining speed of the tools increases during the day. All items of those types should change, though only in the Overworld. I suppose what I have atm would make the items change in other dimensions based on the overworld's day/night cycle?
  13. I'm not sure I understand how you would use that. This is the statement so far: if(Minecraft.getMinecraft().theWorld != null) { if (Minecraft.getMinecraft().theWorld.isDaytime()) { ReflectionHelper.setPrivateValue(Main.class, this, orichalcumTMDay, 0); ReflectionHelper.setPrivateValue(Main.class, this, mithrilAMDay, 9); } else { ReflectionHelper.setPrivateValue(Main.class, this, orichalcumTMNight, 0); ReflectionHelper.setPrivateValue(Main.class, this, mithrilAMNight, 9); } } Wouldn't this need to go into an overriden tick handler of some sort to make it re-evaluate isDaytime every x ticks? Also I'm not finding worldServers.getCurrentTime, worldServers doesn't have any methods.
  14. Ties in with the other thread I made, I'm trying to use reflection to alter a ToolMaterial, depending on the day/night cycle.
  15. I needed to get the world instance to call either isDaytime() or getCelestialAngleRadians() on it. worldServers doesn't have access to either of those, by the way, so how would I detect day/night if I wanted to get the day/night cycle on a server? Speaking of which, I wont clutter the forum with a new post about this, so if I want to then update an item based on the day/night cycle, do I have to use a player tick handler, or something else?
  16. How do you get the world outside of a function that has the world as one of its arguments? I don't know why but I've found absolutely nothing on this from google or the forum's search tool.
  17. Do you mean that I should create a new ToolMaterial with the modified values and give it as the second to last argument? That gives the same error, with Item.ToolMaterial instead of Float.
  18. My material is created and registered in Main.class, so would I want ReflectionHelper.setPrivateValue(Main.class, Main.material, x, y); because when I try to do that, setPrivateValue errors, saying The method setPrivateValue(Class<? super T>, T, E, int) in the type ReflectionHelper is not applicable for the arguments (Class<Main>, Item.ToolMaterial, float, int) One more thing, when I do the field listing for Main, it doesn't give the fields for the tool material, just the tool material itself.
  19. From the end of that post, it seems that reflection is only really needed for efficiency and harvest level? What's the call for attack damage? But that's very useful anyway, thanks for that.
  20. I want to edit the ToolMaterial on an item arbitrarily, is there any function that can update the ToolMaterial after it's been registered, or any method of working around this?
  21. The folder name should be the same as your mod ID, and afaik your mod ID shouldn't be capital or have spaces. Also you should do setTextureName(Reference.MODID + ":texturename"), fetching from that one central variable makes it easy to modify your mod ID and ensures you never misspell it by accident.
  22. What I said was a "plain english" version of what diesie said, do what he told you to.
  23. Or download the source, if the mod in question is open source.
  24. You're going to need the decompiled class files and packages of the mod you want, and put them into your projects workspace. Then you can make references to functions and items and such inside that mod, and it will compile. After it's compiled, delete the compiled class files for that mod from the JAR. There's probably a way to exclude the files you don't need from the compilation, but I don't know it yet. If you're adding support for a mod that you didn't write, say Buildcraft, (as opposed to creating a core mod that all your other mods require) then you're going to want to wrap everything you add that makes reference to Buildcraft in an "if" statement, which checks if Buildcraft is loaded. Otherwise, Buildcraft will be a dependency, and your mod won't work without it.
  25. I actually made a pastebin of this for someone else... http://pastebin.com/7Xk7R1XA

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.