Jump to content

ShetiPhian

Members
  • Posts

    198
  • Joined

  • Last visited

Everything posted by ShetiPhian

  1. The error doesn't help much in finding the problem, but I lucked out as very little had changed before it started so I didn't have much to sift through
  2. ~4days ago, I accidentally cause an infinite notifyBlockOfNeighborChange loop. The error I was getting was exactly the same as you posted. My block was receiving a neighbor change event doing some logic, updating and telling neighbors it changed. When I placed two beside each other and the conditions where right the one would update and tell the other, who would then update and tell the first one, who would update again and this continued forever.
  3. Found another issue. Clients can't connect to a server after replacements have been made. SinglePlayer works fine, and the Server launches but clients can't connect. Short Message: java.lang.IllegalStateException: Can't map item minecraft:tallgrass to id 31 (seen at: 280), already occupied by null, blocked false, ItemBlock false and uncut: And for those wanting it, my replacement code; Values.blockTallGrass = new AltBlockTallGrass(); ItemColored itemTallGrass = (new ItemColored(Values.blockTallGrass, true)).func_150943_a(new String[] { "shrub", "grass", "fern" }); try { GameRegistry.addSubstitutionAlias("minecraft:tallgrass", GameRegistry.Type.BLOCK, Values.blockTallGrass); GameRegistry.addSubstitutionAlias("minecraft:tallgrass", GameRegistry.Type.ITEM, itemTallGrass); } catch (Exception e) { Values.logCore.error("Could not replace tall grass"); }
  4. 'src/main/java' = mod code 'src/main/resources' = mod textures etc. Minecraft > Referenced Libraries > forgeSrc-1.7......... = Minecraft sources with Forge and FML
  5. I know by default the tool classes that exist are 'pickaxe', 'axe', 'shovel', with harvest levels 0 (wood, gold), 1 (stone), 2 (iron), 3 (diamond) Why don't mods expand this with other tools? are we not to do so? Background: I have a block that is rotatable on right-click with a wrench, so Block.rotateBlock works perfectly for this. It also dismantles with sneak + left-click with a wrench, so I check Item.getHarvestLevel if it is a "wrench" In my own wrench tool I set the tool class to "wrench" (harvest 0) Every thing works perfectly, But when testing wrenches added by other mods they do nothing, after looking through their code none have set their wrenches with a custom tool class. To go another step further I have yet to see any mod adding custom toolClasses (some do set harvest levels higher then 3) Now I'm wondering, is setting a custom tool class an over-looked unused feature, or a modding faux pas?
  6. In this case: Always return true; The client thinks nothing happened and places the held block, the server however knows the gui should open and doesn't place the block. The false block is removed when the server tells the client nothing is there. --- If you open a gui both client and server need to return true. Here is one of mine that doesn't always open a gui. @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int face, float posX, float posY, float posZ) { if (world.getBlockMetadata(x, y, z) == 15) { if (!world.isRemote) { entityPlayer.openGui(PixelPowersWorld.INSTANCE, 5, world, x, y, z); } return true; } return false; }
  7. @EventHandler public void serverLoad(FMLServerStartingEvent event) { event.registerServerCommand(new MyCommand()); // Change to whatever name you want } MyCommand needs to implement ICommand As for examples anything in the package net.minecraft.command will help.
  8. Its not in the pre-1210 branches, you need to use the 'new' branch. http://files.minecraftforge.net/minecraftforge/new
  9. When netty was first added the sirgingalot tutorials where the first ones I found, they worked well so I converted everything to it. I never bothered looking for anything else, so never noticed how similar they where Now however I have so many packets across my mods I'll probably just leave it Edit: Thinking about it, I'm sure I settled on this as the only other ways did much more then I needed and where over complex. FML didn't have anything SimpleNetwork (why else would every other tutorial have something way different and sirgingalot basically clone it) And all the warnings and do not use messages didn't exist either Edit2: So I finished what I was working on and took a better look at the network.simpleimpl files. It does look a lot cleaner and is still very simple. Just when I was thinking "it looks like each packet needs two classes, maybe I'm reading it wrong, I should see if someone else has an example" I found this: http://www.minecraftforge.net/forum/index.php?topic=20135.0
  10. @diesieben07 I haven't noticed any, but maybe its a good thing to post my code so it can be looked over, and problems fixed These are in my core and are used by all of my mods: PacketPipeline: http://pastebin.com/5ixeHzzN PacketBase: http://pastebin.com/iLHeGGjt Here is an in use example: NetworkHandler (extends PacketPipeline): http://pastebin.com/R5PqSKvq Packet Example (PacketPlatFormer extends PacketBase): http://pastebin.com/U3UuMT11 Don't use this, there is a better way.
  11. Whov The new system is far easier and cleaner then the old one, but it takes some prep work. sirgingalot has tutorials for the Packet pipeline and AbstractPacket (I use a modified version of both) Let me pastebin code and I'll edit this with links. Don't use those.
  12. Reflection will not be possible in the future, cpw will be locking down the registry once he knows the replacement system is working. From playing with the system, - You don not register replacement blocks or items outside of the addSubstitutionAlias (this will log an error otherwise) - The first parameter is the block/item id (found in Blocks and Items) with the prefix 'minecraft:' (if your not replacing a mod added one that is) - When replacing a block you must replace the item also (an error is caused otherwise and the worlds backup file is used) - The replacement class needs to extend original (at least this appears to be the case)
  13. When replacing a block you must replace the item also. and currently registerBlockIcons isn't called on replacement blocks, so you need to call it from another blocks registerBlockIcons for now.
  14. Your not loading the file. public static void loadConfig() { config.load();
  15. Its basically how I started but I knew basic, c, and a few others so following java wasn't difficult
  16. It doesn't appear writeEntityToNBT adds the id to the tag, but writeToNBTOptional does. you can try that or this (both do the same thing but writeToNBTOptional ignores dead and ridden entities) NBTTagCompound compound2 = new NBTTagCompound(); compound2.setString("id", this.capturedEntity.getEntityString()); this.capturedEntity.writeToNBT(compound2);
  17. Inspecting existing mobs will help, EntityEnderman has what your after, might want to look at EntityPigZombie and EntitySkeleton also. applyEntityAttributes() getDropItem() dropFewItems(boolean playerKill, int lootingLevel)
  18. Just a thought: Your entity height is smaller then the bounding box. What happens if you use this.setSize(1.0F, 2.0F);
  19. Add this to your block: @Override public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) { } Without learning the basics first or at least reading a few tutorials you'll likely end up frustrated and quit before getting very far. Minecraft code can be a pita to read at times
  20. MurpMod.java:194 You need to look on that line. Looks like the same issue I had when I missed a space in my shaped crafting recipe. er.. to clear that up a bit if the shaped crafting is "##", "#" it will fail, you need the a space so both strings are the same length "##", "# "
  21. Here is the frequently used one: GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Here is more information on blending: http://relativity.net.au/gaming/java/Transparency.html
  22. If you extend GuiScreen public void drawScreen(int mouseX, int mouseY, float par3) If you extend GuiContainer public void drawScreen(int mouseX, int mouseY, float par3) public void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY) public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) Check if the mouse is over the bar. mouseX >= energybarX && mouseX <= energybarX + energybarWidth && mouseY >= energybarY && mouseY <= energybarY + energybarHeight Then draw your tooltip
  23. do it with the rest of your blocks in preInit currently registerBlockIcons isn't called so for now you'll need to call it from the registerBlockIcons in another block.
  24. Ok, been playing around with the Item and Block per-world aliasing. Well I can't get it to work The line I'm using : GameRegistry.addSubstitutionAlias("minecraft:tallgrass", GameRegistry.Type.BLOCK, new BlockNewTallGrass()); Note: BlockNewTallGrass extends BlockTallGrass FMLControlledNamespace.addSubstitutionAlias I replacement : contains my block I original: contains net.minecraft.block.BlockTallGrass No errors are thrown, and the data is added to persistentSubstitutions In world block, creative inventory, give command, and pick block all give the original. The only thing that seems to happen is an error "Forge Mod Loader detected that the backup level.dat is being used." Even on new worlds I get that error. Removing the substitution also removes the error. EDIT: Well with a clear and rested mind I took another crack at replacing blocks. It does work, it was completely me overlooking a step. When replacing a block you need to replace the block and replace the item.
×
×
  • Create New...

Important Information

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