Jump to content

wesserboy

Members
  • Posts

    71
  • Joined

  • Last visited

Everything posted by wesserboy

  1. Thank you very much!!! if smooth lighting is turned off my block looks exactly the same as the original: (left vanilla crafting table, right my block) I looked up the blog post you mentioned (I think you ment this one) and I still have a couple of questions. In the tutorial it shows a chart on how to apply lighting when rendering. It states the first thing you have to do is apply the side dependent intensities. This is what i have done to (mostly) fix my problem. Then you have to apply the ColorMultiplier. It states this is what makes blocks appear blue underwater etc. I didn't apply any colorMultiplier, but underwater my block still looks exactly the same as a normal block: (left vanilla crafting table, right my block) I saw the tutorial is a little outdated (2013) so my question is: Is it possible that minecraft applies the ColorMultiplier automatically now? When i turn on smooth lighting, my block doesn't look the same anymore, in the tutorial it states that this is due to the 'Ambient occlusion', and if i'm not mistaking it should be as easy as to multiply the side dependent percentage with another calculated value. But the tutorial only tells what the value is based on, not how to get/calculate it. So my question is, is there some method or formula somewhere to get this value from? It's not completely necessary to fix this, but if it is as easy as applying a multiplication, i think it would be worth the effort.
  2. It looks to me like renderBlockAnvilRotate() only uses the tessellator.setNormal() method when it renders the block in an inventory. I think the boolean declares wether it is rendered in an inventory or in the world, and if it is rendered in the world it looks like it just passes the args to renderStandardBlock(). But i could be wrong, it's a little hard to follow the code with all the deobf arg names... however, if i look at the renderBlockAnvilMetadata() method, it uses the tessellator.setBrightness(block.getMixedBrightnessForBlock()) method, which leads me to think that that line in my code was correct. It also uses the tessellator.setColorOpaque_F() method, but it seems to calculate the three float values according to a block.colorMultiplier() and some hardcoded bit manipulation... The values are calculated even more if EntityRenderer.anaglyphEnable is true. I'm not quite sure what anaglyphEnable means, but it seems odd to me that a setting in the EntityRenderer influences the way a block is rendered... I will put the tessellator.setBrightness(block.getMixedBrightnessForBlock()) call back in my code, because it seems to be right since minecraft itself uses the same call. The bit manipulation is still a bit of a mystery to me, I don't get where all these hardcoded values come from, but it seems to me that the answer to my problem lies within that calculation. You would think there must be a method to get the calculated results for those floats, but the hardcoded calculations lead me to think that's not the case... I will have another look through the RenderBlocks class, any help/explanation on these calculations, or on another approach would be very much appreciated.
  3. When i remove those two lines it looks like this: The block looks very dark, the top is a lot darker than it is supposed to be, the sides look more like the normal crafting table, but still not quite the same. as i said in the first post, this is one of my first attempts at rendering, so i'm also not quite sure what i am supposed to set, and what is already setup for me...
  4. Hello, Today i spent the day rewriting my rendering code, and at this point it is almost perfect. This is how it looks using the new code: Video This is my updated rendering code: Link There is only one problem, the block renders too bright. (there is no shadow) (left is an original crafting table, right is my decaying block) The block can look like any block in the game, I made it to look like a crafting table because it has a 'complex' texture, which is nice to test with. I have tried different values in the methods tessellator.setColorOpaque_F(1F, 1F, 1F) and tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)). But i can't get the shadows to work properly. My question is: How do i get/calculate the right values for the mentioned methods to render the shadows properly, or am i using the wrong methods and is there a different way of doing this? -Wesserboy
  5. Hello, I am currently on my summer break, and i decided i would go do some minecraft modding. One thing i could never do was rendering, so i figured i would use this extra time to learn how to do it. To learn how to do it i set myself up with a nice challenge. I wanted to make a block look like it was decaying by gradually making little blocks disappear from it. I already learned a lot and its beginning to look like something, but i'm not yet happy with it. This is how it currently looks: Video I use the following code to achieve this: link There's a couple of problems with this: Firstly, the animation looks different depending on the side of the block you're looking at, form one side it looks like the blocks are disappearing, but from the other side it looks like the blocks 'slide away'. If you look at the video you will see what i mean. Secondly, I keep rendering the original top of the block, this way there is still a crafting grid on layers deeper inside the block, which looks kinda odd. I would like to render the bottom of the block on top after the first layer has been removed, because i think it would look better that way. I know how to write the logic for this, but the rendering code... If i would have to guess i think i need to stop using the RenderStanderdBlock method and draw the sides by directly interacting with the tessellator. But I am not sure about this at all, as i said it is just i guess. So my question is if someone knows how i would go about achieving this. Is my guess right, or is there a better way? And if my guess is right how would i go about implementing this idea? Does somebody maybe know a good tutorial where this is explained? If you need more code/screenshots/video's or explanation, just ask and i will provide it. I would like to thank you in advance! -Wesserboy
  6. that's true, but when he makes his custom rideable chicken he needs to make sure he let's the player mount it on the server.
  7. Minecraft.getMinecraft().thePlayer is the player on the client, that's why it visually looks like you're on the chicken, but you're actually not. use event.player to let the player mount the chicken on the server.
  8. Thank you very much, it works like a charm now yesterday i watched some tutorials about bit operators since i had never used them, my apologies for forgetting to thank you i've just changed my code and now it works!
  9. if i would use coordinates i would need two sets, one for Xcoords and one for Zcoords, right? but a set only adds an element if it doesn't already contain that element, which would be a problem if two chunk have the same coordinate. or did i misinterpret what you meant?
  10. Hello everybody, lately i've been working on a mod which can control pvp per chunk and it's coming along very nice. but a few days ago i've encountered a bug and i just can't find the cause, this is what happens: i run two clients from eclipse, one will host a lan world and another one will join that lan world. the host is player1 and the one that joins is player2. first pvp is turned off and when one of the players attacks the other one it works fine and tells me that pvp is not enabled in the chunk. then i toggle pvp so it is enabled in the chunk. when player1 then hits player2 it just damages him like it is supposed to. but when player2 hits player1 it still says pvp is not enabled in this chunk and it doesn't cause any damage. this is the code i use: eventhandler: https://gist.github.com/3a757d716d72e54b4731 worlddata: https://gist.github.com/ac072ba4a046ee0379f7 pvp toggle command: https://gist.github.com/d24fd087d4c34dd68f90 pvp read command: https://gist.github.com/e52ba8561b5a03738dec does anyone know what could possibly cause this and how i would fix it? -wesserboy
  11. for the top section i would recommend making an arraylist of blocks you can still break as a field, something like: ArrayList<Block> blocklist = new ArrayList<Block>(Arrays.asList(new Block[]{Blocks.bed, Blocks.brown_mushroom_block, etc...})); this way you can use blocklist.contains(event.block) your code would then look something like this: ArrayList<Block> blocklist = new ArrayList<Block>(Arrays.asList(new Block[]{Blocks.bed, Blocks.brown_mushroom_block, etc...})); @SubscribeEvent public void setBreakableBlocks(PlayerEvent.BreakSpeed event) { ItemStack item = event.entityPlayer.getCurrentEquippedItem(); if(blocklist.contains(event.block) { event.setCanceled(false); } else if(item == null || !ForgeHooks.isToolEffective(item, event.block, event.metadata)){ event.setCanceled(true); } } but it's up to you if you use it or not
  12. if i understand your question right you want to place the (sub)blocks in a creativetab and you want to name them. if so: for the creativetab you can use setCreativeTab(CreativeTab tab) in the constructor of your block to place it in that creativetab. for the names you can use LanguageRegistry.addName(new ItemStack(BlockTreeBlock, 1, meta), "name of the block"). you can place this in the same spot as where you register your block. you can use a for loop and an array of names to go through all the different meta's and name the subblocks.
  13. Thanks a lot, i looked at it and it looks very helpful if i ever need another obfuscated name -wesserboy
  14. yeah, i read about the MCPbot, but i've never used irc and i couldn't get it to connect to the channel so i figured i would just look at the reobf file
  15. thanks everybody, i found the name and it work great now, if someone wants to know the obfuscated name was func_146068_u i found it by opening the reobf file of mcp with a tekst editor.
  16. ok, i am one step further now, since i use a String to find the method within the class i can't use "getDropItem" outside eclipse, i need the obfuscated name of getDropItem, does anybody know where i can find this obfuscated name?
  17. I had problems with that method too, so i wrote my own little method to break the block for me: private void breakBlock(World world, int x, int y, int z){ if(world.getBlock(x, y, z) != Blocks.bedrock){ world.getBlock(x, y, z).dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlockToAir(x, y, z); } } it could be a forge bug since i had the same problem, but this method has been working great for me.
  18. I have looked into it further and i have noticed the problem, entities that do have a getDropItem() method cause a noSuchMethodException if i run the exported version of the mod, however the same entity doesn't cause this exception in eclipse... does anybody know what could be the cause of this?
  19. you can't put spaces before/after the '=' sign, therefore it should be: tile.block.ash.name=Ash instead of: tile.block.ash.name = Ash
  20. I used java reflection, and in my dev environment it seemed to work fine, it spawned the particles every time, but when i exported the mod and tried it, it didn't spawn any particles at all. this is the code i am using: LivingUpdateEventHandler: https://gist.github.com/anonymous/cf4dd49d5de35af5a8a3 EntityItemFX: https://gist.github.com/anonymous/1a5c7715ca01c1ac077c ParticleHelper: https://gist.github.com/anonymous/fbeee5aee9c7ea08e113 does anybody know why this happens?
  21. Hello, I had this idea for a mod that spawns particles around an entity of the item that it drops, i found this method in EntityLiving called getDropItem(), and i wanted to use this to get the item the particle should look like, the only problem is that this method is protected, does anybody know if there is a forge hook to still get this item or another way to get the drop of a specific entity?
×
×
  • Create New...

Important Information

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