-
Reference problem intellij (1.18.2)
okay only works with static method so how can i do that ?
-
Reference problem intellij (1.18.2)
i annotated with SubscribeEvent look at the code
-
Reference problem intellij (1.18.2)
in the following code, references isButtonDown and isKeyDown aren't working... please help me ! thx package com.seawarrior.trueguns.item; import com.mojang.blaze3d.platform.InputConstants; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber @Mod("hk416item") public class HK416Item extends Item implements IHK416Item { public HK416Item(Properties properties) { super(properties); } boolean LeftClick = false; boolean rKeyPressed = false; @SubscribeEvent public void onMouseInput(InputEvent.MouseInputEvent event) { if(event.getButton() == 0 && event.isButtonDown()) { LeftClick = true; } } @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { if(event.getKey() == InputConstants.KEY_R && event.isKeyDown()) { rKeyPressed = true; } } @Override public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) { if(LeftClick) { // Logique clic gauche LeftClick = false; } if(rKeyPressed) { // Logique touche R rKeyPressed = false; } return InteractionResultHolder.consume(player.getItemInHand(hand)); } private void zoom(Player player, double zoomFactor) { // Zoom logic } private void fire(Level world, Player player) { // Fire logic } // Variables cadence de tir private final int fireRate = 15; private int timeSinceLastShot = 0; // Rechargement private final int magAmmo = 30; private int reloadTime = 50; // Zoom private final double zoomFactor = 2.0; @Override public void onStoppedUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks, Player player) { timeSinceLastShot = 0; zoom(player, 1.0); } }
-
Import problem in intellij
i tried to refresh the gradle but nothing changed
-
Import problem in intellij
it's a modern version of forge, so i just can remove the imports or refreshing the gradle ? and how i can do that ?
-
Import problem in intellij
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 } }
IPS spam blocked by CleanTalk.