Jump to content

Noah_Beech

Members
  • Posts

    121
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Urban Ohio City :X
  • Personal Text
    Hello there! If ya need help gimme a PM :)

Noah_Beech's Achievements

Creeper Killer

Creeper Killer (4/8)

6

Reputation

  1. 1. When modifying speed, it modifies your players field of view, which can get annoying... 2. I've only gotten it to work in a very crude way, that glitches up, and could cause incompatibilities with other mods. Aside from that, Can anyone help me with my issue? :l
  2. As far as we know, custom horse armor, as of now, is a no-go without either a crapload of ASM or base edits, either way, things would get ugly really fast
  3. So I found a way to work around the already-terrible attribute system using reflection and player capabilities. Using this, I was able to modify player speed quite nicely, and it worked, and using ObfuscationReflectionHelper I made it so it SHOULD work in normal minecraft. However, it does not . The crash log ---- Minecraft Crash Report ---- // Ouch. That hurt Time: 9/25/13 7:20 PM Description: Ticking entity cpw.mods.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: cpw.mods.fml.relauncher.ReflectionHelper$UnableToFindFieldException: java.lang.NoSuchFieldException: field_73357_f at cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:140) at cpw.mods.fml.common.ObfuscationReflectionHelper.setPrivateValue(ObfuscationReflectionHelper.java:104) at rareores.Common.PlayerTickHandler.onPlayerTick(PlayerTickHandler.java:135) at rareores.Common.PlayerTickHandler.tickStart(PlayerTickHandler.java:164) at cpw.mods.fml.common.SingleIntervalHandler.tickStart(SingleIntervalHandler.java:28) at cpw.mods.fml.common.FMLCommonHandler.tickStart(FMLCommonHandler.java:122) at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:383) at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:282) at net.minecraft.client.entity.EntityClientPlayerMP.func_70071_h_(SourceFile:46) at net.minecraft.world.World.func_72866_a(World.java:2350) at net.minecraft.world.World.func_72870_g(World.java:2311) at net.minecraft.world.World.func_72939_s(World.java:2157) at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1919) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:908) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:836) at net.minecraft.client.main.Main.main(SourceFile:101) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) at net.minecraft.launchwrapper.Launch.main(Launch.java:27) Caused by: cpw.mods.fml.relauncher.ReflectionHelper$UnableToFindFieldException: java.lang.NoSuchFieldException: field_73357_f at cpw.mods.fml.relauncher.ReflectionHelper.findField(ReflectionHelper.java:87) at cpw.mods.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:136) ... 21 more Caused by: java.lang.NoSuchFieldException: field_73357_f at java.lang.Class.getDeclaredField(Unknown Source) at cpw.mods.fml.relauncher.ReflectionHelper.findField(ReflectionHelper.java:78) ... 22 more My code PlayerCapabilities cap = player.capabilities; float speed = cap.getWalkSpeed(); speed *=1.5; ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, cap, speed ,"walkSpeed","field_73357_f"); walkSpeed is a private value in playercapabilities, and I got the field_73357_f from fields.csv in /mcp/conf Help appreciated Thanks.
  4. Yeah, for now I was able to find something that worked, but one day when they document the attribute system and finish it up it will be alot nicer to work with.
  5. found a much better way (At least IMHO) if(player.inventory.hasItem(mod_rareores.ItemEmblemFlight.itemID) && useMap2.get(player.username) == 0){ PlayerCapabilities cap = ObfuscationReflectionHelper.getPrivateValue(EntityPlayer.class, player, "capabilities", "field_71075_bZ"); float speed = player.capabilities.getWalkSpeed(); speed *=1.5; ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, cap, speed ,"walkSpeed", "field_73357_f"); useMap2.put(player.username,1 ); } if(!player.inventory.hasItem(mod_rareores.ItemEmblemFlight.itemID) && useMap2.get(player.username) == 1){ PlayerCapabilities cap = ObfuscationReflectionHelper.getPrivateValue(EntityPlayer.class, player, "capabilities", "field_71075_bZ"); float speed = player.capabilities.getWalkSpeed(); speed /=1.5; ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, cap, speed ,"walkSpeed", "field_73357_f"); useMap2.put(player.username,0 ); }
  6. Okay I understand that, but how Am I going to modify player speed then, I just can't remove the item, and IM not going to use potioneffects.
  7. So essentially the attribute system sucks balls? Back in 1.5 I just needed ONE LINE OF CODE do do what I wanted, and now 60 lines only does it crudely. Would there be ANY way to modify player speed dynamically? Like if a different mod has the player speed at 1.5 times and I want to multiply it by 1.3 lets say, it will go upto 1.5 * 1.3 = 1.95. But doing it my previous way makes it so it removes the old modifier and replaces it with my new one so say 1.5 (/) to 1.3. Would it be possible if I could make my own specific mod attribute and not use vanilla ones, or is there some code elsewhere that modifies player speed? Because What Im doing now and what I was doing earlier is NOT going to work!
  8. Read the OP, I want the players speed to be modified when a player has an item, but if the player already has a speed attribute then I want to modify the existing attribute instead of over-writing it.
  9. Okay so I pushed this aside for awhile to get other things done, but this is the last thing I need to do. Can anyone help?
  10. If you use it on the server, even with an instance of entityplayer, you get a java.lang.NoSuchMethodError , AKA it's not serverside
  11. Anyone please? Im SOO close to figuring it out and it is the last thing I need to do.
  12. Okay, so after tinkering around with the above mentioned function, I found out that it does modify an attribute. After this I quickly got started on using it. But ran into a weird error that I can't seem to figure out. The conditionals determine if a new one should be added, or if it should be modified. But for some reason the player start going about 50x faster than he should and I don;t know why. I use a hashmap to keep data for each player if he should loose the attribute or not. My code PlayerTickhandler ________________________________________________________________ public HashMap<String, Integer> useMap = new HashMap<String, Integer>(); if(useMap.get(player.username) == null){ useMap.put(player.username, 0); } if(player.inventory.hasItem(mod_rareores.ItemEmblemSpeed.itemID) && useMap.get(player.username) == 0){ AttributeInstance attributeinstance = player.func_110148_a(SharedMonsterAttributes.field_111263_d); if(attributeinstance.func_111127_a(speed1.func_111167_a())!= null){ attributeinstance.func_111128_a(1.25); useMap.put(player.username,1 ); System.out.println("Part1works 1"); } else if(attributeinstance.func_111127_a(speed1.func_111167_a())== null){ attributeinstance.func_111121_a(speed1); useMap.put(player.username,1 ); System.out.println("Part1works 2"); } player.jumpMovementFactor *=1.25; } if(!player.inventory.hasItem(mod_rareores.ItemEmblemSpeed.itemID) && useMap.get(player.username) == 1){ AttributeInstance attributeinstance = player.func_110148_a(SharedMonsterAttributes.field_111263_d); attributeinstance.func_111128_a(0.; useMap.put(player.username,0 ); System.out.println("Part2works"); }
  13. You can use Ispecialarmor to make unbreakable armor.
  14. Can anyone help me out? I don't have much time on my hands to mod recently and this is the only thing keeping me from releasing my final version of my mod.
×
×
  • Create New...

Important Information

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