Jump to content

DaqEm

Members
  • Posts

    11
  • Joined

  • Last visited

  • Days Won

    1

DaqEm last won the day on November 30 2022

DaqEm had the most liked content!

DaqEm's Achievements

Tree Puncher

Tree Puncher (2/8)

2

Reputation

  1. @warjort This is not how you treat people... Not everyone has the knowledge you have. I've been modding for 3 years and I didn't even know about these deprecation messages. Most of us do this as a hobby for a few hours a week.
  2. Thank you @warjort. Moving GSON to the top resolved the issue. New ModRecipeManager class: public class ModRecipeManager extends SimpleJsonResourceReloadListener { private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); public static final ModRecipeManager instance = new ModRecipeManager(); public ModRecipeManager() { super(GSON, "custom_recipes"); } @Override protected void apply(Map<ResourceLocation, JsonElement> jsonElementMap, ResourceManager p_10794_, ProfilerFiller p_10795_) { } }
  3. 1.12.2 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
  4. Hi, I'm trying to create custom datapack support for my 5x5 workbench. But when I add a json file to: 'resourses > data > jobsplus (modid) > custom_recipes' and I load a world, it says I need to try safe mode and gives me te following error: P.S. when I remove the file in 'custom_recipes' or when I comment out the line in 'EventAddReloadListener': event.addListener(ModRecipeManager.instance); The world loads without a problem. debug.log: https://gist.github.com/DAQEM/6e09bc9d51cd2fb72265116b1982f843 ReloadListener: @Mod.EventBusSubscriber(modid = JobsPlus.MOD_ID) public class EventAddReloadListener { @SubscribeEvent public static void dataLoading(AddReloadListenerEvent event) { event.addListener(ModRecipeManager.instance); } } ModRecipeManeger: public class ModRecipeManager extends SimpleJsonResourceReloadListener { public static final ModRecipeManager instance = new ModRecipeManager(); private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); public ModRecipeManager() { super(GSON, "custom_recipes"); } @Override protected void apply(Map<ResourceLocation, JsonElement> jsonElementMap, ResourceManager p_10794_, ProfilerFiller p_10795_) { } } File in 'resources > data > jobsplus > custom_recipes': { "id": "jobsplus:exp_jar", "key": { "A": { "item": "minecraft:glass" }, "B": { "item": "minecraft:emerald" }, "C": { "item": "minecraft:oak_planks" } }, "pattern": [ " ", " CCC ", " ABA ", " AAA ", " " ], "requiredLevel": 10 } Any help is greatly appriciated! Thank you!
  5. Yes, just delete the usefulbackpacks-server.toml, restart the server and you're done.
  6. You are using a very old version on Java. Try to find Java 8 291 or Java 8 320 in the web somewhere and install it. (I believe the newest Java 8 version (231) isn't supported on all version but I'm not 100% sure).
  7. You'll have to register the hook (bobber) entity type.
  8. 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.
  9. 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!
  10. 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.
  11. 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 Terms of Use.