Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

ShetiPhian

Members
  • Posts

    198
  • Joined

  • Last visited

Everything posted by ShetiPhian

  1. Just adding to this You also need this in your client proxy to avoid rendering glitches. (I've called mine after loading my config and before registering my blocks) MinecraftForgeClient.preloadTexture("GSM/textures/blocks/blocks.png");
  2. 8 is not a valid render id "java.lang.ArrayIndexOutOfBoundsException: 8" public static final Item bedrockBody = new ItemBedrockArmor(571, bedrockarmor, 8, 1).setIconIndex(.setItemName("bedrockbody"); Where you have "8" is the armor render index. 0 to 4 are used by the default armors. look at the code I posted here http://www.minecraftforge.net/forum/index.php/topic,1455.0.html
  3. The link you want can be found here: http://www.minecraftforge.net/forum/index.php/topic,5.0.html Hint: if you get to "Downloads Adfly:" you've gone too far
  4. Don't use hard coded numbers, if two mods use the same one bad things happen. Instead have RenderingRegistry assign you a number by running the code through your proxy. int renderAmethystArmour = proxy.addArmor("Amethyst") helmetAmethyst = (new WillowItemArmor(1048, 0, enumAmethystArmour, renderAmethystArmour, 0)).setItemName("amethystHelmet"); Server Proxy public int addArmor(String armor) { return 0; //server doesn't care what the number is } Client Proxy @Override public int addArmor(String armor) { return RenderingRegistry.addNewArmourRendererPrefix(armor); } Edit: dumb moment, I forgot armor sets get the same render id (I had individual parts getting their own )
  5. Well the good news is the event system was able to replace all but two parts from my PAPI code. (Just a bit of rethinking was required) The bad news is I'm apparently too dumb to understand how to use the asm library :'( Maybe if I better explained what I'm trying to do. My Mod adds player classes, the strongman/earth class is the only one with troubles. They can punch through stone and get a small bonus to mining speed. To make this work I need to change the return of EntityPlayer.getCurrentPlayerStrVsBlock and EntityPlayer.canHarvestBlock EntityPlayer.canHarvestBlock mock-up public boolean canHarvestBlock(Block par1Block) { //return this.inventory.canHarvestBlock(par1Block); return ShetiPhian.proxy.canHarvestBlock(this, this.inventory.canHarvestBlock(par1Block), par1Block); } EntityPlayer.getCurrentPlayerStrVsBlock mock-up public float getCurrentPlayerStrVsBlock(Block par1Block, int meta) { ItemStack stack = inventory.getCurrentItem(); float var2 = (stack == null ? 1.0F : stack.getItem().getStrVsBlock(stack, par1Block, meta)); int var3 = EnchantmentHelper.getEfficiencyModifier(this.inventory); if (var3 > 0 && ForgeHooks.canHarvestBlock(par1Block, this, meta)) { var2 += (float)(var3 * var3 + 1); } if (this.isPotionActive(Potion.digSpeed)) { var2 *= 1.0F + (float)(this.getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F; } if (this.isPotionActive(Potion.digSlowdown)) { var2 *= 1.0F - (float)(this.getActivePotionEffect(Potion.digSlowdown).getAmplifier() + 1) * 0.2F; } if (this.isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(this.inventory)) { var2 /= 5.0F; } if (!this.onGround) { var2 /= 5.0F; } //return var2; return ShetiPhian.proxy.getCurrentPlayerStrVsBlock(this, var2, par1Block, meta); }
  6. I was getting flickering with my HUD but a few small tweaks to my tick handler and all was good. My handler code can be found in the tutorial, using the onRenderTick() fix my flicker and should work for you. http://www.minecraftforge.net/wiki/Tutorials/Upgrading_To_Forge_for_1.3.1#Ticking
  7. It would be nice to drop a dependency, I noticed the new Event system was able to replace a few things I needed PAPI for. Anyhow, looks like I'm off to google I've never used asm before and have no clue what to do. If anyone want to post any helpful info I'd be grateful
  8. I've only added a single Amulet and it was in the armor directory and didn't use IArmorTextureProvider, so I won't be of much use but; Have you tried throwing some system.out 's in to see if the textures are ever being returned, rather then returning null each time?
  9. I've ran into a snag while converting my 1.2.5 mod PlayerAPI edits on the EntityPlayerSP & MP level which works for most things but flops for canHarvestBlock ForgeHooks.canHarvestBlock calls EntityPlayer.canHarvestBlock which returns its value to ForgeHooks.canHarvestBlock My code does nothing through PlayerAPI, but doing a temp edit in EntityPlayer get everything working fine. For the life of me I just can't seem to think of a way to edit the return of a direct call to EntityPlayer.canHarvestBlock from EntityPlayerSP.canHarvestBlock
  10. ModLoader.addName also sets it to "en_US" This is untested but might work for you private void addName(Object objectToName, String inGameName) { LanguageRegistry.instance().addNameForObject(objectToName, "en_US", inGameName); LanguageRegistry.instance().addNameForObject(objectToName, "en_UK", inGameName); }
  11. I believe .setBlockName requires the first letter to be lower case, but I could be wrong. oreAmethyst = (new WillowBlockOre(225, 0)).setBlockName("amethystOre"); NOTE: The following code enables you to remove ModLoader.addName but functions exactly the same If you want to remove ModLoader.addName your new code would look like: LanguageRegistry.instance().addNameForObject(oreAmethyst, "en_US", "Amethyst Ore"); Or you can make your own addName and just remove "ModLoader." private void addName(Object objectToName, String inGameName) { LanguageRegistry.instance().addNameForObject(objectToName, "en_US", inGameName); } As for generation, I'll give the code to put it in its own class file, personally I find this to be less cluttered when you are generating many things. If you wish to have it in your main class file minimal changes are needed. First you'll need this line (after your textures but before registering your ores looks like a good spot) GameRegistry.registerWorldGenerator(new WorldGenerator()); Next a new class file WorldGenerator.class public class WorldGenerator implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch (world.provider.worldType) { case -1: generateNether(world, random, chunkX*16, chunkZ*16); //Forge provides true chunk coordinates, while ModLoader provides block coordinates and calls them chunkX & chunkZ break; case 0: generateSurface(world, random, chunkX*16, chunkZ*16); //To make these values the same as ModLoader they need to be multiplied by 16 break; } } public void generateSurface(World world, Random random, int blockX, int blockZ) { // TODO Your code here } public void generateNether(World world, Random random, int blockX, int blockZ) { // TODO Your code here } }
  12. I don't see any issues, but then again I'm basically doing the same thing That reminds me, I should update that code with my findings. This can be cleaned up: @Override public EnumSet<TickType> ticks() { EnumSet<TickType> wantedTicks = EnumSet.of(TickType.CLIENT); wantedTicks.add(TickType.CLIENTGUI); return wantedTicks; } To look like this: @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.CLIENT, TickType.CLIENTGUI); } I have no idea what I was thinking before. I've also tried every TickType and only Render, Client, & Player seemed to work on the client side.
  13. If your just after generateSurface & generateNether, like I was. @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch (world.provider.worldType) { case -1: generateNether(world, random, chunkX*16, chunkZ*16); //Forge provides true chunk coordinates, while ModLoader provides block coordinates and calls them chunkX & chunkZ case 0: generateSurface(world, random, chunkX*16, chunkZ*16); //To make these values the same as ModLoader they need to be multiplied by 16 } } public void generateSurface(World world, Random random, int blockX, int blockZ) { } public void generateNether(World world, Random random, int blockX, int blockZ) { }
  14. One class file needs to implement IWorldGenerator You'll also need this line GameRegistry.registerWorldGenerator(new YOURWORLDGENCLASS());
  15. LanguageRegistry.instance().addStringLocalization("explodingCake.name", "en_US", "Exploding Cake");
  16. Thor: the first Official release hasn't happened yet, currently its modders bug find & test versions Lex: Sound good. Do you think using our own icons for new tabs would also be possible?
  17. Hey Lex I have a quick question for you. The chunkX and chunkZ values from ModLoader's generateSurface are 16x bigger then the ones from IWorldGenerator Am I correct in assuming this is intentional because it is providing chunk coordinates (as implied by the name) instead of block coordinates like mod loader?
  18. A nice system to have would be one that asks a random question from the FAQ and requires the correct answer before new accounts can post. That should get people reading it and maybe finding the answer themselves
  19. Best time for them to change over is now, 1.3 needs a good amount of re-coding anyway. EDIT: Also ForgeAPI has a better packet system, at first it isn't as easy as MLMP but as soon as you get the hang of it its far superior. When I converted my mod I cut my packet data down to a 3rd of what MLMP was sending and debugging was easier.
  20. MCNostalgia http://www.minecraftforum.net/topic/800346-tool-mcnostalgia-212-now-works-with-131/
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.