Skip to content

Commit

Permalink
uno is now obtainable via wandering trader
Browse files Browse the repository at this point in the history
right now its guaranteed from every trader for 15 emeralds, but i might change that sometime idk
its not like its all that important since its literally just a deck of cards
  • Loading branch information
awakaxis committed Dec 18, 2024
1 parent d889e18 commit f9bcbfa
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
34 changes: 34 additions & 0 deletions src/main/java/net/awakaxis/uno/mixin/WanderingTraderMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.awakaxis.uno.mixin;

import net.awakaxis.uno.UNOBlocks;
import net.awakaxis.uno.UNOItems;
import net.awakaxis.uno.item.UnoCardItem;
import net.minecraft.world.entity.npc.WanderingTrader;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.trading.MerchantOffer;
import net.minecraft.world.item.trading.MerchantOffers;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(WanderingTrader.class)
public abstract class WanderingTraderMixin {

@Inject(method="updateTrades", at=@At("RETURN"))
private void appendUnoCard(CallbackInfo ci) {
WanderingTrader wanderingTrader = (WanderingTrader) (Object) this;

MerchantOffers merchantOffers = wanderingTrader.getOffers();

MerchantOffer unoCardOffer = new MerchantOffer(
new ItemStack(Items.EMERALD, 15),
ItemStack.EMPTY,
UNOBlocks.CARD_DECK.asItem().getDefaultInstance(),
1, 5, 0.05f
);

merchantOffers.add(unoCardOffer);
}
}
15 changes: 8 additions & 7 deletions src/main/resources/uno.mixins.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"required": true,
"package": "net.awakaxis.uno.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"injectors": {
"defaultRequire": 1
"required": true,
"package": "net.awakaxis.uno.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"WanderingTraderMixin"
],
"injectors": {
"defaultRequire": 1
}
}

0 comments on commit f9bcbfa

Please sign in to comment.