Jump to content

coolAlias

Members
  • Posts

    2805
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • URL
    http://www.minecraftforum.net/members/coolAlias
  • Personal Text
    Find me over at the MinecraftForums

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

coolAlias's Achievements

Reality Controller

Reality Controller (8/8)

747

Reputation

  1. Looks like the Forge documentation needs to be updated, then.
  2. You should be able to attach your Capabilities to any ItemStack, including vanilla, using Forge's `AttachCapabilityEvent<Item>` event.
  3. You need to use Forge's Capabilities system to attach extra data to the Item/ItemStack. For generating random items, take a look at Loot Tables - they are super flexible and can do everything you will need them to do for your system, though they are somewhat complicated to work with.
  4. No, the Capability is for storing which skills the player has and what skill level they are. The actual skill system can be totally separate and simply query the player's Capability when they interact with it. If your skills need to store any information on a per player basis, that should be stored in the player's Capability.
  5. Huh, never thought of doing something like that. Nice. Cheers!
  6. Thanks! I do find it a little odd that the modid needs to be specified in the sounds.json file now - are there any cases where one would want to specify something else? Because you can always fetch sounds from Minecraft or other mods using the registry.
  7. public static SoundEvent SOUND_LEVELUP; // Called from main class during FMLPreInitializationEvent public static void registerSounds() { SOUND_LEVELUP = registerSound(new ResourceLocation(ModInfo.ID, "levelup")); // etc. } private static SoundEvent registerSound(ResourceLocation location) { final SoundEvent sound = new SoundEvent(location).setRegistryName(location); return GameRegistry.register(sound); } During the loading process just before the SoundSystem starts, I receive an error message like the following for every single sound listed in my sounds.json file: File minecraft:sounds/special/levelup.ogg does not exist, cannot add it to event dynamicswordskills:levelup Note how it appears to be searching for the file with the 'minecraft' domain rather than my mod id, even though it shows the correct resource location just after that. I'm using Forge 1.9.4-12.17.0.1976. What am I doing wrong?
  8. One thing I've noticed is you are doing all of your initialization during the FMLInitializationEvent instead of the FMLPreInitializationEvent - in my experience, you should always register your blocks, items, etc. during pre-init.
  9. If I recall correctly, the Container should have a reference to the Inventory, which should have a reference to the TileEntity in use, which should have a reference to the BlockPos. But if that's not the case, then yes, you'd have to resort to a raytrace to fetch the current block, but that's not totally reliable in this case - what if another player or mob interposes itself between the player and the open chest while they are perusing, for example? Container will still be open, but now the MovingObjectPosition will probably contain the mob. Or a player might place blocks between them. Rare, certainly, but it may happen.
  10. java.lang.IllegalArgumentException: Attribute is already registered! [16:00:35] [server thread/INFO] [sTDERR]: [java.lang.Throwable:printStackTrace:-1]: at net.minecraft.entity.ai.attributes.AbstractAttributeMap.registerAttribute(AbstractAttributeMap.java:34) // your code: this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(0.5D); EntityMob already registers the ATTACK_DAMAGE attribute - you can set the value like you do the others, but you cannot re-register it.
  11. No worries - that's the reason they finally consolidated the event buses, it was a mess keeping track of them. @OP As we've said, you have to check if the DamageSource#getEntity is an EntityPlayer, then cast that entity to EntityPlayer so you can call I believe #addChatMessage to send them a chat - it's been a long time since I've looked at 1.6.4 and the chat methods have changed a lot since then, so you may have to look for it yourself.
  12. The first version you posted should be printing to the console each time a zombie dies. To test if your event handler is working at all, you can put a println at the very beginning of it: @ForgeSubscribe public void onEntityDeath(LivingDeathEvent event) { System.out.println("Entity died: " + event.entity); } If you're not getting any output at all, make sure you actually call that random static init1 method you posted... it'd be simpler just to register directly during one of the FML events. Edit: No, don't use FMLCommonHandler event bus - that's the wrong bus for this event. Here's a tutorial - please read it so we don't have to repeat the same information over and over again.
  13. // during pretty much any of the mod init phases: MinecraftForge.EVENT_BUS.register(new YourEventClass()); A quick Google search will bring up a lot of information on using Forge events that would be cumbersome to reproduce in forum posts.
  14. If you registered the class containing that method to the Forge event bus, yeah, that's the basic premise and should be printing 'Hello!' every time a zombie dies.
  15. LivingDeathEvent, check if entity killed is instanceof EntityZombie and if the source of damage was caused by a player. This works in pretty much every version of Minecraft/Forge since at least 1.6.4.
×
×
  • Create New...

Important Information

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