Posted October 21, 20232 yr hi, i'm new in modding and i have a problem, as you can see below the packages and classes : entity, item, sound, ActionResult, Hand, TypedActionResult and World aren't working... they appear in red. if someone have a solution i take ! thx package com.seawarrior.trueguns.item; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.thrown.SnowballEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.sound.SoundEvents; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.TypedActionResult; import net.minecraft.world.World; public class HK416Item extends Item { private int magAmmo = 30; // magazine ammo capacity private int reloadTime = 50; // reload time in ticks public HK416Item(Settings settings) { super(settings); } @Override public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) { if(player.isSneaking()) { // reload startReloading(player); return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand)); } else if(player.getMainHandStack().getMaxDamage() - player.getMainHandStack().getDamage() >= 1) { if(player.getCooldownPeriod() == 0) { fire(world, player); // shoot player.getCooldownPeriodMap().putCooldown(this, 3); // limit fire rate } } return new TypedActionResult<>(ActionResult.PASS, player.getStackInHand(hand)); } private void fire(World world, PlayerEntity player) { // spawn and shoot bullet SnowballEntity bullet = new SnowballEntity(world, player); bullet.setVelocity(player.getRotationVector().multiply(2)); world.spawnEntity(bullet); player.getMainHandStack().damage(1, player, null); world.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENTITY_SNOWBALL_THROW, player.getSoundCategory(), 1, 1); } private void startReloading(PlayerEntity player) { // start reload process } }
October 21, 20232 yr In modern versions of Forge you only need to import the Gradle project into your IDE and let it run. If it doesn't, try refreshing Gradle (in IntelliJ this is on the top right Gradle elephant tab, then the refresh button). For ancient versions you may have to manually run the setupDecompWorkspace task first. Official Forge Discord server | Support FAQ for players
October 21, 20232 yr Author it's a modern version of forge, so i just can remove the imports or refreshing the gradle ? and how i can do that ? Edited October 21, 20232 yr by Seawarrior
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.