Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

theDataSmith

Members
  • Posts

    9
  • Joined

  • Last visited

theDataSmith's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. After several hours going through source code, I finally figured out how to do it. I had to create an ICustomModelLoader and register it using ModelLoaderRegistry#registerLoader. I then used ModelLoaderRegistry#getModel and cast that IModel to an OBJModel so I could use OBJModel#retexture and OBJModel#process to swap out the textures and add the custom data "flip-v" = "true". That would have been enough, but I also needed different transformations for different item perspectives (GUI, GROUND, FIRST_PERSON_RIGHT_HAND, etc). I had to create my own IModel and IPerspectiveAwareModel classes so I could override IModel#bake and IPerspectiveAwareModel#handlePerective. handlePerspective should always be return MapWrapper.handlePerspective(this, [Your IModelState], cameraTransformType); but you can pass in your own IModelState class to handle the different transform types. Anyway, I wrote this hoping someone would find it helpful. Thanks to Matryoshika for pointing me in the right direction.
  2. You can still use blockstates. Although metadata can only store 16 states, if you have some other way to store the information (such as a TileEntity) you can add extra data to the blockstate. It just won't get saved with the metadata. Scroll to "Actual" States https://mcforge.readthedocs.io/en/latest/blockstates/states/#actual-states
  3. What happens if you change return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ); to return true; ?
  4. Thank you! That link helped me out a lot. I was thinking I could pass data to the item model json, similarly to a blockstate json, but that appears to be impossible. Does anyone know if there's any way to load models/textures programmatically, rather than using a json?
  5. This is a basic java question. There are plenty of resources online that can help you. I recommend starting by learning inheritance if you haven't already, then specifically interfaces.
  6. Give your TileEntity a method. public class MyTileEntity extends TileEntity { public void sendData(int data) { // Do something with data. } } Assuming you have the world and position of your TileEntity, you can cast it to your custom class and call the method. TileEntity te = world.getTileEntity(pos); if(te instanceof MyTileEntity) { MyTileEntity myTE = (MyTileEntity) te; myTE.sendData(12); } If you're going to have multiple TileEntity classes that need to receive data in a similar way, I recommend making an interface.
  7. When I use ModelLoader.setCustomModelResourceLocation to register the model for the ItemBlock, it uses the blockstates json, not the models/item json. How to I make it use the models/item json?
  8. If anyone knows how to register the ItemBlock to use [mod]/models/items/[name].json instead of [mod]/blockstates/[name].json I could probably figure it out from there.
  9. Let's say I have a block with a .obj model that has 3 materials. Each material can be one of 10 textures, giving a total of 1000 different combinations. I can easily instantiate all these blocks with a for loop, but it would be impractical to have separate json files for each version. For the block model, I can pass information to the blockstates json file using the block's IBlockState, but how would I do this for the ItemBlock model?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.