-
Posts
1689 -
Joined
-
Last visited
-
Days Won
1
Everything posted by SanAndreaP
-
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?
-
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
-
How to get enchant level & get id of weapon, which was attacked mob
SanAndreaP replied to Kwasti's topic in Modder Support
Use the LivingHurtEvent. -
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.
-
TileEntity renderer just renders in black
SanAndreaP replied to Bedrock_Miner's topic in Modder Support
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(); -
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
-
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.
-
What does not work? Rendering, Moving, finding the structure...?
-
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.
-
oh, you can use Predicates with Guava? Good to know
-
[1.6.4] Error with macerator when inserting ore
SanAndreaP replied to ZippyBling's topic in Modder Support
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. -
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));
-
[1.7.2] [ERROR] Exception in server tick loop
SanAndreaP replied to UltimateDillon's topic in Modder Support
Can you provide the full log? (ForgeModLoader-client-0.log / ForgeModLoader-server-0.log) -
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.
-
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)
-
There is a neat little class called ObfuscationReflectionHelper. Look at it.
-
[1.6.4] Check for a Tile Entity and sending data between them.
SanAndreaP replied to gmod622's topic in Modder Support
I see. But if you really wanna make an excercise for the reader, use pseudocode -
Checking to see if the owner of (x) is logged in?
SanAndreaP replied to Cyan's topic in Modder Support
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() -
Checking to see if the owner of (x) is logged in?
SanAndreaP replied to Cyan's topic in Modder Support
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" -
[SOLVED] Custom ore veins not generating?
SanAndreaP replied to Captain Hillman's topic in Modder Support
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()) -
[1.6.4] Check for a Tile Entity and sending data between them.
SanAndreaP replied to gmod622's topic in Modder Support
Just use a local variable for that one and avoid 2 calls of the same nature -
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);
-
Possible to set a mob to spawn only in a biome's mutation?
SanAndreaP replied to Cyan's topic in Modder Support
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 -
[1.7.2] Texture not working and removing block
SanAndreaP replied to Ablaze's topic in Modder Support
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