Jump to content

Thornack

Members
  • Posts

    629
  • Joined

  • Last visited

Everything posted by Thornack

  1. I apologize for the late reply as I have been a but busy. In the spirit of fleshing this out a bit more, I have noticed that editing the player can be tough and many people are interested in doing just that. Ive noticed many topics about changing the players hitbox, camera angle, camera x,y,z position, camera pitch and yaw rotation, camera viewpoint, player eyeheight, and player reach (i think thats all of them). As of right now reflection is one of the only ways to do a lot of this it seems (although some of this can be achieved with forge or vanilla as you said) the rest of it isnt trivial stuff. Most is very difficult to do (Ive seen alot of people resort to coremods and what not to achieve some of this stuff) and as such I pitched the idea into creating a forge hook or maybe an event that would allow relatively easy access into editing these parameters that all have to do with the player. Something such as a Change camera location event (where you can set the angle) or change camera xposition etc etc or maybe an alterplayer dimensions event which would fire before the player is constructed or rendered allowing someone to alter his dimensions (hitbox eyeheight etc etc). Im not really sure exactly what would be the best approach to all of this as I am still stumped by how alot of it works. However, weith this being said the stuff with the hitbox and player reach is especially interesting to alot of people and I think maybe a forge hook into accessing these parameters would be beneficial. Although, I am not sure exactly how to go about this. My interest is very keen into finding a way to edit all of these parameters relatively easily and im sure lots of pothers feel the same. it would be nice if that functionality could be built into forge. Does anyone have any ideas about this?
  2. Hmmm Ok, Im not sure I understand exactly could you provide an example.
  3. In not sure about th emath but this is definately wrong... Vec3 lookVector = player.getLookVec(); lookVector.xCoord = lookVector.xCoord * 1.5; lookVector.yCoord = lookVector.yCoord * 1.5; lookVector.zCoord = lookVector.zCoord * 1.5; lookVector.addVector(player.posX, player.posY, player.posZ); I want the distance to be 1.5 away from the player but it isnt
  4. found it for those that are reading you can get the look vector on server by doing Vec3 vec3 = player.getLookVec();
  5. also where would I access the look vector is that obtained by using MovingObjectPosition mop= player.rayTrace(5, 1.0F); (cause this is client side only and I need this vector on server side) is there a way to get the look vector server side to avoid a packet. and ya to make a vector in 1.7.10 you need to do Vec3 vec = Vec3.createVectorHelper(player.posX, player.posY, player.posZ);
  6. Can this happen on server side since I need it to happen server side
  7. Hi everyone, I guess this is more of a math question really, I want to drop an item directly in front of my player no matter what his position is or rotation. I have the players position x1,y1,z1 and I want to drop the item at x2,y2,z2 so that these coordinates (where i drop the item) are always located directly in front of my player. The player has a rotation yaw and rotation pitch I was wondering if there is a way to use these values to determine the "forward coordinates" x2,y2,z2 where my item should drop so that they always exist in front of the player. Any ideas?
  8. I do it the following way //when on server I do player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(placeIGetStats.stats.hp); player.setHealth(placeIGetStats.stats.currentHp); player.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(placeIGetStats.stats.currentAtt); PacketOverlord.sendToClient(new PacketUpdatePlayerSharedMonsterAttributes()); //then for movement speed I send a packet and inside my packets process method (which is called client side only I do) the following-> player.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(whatever); note with movement speed you'll encounter a problem most likely where if the player sprints the movement speed will be reset back to the original even after youve applied the effect. I havent found a way to fix this yet (although havent look that hard at fixing it)
  9. Definately stuck on this one, the code is pretty complex I didnt realize how much it took to get the players chosen skin. I may just write my own system for when the mod starts choose your player skin and save it at that point rather than messing with all of this obfuscated hard to read code
  10. Ill send packets just to be sure, I am currently only setting it server side
  11. also setting the attackDamage attribute seems to work also when you set it on the server. Why wouldnt the movement speed work?
  12. I am changing the movement speed of my player and apparently doing player.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(20); <- doesnt change anything the default value is 0.10000000149011612 as determined by player.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getBaseValue(); when I outprint after I change the attribute to my value I get 20 but the player still moves at the same spd
  13. Since they are not actually players, have you tried just using World.getEntityById()? Every time an entity is created, it is assigned an id that stays the same until it dies. You might could use that. Instead of saving the UUID, you can just save the regular ID. I'm not sure if entity IDs persist over world saves, though. I never really tested that. Edit: Looking at the code, I don't think they are saved. So, logging out and logging back in would reload all entities with new IDs. If you want them to be remembered over world saves, just keep using what you were. Ya it is unfortunate that they dont persist otherwise I would use that. Ill be thinking of ways to improve this cause it isnt good atm scanning all Entities in all loaded chunks is a bad idea I think. Even though my method is called once in forever pretty much even if the player spams the morph/unmorph buttons, I still want a more efficient way of getting the entity cause if 5000 players decide to spam then there may be issues. Its just inefficient and Ill bet there is a better way. For now unless I get any ideas ill be working on other stuff. Again if anyone comes up with a better solution please post, I see this get entity by UUID issue alot in the forums and it seems no one's found anything thats really good and efficient I dont think.
  14. Is this what you are looking for? http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2136028-get-entity-by-uuid?comment=6 That is exactly what I am doing currently and it now works on dedicated server and on single player too. However I want a more efficient way of getting my entity since using that method you are scanning through all entities and if there is 5000+ on a server this is taxing. very inefficient.
  15. /** A list of all Entities in all currently-loaded chunks */ public List loadedEntityList = new ArrayList(); Ya it is public I think ill try that and letcha know if it works. I do want to eventually figure out a better way of getting my entity while on server side EDIT: Yes that worked thanks alot!
  16. Im not looking for Players though. I am looking for EntityCustomMob not EntityPlayer.
  17. Im not looking to get the Player by UUID I want a spawned entity for which the player has a UUID. My Player has a list of party members all of which he knows UUID's for all the time. I want to get the entity from the UUID the player knows when the entity is in the world. I want this done on server side Also World.getPlayerEntityByUUID() isnt a method in 1.7.10 I dont think (I only found World # getPlayerEntityByName())
  18. I changed it by adding the following to client proxy public static List getLoadedEntityList(World world){ return world.getLoadedEntityList(); } and then public static Entity getMob(World world, EntityPlayer player) { PlayerParty ppp = PlayerParty.get(player); for (Object object : ClientProxy.getLoadedEntityList()) { if (object instanceof EntityPartyMember) { EntityPartyMember entity = (EntityPartyMember) object; long uuidMost = ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDMost"); long uuidLeast =ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDLeast"); if (entity.getUniqueID().getMostSignificantBits() == uuidMost && entity.getUniqueID().getLeastSignificantBits() == uuidLeast) { return entity; } } } System.out.println("DID NOT FIND ENTITY: Entity is Null"); return null; } but I still get a crash this time it is a java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP but this is from the server thread nothing is printed to consol. at custommod.battle.helper.WorldHelper.getMob(WorldHelper.java:145) ~[WorldHelper.class:?]
  19. Does anyone know of a better way to get an entity by its UUID when you are on the server?
  20. That is really weird why would it be on ClientSide Only...
  21. Now I understand that my getMob function is taxing, I havent been able to find a way around using it which sucks. If anyone has any ideas as to how to achieve that I would gladly appreciate any input. As Always Thanks for reading the post
  22. When I test my mod on a dedicated server and when I trigger the method that transforms the player into his party member I get a no such method error (this doesnt happen in LAN or when in singleplayer) I have a getMob function, this function gets the entity that the player spawned from his party list by comparing the uuids the player knows with the uuids of entities from the world //this function gives me a no such method error when I run the server and when player morphs public static Entity getMob(World world, EntityPlayer player) { PlayerParty ppp = PlayerParty.get(player); for (Object object : world.getLoadedEntityList()) { if (object instanceof EntityPartyMember) { EntityPartyMember entity = (EntityPartyMember) object; long uuidMost = ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDMost"); long uuidLeast =ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDLeast"); if (entity.getUniqueID().getMostSignificantBits() == uuidMost && entity.getUniqueID().getLeastSignificantBits() == uuidLeast) { return entity; } } } System.out.println("DID NOT FIND ENTITY: Entity is Null"); return null; } I have a morph function, this function swaps positions with the entity the player is transforming into and triggers a model/texture switch and will in the future switch their stats and all of that The way it works is as follows For some reason the helper method gives me a no such method exception when I run dedicated server and test. This method is located inside my BattlePlayerProperties class which is a IEEP class that adds additional stuff to the player public void morph(boolean shouldBeMorphed){ if(shouldBeMorphed){ System.out.println("Morphing"); } else{ System.out.println("Returning"); } EntityPartyMember morphPartyMember = (EntityPartyMember) WorldHelper.getMob(player.worldObj, player); //this line gives me a no such method error when I run the server and test Im not sure why This is happening morphPartyMember.setMorphedIntoPlayer(shouldBeMorphed); double preMorphPosX = this.player.posX; double preMorphPosY = this.player.posY; double preMorphPosZ = this.player.posZ; this.player.setPositionAndUpdate(morphPartyMember.posX, morphPartyMember.posY, morphPartyMember.posZ); this.player.prevPosX = morphPartyMember.posX; this.player.prevPosY = morphPartyMember.posY; this.player.prevPosZ = morphPartyMember.posZ; morphPartyMember.setPosition(preMorphPosX, preMorphPosY, preMorphPosZ); morphPartyMember.prevPosX = preMorphPosX; morphPartyMember.prevPosY = preMorphPosY; morphPartyMember.prevPosZ = preMorphPosZ; } The consol error log (Please let me know if I have provided enough code/info about this error)
  23. From what I can tell this is the relevant bit of code where p_152674_7_ is the GameProfile of the player and is passed from TileEntitySkull is seems but I am not sure how all of it works as it is all obfuscated pretty much. I have managed to get my players game profile working but the f (map.containsKey(Type.SKIN)) isnt true for some reason. ResourceLocation resourcelocation = AbstractClientPlayer.locationStevePng; if (p_152674_7_ != null) { Minecraft minecraft = Minecraft.getMinecraft(); Map map = minecraft.func_152342_ad().func_152788_a(p_152674_7_); if (map.containsKey(Type.SKIN)) { resourcelocation = minecraft.func_152342_ad().func_152792_a((MinecraftProfileTexture)map.get(Type.SKIN), Type.SKIN); } } this is what I have so far in my render code. The game profile prints correctly it seems for my player it contains his uuid and name but for some reason I am not getting the texture not sure why or where this happens and thats the bit that I need. private ModelBase playerModel = new ModelBiped(); private ModelBase consistentModel; private GameProfile gameProfile = null; private ResourceLocation consistentTexture; private ResourceLocation currentTexture; //more renderer code that is irrelevant to the issue @Override public void doRender(Entity entity, double x, double y, double z, float f, float F) { if (entity instanceof EntityCustomType) { EntityCustomType ent = (EntityCustomType) entity; String playerName = ent.getPlayerName(); gameProfile = MinecraftServer.getServer().func_152358_ax().func_152655_a(playerName); if (playerName != null && !playerName.equals("")) { if(gameProfile !=null){ this.getGameProfileTexture(gameProfile); this.mainModel = this.playerModel; } else{ this.currentTexture = AbstractClientPlayer.locationStevePng; this.mainModel = this.playerModel; } } else { this.currentTexture = this.consistentTexture; this.mainModel = this.consistentModel; } } super.doRender(entity, x, y, z, f, F); } public void getGameProfileTexture(GameProfile profile) { ResourceLocation resourcelocation = AbstractClientPlayer.getLocationSkin(profile.getName()); Minecraft minecraft = Minecraft.getMinecraft(); Map map = minecraft.func_152342_ad().func_152788_a(profile); if (map.containsKey(Type.SKIN)) { System.out.println(map.containsKey(Type.SKIN)); //never called resourcelocation = minecraft.func_152342_ad().func_152792_a((MinecraftProfileTexture)map.get(Type.SKIN), Type.SKIN); this.currentTexture = resourcelocation; } this.currentTexture = resourcelocation; }
  24. I have been looking at it and it is quite difficult I am trying stuff but am not having much success as the code it obfuscated alot and uses quite a few fucntions to get the players game profile and somehow find the texture
×
×
  • Create New...

Important Information

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