Jump to content

bmwalter68

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

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

bmwalter68's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. FWIW, my family has a world we've been playing on for several years. As we've moved through versions of Forge and various mods it has filled up with a ton of legacy blocks, finally crossing the 4096 explosion point when adding a new mod. After reading this thread I found World Utils for 1.12.2 which successfully removed 600+ unused blocks from the world. The command you're looking for is: /worldutils registry remove-missing-blocks Step by step, here's how I fixed my issues: Back up the old map. Make sure you don't /fml confirm when it it warns that you've exceeded 4096 blocks! Load up MC running the mods I was interested in keeping Started a clean flat world where I could execute the command Copy the afflicted level.dat into the instances config/worldutils folder Run: /worldutils registry remove-missing-blocks Copy the fixed level.dat back into my old world directory YMMV and you definitely need to work with a version of level.dat that hasn't been saved after the exceeded max blocks warning. - B
  2. Thanks 707! PlayerRespawnEvent did the trick. Marking as resolved.
  3. Following up my own post... I have this working, though I'm not sure I'm in love with the solution. Instead of pushing updates from server to client in PlayerChangedDimensionEvent and PlayerEvent.Clone, I added another CLIENT => SERVER packet which requests a capability update and added it to the AttachCapabilitiesEvent on the client side: @SubscribeEvent public static void onAttachCapabilitiesEvent(AttachCapabilitiesEvent<Entity> event) { if (event.getObject() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.getObject(); event.addCapability(new ResourceLocation(Reference.MODID, "evacuation_cooldown"), new Provider(new EvacuationCooldown(player))); if (player.getEntityWorld().isRemote) { PacketHandler.instance.sendToServer(new RequestEvacuateCooldownUpdateMessage()); } } } This handles both the player changing dimensions and updating the client after death. PlayerEvent.Clone still needs to handle copying the data on the server side, but doesn't update the client: @SubscribeEvent public static void onPlayerCloneEvent(PlayerEvent.Clone event) { if (!event.isWasDeath()) { return; } IEvacuationCooldown oldCooldown = event.getOriginal().getCapability(EVACUATION_COOLDOWN, null); IEvacuationCooldown newCooldown = event.getEntityPlayer().getCapability(EVACUATION_COOLDOWN, null); if (oldCooldown != null && newCooldown != null) { newCooldown.setLastUse(oldCooldown.getLastUse()); } } This currently works, but for some reason this seems like too many hoops to be jumping through. Does anyone have a better solution?
  4. Hi all! I have a question about player capabilities in 1.12.2... I'm trying to use a player capability to store the last time one of my items was used by the player to effect a cooldown period that is tied to the player, not the itemstack. Basically, "You are only allowed to use any instance of this item every X minutes." The functionality is working as expected, the problem I'm having is keeping the last used time in sync with the client for display purposes. I've built a custom sync packet to update the last used value on the client, and I send the packet during PlayerLoggedInEvent, PlayerChangedDimensionEvent and PlayerEvent.Clone when isWasDeath() is true. The sync packet is also working as expected, arriving and updating the client. The problem I'm encountering looks to be related to the order that events fire surrounding player death. Here is the result of some logging: [10:34:01] [Server thread/INFO]: bmwalter68 fell from a high place [10:34:01] [main/INFO]: [CHAT] bmwalter68 fell from a high place [10:34:02] [Server thread/INFO] [transporterng]: [SERVER] new EvacuationCooldown(EntityPlayer) [10:34:02] [Server thread/INFO] [transporterng]: [SERVER] onAttachCapabilities [10:34:02] [Server thread/INFO] [transporterng]: [SERVER] onPlayerClone: oldCooldown=EvacuationCooldown{lastUse=1518536021113, player=EntityPlayerMP['bmwalter68'/139, l='Overworld', x=-237.43, y=63.00, z=-206.25]} newCooldown=EvacuationCooldown{lastUse=0, player=EntityPlayerMP['bmwalter68'/1268, l='Overworld', x=-221.50, y=64.00, z=-86.50]} [10:34:02] [Server thread/INFO] [transporterng]: [SERVER] EvacuationCooldown:setLastUse(1518536021113) player=EntityPlayerMP['bmwalter68'/1268, l='Overworld', x=-221.50, y=64.00, z=-86.50] [10:34:02] [Server thread/INFO] [transporterng]: [SERVER] EvacuationCooldown:updateClient(1518536021113) player=EntityPlayerMP['bmwalter68'/1268, l='Overworld', x=-221.50, y=64.00, z=-86.50] [10:34:02] [Server thread/INFO] [transporterng]: [SERVER] onPlayerClone: client updated [10:34:02] [main/INFO] [transporterng]: [CLIENT] EvacuationCooldown:setLastUse(1518536021113) player=EntityPlayerSP['bmwalter68'/139, l='MpServer', x=-237.43, y=63.00, z=-206.25] [10:34:02] [main/INFO] [transporterng]: [CLIENT] new EvacuationCooldown(EntityPlayer) [10:34:02] [main/INFO] [transporterng]: [CLIENT] onAttachCapabilities The event handler code for PlayerEvent.Clone: @SubscribeEvent public static void onPlayerCloneEvent(PlayerEvent.Clone event) { if (!event.isWasDeath()) { return; } IEvacuationCooldown oldCooldown = event.getOriginal().getCapability(EVACUATION_COOLDOWN, null); IEvacuationCooldown newCooldown = event.getEntityPlayer().getCapability(EVACUATION_COOLDOWN, null); if (oldCooldown != null && newCooldown != null) { newCooldown.setLastUse(oldCooldown.getLastUse()); newCooldown.updateClient(); } } It looks like the client gets updated properly and then a new capability instance is attached, effectively replacing the value just updated via the packet. Am I missing something obvious here, or is this just simply a timing issue I need to account for?
×
×
  • Create New...

Important Information

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