Jump to content

ItsTheRuski

Members
  • Posts

    55
  • Joined

  • Last visited

Everything posted by ItsTheRuski

  1. I am not sure. I am getting a list of all entities of EntityLivingBase that are around the player. I am not sure how to check what is a server-side object.
  2. I tried this same approach, but I am getting a java.util.ConcurrentModificationException when I try to access the list. Here is my code for a custom potioneffect that collects all the entities that: 1.are not the players and 2.extend EntityLivingBase. Then I simply print out what their names with the entity.getName() method i.e. (Zombie, Pig, Cow, Sheep) I am getting the error java.util.ConcurrentModificationException on the line for(Entity e : list) and the description says net.minecraft.util.ReportedException: Ticking player Thanks for helping! =)
  3. Most of the classes that you are referring to have non-static methods and variables. This mean that you have to have an instance of that class to call those methods on. For example, each player(since they are an instance of the class EntityPlayer) has its own isSneaking() method. Therefore, you have to have an instance of the class you are calling already created in order to use those methods. Also, don't modify base classes. From what I've read on the Mojang page, you cannot modify the code that has already been written: it's illegal to redistribute modified base classes. Instead, make other classes that extends from the base classes and use @Override to modify the methods. Then find a way to implement your classes into the game. To check if you accidentally modified a base class, re-obfuscate your mod(package it) then check the zip file that is created. If you see any classes that you did not write(usually a combination of three lowercase letters) that mean you modified a base class in some way.
  4. I fixed it by making a different image with my icons in the exact same coordinates of the image as the regular status effect icons, then I binded that image to the render engine.
  5. I fixed the problem. I made a check for the first fall the player takes after the status effect ends and I cancel that fallEvent.
  6. I fixed it. I was giving the player new instances of my potion effects, but I didn't set the status icon of those potion effects.
  7. Does Minecraft or Forge support alpha transparency for icons,blocks, or items?
  8. I made several 16x16 status icons and combined them with the regular player inventory picture like this: Then, I overide the setIconIndex method of my custom potion to coordinates as if the series of status icons in the inventory picture were a 2D array which means that setIconIndex(0,0) would return the speed icon and setIconIndex(2,1) would return the jump boost icon. However, when I try to set the icon to an icon that is to the right of the fire resistance icon, then, in game, it looks as if the icon was too far so the game looked for the leftmost icon on the next row. Here's an example of when I try setIconIndex(8,1) which is the brick-textured apple So my question is, how would I display my custom status icons? Thanks for taking the time to read this =)
  9. I meant that you can see the images of what's going on. The rendering problem is NOT fixed yet. Please help =)
  10. Here is my cutom potion file : package eclipse.MoreApples.potion; import java.util.Timer; import java.util.TimerTask; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureObject; import net.minecraft.client.resources.ReloadableResourceManager; import net.minecraft.client.resources.Resource; import net.minecraft.client.resources.SimpleReloadableResourceManager; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.src.ModLoader; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingFallEvent; public class FlyingPotion extends Potion { public FlyingPotion(int par1, boolean par2, int par3) { super(par1, par2, par3); } public Potion setIconIndex(int par1, int par2) { //(3,2) is where I drew my texture in the "2D array" of textures in the inventory.png super.setIconIndex(3,2); return (Potion)this; } @Override public int getStatusIconIndex() { ResourceLocation r = new ResourceLocation("More_Apples:textures/gui/inventory.png"); TextureObject texture = Minecraft.getMinecraft().renderEngine.getTexture(r); Minecraft.getMinecraft().renderEngine.bindTexture(r); return super.getStatusIconIndex(); } } And here is what's rendering: I have also noticed something. If I give myself the potion effect, then quit the game before the potion effect runs out, it will render this:
  11. I tried this but I am still not getting the image. In fact, I am not getting the name of my potion effect either.
  12. I was able to get my custom potioneffect to render with my custom texture in the player's gui before I updated to the latest forge. Now there are methods like Minecraft.getMinecraft().renderEngine.bindTexture(par1ResourceLocation) and Minecraft.getMinecraft().renderEngine.getTexture(par1ResourceLocation) and Minecraft.getMinecraft().renderEngine.loadTexture(par1ResourceLocation, par2TextureObject). Does anyone know how to use them?
  13. Throgh numerous if's, else if's, and print statements, I am noticing that the entity.getActivePotionEffect(myPotion) returns null after the first time. I want to be able to check for my potion effect multiple times. Does it make any difference if my call to entity.getActivePotionEffect(myPotion) is in an Forge Hooks class that uses LivingUpdateEvent?
  14. How would I check when a potion effect that is on the player has ended. If I use myPotionEffect.duration == 0, it only works one time. After the potion effect is re-applied, the duration still reads 0.
  15. I just thought that a tickhandler is inefficient since it constantly checks for a certain condition. I tried to put all of this code into a custom potion effect except I don't know how to modify what happens when a potion effects duration reaches 0. I tried using LivingEntityUpdateEvent and check when my custom potion's duration reached zero. Here's the code: The only problem is that when I fall my fall damage doesn't get negated. I noticed several lines of code in which the server says that the player has fallen even though I cancelled the event. A couple lines afterward, a statement in my event class gets printed out stating that the event has NOT been cancelled. This means that the livingFallEvent is getting called twice even though the player only fell once. Here is the full FORGEMODLOADER-CLIENT-0.LOG
  16. THANK YOU SO MUCH! GotoLink, your advice worked! I realized now that I have an extra folder, so I need to specify. Thanks again to both of you for helping! =)
  17. I put the texture in the right place and gave the ResourceLocation the same address : textures/gui/container/inventory.png Although, I have to agree with you that this is weird. I gave setIconIndex(int par1, int par2) coordinates that match the jump boost icon and my custom potion effect texture rendered as the jump boost icon. However, when I switched the coordinates, it went back to the bank spot, even though I triple-checked that there was a texture there. Also, my full file path is C:\Users\ItsTheRuski\Dropbox\Modding\More Apples\forge\mcp\src\minecraft\assets\more_apples\textures\gui\container\inventory.png Is that filepath correct? Thanks, again! =)
  18. How would that cancel the rendering of the potioneffect?
  19. I am trying to do the same thing. So far I have realized that the EntityLiving class has an updatePotionEffects method which takes the hashmap( a hashmap is sort of like an array, but each cell of the array has several attributes) of potioneffects curerntly on the living entity and displays them. There are no parameters to the method, so we cannot modify the way the potioneffects are rendered. However, there are several other ways to achieve our goal: 1. Mimic the commands of instantiating a potioneffect on the living entity in a food item, armor, or such class without adding it to the living entity's potioneffect hashmap( I tried this on a custom food item, still trying to get it to work) 2. Creating a custom class that extends EntityLiving and rewriting the updatePotionEffects method. One would have to change the instance of the player that the potioneffect is suppose to be affecting from a EntityLivingBase to a XXXX class that extends EntityLivingBase Try the first option and I will try the second option. This way we can collaborate on our mutual dilemma. =)
  20. I do. I created a copy of inventory.png and replaced the empty spot with a texture.For some reason, it is loading a deafult empty texture space, even though I made my own texture sheet.
×
×
  • Create New...

Important Information

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