Jump to content

HutchCS

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

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

HutchCS's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I posted a topic a few days ago regarding getting new villager trades, and I was able to generate new trades for the Villager by copying the old VillagerData into a new VillagerData variable and setting the villager i am interacting with to have the new VillagerData variable. However I am not able to update the Trading GUI as it will still have the old trades rather than the new ones. I know that it is generating new trades because I was able to print out the offers costs and results before and after they were swapped and they were different items.
  2. I didnt end up using the access transformer as I wasn't able to find the proper srg name for the updateTrades method even though i copied the same one used https://github.com/Favouriteless/SeasonalVillagers/blob/main/src/main/resources/META-INF/accesstransformer.cfg in this mod, but whatever. I was however able to get new trades through copying the old villager data into a new villagerdata variable, this will give me new trades (tested using println, I can see the result and costA and costB are different), but it wont update in the Villager GUI
  3. Hello all, I am trying to make a villager refresh mod, it is supposed to be able to refresh the most recent trade if it has not been traded with at that level. I am able to refresh the trades at level 1 by simply setting them as null and they auto regenerate, but for the later levels, that does not suffice, I was able to separate the MerchantOffers at the new trade (meaning if level three, it has the 4 trades from level 1 and 2 as one MerchantOffers, but the level 3 trades are a separate MerchantOffers). I have not been able to successfully regenerate new trades to replace for that final level. Any ideas?
  4. Hi, I'm trying to make a mod in which when you do some action (havent decided yet) it will refresh the current merchant trades into other basic merchant trades (Rather than break the workstation and replace it, I would rather just be able to hit a button/interact with specific item and the trades would refresh). This is what I have so far, @SubscribeEvent public static void villagerRefresh(EntityInteractSpecific event) { LivingEntity targetEntity = (LivingEntity) event.getTarget(); PlayerEntity playerEntity = event.getPlayer(); if (targetEntity instanceof VillagerEntity) { VillagerEntity villagerEntity = (VillagerEntity) targetEntity; MerchantOffers offers = villagerEntity.getOffers(); MerchantOffers newOffers = new MerchantOffers(offers.write()); if (playerEntity.getHeldItem(event.getHand()).getItem() == Items.STICK.getItem()) { VillagerEntity.setOffers(newOffers); } } } With some testing I can confirm that it does enter the second if statement, but I can't actually set the new trades. Any help would be greatly appreciated
×
×
  • Create New...

Important Information

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