Jump to content

Footbal

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Footbal

  1. Thanks for your help. At this point, you're right, I'll probably have to look for other implementations, since it's acting so strange. I'll do some experimentation with the various instances of WorldInfo and see if I can figure out how to do it. To anyone else interested, I'll probably post whatever solution I find. Thanks!
  2. If you look in net.minecraft.entity.EntityLivingBase, in the method attackEntityFrom(DamageSource, float), you'll see a bunch of qualifying statements checking where the damage is coming from and reacting accordingly (for instance, checking if the damage is fire && the player has a fire resistance potion on --> no damage [return false]). This looks like the best place to me to add your code. Note that EntityAIArrowAttack will reach attackEnitityFrom(...) in the form of a DamageSource object (the float parameter appears to be some sort of damage value?). damageSource.getEntity() will be the mob that shot you. Add in some code that checks whether that mob is the mob you want (using instanceof), then I think you can use this.addPotionEffect(PotionEffect) to put your potion effect on them. "this" will be the EntityLivingBase, so if it's you that's shot, I think it should apply the effect to you. *edit* Are you saying you want the damage of the arrow to be custom, or the damage of the potion? You should be able to set the arrow damage in attackEntityFrom(...) a few lines down from where it determines it should damage the entity, although there might be another way to do it involving that float parameter passed in from whatever called attackEntityFrom(...).
  3. Thanks, that explains a lot. However, the problem I'm now having is with persistence. Using the World object passed to onBlockPlacedBy, I was able to successfully edit the WorldInfo instances (seemingly all of them) with worldObject.getWorldInfo(). Both the respawn and gui code worked using this command. After exiting to the menu and reloading the world, however, it was only the respawn code that now recognized this instance of WorldInfo. Here's what I did to accomplish this level of persistence: added respawn variable initialization to WorldInfo(WorldInfo info) constructor added respawn variable to NBTTagCompound in updateTagCompound(...) using setBoolean("respawnEnabled", this.respawnEnabled) added respawn variable initialization to WorldInfo(NBTTagCompound compound) constructor This clearly works on some level because whatever WorldInfo object NetServerHandler is pulling is correct after saving, but the one GuiGameOver is pulling is not. Most confusingly of all, I tried setting my variable directly to the gui's WorldInfo with Minecraft.getMinecraft().theWorld.getWorldInfo() and it STILL didn't work, even when the WorldInfo object was directly descended from the Minecraft object in both the gui and block code. There's only one constructor in WorldInfo that I didn't add my property too, and that's the one that takes in a WorldSettings object as an argument. Could this be the one that GuiGameOver is using? If so, how do you recommend I make sure the client knows about my property?
  4. I couldn't say why the game crashes, but you could try adding the requirement && par5EntityPlayer.getCurrentEquippedItem().getItemDamage() == redDye.getItemDamage() to specify red dye
  5. I'm developing a mod which adds a property called respawnEnabled to the WorldInfo instance similar to isHardCoreModeEnabled and many of the other variables in net.minecraft.world.storage.WorldInfo. The mod uses this property to modify the behavior of the respawn code found in net.minecraft.network.netServerHandler and the gui code found in net.minecraft.client.gui.GuiGameOver so that if this property is true (it's a boolean), the game will proceed with the non-hardcore respawning behavior even if the game is in hardcore mode. My problem is that GuiGameOver doesn't seem to see that respawnEnabled is true, so it presents the player with the hardcore death screen. BUT, the respawn code DOES see the property as true, so clicking the "Delete World" button will actually respawn the player (since the delete world and respawn button send the same command and it's dealt with down the line). The only reason I can see for this is that there are TWO instances of WorldInfo in the game. I can't find a reason for this, nor can I find where the second instance would come from. Can anyone shed light on this problem? If it's any help, the respawn code gets its WorldInfo instance from a WorldServer object and GuiGameOver gets its instance from a WorldClient object. If it really is an issue of client vs server instances, how do I access both of those instances from another class like Block?
×
×
  • Create New...

Important Information

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