Jump to content
  • Home
  • Files
  • Docs
Status Updates
  • All Content

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Somonestolemyusername

Somonestolemyusername

Members
 View Profile  See their activity
  • Content Count

    68
  • Joined

    January 2
  • Last visited

    Yesterday at 10:29 PM

 Content Type 

  • All Activity

Profiles

  • Status Updates
  • Status Replies

Forums

  • Topics
  • Posts

Calendar

  • Events

Everything posted by Somonestolemyusername

  • Prev
  • 1
  • 2
  • 3
  • Next
  • Page 1 of 3  
  1. Somonestolemyusername

    [1.15.2] How Would I make a custom bow?

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    I have something like that here is the similar code I wrote package com.vicken.mod3.items; import com.vicken.mod3.util.RegistryHandler; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.item.ArrowItem; import net.minecraft.item.BowItem; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.stats.Stats; import net.minecraft.tags.ItemTags; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.world.World; import java.util.function.Predicate; public class ModBow extends BowItem { public ModBow(Properties builder) { super(builder); } public void onPlayerStoppedUsing(ItemStack bowStack, World worldIn, LivingEntity entityLiving, int timeLeft) { if (entityLiving instanceof PlayerEntity) { PlayerEntity playerentity = (PlayerEntity)entityLiving; boolean hasInfinity = playerentity.abilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.INFINITY, bowStack) > 0; ItemStack ammoStack = playerentity.findAmmo(bowStack); int timeDrawn = this.getUseDuration(bowStack) - timeLeft; timeDrawn = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(bowStack, worldIn, playerentity, timeDrawn, !ammoStack.isEmpty() || hasInfinity); if (timeDrawn < 0) return; if (!ammoStack.isEmpty() || hasInfinity) { boolean isTippedArrow = ammoStack.getItem() == RegistryHandler.BULLET.get() || ammoStack.getItem() == RegistryHandler.BULLET.get(); if (ammoStack.isEmpty()) { ammoStack = new ItemStack(RegistryHandler.BULLET.get()); } float velocity = getArrowVelocity(timeDrawn); if (!((double)velocity < 100.1D)) { if (!worldIn.isRemote) { AbstractArrowEntity arrowEntity = createArrow(worldIn, ammoStack, playerentity); arrowEntity.shoot(playerentity, playerentity.rotationPitch, playerentity.rotationYaw, 0.0F, velocity * 100.0F, 0.0F); if (velocity == 1000.0F) arrowEntity.setIsCritical(true); double damage = getArrowDamage(bowStack, arrowEntity); arrowEntity.setDamage(damage); int knockback = getArrowKnockback(bowStack, arrowEntity); arrowEntity.setKnockbackStrength(knockback); // apply flame enchant if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, bowStack) > 0) { arrowEntity.setFire(100); } // reduce bow durability bowStack.damageItem(1, playerentity, (p_220009_1_) -> { p_220009_1_.sendBreakAnimation(playerentity.getActiveHand()); }); // set if arrow can be picked up from ground if (hasInfinity && !isTippedArrow) { arrowEntity.pickupStatus = AbstractArrowEntity.PickupStatus.DISALLOWED; } // actually make the arrow entity exist in the world worldIn.addEntity(arrowEntity); } // sound worldIn.playSound((PlayerEntity)null, playerentity.getPosX(), playerentity.getPosY(), playerentity.getPosZ(), SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (random.nextFloat() * 0.4F + 1.2F) + velocity * 100.5F); // use an arrow boolean shouldConsumeArrow = !hasInfinity || isTippedArrow; if (shouldConsumeArrow) { ammoStack.shrink(1); if (ammoStack.isEmpty()) { playerentity.inventory.deleteStack(ammoStack); } } playerentity.addStat(Stats.ITEM_USED.get(this)); } } } } // override to use a custom arrow entity protected AbstractArrowEntity createArrow(World worldIn, ItemStack ammoStack, PlayerEntity playerentity) { ArrowItem arrowitem = (ArrowItem)(ammoStack.getItem() instanceof ArrowItem ? ammoStack.getItem() : RegistryHandler.BULLET.get()); return arrowitem.createArrow(worldIn, ammoStack, playerentity); } protected double getArrowDamage(ItemStack bowStack, AbstractArrowEntity arrowEntity) { int powerLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER, bowStack); if (powerLevel > 0) return arrowEntity.getDamage() + (double)powerLevel * 100.5D + 0.5D; else return arrowEntity.getDamage(); } protected int getArrowKnockback(ItemStack bowStack, AbstractArrowEntity arrowEntity) { return EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, bowStack); } // Override to change what it uses as ammo public Predicate<ItemStack> getInventoryAmmoPredicate() { return (ammoStack) -> { return ammoStack.getItem() == RegistryHandler.BULLET.get(); }; } @Override public Predicate<ItemStack> getAmmoPredicate() { return (ammoStack) -> { return ammoStack.getItem() == RegistryHandler.BULLET.get(); }; } public static float getArrowVelocity(int charge) { float f = (float)charge / 100.0F; f = (f * f + f * 100.0F) / 100.0F; if (f > 100.0F) { f = 100.0F; } return f; } } but for some reason its not shooting the bullets
    • January 17
    • 18 replies
  2. Somonestolemyusername

    [1.15.2] How Would I make a custom bow?

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    all i has in it is package com.vicken.mod3.entities.projectiles; import com.vicken.mod3.util.RegistryHandler; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.WallTorchBlock; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.projectile.ArrowEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Effects; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; public class Ak47ArrowEntity extends ArrowEntity { public Ak47ArrowEntity(World worldIn, LivingEntity shooter) { super(worldIn, shooter); RegistryHandler.BULLET.get(); } @Override protected void arrowHit(LivingEntity living) { super.arrowHit(living); living.setFire(15); } }
    • January 16
    • 18 replies
  3. Somonestolemyusername

    [1.15.2] How Would I make a custom bow?

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    ok can u help write the code? i started learning to mod a few weeks ago all i know is items armors block recipes and other stuff. also I already have a projectile class named Ak47ArrowEntity
    • January 16
    • 18 replies
  4. Somonestolemyusername

    [1.15.2] How Would I make a custom bow?

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    but if I use the snowball class it will be like im shooting snowballs not bullets. you know mr crayfishes gun mod? i want my gun to be somewhat like that also i figured out how to connect my registered object to the class
    • January 16
    • 18 replies
  5. Somonestolemyusername

    [1.15.2] How Would I make a custom bow?

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    oh I thought i just needed onUsingTick. also I looked over your code and I don't want my Gun/Bow shooting bullets like a snowball I want it to actually shoot like a real ak47 as i said before
    • January 15
    • 18 replies
  6. Somonestolemyusername

    [1.15.2] Armor Model Not Registering To Armor

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    ik i separately put that in the items section
    • January 15
    • 15 replies
  7. Somonestolemyusername

    [1.15.2] How Would I make a custom bow?

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    I tried using the onUsingTick but it made my game crashed even when i reduced the tick to 1
    • January 14
    • 18 replies
  8. Somonestolemyusername

    [1.15.2] How Would I make a custom bow?

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    here is the code for the gun i made and registered public static final RegistryObject<Item> AK47 = ITEMS.register("ak47", () -> new Ak47(new Item.Properties().group(ModItemGroup.instance).maxDamage(10000))); Ak47 class: package com.vicken.mod3.items; import com.vicken.mod3.entities.projectiles.Ak47ArrowEntity; import com.vicken.mod3.util.RegistryHandler; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.entity.projectile.ArrowEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.world.World; import java.util.function.Predicate; public class Ak47 extends ModBow { public Ak47(Properties builder) { super(builder); } @Override protected AbstractArrowEntity createArrow(World worldIn, ItemStack ammoStack, PlayerEntity playerentity) { return new Ak47ArrowEntity(worldIn, playerentity); } @Override protected double getArrowDamage(ItemStack bowStack, AbstractArrowEntity arrowEntity) { int powerLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER, bowStack); return (double)powerLevel * 100.5D + 100.5D; } @Override public Predicate<ItemStack> getInventoryAmmoPredicate() { return (ammoStack) -> { return ammoStack.getItem() == RegistryHandler.BULLET.get(); }; } } modBow class: package com.vicken.mod3.items; import com.vicken.mod3.util.RegistryHandler; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.item.ArrowItem; import net.minecraft.item.BowItem; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.stats.Stats; import net.minecraft.tags.ItemTags; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.world.World; import java.util.function.Predicate; public class ModBow extends BowItem { public ModBow(Properties builder) { super(builder); } public void onPlayerStoppedUsing(ItemStack bowStack, World worldIn, LivingEntity entityLiving, int timeLeft) { if (entityLiving instanceof PlayerEntity) { PlayerEntity playerentity = (PlayerEntity)entityLiving; boolean hasInfinity = playerentity.abilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.INFINITY, bowStack) > 0; ItemStack ammoStack = playerentity.findAmmo(bowStack); int timeDrawn = this.getUseDuration(bowStack) - timeLeft; timeDrawn = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(bowStack, worldIn, playerentity, timeDrawn, !ammoStack.isEmpty() || hasInfinity); if (timeDrawn < 0) return; if (!ammoStack.isEmpty() || hasInfinity) { boolean isTippedArrow = ammoStack.getItem() == RegistryHandler.BULLET.get() || ammoStack.getItem() == RegistryHandler.BULLET.get(); if (ammoStack.isEmpty()) { ammoStack = new ItemStack(RegistryHandler.BULLET.get()); } float velocity = getArrowVelocity(timeDrawn); if (!((double)velocity < 100.1D)) { if (!worldIn.isRemote) { AbstractArrowEntity arrowEntity = createArrow(worldIn, ammoStack, playerentity); arrowEntity.shoot(playerentity, playerentity.rotationPitch, playerentity.rotationYaw, 0.0F, velocity * 100.0F, 1.0F); if (velocity == 1.0F) arrowEntity.setIsCritical(true); double damage = getArrowDamage(bowStack, arrowEntity); arrowEntity.setDamage(damage); int knockback = getArrowKnockback(bowStack, arrowEntity); arrowEntity.setKnockbackStrength(knockback); // apply flame enchant if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, bowStack) > 0) { arrowEntity.setFire(100); } // reduce bow durability bowStack.damageItem(1, playerentity, (p_220009_1_) -> { p_220009_1_.sendBreakAnimation(playerentity.getActiveHand()); }); // set if arrow can be picked up from ground if (hasInfinity && !isTippedArrow) { arrowEntity.pickupStatus = AbstractArrowEntity.PickupStatus.DISALLOWED; } // actually make the arrow entity exist in the world worldIn.addEntity(arrowEntity); } // sound worldIn.playSound((PlayerEntity)null, playerentity.getPosX(), playerentity.getPosY(), playerentity.getPosZ(), SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (random.nextFloat() * 0.4F + 1.2F) + velocity * 100.5F); // use an arrow boolean shouldConsumeArrow = !hasInfinity || isTippedArrow; if (shouldConsumeArrow) { ammoStack.shrink(1); if (ammoStack.isEmpty()) { playerentity.inventory.deleteStack(ammoStack); } } playerentity.addStat(Stats.ITEM_USED.get(this)); } } } } // override to use a custom arrow entity protected AbstractArrowEntity createArrow(World worldIn, ItemStack ammoStack, PlayerEntity playerentity) { ArrowItem arrowitem = (ArrowItem)(ammoStack.getItem() instanceof ArrowItem ? ammoStack.getItem() : RegistryHandler.BULLET.get()); return arrowitem.createArrow(worldIn, ammoStack, playerentity); } protected double getArrowDamage(ItemStack bowStack, AbstractArrowEntity arrowEntity) { int powerLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER, bowStack); if (powerLevel > 0) return arrowEntity.getDamage() + (double)powerLevel * 100.5D + 0.5D; else return arrowEntity.getDamage(); } protected int getArrowKnockback(ItemStack bowStack, AbstractArrowEntity arrowEntity) { return EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, bowStack); } // Override to change what it uses as ammo public Predicate<ItemStack> getInventoryAmmoPredicate() { return (ammoStack) -> { return ammoStack.getItem().isIn(ItemTags.ARROWS); }; } public static float getArrowVelocity(int charge) { float f = (float)charge / 100.0F; f = (f * f + f * 100.0F) / 100.0F; if (f > 100.0F) { f = 100.0F; } return f; } } but for some reason the bullet is not shooting and also idk how to make it shoot constantly so i don't have to wait for it to load like a real bow and so it can shoot like a real ak47 does
    • January 13
    • 18 replies
  9. Somonestolemyusername

    [1.15.2] How Would I make a custom bow?

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    I want to add my custom bow class because it makes it so that the ammo is bullets, and the speed of the throwing is velocity 100 and that it shoots constantly and not like a real bow but like a ak47 I was able to do this with mcreator but i cant seem to do it with java.
    • January 13
    • 18 replies
  10. Somonestolemyusername

    [1.15.2] How Would I make a custom bow?

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    I did that but I'm saying I made a separate mod class for it and I want to take the properties from there and put it into the bow while registering.
    • January 13
    • 18 replies
  11. Somonestolemyusername

    [1.15.2] How Would I make a custom bow?

    Somonestolemyusername posted a topic in Modder Support

    hi. I am trying to make a custom gun/bow I got the properties ready but idk how to connect it to the object in the registry handler. can someone help?
    • January 12
    • 18 replies
  12. Somonestolemyusername

    [1.15.2] Armor Model Not Registering To Armor

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    thx it worked, also my pickaxe texture isint working and the item texture for the armor
    • January 12
    • 15 replies
  13. Somonestolemyusername

    [1.15.2] Armor Model Not Registering To Armor

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    Hello? noone has helped me for the last 20 hours and i think that other person stole my code
    • January 10
    • 15 replies
  14. Somonestolemyusername

    [1.15.2] Armor Model Not Registering To Armor

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    hello? why hasent anyone replied?
    • January 9
    • 15 replies
  15. Somonestolemyusername

    [1.15.2] Armor Model Not Registering To Armor

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    ok here it got uploaded https://github.com/ben10101010/my_mod
    • January 9
    • 15 replies
  16. Somonestolemyusername

    [1.15.2] Armor Model Not Registering To Armor

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    ok give it a few min its uploading to github
    • January 9
    • 15 replies
  17. Somonestolemyusername

    [1.15.2] Armor Model Not Registering To Armor

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    sure let me just upload it to github
    • January 9
    • 15 replies
  18. Somonestolemyusername

    [1.15.2] Armor Model Not Registering To Armor

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    wait it is under assets and mod id my bad but for some reaso n the texture dont work
    • January 9
    • 15 replies
  19. Somonestolemyusername

    [1.15.2] Armor Model Not Registering To Armor

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    no that's for the item , I mean when i put on as in the actual model as in when you wear the armor in game and you go in F5 mode and you see armor on you other than error texture
    • January 9
    • 15 replies
  20. Somonestolemyusername

    [1.15.2] Armor Model Not Registering To Armor

    Somonestolemyusername posted a topic in Modder Support

    so in my mod I made netherite armor, and the item texture for the chestplate and boots are working except the other pieces, but when i put on the armor the texture in my resources/assets/my_mod/textures/models/armor isint registering to the armor therefore giving me the error texture. how do I fix this?
    • January 9
    • 15 replies
  21. Somonestolemyusername

    [1.16.4] Mod registries not loaded before Event Listener

    Somonestolemyusername replied to st4s1k's topic in Modder Support

    ok
    • January 9
    • 12 replies
  22. Somonestolemyusername

    [1.16.4] Mod registries not loaded before Event Listener

    Somonestolemyusername replied to st4s1k's topic in Modder Support

    what version of minecraft are you coding in?
    • January 9
    • 12 replies
  23. Somonestolemyusername

    [1.15.2]Modded Block Not Registering Into Minecraft[solved]

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    nvm i solved it
    • January 5
    • 44 replies
  24. Somonestolemyusername

    [1.15.2]Modded Block Not Registering Into Minecraft[solved]

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    im trying to add the blockitem to ModItemGroup but its not letting me
    • January 5
    • 44 replies
  25. Somonestolemyusername

    [1.15.2]Modded Block Not Registering Into Minecraft[solved]

    Somonestolemyusername replied to Somonestolemyusername's topic in Modder Support

    wait but i mean what do i use in it to connect it to the block like for netherite_block would i use netherite_block_item?
    • January 5
    • 44 replies
  • Prev
  • 1
  • 2
  • 3
  • Next
  • Page 1 of 3  
  • All Activity
  • Home
  • Somonestolemyusername
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community