-
Posts
66 -
Joined
-
Last visited
Everything posted by Luckydel
-
I need to raise the cursor (Sight) of the weapon. Does anyone have any ideas 😃
-
Me need to remove this animation along the arc. (0.05-0.11) (Forgive me if I name these movements or animations incorrectly)
-
How to remove the sight (cross in the center of the screen)
Luckydel replied to Luckydel's topic in Modder Support
Thanks 🙃 -
How to remove the sight (cross in the center of the screen)
Luckydel replied to Luckydel's topic in Modder Support
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 -
Luis_ST, warjort thx
-
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
-
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.
-
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
-
How to turn off the animation when the item is damaged?
Luckydel replied to Luckydel's topic in Modder Support
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 -
How to turn off the animation when the item is damaged?
Luckydel replied to Luckydel's topic in Modder Support
@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. -
How to turn off the animation when the item is damaged?
Luckydel replied to Luckydel's topic in Modder Support
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? -
How to turn off the animation when the item is damaged?
Luckydel replied to Luckydel's topic in Modder Support
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. -
How to turn off the animation when the item is damaged?
Luckydel replied to Luckydel's topic in Modder Support
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. -
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?