Jump to content

Nuchaz

Members
  • Posts

    20
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Nuchaz's Achievements

Tree Puncher

Tree Puncher (2/8)

5

Reputation

  1. I should also mention I am loading an OBJ model so I am pretty sure it is using the OBJBakedModel class when rendering. After further investigation, the OBJBakedModel class implements IPerspectiveAwareModel and it calls the handlePerspective method like this: @Override public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } So it looks like it is calling the static, state sensitive method of handlePerspective for IPerspectiveAwareModel instead of the method with just the TransformType, which is the one I need to get called in my custom OBJ model that extends IPerspectiveAwareModel. In debug mode in Eclipse I can see that the state sensitive version of handlePerspective is indeed running on IPerspectiveAwareModel, but the handlePerspective on my custom model never gets called. This is starting to maybe look like a bug in forge, but I'd like a second opinion. Should I create an issue on the forge github for this? I am still wondering too if maybe there is just something new I have to do that wasn't in 1.8.9 that I am unaware of.
  2. I am updating my mod, BiblioCraft, from 1.8.9 to 1.9.4 / 1.10.2 (tried both, same issue) and I have some custom models that implement IPerspectiveAwareModel. The interface adds the handlePerspective method to my custom model and in 1.8.9 would run every tick on item models. Now in 1.9.4 / 1.10.2 it doesn't get called at all and my models transforms are unaffected by anything that happens in this method. What changed here? Is there something new I need to do to make the handlePerspective method fire in 1.9.4 / 1.10.2?
  3. Greetings. I am thinking you need to register your textures. Everything else looks good as far as I can tell. In 1.8.9 we need to @SubscribeEvent the client side event: "TextureStitchEvent" and then you can register your textures in that. For example: event.map.registerSprite(new ResourceLocation("bibliocraft:models/bookcase_books")); Hope that helps.
  4. Greetings, I am working on rendering a compass item using a custom OBJ model. I have a model class that implements ISmartItemModel and I am creating an IBakedModel in the handleItemState method. I create my OBJModel.OBJState using my List<String> of the parts I want to show and then I can create TRSRTransformation with whatever I need and then use that stuff to bake the IBakedModel that gets rendered. I can't seem to figure out a way to apply the transform to individual parts, using this method the transform is applied to the entire model. My model only has 2 parts, the base and the compass needle. I want to rotate the compass needle on a single axis based on a float value that is saved in NBT to the ItemStack. So my question, is there is a way to apply transforms to individual parts of a custom model? Thanks.
  5. I haven't quite figured out vanilla json models yet so I can try loading the cube_all model. I'm still going through the learning curve on much of the 1.8 stuff. I plan to keep experimenting with that. But I did learn that I can just edit or remove the "textures" portion of my json file and it doesn't seem to make any difference. The textures are being loading from the .mtl file that goes with the .obj file. So maybe there is something else I need to do since I am using an obj model.
  6. I just tried the breakpoint and it turns out that yeah, it is null. My property isn't getting initialized before createBlockState() is being called. I checked and it looks like the constructor in my block doesn't seem to get called before the createBlockState() method either. That seems pretty odd, so I tried removing the final from the property and initalizing my WOOD_TYPE inside the createBlockState() method and it worked! Thanks, at least I understand the problem better and have a work around. I don't understand why my WOOD_TYPE isn't getting initialized as a final static type though. With the metablocks working, the textures on the models still aren't changing. I have my 7 blocks, but the textures are all the same. The only place I've done anything to read the metadata / "woodtype" is in the json file I shared in the OP. Is there something else that must be done? Like is there something I have to put into my .mtl file to allow me to override the default texture or does something have to change in my json file? Thanks.
  7. Hello everyone, I ran into another problem that I am stuck on. For the life of my I can't seem to get blockstates working in such a way that it simulates metadata. I basically have a block and I want 7 variants. Each variant should have a different texture. That is the only difference. I am using custom OBJ models and I have my block working fine. I've read over several "metadata" and blockstates tutorials and have tried everything I can think of over the last 3 days with the same results all the time. I get a crash on the createBlockState method in my block if I try to add any IProperty to the blockstate. The crash happens on game load, before I even get to the menu and while the forge splash screen shows I am on the "constructing mods" phase. So, for example, I can do this with no problems: @Override protected BlockState createBlockState() { return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{OBJModel.OBJProperty.instance}); } But if I try adding this to my block class I crash: public static final PropertyInteger WOOD_TYPE = PropertyInteger.create("woodtype", 0,6); @Override protected BlockState createBlockState() { System.out.println("test"); return new ExtendedBlockState(this, new IProperty[]{WOOD_TYPE}, new IUnlistedProperty[]{OBJModel.OBJProperty.instance}); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(WOOD_TYPE, meta); } @Override public int getMetaFromState(IBlockState state) { return state.getValue(WOOD_TYPE); } I've tried creating my own Enum and using the PropertyEnum class and I've tried creating an IUnlistedProperty and using the Properties.toUnlisted and adding either one to the IUnlistedProperties all the time with a similar crash. I've tried returning just a BlockState with the same results too. I've tried commenting out my getExtendedState method to make sure that wasn't interfereing and I got the same result. The code above I think is the simplest methods to get some meta data values. However, I get the NPE crash. Here is my crash: http://pastebin.com/cMmjDCsB It comes down to this: Caused by: java.lang.NullPointerException at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:213) Which I am totally at a loss for. I've tried everything I can think of and I keep getting this error if I try to add an IProperty. I've even copy pasted the three methods from BlockColored and I got the same exact result. I think I added the relevant data to my .json file, but I am not totally confident on that. Here is my .json: { "forge_marker": 1, "defaults": { "textures": { "wood": "bibliocraft:texture", "books": "bibliocraft:texture" }, "custom": { "flip-v": true }, "model": "bibliocraft:bookcase.obj" }, "variants": { "normal": [{}], "inventory": [{ "transform": "forge:default-block" }], "woodtype": { 0: { "textures": { "wood": "minecraft:blocks/planks_oak" } }, 1: { "textures": { "wood": "minecraft:blocks/planks_spruce" } }, 2: { "textures": { "wood": "minecraft:blocks/planks_birch" } }, 3: { "textures": { "wood": "minecraft:blocks/planks_jungle" } }, 4: { "textures": { "wood": "minecraft:blocks/planks_acacia" } }, 5: { "textures": { "wood": "minecraft:blocks/planks_darkoak" } }, 6: { "textures": { "wood": "bibliocraft:blocks/frame" } } } } } For further reference, my custom models are loaded in the preInit on the client side like this: OBJLoader.instance.addDomain("bibliocraft"); Item item = Item.getItemFromBlock(BlockBookcase.instance); ModelResourceLocation loc = new ModelResourceLocation("bibliocraft:" + BlockBookcase.name, "inventory"); ModelLoader.setCustomModelResourceLocation(item, 0, loc); Does anyone have any idea what is happening or what I can do to fix this? Is there something I am missing perhaps? I just want some simple block variants. I think I posted all the relevant code, but let me know if there is something else.
  8. It may be that your texture is mirrored. I had this issue with my obj models. My UVs were being mirrored both vertically and horizontally. To fix this, I had to add a line to my json file. In the "defaults" section of the json add "custom": { "flip-v": true }
  9. Thanks! That looks like exactly what I am looking for. I'll have a play around with it later. I didn't know I could share an .mtl between obj models and I wasn't sure how to stitch textures. That was something I wanted to know at some point. So huge thanks for the extra tips too!
  10. Hello everyone, I am working on updating BiblioCraft to v1.8.8 and am still working my way through all the new features trying to understand how to use them. I think I am going to really like the new systems once I get a feel for them. So far I think I have an understanding of how to render OBJ models, show/hide parts of the models, and apply transforms using the getExtendedState within my block classes. Now I am trying to understand how to dynamically update the texture of my blocks. I've looked over the retexture method in the OBJModel class so I sure there must be a way to do this. What I am doing is basically saving a string to NBT on the TileEntity (for ex: "minecraft:blocks/planks_oak") which I can pass on to easily work with either the retexture method in the OBJModel class or I can easily use it to get a TextureAtlasSprite. This only really needs to happen on block placement (the string will be saved to the ItemStack and passed to the Tile on placment) and when the blocks initially load. I also want to pull the string from NBT on the ItemStack, get the texture and apply it to the ItemStack model as well. That NBT tag can changed in game so the texture on the ItemStack model can change any number of times. I've been looking at this example on the forge github of the ModelBakeEventDebug class trying to understand how I might approach this retexture problem. https://github.com/MinecraftForge/MinecraftForge/blob/master/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java From what I've learned from that I am guessing I may have to create a custom model class and implement several interfaces and use the handleBlockState and handleItemState methods. But I am not sure how to approach that using an OBJ model because there is already a OBJModel class and an OBJBakedModel class that already does all the things including the implementation of the retexture method from the IRetexturableModel interface. I thought about just extending the OBJBakedModel class and overrideing the handleBlockState method but the current OBJBakedModel handleBlockState method is doing some things that access private variables when dealing with the visibility groups. I am just not sure how to proceed. I am wondering if I have to do something in my model json file too. Can anyone give me some tips on how to dynamically change the texture on an OBJ model? Or possibly is there any working examples out there I can read over that allow retexturing an OBJ model? Thanks!
  11. Yup, my logic was flawed. There was a hole in my logic I didn't realize until someone found a way to exploit it. I have fixed it. I was just hoping for extra layers of security, it just seemed like a good idea.
  12. I'm aware of all that, and I agree with you (except the nothing will happen part). All my logic is server side. I've even fixed the problem. I just want extra security to know that someone can't hack my packets. Stuff CAN happen when packets get hacked, they can trigger server logic that shouldn't be triggered unless under certain circumstance. The circumstance is irrelevant though, since it is a straightforward question. The question still stands, can I get the ModID from a custom packet?
  13. I am trying to secure my custom packets better because I found out you can just send packets to any mod if you know the channel id of that packet and some folks are using this to cheat. There is a mod out there that will send a packet to my mod from a hacked client on a server and can be used to spawn anything. I've already taken steps to fix it. I've even doubled up on security for the issue, but I wouldn't mind adding a 3rd layer. In my server packet handler, where I receive my event.packet, I would like to get the ModID of the mod that sent the packet, than I can just compare with my own ModID and return anyone using a different mod. So, is there a way to get the ModID from a custom packet? Thanks.
  14. I noticed some of the bindTexture stuff has moved around a little. In places where I used ForgeHooksClient.binTexture(String, int) for 1.4.7, I now use: FMLClientHandler.instance().getClient().renderEngine.bindTexture(String) for 1.5.x (no more int variable required). I am not sure if there is a simpler way, but this seems to work. Though I haven't tried it with EntityFX, it works great on my item renderers that implement IItemRenderer. Hope that helps.
  15. Hello, I am trying to write a method that can scan and ultimately return an array of texture names from the /armor/ directory. I know this directory exists inside of minecraft.jar and inside a bunch of files inside the /mods/ folder, but when loaded up minecraft sees them all as being in /armor/. At first I was thinking I could use some file operations with File and/or JarFile and loading minecraft.jar and returning what I need. But then I realized that probably won't get me the armor textures inside of all the mod files. It seems a little overkill to have to write methods to scan though all the .zip's and .jar's in /mods/ folder manually just to find these textures. Is there an easier way through forge to list of all .png's that can be found in /armor/ plus its sub-directories?
×
×
  • Create New...

Important Information

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