Jump to content

SirXenophon

Members
  • Posts

    7
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Personal Text
    Player for 4 years/recent modder

SirXenophon's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. OK. The only data transfer I have used so far is DataWatcher, so I will have to look into that. Would my tile entity class extend anything in particular or would it just be a generic tile entity class?
  2. I want to create a TileEntity where the player can enter integers in-game into the GUI that are then relayed to algorithms in my code that will process them for different purposes. I know this is a general/vague question, but all I need really is to be pushed in the right direction and I'm sure I can figure the rest out. At the moment I simply know of no tile entities that serve this sort of purpose for me to emulate.
  3. I want to set certain tasks for my custom mob that involve it moving to fixed coordinate (x,y,z). It's seems that the tryMoveToXYZ(x,y,z,speed) method works fine, but only if the mob is within 16 blocks of (x,y,z). Otherwise, it appears that the vanilla code for something like EntityAIMoveIndoors has the mob move in a random direction towards (x,y,z) a number of times until it is within 16 blocks of (x,y,z), at which point it can finally move directly. This has the unfortunate side effect of the mob following a somewhat random walk (not entirely true since the direction vectors are towards (x,y,z) but still not ideal). I suppose I could change the code in RandomPositionGenerator so that the random direction vector and desired direction vector have dot product not just positive but also large enough to ensure the angle between them is less than pi/6 or so. But this seems rather complicated for what should be a simple task. Any ideas?
  4. OK. I figured it was something simple. Thank you!
  5. I am creating a custom mob entity similar to a villager and a custom set of villages. The villages are saved in a VillageCollection class that extends WorldSavedData and the entities extend EntityAgeable (similar to vanilla). I want to set an AI task for the villagers of finding the nearest village, but in order to call the VillageCollection class I need to use the static method VillageCollection.get(world). My question is how do I access world from an instance of an EntityAgeable? I've been able to do this for things like break and place events using breakEvent.world and placeEvent.world, so it seems like something similar ought to be possible for living entities (certainly they need access to the world in order to navigate it!).
  6. I want to create a WorldSavedData object that records information that may happen as frequently as once every few seconds (let's say an object that records how many times a player has jumped since world creation, for example). I have the class for my WorldSaveData object written, including all of the appropriate methods (e.g. readFromNBT, writeToNBT, and mutator methods for updating the variables in my object). I am able to access the object using the static get method, and have subscribed an event handler for dealing with my event (player jumping, for example). Also, after the event handler has called the mutator method to update the variable, the WorldSavedData is marked as dirty. However, when I try to use the event handler to update my object (the number of times a player has jumped) it doesn't seem to update the correct value. It seems that the variable has not yet been saved to the NBT format and so I'm only able to access the last-saved number of jumps the player has made. Is there a way to force the game to call the writeToNBT method after updating my variable? Is this even desirable? Or is there some other way of achieving my goal that I have overlooked?
×
×
  • Create New...

Important Information

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