Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Stynxyxy

Members
  • Joined

  • Last visited

Everything posted by Stynxyxy

  1. I Wanted to create a oxidation function for my own items. But i get Errors when I start minecraft. Here the code for the oxidation: package de.stynxyxy.armorplus.oxidationevents; import de.stynxyxy.armorplus.item.copperlightoxidated; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.item.enchantment.Enchantment; import de.stynxyxy.armorplus.item.kupferarmorItem; import net.minecraft.world.item.ItemStack; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import de.stynxyxy.armorplus.init.moditems; import org.apache.commons.lang3.ObjectUtils; import java.util.HashMap; import java.util.Map; @Mod.EventBusSubscriber public class oxidation { private static final int TRANSFORM_DELAY = 100; // Number of ticks after which the item should transform private static final Map<ItemStack, Integer> transformCounts = new HashMap<>(); private static final Map<Item, Item> TRANSFORM_MAP = new HashMap<>(); static { //TRANSFORM_MAP.put(moditems.copper_boots.get(),moditems.exposed_copper_boots.get()); } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.END && event.side.isServer()) { for (ServerPlayer player : event.getServer().getPlayerList().getPlayers()) { Inventory inventory = player.getInventory(); for (int i = 0; i < inventory.getContainerSize(); i++) { ItemStack itemStack = inventory.getItem(i); if (shouldTransform(itemStack)) { int tickCount = transformCounts.getOrDefault(itemStack, 0); if (tickCount >= TRANSFORM_DELAY) { Item targetItem = TRANSFORM_MAP.get(itemStack.getItem()); if (targetItem != null) { ItemStack newItemStack = new ItemStack(targetItem, itemStack.getCount()); // Transfer enchantments to the new item Map<Enchantment, Integer> enchantments = itemStack.getAllEnchantments(); for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) { Enchantment enchantment = entry.getKey(); int level = entry.getValue(); newItemStack.enchant(enchantment, level); } // Set the name of the new item newItemStack.setHoverName(itemStack.getHoverName()); inventory.setItem(i, newItemStack); transformCounts.remove(itemStack); } } else { transformCounts.put(itemStack, tickCount + 1); } } } } } } private static boolean shouldTransform(ItemStack itemStack) { return TRANSFORM_MAP.containsKey(itemStack.getItem()); } } Thank you (;
  2. How do I get the arrow entity then?
  3. I want to create a particle Trail for an Arrow
  4. I want to detect an arrow every tick. Is there any event that can help me achieve this? I have tried using the LivingGetProjectileEvent, but it only updates a few times and then stops, even if the arrow is still in the air. Additionally, this event only provides information about the player who shot the arrow.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.