Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

DaqEm

Members
  • Posts

    4
  • Joined

  • Last visited

DaqEm's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I don't think there are any "not from the stone age" tutorials for those versions out there because those versions are from the stone age. I'd recommend using the newer versions of Forge / Minecraft.
  2. The reviveCaps() worked for me. I'm using forge 37.0.67. My Clone Event: public static void onDeath(PlayerEvent.Clone event) { if (event.isWasDeath()) { event.getOriginal().reviveCaps(); event.getOriginal().getCapability(ModCapabilityImpl.MOD_CAPABILITY).ifPresent(oldStore -> { event.getEntity().getCapability(ModCapabilityImpl.MOD_CAPABILITY).ifPresent(newStore -> { newStore.copyForRespawn((ModCapabilityImpl) oldStore); }); }); event.getOriginal().invalidateCaps(); } } In my IModCapability: void copyForRespawn(ModCapabilityImpl oldStore); In my ModCapabilityImpl: @Override public void copyForRespawn(ModCapabilityImpl oldStore) { this.value = oldStore.value; } Hope this helps!
  3. Okay, so completely forgot it fired client and server side. I made some adjustments to the PlayerTickEvent and found the problem. @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent event) { if (event.side == LogicalSide.SERVER && event.phase == TickEvent.Phase.START) { event.player.getCapability(CuriosCapability.INVENTORY).ifPresent((jobHandler) -> { int currentValue = jobHandler.getSlots(); JobsPlus.LOGGER.info(currentValue + " | | | " + jobHandler + " " + event.player.getScoreboardName() + " server"); jobHandler.setSlots(currentValue + 1); }); } if (event.side == LogicalSide.CLIENT && event.phase == TickEvent.Phase.START) { event.player.getCapability(CuriosCapability.INVENTORY).ifPresent((jobHandler) -> { int currentValue = jobHandler.getSlots(); JobsPlus.LOGGER.info(currentValue + " | | | " + jobHandler + " " + event.player.getScoreboardName() + " client"); jobHandler.setSlots(currentValue + 1); }); } } [21:20:45] [Server thread/INFO]: 23 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@8899b18 Dev server [21:20:45] [Render thread/INFO]: 31 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@3db84bfa Dev client [21:20:45] [Server thread/INFO]: 24 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@8899b18 Dev server [21:20:45] [Render thread/INFO]: 32 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@3db84bfa Dev client [21:20:45] [Server thread/INFO]: 25 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@8899b18 Dev server [21:20:45] [Render thread/INFO]: 33 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@3db84bfa Dev client [21:20:45] [Server thread/INFO]: 26 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@8899b18 Dev server [21:20:45] [Server thread/INFO]: 27 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@8899b18 Dev server Marking this as solved.
  4. Hey everyone, I've been testing the new 1.17.1 way to create capabilities and for some reason the AttachCapabilitiesEvent is firing twice when I join a singleplayer world. The code I used is here: GitHub - TheIllusiveC4/Curios at 726bfd9589d49174520379de8bfdb53b5208ed13 (this is not my code, I just it for testing purposes only) @SubscribeEvent public void onAttachEntityCaps(AttachCapabilitiesEvent<Entity> event) { if (event.getObject() instanceof Player) { event.addCapability(CuriosCapability.ID_INVENTORY, CurioInventoryCapability.createProvider((Player) event.getObject())); LOGGER.info("Attached Capability!"); } } Also to do some more testing I've added a PlayerTickEvent (I know it's bad but its for testing xD): @Mod.EventBusSubscriber(bus= Mod.EventBusSubscriber.Bus.MOD) public class EventPlayerTick { int count = 0; @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent event) { if (count == 100) { event.player.getCapability(CuriosCapability.INVENTORY).ifPresent((jobHandler) -> { int currentValue = jobHandler.getSlots(); JobsPlus.LOGGER.info(currentValue + " | | | " + jobHandler + " " + event.player.getScoreboardName()); jobHandler.setSlots(currentValue + 1); }); count = 0; } count += 1; } } and that outputs this: [20:45:13] [Server thread/INFO]: 0 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@3524f28 Dev [20:45:14] [Render thread/INFO]: 0 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@1014c825 Dev [20:45:15] [Server thread/INFO]: 1 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@3524f28 Dev [20:45:16] [Server thread/INFO]: 2 | | | me.daqem.jobsplus.testcap.CurioInventoryCapability$CurioInventoryWrapper@3524f28 Dev So this definitely are 2 capabilities attached to the Player. Any help is appreciated! Thank you.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.