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.

Luckydel

Members
  • Joined

  • Last visited

Everything posted by Luckydel

  1. I need to raise the cursor (Sight) of the weapon. Does anyone have any ideas ๐Ÿ˜ƒ
  2. Me need to remove this animation along the arc. (0.05-0.11) (Forgive me if I name these movements or animations incorrectly)
  3. warjort, Yes, thanks, I realized that I need this event, I was able to remove the entire gui, but I donโ€™t understand how I can disable CROSSHAIR
  4. This https://ibb.co/hgnc7dm (Sorry for the link, it seems I chose a bad photo hosting or did not understand how to upload a photo to the forum correctly) Just turn it off temporarily.
  5. Luis_ST, warjort thx
  6. I need a slowdown effect like Item::releaseUsing. I tried through @SubscribeEvent public static void modTick(TickEvent.PlayerTickEvent event){ event.player.setSpeed(0.1F); } But it doesn't seem to work
  7. Oh, I renamed this when I posted the code on the site, I didnโ€™t want to say the name of the mod =), in fact, warmod_perekur is indicated everywhere instead of mymod, sorry for the deception ๐Ÿ˜ƒ So the question is open.
  8. Hello, sorry to disturb you. I can't hear the sound in the game. I tried to register. @Mod(Main.MODID) public class Main { public static final String MODID = "mymod"; public Main() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); ForgeModSounds.REGISTRY.register(modEventBus); } } @Mod.EventBusSubscriber(modid = Main.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ForgeModSounds { public static final DeferredRegister<SoundEvent> REGISTRY = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, Main.MODID); public static final RegistryObject<SoundEvent> empty = REGISTRY.register("empty", () -> new SoundEvent(new ResourceLocation(Main.MODID, "empty"))); } I use in Range item. public static BulletEntity shoot(Level world, LivingEntity entity, float power, double damage, int knockback, String soundName) { ... world.playSound(null, entity.getX(), entity.getY(), entity.getZ(), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(Main.MODID, "empty")), SoundSource.PLAYERS, 1, 1.0F / (world.getRandom().nextFloat() * 0.4F + 1.2F) * 0.5F); //OR //world.playSound(null, entity.getX(), entity.getY(), entity.getZ(), // ForgeModSounds.empty.get(), SoundSource.PLAYERS, 1, 1.0F / (world.getRandom().nextFloat() * 0.4F + 1.2F) * 0.5F); //return entitybullet; } assets/mymod/sounds.json { "empty": { "category": "neutral", "sounds": [ { "name": "warmod_perekur:empty", "stream": false } ] } } assets/mymod/sounds/empty.ogg
  9. Thanks to everyone who tried to help. This is what helped me. @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { return false; } Topic can be closed
  10. @Mod.EventBusSubscriber(modid = Main.MODID) public class Makarov extends ProjectileWeaponItem implements Vanishable { private static final float power = 2f; private static final double damage = 5; private static final int knockback = 1; private static final int ammoInt = 8; ////////////////////////////////////////////////////////////////////////////////////////////// public Makarov(Properties settings) { super(settings.durability(ammoInt)); //IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); renderAnimation2 = new RenderAnimation2(); } @Override public InteractionResultHolder<ItemStack> use(Level world, Player entity, InteractionHand hand) { ItemStack itemstack = entity.getItemInHand(hand); InteractionResultHolder success = new InteractionResultHolder(InteractionResult.PASS, entity.getItemInHand(hand)); if(itemstack.getDamageValue()<8){ entity.startUsingItem(hand); return success; } if (checkAmmoAvailability(itemstack,entity)){ return success; } return new InteractionResultHolder(InteractionResult.FAIL, entity.getItemInHand(hand)); } public boolean checkAmmoAvailability(ItemStack itemstack,Player entity){ if(entity.getProjectile(itemstack).isEmpty()){ return false; } ItemStack ammo = entity.getProjectile(itemstack); ammo.shrink(1); if (itemstack.isEmpty()) { entity.getInventory().removeItem(itemstack); } //itemstack.setDamageValue(0); return true; } @SubscribeEvent public static void InputEvent(InputEvent.InteractionKeyMappingTriggered event){ ItemStack itemStack = Minecraft.getInstance().player.getItemInHand(event.getHand()); if(itemStack.is(ForgeModItems.MAKAROV.get())){ event.setSwingHand(false); } } @Override public void releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) { if (user instanceof ServerPlayer player) { float f = 1; ItemStack itemstack = player.getProjectile(stack); if (!itemstack.isEmpty()) { if (itemstack.isEmpty()) { itemstack = new ItemStack(ForgeModItems.GUNSHOTAMMO_9x8.get()); } if (!world.isClientSide) { BulletEntity bull = BulletEntity.shoot(world, player, power, damage, knockback); } CompoundTag compoundTag = stack.getTag(); compoundTag.putInt("Damage",compoundTag.getInt("Damage")+1); if (itemstack.isEmpty()) { player.getInventory().removeItem(itemstack); } player.awardStat(Stats.ITEM_USED.get(this)); } } } public UseAnim getUseAnimation(ItemStack p_40678_) { return UseAnim.NONE; } public static final Predicate<ItemStack> BULLET_ONLY = (context) -> { return context.is(modItemType.GUNSHOTAMMO_9x8); }; public Predicate<ItemStack> getAllSupportedProjectiles() { return BULLET_ONLY; } public AbstractArrow customArrow(AbstractArrow arrow) { return arrow; } public int getUseDuration(ItemStack p_40680_) { return 300000; } public int getDefaultProjectileRange() {return 15;} } Perhaps my code will help solve this problem.
  11. Well, I can turn off the damage and there will be no such animation. I wrote it in the item class Sorry, the event worked but it didn't help, do you have any other ideas?
  12. Sorry, I need to remove this animation when the gun moves up and down, due to the change in durability. I tried: But it didn't remove the animation. Probably it arises because of change of ItemStack.
  13. Excuse me, as far as I understand, an item with zero durability is destroyed. It doesn't suit me. I also need to restore durability later.
  14. I need to disable the up and down animation of an item when the item loses durability. I change durability like this: Is there another way to change durability?

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.