TheGreyGhost
Members-
Posts
3280 -
Joined
-
Last visited
-
Days Won
8
Everything posted by TheGreyGhost
-
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
-
Background info that might help http://greyminecraftcoder.blogspot.ch/2015/01/mining-blocks-with-tools.html
-
[1.8] Custom model block rendering in inventory?
TheGreyGhost replied to 61352151511's topic in Modder Support
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 -
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
-
[1.8] Custom model block rendering in inventory?
TheGreyGhost replied to 61352151511's topic in Modder Support
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 -
[1.8] How to get ModelResourceLocation from ItemStack?
TheGreyGhost replied to RoseCotton's topic in Modder Support
Hi This might help... RenderItem:: public void renderItemModel(ItemStack stack) { IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack); this.renderItemModelTransform(stack, ibakedmodel, ItemCameraTransforms.TransformType.NONE); } -TGG -
1.8 Custom Flower not rendiring when placed...looks like block
TheGreyGhost replied to Vladan899's topic in Modder Support
This link will probably help http://greyminecraftcoder.blogspot.com.au/2015/03/troubleshooting-block-and-item-rendering.html -TGG -
Hi This troubleshooting guide might help... http://greyminecraftcoder.blogspot.com.au/2015/03/troubleshooting-block-and-item-rendering.html -TGG
-
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
-
Creating a 'commandblock' that only runs one predetermined command
TheGreyGhost replied to Brickfix's topic in Modder Support
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 -
[1.6.4] Making a custom Furnace with 4 input slots
TheGreyGhost replied to shmcrae's topic in Modder Support
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 -
[1.7.10] Making a 3x1x1 Block - Hit-box Problems
TheGreyGhost replied to Whyneb360's topic in Modder Support
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 -
[1.8] Trouble making newly spawned water flow
TheGreyGhost replied to Siphorus's topic in Modder Support
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 -
[1.8] How do I use an .obj file as a model for a block?
TheGreyGhost replied to pandaninjarawr's topic in Modder Support
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 -
[1.8] Item rendering for display, like Item Frame ...how?
TheGreyGhost replied to RoseCotton's topic in Modder Support
Hi Have you looked in the RenderItemFrame.doRender()? The item rendering is called from here. -TGG -
[1.6.4] Making a custom Furnace with 4 input slots
TheGreyGhost replied to shmcrae's topic in Modder Support
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 -
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
-
[1.8] [SOLVED] Item shows "item.<name>.name"
TheGreyGhost replied to DTaylorMedia's topic in Modder Support
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 -
Ah, thanks dude! I'll remember that one.
-
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
-
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