-
Moomallowz changed their profile photo
-
[1.16.5] Within an event, summon a random item.
Never mind, I've figured it out on my own.
-
[1.16.5] Within an event, summon a random item.
You mention the 'world' variable, but it doesn't seem to exist. Must I create it in the event as well, and if so, how?
-
[1.16.5] Within an event, summon a random item.
I have an event which fires when a "clam" item is used. I would like to summon an item at the player's location, within the if/else statement shown below. @SubscribeEvent public static void clamUsed(PlayerInteractEvent.RightClickItem event) { LivingEntity player = event.getEntityLiving(); ItemStack mainhand = player.getItemStackFromSlot(EquipmentSlotType.MAINHAND); if (player.getHeldItemMainhand().getItem() == RegistryHandler.CLAM.get()) { Random random = new Random(); if (random.nextInt(20 - 1 + 1) + 1 == 20) { //Give the player Item A } else { //Give the player Item B } mainhand.shrink(1); } } How?
-
[1.16.4] Remove 1 item in offhand ItemStack when an event fires.
Happy New Year to anyone who stumbles across this topic, by the way.
-
[1.16.4] Remove 1 item in offhand ItemStack when an event fires.
Here's my event, which fires when a fishing rod is cast (or reeled in, I'll fix that later). @SubscribeEvent public static void usedWorm(PlayerInteractEvent.RightClickItem event) { LivingEntity player = event.getEntityLiving(); if (player.getHeldItemOffhand().getItem() == RegistryHandler.WORM.get()) { if (player.getHeldItemMainhand().getItem() == Items.FISHING_ROD) { player.addPotionEffect(new EffectInstance(Effects.LUCK, 2400)); //fairly certain the ItemStack thingy goes here, not sure about syntax though } } } The event is currently allowing the offhand item (the Worm) to be used an infinite number of times. To maintain balance, a Worm must be consumed when this is done. It is absolutely imperative to catching funny fish. I am unfamiliar with ItemStacks and their applications. Is it possible to dumb this down enough for my ogre brain to comprehend?
-
How do I add custom trades to the Wandering Trader?
In my defense, I now know how to add ".get()" to the end of my line, thus giving it an instance of a modded item to work with.
-
How do I add custom trades to the Wandering Trader?
IT WORKS! Thank you, good sir!
-
How do I add custom trades to the Wandering Trader?
public class Main { public static void main(String[] args) { System.out.println("Sir, I'd greatly appreciate it if you at least told me what I did wrong."); } }
-
How do I add custom trades to the Wandering Trader?
If you were asking for my issue... REQUIRED TYPE: IItemProvider PROVIDED: RegistryObject <net.minecraft.item.item> If you were asking what my issue was, everything I touch breaks. It's hereditary, I think.
-
How do I add custom trades to the Wandering Trader?
I'M SO SORRY, BUT AW BEANS, I MESSED IT UP. event.getGenericTrades().add(new BasicTrade(3, new ItemStack(RegistryHandler.EXOTIC_SPICE, 1), 10, 10)); This is what I have. I probably did something stupid, but I don't know what.
-
How do I add custom trades to the Wandering Trader?
Thanks! Now the Wandering Trader has a use, and my mod is ready to update!
-
How do I add custom trades to the Wandering Trader?
By the way, and I hate to be a bother, what would I need to do to add a modded item to the trade rather than a vanilla one?
-
How do I add custom trades to the Wandering Trader?
That's what I was looking for, thank you sir.
-
How do I add custom trades to the Wandering Trader?
Never mind. Apparently, my stupidity knows no bounds, because about 83 errors were returned. I'm fairly certain that adding trades has to do with the BasicTrade class. however, and I've tried adding it into the method where I call the WandererTradesEvent. No luck so far, though. Stupid as I may be, with the little experience in Java that I have, I will keep trying. Can someone walk me through setting up a trade?
-
How do I add custom trades to the Wandering Trader?
I am a dunce. I think I have it figured out now, though... thanks for the help!
IPS spam blocked by CleanTalk.