Jump to content

Thornack

Members
  • Posts

    629
  • Joined

  • Last visited

Everything posted by Thornack

  1. I need to be able to check whether or not my entities UUID is actually persisting throughout me setting it dead and creating a dummy instance of it where I then populate the dummy instance with my entities data on spawning the dummy instance to achieve the effect of "storing the entity" inside the itemstack and inside the other entity. My goal is to get the entity by its unique identifier based on an event. But i cannot get it if i dont know how to access the identifier.
  2. Ok, My next question is how would I access that then, using the getEntityId(). Im not sure how to sync client and server
  3. So are you saying that the UUID is actually persisting throughout on the server?
  4. I tested that out and ya the UUID changes everytime the entity is spawned and then recaptured and then spawned again
  5. that code is located inside my @Override public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4){} method inside my CustomItem class [EDIT] I am trying to save the Entity UUID directly as a variable inside my entity class and maybe accomplish what I want that way. Inside the NBT methods in my CustomHitEntity (shown above) I have added the following in the Entity class I added public Long UUIDMost; in the readNBT method UUIDMost = nbtCompound.getLong("UUIDMost"); in the writeNBT method nbtCompound.setLong("UUIDMost", getUniqueID().getMostSignificantBits()); Im going to try and get these instead and see if they persist
  6. I have a model with 198 pieces n I still use my method haha
  7. woops my mistake I meant to paste the following into that last post caughtEntity.readEntityFromNBT(caughtEntityNBT); UUID id = caughtEntity.getUniqueId(); //this should be the UUID right list.add(EnumChatFormatting.DARK_PURPLE+"UUID: "+id); [code] the id changes if I do that
  8. ok but if you dont want to have to do any of that then just add a method similar to the one I use to create your child/parent piece relationships (cause that method fixes rotation point math) and then use the technique I described below that to keep your angles unaltered by any math. It works pretty well (at least for all angles which is what you want) but it can get tedious if ur models have alot of parent pieces.
  9. oh that is my custom model renderer class where i added customized methods you can use the default Model Renderer your using and modify my child method to work with ur model renderer I created my own renderer to add customized methods
  10. ok ya I am writing the entity using the NBT but why does it change each tick when I do inside my item class caughtEntity.readEntityFromNBT(caughtEntityNBT); int id = caughtEntity.getEntityId(); list.add(EnumChatFormatting.DARK_PURPLE+"UUID: "+id); I can see the entityid incrementing each tick when i mouse over my item EDIT[] in my CustomHitEntity class I have the following NBT methods @Override public void readEntityFromNBT(NBTTagCompound nbtCompound) { super.readEntityFromNBT(nbtCompound); nbtCompound.getString("hitEntityName"); stats.impactEntityName = nbtCompound.getString("impactEntityName"); stats.level = nbtCompound.getInteger("Level"); stats.hp = nbtCompound.getInteger("MaxHP"); stats.currentHp = nbtCompound.getInteger("CurrentHP"); stats.att = nbtCompound.getInteger("MaxAtt"); stats.currentAtt = nbtCompound.getInteger("CurrentAtt"); stats.def = nbtCompound.getInteger("MaxDef"); stats.spd = nbtCompound.getInteger("MaxSpd"); stats.currentSpd = nbtCompound.getInteger("CurrentSpd"); } @Override public void writeEntityToNBT(NBTTagCompound nbtCompound) { super.writeEntityToNBT(nbtCompound); nbtCompound.setString("hitEntityName", EntityList.getEntityString(this)); nbtCompound.setString("impactEntityName", this.getImpactEntityName()); nbtCompound.setInteger("Level",stats.level); nbtCompound.setInteger("MaxHP",stats.hp); nbtCompound.setInteger("MaxAtt",stats.att); nbtCompound.setInteger("MaxDef",stats.def); nbtCompound.setInteger("MaxSpd",stats.spd); nbtCompound.setInteger("CurrentHP",stats.currentHp); nbtCompound.setInteger("CurrentAtt",stats.currentAtt); nbtCompound.setInteger("CurrentDef",stats.currentDef); nbtCompound.setInteger("CurrentSpd",stats.currentSpd); }
  11. lemme know if it works out for ya also the thanks button is top right
  12. I have come up with a method to achieve that but it isnt the best approach and i use it for 1.7.10 not sure how it has changed in 1.8 since i havent updated but you could try it out. This method works to keep your initial rotation angles from being messed up when adding child/parent piece relationships. [NOT A COMPLETE CLASS] - lets say you have a model with two pieces one piece you want to be the parent and the other you want to be the child (example below) This is the method I use to add the child/parent relationship but if you use it directly (ie if you make ur desired parent the parent of your child) and if your parent has rotations other than 0 then your original rotations will be messed up upon setting up the parent/child relationship (as you already know). I solve the porblem in the following way: 1: create a dummy rotation model piece without a box 2: set the rotation point of this dummy piece to be the same as that of the piece you want to be the parent 3: make the dummy piece the parent of your child piece and make the dummy piece the parent of your desired parent piece 3: VOILA - the original rotations are preserved and you can set up the control you need using a parent/child piece setup
  13. so currently i use the following to save my entity inside the itemstack I had to remove alot of code as this class is large //called back from the AnimationEntity class when the catch animation finishes to generate the itemstack public void onEntityCaught(){ ItemStack itemstack = this.generateCustomItemstack(this.hitEntity, this.getCustomEggItemType(), this.impactEntityName); EntityItem customEggItem = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, itemstack); customEggItem.motionX = customEggItem.motionY = customEggItem.motionZ = 0; this.worldObj.spawnEntityInWorld(customEggItem); this.setDead(); } //generates an itemStack containing the caught entity private ItemStack generateCustomItemstack(EntityCustom hitEntity, CustomItem customItemType, String impactEntityName){ return CustomItemStackFactory.generateCustomItemStack(hitEntity, customItemType, impactEntityName); } @Override protected void readEntityFromNBT(NBTTagCompound nbtTagCompound) { NBTTagCompound hitEntityNBT = nbtTagCompound.getCompoundTag("hitEntity"); this.wasCaught = nbtTagCompound.getBoolean("wasCaught"); } @Override protected void writeEntityToNBT(NBTTagCompound nbtTagCompound) { NBTTagCompound hitEntityNBT = new NBTTagCompound(); this.hitEntity.writeEntityToNBT(hitEntityNBT); nbtTagCompound.setTag("hitEntity", hitEntityNBT); nbtTagCompound.setString("impactEntityName", this.impactEntityName); nbtTagCompound.setBoolean("wasCaught", this.wasCaught); } This is where the actual item stack NBT data is saved in the new itemstack CustomItemStackFactory public class CustomItemStackFactory { public static ItemStack generateCustomItemStack(EntityCustom hitEntity, CustomItem customItemType, String impactEntityName){ ItemStack customItem = new ItemStack(customItemType); if(customItem.stackTagCompound == null){ customItem.stackTagCompound = new NBTTagCompound(); } NBTTagCompound entityCustomNBTCompound = new NBTTagCompound(); hitEntity.writeEntityToNBT(entityCustomNBTCompound); customItem.stackTagCompound.setTag("hitEntity", entityCustomNBTCompound); customItem.stackTagCompound.setString("impactEntityName", impactEntityName); return customItem; } } EDIT - Diesieben07, Im not sure how I would implement that (kinda my original question actually as how one would go about doing that) would I get the UUID and save it using NBT?
  14. Dang ya i was starting to realize ill probably have to figure out my own system for ids
  15. One thing to note that i have noticed. With the current setup that I have, if i try caughtEntity.readEntityFromNBT(caughtEntityNBT); int id = caughtEntity.getEntityId(); list.add(EnumChatFormatting.DARK_PURPLE+"UUID: "+id); inside my method that adds information about the itemstack, then the entity id seems to increment each tick also i tried to add UUID id = caughtEntity.getUniqueID(); instead of the int id = caughtEntity.getEntityId(); line and upon doing so the UUID also seemed to change everytick when i placed my mouse over the itemstack to display the information about it.
  16. Ok so without making this too confusing here is the info you requested. In my mod I have an entity that can capture other entities (it can only capture one entity at a time though and works perfectly atm). This entity has a method where if it hits another entities hitbox, it gets the hit entity and passes it to a placeholder entity - (that plays an animation and stores the entity as NBT then it sets the impacted entity to dead and generates an itemstack that contains the entities data). The resultant itemstack is dropped into the world and stays in world until a player picks it up and this item works like a monster egg that spawns a new entity with the same data as the impacted entity that was set to dead previously. If this entity is hit again by the first entity (mentioned above) then the same process occurs. I need a way of preserving some sort of entity id for the captured entity throughout the process so that it is retrievable at a later time. I dont think it would work if I used the actDead solution you suggested since if i spawn an entity with the same data as the impacted entity and the impacted entity is still "alive" and in the world somewhere) then eventually there will be too many entities in world and this would be a bad thing. And I dont think I could get the exact instance of the entity i want, so that it exists first in world then moves to exist inside the capturing entity when it is hit by it then moves to exist inside the animating entity and then moves to exist inside the itemstack until a player picks it up and uses it then it moves back to exist inside the world when the itemstack is used again. Currently I accomplish this "existing" by using NBT to essentially clone the entity that was impacted and setting the impacted entity in world to dead. But since I am then creating a new instance of the entity when the itemstack is used the UUID changes and i need it to stay the same.
  17. Hi everyone I have an entity that I create and then set dead at various times determined by the player. Then I create a new instance of this entities class with blank NBT and populate the NBT with my custom entity data (stats, and other things etc...) I need to be able to give this entity something like a UUID that persists between each setdead/ creation of a new instance of the entities class with blank nbt data so that I can get this entity using this id at a later time. I was wondering if there is anything in minecraft that I could use to achieve this. I checked and my entities id changes after each call to set the entity to dead. What I need is a way to get each specific instance of my entity whenever it is not dead based on its unique identifier after it has been set dead at some previous time. But i cannot do this because the .getEntityId() method returns a different id each time. I could create my own system and store it as NBT data along side my other data that I am already populating but I feel like minecraft already has some sort of "label" that I could use to accomplish this.
  18. I have tried out some stuff and turns out my idea probably isnt the best approach I dont think as it is pretty complex and breaks alot of stuff, Has anyone implemented spell buttons before and if so what approach did you take?
  19. That worked, But wow does that ever lag minecraft Im going to not use that haha
  20. Hi I have been trying to add light to my entity and it doesnt seem to work. The method is called inside my entities onLivingUpdate method but no light shows up. anyone know what the issue is. @Override public void onLivingUpdate() { super.onLivingUpdate(); this.addLight(); } private void addLight() { System.out.println("add Light is being called"); //THIS GETS OUTPRINTED ON UPDATE SO IT IS BEING CALLED this.worldObj.setLightValue(EnumSkyBlock.Block, (int) this.posX, (int) this.posY, (int) this.posZ, 16); this.worldObj.markBlockRangeForRenderUpdate((int) this.posX, (int) this.posY, (int) this.posX, 12, 12, 12); this.worldObj.markBlockForUpdate((int) this.posX, (int) this.posY, (int) this.posZ); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX, (int) this.posY + 1, (int) this.posZ); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX, (int) this.posY - 1, (int) this.posZ); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX + 1, (int) this.posY, (int) this.posZ); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX - 1, (int) this.posY, (int) this.posZ); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX, (int) this.posY, (int) this.posZ + 1); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX, (int) this.posY, (int) this.posZ - 1); }
  21. Why yes I am making spell buttons and this seemed like an idea i would try out. Hopefully it doesnt create some weird havock haha thanks for your idea ill try it out. And ya the shift-activation is what I want.
  22. Ideally i want the buttons clickable when you are in the main screen (with the cross-hairs and other stuff)
  23. Hi Everyone, I am trying to put a series of buttons in the player hud where they can be clicked on after the player clicks the enable mouse key that I have registered using a keyhandler. I already know how to add buttons to a regular gui but the hud seems different. Any ideas as to where to start? I know that for a regular gui (lets say for a tile entity gui) you have to do the following to give it buttons But to render anything in the player hud I know you have to render everything using this event. @SubscribeEvent(priority=EventPriority.NORMAL) public void RenderBattleGUI(RenderGameOverlayEvent.Post event) { } I cant seem to figure it out. I want the button to render in the hud the whole time the player is in survival mode and only when my custom key is pressed that enables the mouse can the player "click" on the button to activate it. I understand the mouse stuff i think but the buttons are giving me trouble.
  24. Oh believe me I have been looking at it, it is pretty amazing. Very complex though so it is taking me a while to figure stuff out
  25. I was wondering if anyone knows how I could access the players height and width of the bounding box and the player camera zoom (i guess its position). I need to alter these fields to work with my model (I need to zoom out the camera (change its position to be farther backwards) and I need to change the height of the players bounding/hitbox and I need to change the location of the + target mouse over icon thing to change the "height" at which the model breaks blocks/hits entities etc. If anyone knows anything about this I would appreciate your input
×
×
  • Create New...

Important Information

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