Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. That won't save you on a dedicated server, if notifyPickup is ever called from the server thread, it will crash in a dedicated server regardless of the isRemote check or not. Strange but true. I'm guessing this event never fires on the client, only on the server. You can check by just putting System.out.println("notifyPickup"); in your event handler and nothing else. If so, you'll need to open your GUI on the client by sending it a message from the server. You could do this by sending it a network message. http://greyminecraftcoder.blogspot.com.au/2015/01/client-server-communication-using-your.html for 1.8, 1.7 was similar. There is another way using Containers which I'm not really familiar with. Perhaps others too - google may help. -TGG
  2. Hi I think it might be bad news to call this.markDirty(); in your TE constructor. It's not necessary (vanilla TE don't do it) and it just might be causing your symptoms, by reading chunk information before your TE has finished constructing. -TGG
  3. You are compiling Java 7 code for Java 6. Java 6 does not support the diamond operator HashMap<> http://www.javaworld.com/article/2074080/core-java/jdk-7--the-diamond-operator.html Either write the operator out long hand (see the link) or compile for Java 7.... -TGG
  4. Hi The reason for the render of the block not updating is because blocks are compiled into a rendering "list" which is cached/reused until the blocks change (eg you place a block nearby, which causes the rendering list to be recompiled). Changing the graphics level does recompile all the rendering list (I think), but your setGraphicsLevel probably is not called before the recompilation, so it uses the old setting. Might be worth looking how the vanilla leaves do it, exactly. -TGG
  5. Hi Asweez Keen, thanks. If you would be willing to code up an example or two (or more) on Entities, it would be very helpful because the example project currently has nothing on Entities at all. The rough thought I had was for four examples: Entities basic entity that can be spawned and disappears after a certain time missile entity (always people trying to code their own guns & bullets, bows & arrows, etc) entity rendering / techne -based / animation entity with basic AI Perhaps a fifth for mountable entity like Jabelar suggested Any contribution would be very helpful. The existing project is at https://github.com/TheGreyGhost/MinecraftByExample If you like, you could fork and PR; alternatively if you want to do a completely separate project that's fine too, I could integrate myself. It would help a lot if you follow the package structure, class, notes, and commenting style used by the rest of the project because that will save me having to refactor it. Cheers TGG PS @Jabelar thanks for the suggestions, I'll add them to the wish list. Will need to up my skills for some of those The project has a fair few examples, including network messages which are a minefield for the unwary.
  6. Hi does your setGraphicsLevel() ever get called? Does your leaves texture have opacity in it? Try making public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT_MIPPED; } -TGG
  7. This article might help? http://www.vogella.com/tutorials/EclipseDebugging/article.html -TGG
  8. Hi These two links will probably tell you all you ever wanted to know about block mining (as well as a lot you had no idea you didn't want to know) http://greyminecraftcoder.blogspot.ch/2015/01/mining-blocks-with-tools.html http://greyminecraftcoder.blogspot.ch/2015/01/summary-of-logic-flow-when-mining-blocks.html -TGG
  9. Hi public int getMetaFromState(IBlockState state) { return 0; } This will reset your block's state to zero every time it is placed. Check out BlockNewLog. -TGG
  10. HI not sure I understand your question. Could you show your code which works for SkullOwner but not for Display or Name or Lore? -TGG
  11. Sorry dude, I'm out of ideas then. You'll probably need to trace into the this.w.spawnParticle method to see what the problem is. It might help to compare with a block of TNT detonated at the same location. -TGG
  12. Dude! Less Mountain Dew, more Sleep Yes setting the Project SDK is very important and nothing will work without it. Did you fix it yet? For some reason, I've found I need to use the following method to import projects correctly with IntelliJ, I'm not sure why. If you're still having no luck, you might try this: 1) From the command line in your project's directory containing the build.gradle file, run gradlew setupDecompWorkspace to install Forge and configure the project, this will take quite some time, maybe 20 minutes or more. 2) From the command line, run gradlew idea 3) Open the project (open the MinecraftByExample.ipr file, not the gradle file). 4) It will ask you whether you want to import the "unlinked gradle project". Choose yes. 5) Run the gradle task 'getIntellijRuns' afterwards to get the Run and Debug configurations. Note- if you are copying the code to your own project, don't forget to add this line to the end of your build.gradle file, otherwise your assets won't work (see here): sourceSets { main { output.resourcesDir = output.classesDir } } -TGG
  13. Hmmm that's curious Try putting a breakpoint here public void doExplosionB(boolean b) { this.w.playSoundEffect(this.x, this.y, this.z, "random.explode", 4.0F, (1.0F + (this.w.rand.nextFloat() - this.w.rand.nextFloat()) * 0.2F) * 0.7F); if ((this.size >= 2.0F) && (this.s)) // HERE and seeing whether it calls triggered on both the client and the server threads. -TGG
  14. FYI some links which talk a bit more about this http://greyminecraftcoder.blogspot.com.au/2015/01/thread-safety-with-network-messages.html plus some example network code in this project https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe60_network_messages/Notes.txt -TGG
  15. Hi This tutorial project has an example specifically about a furnace (MBE31), it might help you... https://github.com/TheGreyGhost/MinecraftByExample https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe31_inventory_furnace/Notes.txt -TGG
  16. No, you're right, that won't work if you try to have your Block extend TileEntity, because it will then be a TileEntity not a Block.... Your block needs to implement ITileEntityProvider. It will need to provide a method for TileEntity createNewTileEntity(World world, int metadata); where the TileEntity it returns should be your very simple TileEntity class. I would definitely recommend you use a TileEntity for what you're trying to do. I don't think an ISimpleBlockRenderingHandler will work how you want. Why do you worry about your TileEntity being pushable by pistons? I don't think that is necessary for a ship? -TGG
  17. For example MyCustomBlock:: /** * allows items to add custom lines of information to the mouseover description */ @Override public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List textList, boolean useAdvancedItemTooltips) { textList.add("Right click: select blocks,"); textList.add(" then: toggle drag on/off"); textList.add("Left click: deselect"); textList.add("Right hold: place the copy"); textList.add("Left hold: undo copy"); textList.add("Mouse wheel: rotate selection"); textList.add("CTRL+right: flip selection"); } -TGG
  18. Hi Looking at the way the piston is implemented, I don't think it will be able to push blocks which have TileEntity information (it will cause the TileEntity to be destroyed/overwritten). This might perhaps be ok if your TileEntity doesn't actually have any data stored in it - it might automatically discard & regenerate your TileEntity - but I'm not sure. You could perhaps try it and see - just provide a simple TileEntity for your Block (don't use BlockContainer) and make sure Block.getMobilityFlag() returns 0. No guarantees though. I think you are right, you need a TileEntity to render using a TileEntitySpecialRenderer. In 1.8 it's difficult to do custom block render without it (other choices are: ISmartBlockModel in some cases, or using ASM+Reflection to insert your custom rendering code into the vanilla code - which can be rather hard to get right). What's the "custom" rendering actually do? -TGG
  19. Please show the updated error message with the correct registration code, because as Ernio pointed out that error message was almost certainly caused by propsChannel.registerMessage(propsPacketHandler.class, propsPacket.class, 1, Side.SERVER); Your toBytes() and fromBytes() won't cause this error unless you accidentally overwrite the header byte by using the wrong ByteBuf method, and the discriminator byte is correct, so that's very unlikely to be the problem. -TGG
  20. Hi Yes, ISmartBlockModel will let you do that. You define the model using all the quads, then return a list of some of them ("layers" of them, if you have grouped them into "layers") based on the IBlockState passed to it. -TGG
  21. Hi >And yes, it is shown that I checked !World.isRemote before creating the explosion. I'm stumped, thanks in advance. ironic really In this case the explosion needs to execute on both client and server. You can tell this if you put a breakpoint in the vanilla doExplosionB - it breaks twice, once on server thread, once on client thread. Particle spawning does nothing on the server, which is why you don't see anything. -TGG
  22. Hi FYI Here are the steps I used to troubleshoot the problem... From BlockFlower:: private IIcon[] field_149861_N; @SideOnly(Side.CLIENT) public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { for (int i = 0; i < this.field_149861_N.length; ++i) { p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); } } An NPE in getSubBlocks can only be caused if field_149861_N is null. Your console error message would have shown that line number, alternatively you can use your debugger to set a breakpoint there and see it directly http://www.terryanderson.ca/debugging/run.html and http://www.vogella.com/tutorials/EclipseDebugging/article.html why is field_149861_n null? probably because you haven't initialised it. BlockFlower does it here public void registerBlockIcons(IIconRegister p_149651_1_) { this.field_149861_N = new IIcon[field_149860_M[this.field_149862_O].length]; for (int i = 0; i < this.field_149861_N.length; ++i) { this.field_149861_N[i] = p_149651_1_.registerIcon(field_149860_M[this.field_149862_O][i]); } } so either you need to call registerBlockIcons, or set field_149861_N yourself, or override getSubBlocks to return your subblock instead of the vanilla flower subblocks, or override BlockBush instead of BlockFlower. Depends on what you plan to do with your block. -TGG
  23. Hi Yeah there is a better way, look at ISmartBlockModel. It lets you choose which parts of your model to return without having to create a model for every single combination. If you search this forum you should find a couple of posts about it, there is also one in the tutorials section from a couple of weeks ago. This troubleshooting guide might help you get to the bottom of the texture problem http://greyminecraftcoder.blogspot.com.au/2015/03/troubleshooting-block-and-item-rendering.html Must admit I've never tried subfolders like that before, don't know if it should work. Try calling your subfolder something distinctly different from the block name? -TGG
  24. Hi You might find this link useful http://minecraft.gamepedia.com/Block_models uvlock is used to control the rotation of the textures for different block orientations. It depends on how you want your block to appear, easiest way is to try both and see with your own eyes what the difference is and which one you need -TGG
  25. Hi This tutorial project has a working example of changing the overlays including the armour bar https://github.com/TheGreyGhost/MinecraftByExample (see MBE40) https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe40_hud_overlay/Notes.txt It's for 1.8 but 1.7.10 is more or less identical. -TGG
×
×
  • Create New...

Important Information

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