• 1

    posted a message on Block with different texture sides (help) 1.12.2

    There should be some errors in the log (logs/latest.log in the game directory) explaining what went wrong, upload it to Gist and link it here.


    You may want to install Forge while you're working on the model, since it greatly improves the error reporting of the model loading process. If you do, upload the FML log (logs/fml-client-latest.log in the game directory) instead of the Vanilla log.


    You should also upload the model file itself and post the paths of your texture files.

    Posted in: Discussion
  • 1

    posted a message on Block with different texture sides (help) 1.12.2

    You should create a resource pack rather than editing the vanilla files directly.


    The JSON model format is documented here.


    Each property in the textures block defines the value of a texture name. The block/cube model uses one texture per side, with the side's name as the texture name. The up texture is displayed on the top of the block, the east texture is displayed on the east side of the block, etc.


    The texture paths are in the format "<domain>:<path/to/texture>", which corresponds to assets/<domain>/textures/<path/to/texture>.png. If you don't specify a domain, it defaults to minecraft.

    Posted in: Discussion
  • 1

    posted a message on [Solved][1.9.4+] Making Entity Textures By Accessing Block ResourceLocations
    Quote from Icedice9»

    Hey, this is looking promising! I used the line below:

    TextureAtlasSprite sprite = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(block.getDefaultState()).getParticleTexture();


    Two questions with this: First, is there a better way than using getDefaultState? I get the feeling this won't support blocks with metadata like

    stone, for example, that have multiple sub blocks.


    Store the full IBlockState rather than just the Block.




    Second, how can I get a BufferedImage from the TextureAtlasSprite? Is it possible to get a ResourceLocation or DynamicTexture from the TextureAtlasSprite? I will use the BufferedImage to create the entity texture by duplicating the block's texture multiple times over the entity texture.



    JEI has code to get a TextureAtlasSprite from an IBlockState or ItemStack (this returns the particle texture) and to get a BufferedImage from a TextureAtlasSprite here.

    Posted in: Modification Development
  • 1

    posted a message on [Solved][1.9.4+] Making Entity Textures By Accessing Block ResourceLocations

    You'll need to get the IBakedModel for the block and then get the texture locations from that. Either use the model's particle texture or the texture from one of the model's BakedQuads.


    These texture locations are actually the names of sprites on the block texture atlas, they don't necessarily correspond to texture files on disk. This means you should get the textures from the atlas rather than reading them from a file.

    Posted in: Modification Development
  • 1

    posted a message on How to get WorldServer reference from world or EntityPlayer
    Quote from BillyGalbreath»

    Very good points both of you make. However, I guess the part that confuses me is that I am working with a custom Container object so it's loaded on both server and client side (client loads it behind a Gui), and I'm doing something on another thread and need to schedule something back on the main thread for thread safety b.s., and I the only thing I've found to be able to do so is use Minecraft.getMinecraft().addScheduledTask() or player.getWorldServer().addScheduledTask(). I can't use the Minecraft class because it will make the server side fail with the container loads with that import (because it doesnt exist server side), so I'm using the WorldServer method because even in single player the game is running a server instance. The method I posted earlier is backed by a sidedDelegate instance that can hold the data I need for either case safely. Or am I fundamentally missing some basic knowledge here?



    A client-side Container shouldn't be directly interacting with the server (or scheduling a task to run on the server thread) as that would be reaching across logical sides.

    You need to handle this through the sided proxy system:

    • On the physical client (i.e. in the client proxy), check which logical side the thread belongs to:
      • If it belongs to the logical client, schedule a task to run on the client thread using the Minecraft instance.
      • If it belongs to the logical server, schedule a task to run on the server thread using the MinecraftServer instance or a WorldServer instance (which delegates to the MinecraftServer instance anyway).

    • On the physical server (i.e. in the server proxy), check which logical side the thread belongs to:
      • If it belongs to the logical client, throw an exception as something has gone wrong (the physical server doesn't run the logical client).
      • If it belongs to the logical server, schedule a task to run on the server thread using the MinecraftServer instance or a WorldServer instance.


    As explained in the documentation I linked, World#isRemote is the way to tell which logical side code is running on.


    Are you sure you need a separate thread? Can you not run this code on the main client/server thread directly?

    Posted in: Modification Development
  • 1

    posted a message on Porting problems: on the subject of crafting
    Quote from theishiopian»

    1. what is the registry name of skull blocks?



    Look at the Block.registerBlocks method for the registry names of vanilla Blocks (and their ItemBlocks) and look at the Item.registerItems method to see the registry names of vanilla Items (including block items that don't extend ItemBlock, like ItemSkull).



    2. Is it possible to, within one json, to define a recipe that can take multiple different ingredients in the same slots, as in you can use sticks or blaze rods as a handle for a pickaxe. Is there a way to do it without using the ore dictionary?


    You can use an array of ingredient objects anywhere a single ingredient is expected to create a compound ingredient that matches any of the items matched by the component ingredients.

    Vanilla uses this for recipes accept multiple possible items per slot (e.g. minecraft:crafting_table accepts any plank).

    Posted in: Modification Development
  • 1

    posted a message on Getting players inventory through the server
    Quote from Callunxz»

    Hm... anyway I can send the information of the items to the other clients?


    I assume through packets, which is the best method?


    You'll need to scan each player's inventory for changes every tick on the server and then send any changes to all players tracking that player entity.

    Use a capability to store the list of items that need to be synced/rendered for each player. Note that you can't use IItemHandler directly, since EntityPlayer already provides that capability itself.

    I wrote this pseudocode example of how you could handle the syncing. In the packet's handler, you'd want to apply the changes from the packet to the client-side player entity's item list.
    Posted in: Modification Development
  • 1

    posted a message on IDEA refuses to add library even though it allowed it previously

    I knew you should add it as a dependency (which I had) but I didn't know you should run the "idea" task afterwards. There was also a bug in my build.gradle.


    You shouldn't use the idea task. When creating the project, import build.gradle directly. When updating the project (e.g. adding/removing dependencies), refresh it from IDEA's Gradle window.
    Posted in: Modification Development
  • 1

    posted a message on Rendering a multi-layer, NBT dependant item

    The ICustomModelLoader should return the base state of the model. The broken state can be handled by the ItemOverrideList.


    The textures can either default to null (like ModelDynBucket) or be manually loaded from a file (like Tinkers' Construct's ToolModelLoader).


    If the model is loaded from a blockstates file, IModel#retexture will be called with the textures specified in it; allowing you to return a new model with those textures.


    ICustomModelLoader#accepts should only return true for a specific location (if you're using a single instance like ModelDynBucket) or extension (if you're loading data from a file like Tinkers' Construct). Look at the implementations of this method in ModelDynBucket.Loader and ToolModelLoader for examples. models/item isn't specific enough.


    You probably don't need a cache here.

    Posted in: Modification Development
  • 1

    posted a message on Annotation based config system problem

    I had to change xlfoodmod.general.WorldGen.tooltip to xlfoodmod.general.worldgen.tooltip in the lang file to get the category tooltip working, this is because Forge coerces your field names to lowercase before using them in lang keys and subcategory names.


    It turns out that Forge doesn't actually use the lang key specified for the @Config class in the config GUI if there's only one @Config class, the title is always just your mod's name. I've reported this here.

    Posted in: Modification Development
  • To post a comment, please .