Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. Now this is something I haven't considered. Other than being triggered from inside the game, the tests ended up being just plain old junit tests? Even if it is not a clean way to write tests, it certainly sounds like a whole lot more fun then fighting classloaders or stubbing whole universes =) I guess it would be more accurate to call them "junit-style" tests because I didn't actually write them using the usual junit annotations, and the testing code is in the main src not in testing packages (The Tester Item is enabled using a command line parameter). But yes, that's the idea. It worked really well for the mod I was making which had to copy blocks back and forth - I created a testing world, used the "Testing Item" to initialise a test region, perform a series of test copy & rotate operations, and check the results against the expected outcome at each step. Logging of any errors. I must have discovered twenty or thirty subtle bugs that way. If you know a lot more about junit than me, you could probably figure out how to do it more cleanly by calling the right junit methods to set up the logging, start the testing, etc. Might not be worth it. You just have to be careful to remember which side your test code needs to run on, but that's not hard. You wouldn't need an item either, just a command line parameter or similar should be enough - for example you have a tick handler which checks for the presence of the parameter and runs tests if required. -TGG
  2. Background info that might help http://greyminecraftcoder.blogspot.ch/2015/01/mining-blocks-with-tools.html
  3. Hi There's no tool I know of that will convert that automatically. You could perhaps fiddle with the model renderer to (eg) pull out the ModelBox quad lists and convert them to a BlockModel quad list; your ISmartItemModel.handleItemState() could update the animation settings and generate the new quadlist. So it would look something like ISmartItemModel.handleItemState(): set up the ModelRenderer as per your code, and copy the model quads into a format suitable for BlockModel, so that IBlockModel.getGeneralQuads() returns the list of quads that would normally be rendered by the ModelRenderer.render(). I think that would be hard work to implement even for a rather experience modder. But it might be useful to a lot of people if you could crack it. -TGG
  4. Hi I've run into this problem myself and after wasting hours trying to set up stubs for vanilla objects, the way I solved it was to add a "Tester" item ingame. When the player uses the item, it interrupts the game and executes all the unit tests and integration tests using the already-set-up vanilla objects. Not as friendly as separate junit tests but it did the trick. -TGG
  5. Hi I would recommend converting your obj model to the json blockmodel format. With an ISmartItemModel you can return whatever list of Quads you want for rendering. Otherwise - IItemRenderer has been abandoned; Forge doesn't support using models for item rendering (yet?) so you will need to use Reflection to insert your rendering code into the right place. If it were me, I would probably create a custom class extending RenderItem, override the public void renderItemIntoGUI(ItemStack stack, int x, int y) to call my custom rendering code if stack==myItem. Use reflection to insert your custom class into the vanilla code, either right at creation in Minecraft.startGame() if possible, or otherwise overwriting the various fields that it is stored in. No guarantee it will work, and it's not terribly compatible with any other mods who think to do the same, but it's the only way I can think of. Stick with ISmartItemModel if you can... -TGG
  6. Hi This might help... RenderItem:: public void renderItemModel(ItemStack stack) { IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack); this.renderItemModelTransform(stack, ibakedmodel, ItemCameraTransforms.TransformType.NONE); } -TGG
  7. This link will probably help http://greyminecraftcoder.blogspot.com.au/2015/03/troubleshooting-block-and-item-rendering.html -TGG
  8. Hi I'm not sure I understand your question. All collision detection in minecraft is done by checking whether the AABB overlap. world.getEntitiesWithinAABB for example, will give you a list of suitable entities and you can iterate through them all to check their class? -TGG
  9. https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe21_tileentityspecialrenderer/Notes.txt -TGG
  10. Hi This troubleshooting guide might help... http://greyminecraftcoder.blogspot.com.au/2015/03/troubleshooting-block-and-item-rendering.html -TGG
  11. Hi Without looking at your code too hard, my first guess is that it's because you haven't implemented onDataPacket() and getDescriptionPacket(). If you're doing everything server-side, I would have thought it's not necessary, but I'm not 100% sure. See here for an explanation http://greyminecraftcoder.blogspot.com.au/2015/01/tileentity.html Otherwise - are you sure that server side update stops getting called? Show an example of the test code and the console output that leads you to that conclusion? -TGG
  12. Hi You might find this tool useful... http://www.planetminecraft.com/mod/item-transform-helper---interactively-rotate-scale-translate/ -TGG
  13. If you're using a TileEntity, you can tell vanilla to call your TileEntity update() method every tick. in 1.8 make your TileEntity implement IUpdatePlayerListBox and implement update() in 1.7.10 just override updateEntity() and make sure canUpdate() returns true -TGG
  14. Hi Since your recipes are going to be rather different to the vanilla recipes, probably best to create your own. You could use the vanilla shapeless recipes as inspiration. Perhaps something as simple as FourInputFurnaceRecipe with eight fields eg public class FourInputFurnaceRecipe private ItemStack input1; // type of Item and the number required private ItemStack input2; private ItemStack input3; private ItemStack input4; private ItemStack output; public ItemStack getOutput(ItemStack slot1, ItemStack slot2, ItemStack slot3, ItemStack 4) { // check each slot against the input to see if item matches and slot contains at least the minimum required # of items. If so, return output, otherwise return null } } -TGG
  15. Hi The bed and the door are both very good examples of this. For bed, the most interesting parts are ItemBed and BlockBed.onNeighbourBlockChange. The spawning takes place in ItemBed; ItemDoor shows a slightly different way of doing it. The key thing is that you need to place the multiple blocks but also keep them in sync (eg if one is destroyed, the others need to be destroyed too) -TGG
  16. Hi All After seeing the number of folks struggling with the dreaded purple-and-black texture for blocks and items in 1.8, I have put together a troubleshooting guide: http://greyminecraftcoder.blogspot.com.au/2015/03/troubleshooting-block-and-item-rendering.html -TGG
  17. I don't know the answer off the top of my head. I'd suggest you put a breakpoint into ItemBucket.tryPlaceContainedLiquid(), use a bucket to place some water, and see what vanilla does. -TGG
  18. Hi Currently, you can't easily convert a generic .obj to the block model format that Minecraft uses, and in fact the block model format is only capable of rendering a subset of what your obj model might consist of. Some background info here (see the various Blocks topics) http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html You might have some luck importing your model into a program like BDcraft Cubik http://bdcraft.net/cubik I haven't used it but have heard rumours it might do what you want. -TGG
  19. Hi Have you looked in the RenderItemFrame.doRender()? The item rendering is called from here. -TGG
  20. You will need to code a custom furnace for that. Here's an example of that for 1.8. 1.6.4 is quite similar. https://github.com/TheGreyGhost/MinecraftByExample (MBE31) -TGG
  21. I'm pretty sure that alpha layers don't use AO? If that doesn't work for you, I think you are going to need ASM+Reflection to intercept deep into the vanilla rendering code. You gotta ask yourself if its really worth it.... -TGG
  22. Hi As Draco said you need to create a lang file and put it in the right place A lang file typically looks like this https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/resources/assets/minecraftbyexample/lang/en_US.lang where you have item.crystal_red.name=your name in this file src/main/resources/assets/minecraftbyexample/lang/en_US.lang -TGG
  23. Ah, thanks dude! I'll remember that one.
  24. There still seems to be some support for it in 1.8. I have no idea how to use it. MinecraftForgeClient.reserveStencilBit FrameBuffer.enableStencil -TGG
  25. Hi Unfortunately I think you're right, there's no easy way. A TileEntitySpecialRenderer would let you render the two parts separately (AO in block, sloped in TESR) but that's pretty inefficient if you have a lot of roof... You might be able to do something in multiple rendering layers using this forge extension - i.e. Render your AO in the CUTOUT and the non-AO in the CUTOUT MIPPED, by returning a different ISmartBlockModel for the two passes. Block:: /** * Queries if this block should render in a given layer. * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer */ public boolean canRenderInLayer(EnumWorldBlockLayer layer) { return getBlockLayer() == layer; } -TGG
×
×
  • Create New...

Important Information

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