MinecraftScripterAI
Discord ↗
Link Copied to Clipboard
×
"Crea un item che fa tornare il weather clear una volta cliccato col tasto destro"
/* This mod creates an item that sets the weather to clear when right-clicked in Minecraft Forge. */ public class ClearWeatherItem extends Item { public ClearWeatherItem(Properties properties) { super(properties); } @Override public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) { if (!world.isClientSide) { /* The duration is set to 6000 ticks, which is equivalent to 5 minutes in Minecraft time. */ ((ServerWorld) world).setWeather(6000, 0, false, false); player.displayClientMessage(new StringTextComponent("Weather set to clear."), true); } return ActionResult.success(player.getItemInHand(hand)); } } /* Don't forget to register your item in your mod's item registry! */