Jump to content

SanAndreaP

Forge Modder
  • Posts

    1689
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by SanAndreaP

  1. 1. instanciate your items within the init() method, not within the declaration of the variable 2. call your ModItems.init() method within your preInit (FMLPreInitializationEvent) method in your main mod file edit - can you post the full ForgeModLoader-server-0.log file?
  2. Actually, Forge is missing an argument (isAnimal). Just use this: private static final Class<?>[][] paramTypes = new Class[][] {{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class}}; public static final EnumCreatureType ambientWater = EnumHelper.addEnum(paramTypes, EnumCreatureType.class, "ambientWaterFish", EntityWaterMob.class, 40, Material.water, false, true); instead of: public static final EnumCreatureType ambientWater = EnumHelper.addCreatureType("ambientWaterFish", EntityWaterMob.class, 40, Material.water, false); The last parameter, as previously suggested, means isAnimal. Set it to true/false accordingly
  3. If you still want a hook for it, you (or any coremodder who wants to do it as well) can attempt to do ASM. I've done it for myself recently, since I need the sneak key for the landing when flying on an entity. Here's the ASM code: https://github.com/SanAndreasP/SAPManagerPack/blob/master/java/sanandreasp/core/manpack/transformer/TransformPlayerDismountCtrl.java It basically hooks into where the dismount happens (within EntityPlayer) and calls a newly created method (_SAP_canDismountWithLSHIFT) from the dismounted entity (ridingEntity). When the method returns true, it dismounts, otherwise it doesn't. The method is injected within the Entity class. The method is "runtime-overritten" in my custom entity and returns true when it's on the ground. You could also turn this into an event and make a Pull Request to Forge.
  4. Before the line GL11.glEnable(GL11.GL_ALPHA_TEST); put this piece of code inside: int bright = 0xF0; int brightX = bright % 65536; int brightY = bright / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX, brightY); It should brighten your render stuff up. The bright integer can range from 0x00 (complete darkness) to 0xF0 (complete brightness). If it doesn't work, put it before tessellator.startDrawingQuads();
  5. Yea i know right. I have a mod were i have done the same but have no config file. Is it the config that makes me need the preinit? And i did not have the time yesterday to try it out, i will today when i get home. look here why you should register your items / blocks in preinit: http://greyminecraftcoder.blogspot.de/2013/11/how-forge-starts-up-your-code.html
  6. Check if the chunkposition variable in your onItemRightClick method is null, so you can be sure if it even can find your structure or not.
  7. What does not work? Rendering, Moving, finding the structure...?
  8. Look at how I've done it (important lines are marked): https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/sanandreasp/mods/EnderStuffPlus/registry/ServerEvents.java#L122-L124 Basically you use the LivingHurtEvent and check if the event.source.getSourceOfDamage() is an instance of your custom arrow class, if yes, do your stuff.
  9. oh, you can use Predicates with Guava? Good to know
  10. If you would read the error, you would see it appears to be in this method: public boolean isOre(ItemStack itemstack) Also he doesn't make any array with the size of 0. To ZippyBling: What I can see is that this is your problem: if(OreDictionary.getOres(oreNames) != null){ if(OreDictionary.getOres(oreNames).get(0).itemID == itemstack.itemID){ return true; } } You check if the value returned by getOres is not null but don't check if it has a size > 0.
  11. You can also use this code to make sure you really catch every biome (even modded ones) ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(); for( BiomeGenBase biome : BiomeGenBase.biomeList ) { if( biome != null ) { biomes.add(biome); } } EntityRegistry.addSpawn(EntityAncientzombie.class, 5, 1, 3, EnumCreatureType.monster, biomes.toArray(BiomeGenBase.biomeList));
  12. Can you provide the full log? (ForgeModLoader-client-0.log / ForgeModLoader-server-0.log)
  13. Or, if your PC can handle it, you could just run a dedicated server, a client with "Reika_Kalseki" as username and a client with a random username in Eclipse, connect both clients to the server and see the results.
  14. setBlockHarvestLevel(Block, "tool", lvl); this only prevents the blocks from being harvested, thus not dropping items (like diamond ore only drops diamond with an iron pickaxe or better) As I've seen in the OP, he doesn't want this behavior:
  15. Firstly, thank you for taking the time to respond; however, although I believe the method you mentioned could accomplish the behavior I am looking for it's kind of a "work around" to the vanilla tool effectiveness system. I believe the above function is more intended to be used for player specific conditions (like if a player has a mining speed potion applied). Your suggestion follows the same logic that I was proposing in my previous post however, so I am beginning to think this may be the best solution (because no vanilla or forge solution exists). I will code everything in the above manner to see if it behaves as we assume, and if so I will report back; but if anyone knows of a better solution to making a block unbreakable by everything but one specific tool I would love to hear. Thank you once again for your time and attention to this matter! 1. canEntityDestroy is only called by those entities mentioned within that methods code, so not really useful 2. getPlayerRelativeBlockHardness should work just fine, since your goal actually is a player specific condition (either the player has a blowtorch or not)
  16. There is a neat little class called ObfuscationReflectionHelper. Look at it.
  17. I see. But if you really wanna make an excercise for the reader, use pseudocode
  18. That is a horrible idea (especially if you check it every tick, like the OP plans to. getAllUsernames needs to iterate the whole player list and copy the username into a (newly allocated) array. Then you convert that array to a list again, just to iterate it once again (that's what Arrays.asList().contains) does. If you really need to do this, iterate ServerConfigurationManager#playerEntityList directly and check for the username. oooh, I thought the getAllUsernames uses a pre-defined array already... yeah than this is not at all a good idea, scratch that. But there is the PlayerLoggedInEvent / PlayerLoggedOutEvent, as GotoLink mentioned, and it actually does fire on the server and client AFAIK edit: Or you could always use the IPlayerTracker interface, It does the same things as the events do. Make a class which implements it and register a new instance of that class with GameRegistry.registerPlayerTracker()
  19. To be fair: I use @SideOnly(Side.CLIENT) on my client-sided classes/methods/fields to make sure they are really client-sided (helps to figure out if you use any client references where they shouldn't be while testing on the dedicated server) B2T: To check if an user is currently logged into the server, use this: Arrays.asList(MinecraftServer.getServer().getAllUsernames()).contains("USERNAME") So in my case (sanandreasMC) you replace "USERNAME" with "sanandreasMC"
  20. FMLLog.log(Level.SEVERE, "GENERATING CUSTOM ORES!"); I encourage you not to use the SEVERE level, as it is only for critical errors. Use the INFO level (or use FMLLog.info())
  21. Just use a local variable for that one and avoid 2 calls of the same nature
  22. You need to do GameRegistry.addBiome(biome); (which is a wrapper method for this line, you might as well also use this one) WorldType.NORMAL.addNewBiome(biome); above your BiomeManager.addSpawnBiome (<- this only adds the biome to a list for the initial player spawn algorithm to choose from, upon world creation) Please note that this only adds them to the normal world type, to have your biome in the large biomes worldtype, too, add this line: WorldType.LARGE_BIOMES.addNewBiome(biome);
  23. Then just let it spawn in every BiomeGenPlains and then check in your entitys getCanSpawnHere() method if 1. the super method returns also true (if you didn't already override the method) 2. if the biome in which the entity is placed has the name "Sunflower Plains" To get the biomes name, use worldObj.getBiomeGenForCoords([X-Position of entity], [Z-Position of entity]).biomeName
  24. Yeah, it worked. Thanks a lot! Can you just explain why preInit works and init doesn't? I have a link which explains this quite well: http://greyminecraftcoder.blogspot.de/2013/11/how-forge-starts-up-your-code.html
×
×
  • Create New...

Important Information

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