Jump to content

gamas

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by gamas

  1. @Daniel Rollins thanks for your codes by setting attributes via GlobalEntityTypeAttributes . I wonder for MOVEMENT_SPEED, could I achieve the same goal by calling MobEntity.setAIMoveSpeed(float)?
  2. How would I do that @Draco18s, @DavidM if I don't have any real target? When you said target, do you mean a real entity (mob or living entity) that I want to target? Ideally, I just want the fireball to go in the direction of the center cursor? But I don't know how to get the position of the center cursor? In general, I don't quite understand the concept of player look vector ? . I wonder if there is documentation about this? Vec3d looking = player.getLookVec()
  3. That's a good idea @Draco18s ?. Below is the GhastEntity source code that I can see. But the code assumes that it has a target entity position (livingentity). But in my case, I don't have a target entity position ?
  4. Hi I am trying to shoot fireball from my custom axe when I click the right click on my mouse. I am able to do so, but I am not able to set the direction of the fireball properly Every time the fireball launch, it appears in front of the player which is good, but not in the direction of the center target cursor. It randomly changes the direction. Sometimes it appear on the left, or below or above or to the right on the target cursor in front of me. I want the fireball's direction to be exactly at the target cursor in front of me. I want the fireball direction to be like when I am shooting an arrow. What am I missing? package com.mycompany.firstmod.item; import com.mycompany.firstmod.init.ModItemGroup; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.FireballEntity; import net.minecraft.item.*; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class CustomAxe extends AxeItem { public static final Logger LOGGER = LogManager.getLogger(CustomAxe.class); public int fireballStrength = 9; public CustomAxe() { super(ItemTier.IRON, 6.0F, -3.1F, new Item.Properties().group(ModItemGroup.MOD_ITEM_GROUP)); } public CustomAxe(IItemTier tier, float attackDamageIn, float attackSpeedIn, Item.Properties builder) { super(tier, attackDamageIn, attackSpeedIn, builder); } public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand handIn) { Vec3d looking = player.getLookVec(); FireballEntity fireballentity = new FireballEntity(world, player,looking.x,looking.y,looking.z); LOGGER.info(String.format("%s, %s, %s", looking.x, looking.y, looking.z)); fireballentity.explosionPower = fireballStrength; world.addEntity(fireballentity); LOGGER.info("********** Magic Axe swing **************"); return super.onItemRightClick(world, player, handIn); } }
  5. Thank you @Zeide, that was it. My model file was like this before { "parent": "item/generated", "textures": { "layer0": "firstmod:item/invincible_sword" } } after I changed the "parent":"item/handheld", my custom sword looks good now. Below is the screenshot Really appreciate your help
  6. Hi there, I created a custom sword. It seems to work fine, behaves properly in term of its attack power, recipe. But when I look at it in Third Person view from the front, I notice that it is being held weirdly (screenshot attached). When I hold a regular diamond sword, it is being held properly (also screenshot attached). package com.ayclogic.aycfirstmod.item; import com.mycompany.firstmod.init.ModItemGroup; import net.minecraft.item.IItemTier; import net.minecraft.item.Item; import net.minecraft.item.SwordItem; public class CustomSword extends SwordItem { public CustomSword() { super(CustomTier.MATERIAL, 99, -2.0F, new Item.Properties().group(ModItemGroup.MOD_ITEM_GROUP)); } } any idea how to fix this? Diamond Sword Custom Sword
  7. Hi I am a bit new in Minecraft. I want to make an axe that can spit lighting when I right click on my mouse. When I execute below code, I was hoping it would strike a cow that is front of my character, but all it did was produced the lightning sound, but I don't see any lightning anywhere. I thought my code, would produce a lighting 20 steps in front of me. I think what I was missing in my code was a way to get a reference to the animal (cow) in front of me. I feel if I can get a reference of cow in front of me, I can set the my LightningBoltEntity to that animal position. But this is just a guess package com.ayclogic.aycfirstmod.item; import com.ayclogic.aycfirstmod.init.ModItemGroup; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.LightningBoltEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.*; import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class AycLightningAxe extends AxeItem { public static final Logger LOGGER = LogManager.getLogger(AycFireballAxe.class); public AycLightningAxe() { super(ItemTier.IRON, 6.0F, -3.1F, new Item.Properties().group(ModItemGroup.MOD_ITEM_GROUP)); } public AycLightningAxe(IItemTier tier, float attackDamageIn, float attackSpeedIn, Item.Properties builder) { super(tier, attackDamageIn, attackSpeedIn, builder); } public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand handIn) { if (!world.isRemote) { Vec3d vec3d = player.getEyePosition(1.0F); Vec3d vec3d1 = player.getLook(1.0F); Vec3d vec3d2 = vec3d.add(20, 0, 0); BlockPos blockPos = new BlockPos(vec3d2); LightningBoltEntity lightning = new LightningBoltEntity(world, blockPos.getX(), blockPos.getY(), blockPos.getZ(), false); ItemStack itemStack = player.getHeldItem(handIn); itemStack.damageItem(1, player, (p_220040_1_) -> { p_220040_1_.sendBreakAnimation(handIn); }); world.addEntity(lightning); } LOGGER.info("********** Abigail Lighting swing **************"); return super.onItemRightClick(world, player, handIn); } //AycLightningAxe } Any assistance would be greatly appreciated.
  8. I think I got it. This is how I create custom Axe which spit fireball in 1.15 package com.ayclogic.aycfirstmod.item; import com.ayclogic.aycfirstmod.init.ModItemGroup; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.FireballEntity; import net.minecraft.item.*; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.world.World; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class AycAxe extends AxeItem { public static final Logger LOGGER = LogManager.getLogger(AycAxe.class); public int fireballStrength = 3; public AycAxe() { super(ItemTier.IRON, 6.0F, -3.1F, new Item.Properties().group(ModItemGroup.MOD_ITEM_GROUP)); } public AycAxe(IItemTier tier, float attackDamageIn, float attackSpeedIn, Item.Properties builder) { super(tier, attackDamageIn, attackSpeedIn, builder); } public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand handIn) { FireballEntity fireballentity = new FireballEntity(world, player,player.getLookVec().x,player.getLookVec().y,player.getLookVec().z); fireballentity.explosionPower = fireballStrength; fireballentity.rotationPitch = player.rotationPitch; fireballentity.rotationYaw = player.rotationYaw; fireballentity.setPosition(player.getPosX(), player.getPosY()+2, player.getPosZ()); world.addEntity(fireballentity); LOGGER.info("********** Magic Axe swing **************"); return super.onItemRightClick(world, player, handIn); } }
  9. Thanks @Ugdhar I did not realize that https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a#nitty-gritty-random-things-ctrlf-section is sort of the migration documentation.
  10. Hi, I am kind of new in Minecraft modding. I was following a video on how to create a custom Axe and shield for minecraft 1.12. It worked great. But when I realized the latest version of minecraft is 1.15, it seems like the code in 1.12 is completely broken in 1.15. And there isn't a good documentation Below is the code that is working in 1.12, but not in 1.15 import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityLargeFireball; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumHand; import net.minecraft.world.World; public class CustomAxe extends ItemAxe { public int power = 3; public String axeName = "my_axe"; public CustomAxe(ToolMaterial material) { super(material, 1, 1); this.setUnlocalizedName(axeName); this.setRegistryName(axeName); this.setCreativeTab(CreativeTabs.COMBAT); this.setMaxDamage(power); } @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { if(!world.isRemote) { world.spawnEntity(createFireball(world, player, power)); } return super.onItemRightClick(world, player, hand); } public static EntityLargeFireball createFireball(World world, EntityPlayer player, int power){ EntityLargeFireball fireball =new EntityLargeFireball(world,player.posX,player.posY+2,player.posZ, player.getLookVec().x,player.getLookVec().y,player.getLookVec().z); fireball.explosionPower = power; fireball.shootingEntity = player; fireball.rotationPitch = player.rotationPitch; fireball.rotationYaw = player.rotationYaw; return fireball; } } Any idea how to convert above 1.12 code to 1.15? Any 1.15 guide / documentation / tutorial?
  11. Is there a guide/documentation on how to create custom weapons in 1.15.2? I used to follow a tutorial video on how to create a custom axe in 1.12, but it seems like everything is changed now in 1.15.2. There is no longer ItemAxe. There is no longer setCreativeTab(CreativeTabs.COMBAT). Is there migration documentation from 1.12 to 1.15?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.