Jump to content

Povstalec

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Povstalec's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Alright, thanks, that helped a lot. It gave me the idea to extend the BlockItem class and add some stuff to updateCustomBlockEntityTag(), which now deletes the randomly generated address and replaces it with the one from the BlockItem. It's probably not the best way to go around it, but it does what I want for now. I'll probably come up with something better later down the line.
  2. Block Entity code SavedData code Block code Yeah, I know, I'm making sure it only runs on server, so the problem can't be there.
  3. I've got a BlockEntity, which can save its data to an item when broken(just like a Shulker Box). I use this to generate an "address" - When the BlockEntity is placed in the world for the first time, it will generate a new address and save the address to SavedData. When it is broken, the NBT data is saved to a BlockItem and the address is deleted from SavedData. When it is placed again, this time using the BlockItem that has data from the previous BlockEntity saved, it should copy the data and check if it has the address tag; if it does, it will save the address to SavedData again. The last part used to work for me, but then I changed some things and forgot to make a backup, so it doesn't work properly now. What it does now is: The BlockEntity checks if there is an address tag, but there isn't one, so it generates a new address which it saves to SavedData. The address tag is then copied from the BlockItem immediately after, so when I click on it to see the address, the address is different from what is now saved in SavedData. I'm pretty sure the problem lies in the fact that onLoad() is called before BlockItem NBT data is copied over. I'm using onLoad() to check whether or not it should generate an address and I know the BlockItem NBT data is stored correctly, because: 1. I'm saving more than just the address and everything else works perfectly and 2. the BlockEntity shows the correct address after I place it and click on it. Is there a way to fix/work around this?
  4. Technically, yes, I don't neet to keep the chunk loaded, nor do I need the block entity just to teleport stuff there. But I'm trying to recreate Transport Rings from Stargate, which work by having a platform on each end, that does its own thing. My block entities represent these platforms. Each one takes a different amount of time to get into position animation-wise, so when the first block entity is has already finished its animation, the second entity might still be in the middle of its own animation. Each block entity waits for a certain amount of ticks to change its blockstate at the end of the animation cycle(so that redstone can detect when it's done), so unloading it prematurely/not loading it at all would mean that the blockstate never gets changed and since mysystem works by only allowing block entities to connect to other block entities if they're done animating, the block entity would essentially become inaccesssible until a player loaded it and allowed it to finish its animation. So unless there's a way to do what I want without a loaded chunk, I'd preferably like to keep the loaded chunk. I haven't used Capabilities before, so maybe what you told me can be used to fix my problem without getting rid of the loaded chunk, I dunno. I'll see once I learn a bit more about them. But just in case it's not, any other ways to do it?
  5. Hello, I have a block entity that is using entity.teleportTo(x, y, z); to teleport an entity(Armor Stand in this case) into a chunk that's being kept loaded with ForgeChunkManager.forceChunk(level.getServer().getLevel(Level.OVERWORLD), StargateJourney.MODID, getBlockPos(), level.getChunk(getBlockPos()).getPos().x, level.getChunk(getBlockPos()).getPos().z, true, true); It works well, however, when I teleport the player alongside the entity, the entity doesn't load. It's still there, because if the player leaves to unload the chunk and then returns, the entity appears where it should. I've tried fixing it by not forceloading the chunk and the entity loads without problems, but I actually need to have the chunk loaded, because I have a block entity in said chunk, that is ticking(essentially, it's the second end of a teleporter mechanism). Is there a workaround to load the entity manually or even better, have it never unload in the first place?
×
×
  • Create New...

Important Information

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