Jump to content

fcelon

Members
  • Posts

    115
  • Joined

  • Last visited

Everything posted by fcelon

  1. I already looked to vanilla ItemBow class. There is no code responsible for firing the event.
  2. Hello, I have created a custom bow, but it does not trigger arrowLooseEvent. Probably because it does not shoots, when player stops using it, but after another click. This means, that any custom bow enchantments, that require that event will not work on my bow. Is there any way, how to fire that event manually? Thanks for any help.
  3. For me it is EntityPlayer in both cases (getEntity and getSourceOfDamage). Do I have to upgrade to latest forge version?
  4. Hello, Is there any way, how to get informations about the projectile, that has hit entity? I want to know, if arrow that has hit entity has custom tag. I tried to use LivingHurtEvent, but it does not seem to work correctly. According to http://jabelarminecraft.blogspot.cz/p/minecraft-forge-172-finding-block.html event.source.getEntity() returns any entity that dealt it (the arrow) However, for me it always return enther the player or null. @SubscribeEvent(priority=EventPriority.HIGHEST, receiveCanceled=true) public void onEvent(LivingHurtEvent event) { Entity entitysource = event.getSource().getSourceOfDamage(); if (entitysource instanceof EntityLivingBase) { if (event.getSource().isProjectile()) { System.out.println(event.getSource().getEntity()); } } } Output: [17:03:19] [Server thread/INFO]: [STDOUT]: EntityPlayerMP['Player911'/7, l='Testing world', x=237.17, y=56.00, z=-111.85] [17:03:19] [Client thread/INFO]: [STDOUT]: null Thanks for any help.
  5. Thanks you very much. I didn't know that. I thoutht it was part of the mod.
  6. It creates two files for some reason. My code is located in C:\Users\Petr Myslík\Desktop\Workspace\1.11\src\main\java. My assets are located in C:\Users\Petr Myslík\Desktop\Workspace\1.11\src\main\resources.
  7. Hello, when I compile my mod, two jar files are created. One with the source code and one with assets. How can I get my mod compiled to a single jar file? Thanks for any help
  8. Thakns you, Block::harvestBlock worked well for me.
  9. Hello, I made a mod, that adds shield enchantments, but the problem with them is shields can't be enchanted by vanilla ways, because their enchantability is 0. The getItemEnchantability() for shields returns always 0, not a variable. Is there any way, how to change it (without adding my own shield, that will replace vanilla one)? Thanks for any help
  10. Hello, I have created an enchantment, that makes tools break multiple block at once (like in 3x3 area). However, now it simply destroys the additional block and if there is any enchantment on that tool, that affects block loot, it has no effect. Is there any way how to simulate, that that block was mined by the tool, that caused it to break, so all the enchantments n that tool would be applied on that block properly. Thakns for any help.
  11. I am sure, no errors reported for some reason. However, I have already solved the problem. There was nothing wrong within the model, it was in the code. When I used new ModelResourceLocation(String location, String variantIn), I completely forgot to put mod ID before model name into location string and that was causing all the problems.
  12. { "parent": "item/generated", "textures": { "layer0": "mujmajnkraftsbettersurvival:items/nunchakupattern1" }, "display": { "thirdperson_righthand": { "rotation": [ -80, -260, 140 ], "translation": [ 1, 3, 1.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "thirdperson_lefthand": { "rotation": [ -170, -80, 140 ], "translation": [ 1, 3, 1 ], "scale": [ 0.9, 0.9, 0.9 ] }, "firstperson_righthand": { "rotation": [ 0, 90, 25 ], "translation": [ 0.13, 3.2, 0.13], "scale": [ 0.68, 0.68, 0.68 ] }, "firstperson_lefthand": { "rotation": [ 0, -90, -25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] } } } This item model does not work for me. When I load the game, item with this model looks like a missing texture block with the model name written on top of it. This mens (as far as I know), that the model is loaded, but the texture is not. Why? I tried different model wiht the "mujmajnkraftsbettersurvival:items/nunchakupattern1" texture in it and it loaded the texture without problems. Also I am not getting any errors about missing model/texture. Thanks for any help.
  13. Hi, I have created a weapon with auto attack ability. When player holds attack key (left mouse button), the weapon automatically attacks as fast as possible, so no spamming is needed. I am using mouse event, that triggers whever the button is pressed or released and it works fine. However, the problem is when player pauses the game when auto-attacking. Then the game doesn't recognise, that the button was released and auto attack contiunes untill it's pressed and realsed again. Is there any simple way to solve this problem?
  14. This is my first mod and I'm not very experienced with Java, sorry for that. Thanks anyway.
  15. Hello, I have added throwable weapon to my mod and I want to let any entity, that was hit by that weapon to drop it, when it dies. I have created a capability to store all weapons "inside" the entity, but there is some problem with saving the data to NBT anr the game instantly crashes. Is there anything wrong with this code. Code: public class SpearsInStorage implements IStorage<ISpearsIn>{ @Override public NBTTagCompound writeNBT(Capability<ISpearsIn> capability, ISpearsIn instance, EnumFacing side) { NBTTagCompound compound = new NBTTagCompound(); ArrayList<ItemStack> list = instance.getSpearsIn(); int n=1; for (ItemStack spear:list) { NBTTagCompound nbt = spear.serializeNBT(); compound.setTag("Spear"+n, nbt); n=n+1; } compound.setBoolean("HasSpears", true); return compound; } @Override public void readNBT(Capability<ISpearsIn> capability, ISpearsIn instance, EnumFacing side, NBTBase nbt) { for (int n=1;n<64; n++) { try { NBTTagCompound compound = ((NBTTagCompound)nbt).getCompoundTag("Spear"+n); ItemStack spear = new ItemStack(compound); instance.addSpear(spear); } catch (Exception e) { n=64; } } } } I used this tutorial when creating the capability: http://www.planetminecraft.com/blog/forge-tutorial-capability-system/. I have already added a different capability to my mod and it worked without problems. Thanks for any help.
  16. @SubscribeEvent(priority=EventPriority.HIGHEST, receiveCanceled=true) public void onEvent(LivingHurtEvent event) { Entity source = event.getSource().getSourceOfDamage(); if (source instanceof EntityLivingBase && !source.world.isRemote) { EntityLivingBase living = (EntityLivingBase) source; if (living.getHeldItemMainhand()!=null) { if (living.getHeldItemMainhand().getItem() instanceof ItemSpear) { double distance = living.getDistance(living.prevPosX, living.prevPosY, living.prevPosZ); System.out.println(distance); } } } }
  17. I tried this as well, but it also always returns 0.
  18. Hello, I want to create a weapon, that deals damage based on movement speed of the player, who strikes with it. However, I don't know, how to get it. I tried to get Xmotion and Zmotion, but this seems to only work when the player is jumping or being knocked back. When he is just wlking, it always returns 0. I also tried to get AImovementspeed, but it returns me, how fast entity should move based on speed modifiers no matter if it's moving or not. Thanks for help
  19. Hello, is there any way to add new tooltip to vanilla Item? I know there is ItemTooltipEvent, but it seems I can't change anything in it. I tried to use event.getItemStack().getItem().addInformation, but it doesn't do anything. Thanks for any help
  20. Hello, I have added a throwable weapon to my mod and I want to make sure it'll be dropped, when the entity hit by that weapon dies, so the player can use it again. Is there any way how to add custom drop to any entity at the moment it gets hit or do I need to save it somewere and call it during LivingDropsEvent? Thanks for any help
  21. Hello, I need help with registering custom entity. A am using this code: net.minecraftforge.fml.common.registry.EntityRegistry.registerModEntity(ResourceLocation registryName, Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates) But I have no idea what the ResourceLocation registryName is. I watched a tutorial and there was nothing about it. I even looked to the source code of other 1.11 mod and there was no ResourceLocation registryName in registerModEntity at all. But for me, the game crashes without it. Thanks for help
  22. Hello, I have created a mod, that adds more melee weapons to minecraft. I want this mod to be compatible with other mods, so the player could craft weapons from mater from that mods. However, this means I have to add textures for all those weapons made from materials from different mods. Is there an easy way to automatiacally generate those textures based on shape of weapon and texture of item, from which is that weapon made or do I need manually draw all these textures? Thanks for any help.
  23. Hello, I am making a mod, that adds more weapons to vanilla minecraft. I have already created those weapons from vanilla materials. However, I also want to create copper, bronze and silver versions of my weapons, but I have no idea, how to do it. Do I need the source code of mods, that add those metals? Thanks for help
×
×
  • Create New...

Important Information

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