Jump to content

mnn

Members
  • Posts

    298
  • Joined

  • Last visited

Everything posted by mnn

  1. I wrote possible solution quite time ago, it does exactly what you're saying:
  2. problem solved. forge does some changes to all events on start using ASM library. the event is in my coremod and namespace was marked with TransformerExclusions so my event didn't get the needed tweaking after start.
  3. proxy implementing gui handler? looks weird. use override annotation where it should be (like on registerRenderThings in client proxy), also I don't think that registerRenderThings should be static.
  4. it's just my helper class, you'll be fine with this piece of code to make spawning working: Entity entity = new EntityItem(world, x, y, z, itemStackToSpawn); world.spawnEntityInWorld(entity); to handle right click you'll override in the scepter method onItemUse . from its parameters you have all the info needed for spawning an item into the world (don't forget to NOT spawn item on a client side), detecting if it's a diamond block (world.getBlockID) and destroying that block (world.setBlock, block #0 is air ~ nothing).
  5. Is possible to have custom events? I did implement one, but it doesn't seem to be working. event class: http://paste.minecraftforge.net/view/1d1907f2 event triggered: http://paste.minecraftforge.net/view/271a63a0 event handler: http://paste.minecraftforge.net/view/1036b904 handler is register in @init method: MinecraftForge.EVENT_BUS.register(new PowerEventHandler()); It crashes on getting parameter-less constructor (tried even adding one, but then my event rewritten ALL other events...) Constructor<?> ctr = eventType.getConstructor(); 2013-03-03 15:05:44 [iNFO] [sTDERR] java.lang.NoSuchMethodException: monnef.core.LightningGeneratedEvent.<init>() 2013-03-03 15:05:44 [iNFO] [sTDERR] at java.lang.Class.getConstructor0(Class.java:2706) 2013-03-03 15:05:44 [iNFO] [sTDERR] at java.lang.Class.getConstructor(Class.java:1657) 2013-03-03 15:05:44 [iNFO] [sTDERR] at net.minecraftforge.event.EventBus.register(EventBus.java:69) 2013-03-03 15:05:44 [iNFO] [sTDERR] at net.minecraftforge.event.EventBus.register(EventBus.java:53) 2013-03-03 15:05:44 [iNFO] [sTDERR] at monnef.jaffas.power.mod_jaffas_power.load(mod_jaffas_power.java:131) 2013-03-03 15:05:44 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-03-03 15:05:44 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2013-03-03 15:05:44 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2013-03-03 15:05:44 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Method.java:597) 2013-03-03 15:05:44 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:478) 2013-03-03 15:05:44 [iNFO] [sTDERR] at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) 2013-03-03 15:05:44 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2013-03-03 15:05:44 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Method.java:597) 2013-03-03 15:05:44 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) 2013-03-03 15:05:44 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 2013-03-03 15:05:44 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) 2013-03-03 15:05:44 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) 2013-03-03 15:05:44 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:268) 2013-03-03 15:05:44 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140) 2013-03-03 15:05:44 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-03-03 15:05:44 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2013-03-03 15:05:44 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2013-03-03 15:05:44 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Method.java:597) 2013-03-03 15:05:44 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) 2013-03-03 15:05:44 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 2013-03-03 15:05:44 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) 2013-03-03 15:05:44 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) 2013-03-03 15:05:44 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:268) 2013-03-03 15:05:44 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83) 2013-03-03 15:05:44 [iNFO] [sTDERR] at cpw.mods.fml.common.Loader.initializeMods(Loader.java:656) 2013-03-03 15:05:44 [iNFO] [sTDERR] at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207) 2013-03-03 15:05:44 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:456) 2013-03-03 15:05:44 [iNFO] [sTDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44) 2013-03-03 15:05:44 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:744) 2013-03-03 15:05:44 [iNFO] [sTDERR] at java.lang.Thread.run(Thread.java:662)
  6. thanks, didn't know about that method (a little confusing: getCreativeTab vs. getCreativeTabs ).
  7. what doesn't work? the event is working alright. if you want example here it is: https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/item/CustomDrop.java#L73, highlighted line is the adding new item to be dropped from currently killed entity.
  8. I'm pretty sure it is possible, but I have no clue how would I do that..
  9. you just create a new entity and spawn it into the world, example: https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/core/PlayerHelper.java#L19. do NOT spawn it on the client side.
  10. topic with same problem - http://www.minecraftforge.net/forum/index.php/topic,6196.0.html
  11. you have a player entity so you could do something like this maybe player.rayTrace to get the active block?
  12. http://www.minecraftforge.net/forum/index.php/topic,5483.msg29791.html#msg29791
  13. if you do it only on a server side, it should work (after casting it of course).
  14. you could try this for dimension change: MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension(par3EntityPlayer, MysticRealm.dimensionID);
  15. It worked for me pretty well . but yep, it's not my first programming language. Going from C# to Java was sometimes unpleasant, but feasible.
  16. You could try initializing datawatchers in EntityJoinWorldEvent (only for players) or using IPlayerTracker. I haven't done this before so I might be wrong. The down side of this solution is that your mod might collide with other mods, if they are using datawatcher with same ID. Safer (and a bit harder to implement) would be utilize custom packets. It's also possible that with PlayerAPI it would be easier to implement, but I don't use it so I can't really tell.
  17. take a look at this source code, it's exactly what you want https://github.com/ForgeEssentials/ForgeEssentialsMain/blob/master/src/FE_SRC_COMMON/com/ForgeEssentials/commands/CommandBed.java#L52
  18. I was afraid of that. And from what I've read about the new FML deobfuscation on-the-fly, it happens after core mods are processed so no luck with that. Yeah, I was thinking about parsing it out from mcp files, but I though that with all that mods using fml and asm there would be something easy to use already implemented.
  19. I'm playing with coremod and I'd like to know, if there is some way of getting class/method/field names from deobf to obf form automaticly. Is there some "names registry" or something that would help me with this task, or do I have to implemented my own translator class and then every new version of MC updating it?
  20. the code you provided looks ok - it should drop either ore when block's meta is 7 or gem otherwise. you want dropping two different items from your block? if so you'll probably have to override Block.getBlockDropped method and fill the return list with your items (ItemStack(s) containing your item(s)).
  21. imho items and blocks can be aquired by normal means: looking for an item with specific name in an array Item.itemsList or for a block in Block.blocksList . if a mod is present you can find out either using the mod's api, using reflection or Loader.isModLoaded method (there will be even more ways I guess).
  22. eh, if I'm correct it could be done using ASM library - adding a hook to the getBlockTileEntity (you have to be a core mod in order to be able to do that), then you could find out who's called that method (more here or here). but the perfomance cost wouldn't be small and it is quite extreme and messy solution. I don't recommend this, but it is imho doable...
  23. you can browse this (ugly, but working) code, it should contain all needed parts : https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/entity/EntityJaffaPainting.java
  24. I think you just use free ones (not 100% sure though, I don't have access to the MC code right now).
×
×
  • Create New...

Important Information

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