Jump to content

[1.8]Blocks item model not working?


Looke81

Recommended Posts

I have managed to create a block but i cant for the life of me manage to get the blocks item models to work and I dont see what im doing wrong.

 

Heres my blocks item model if it helps:

 

{

    "parent": "tm:block/block_MachineCore",

    "display": {

        "thirdperson": {

            "rotation": [ 10, -45, 170 ],

            "translation": [ 0, 1.5, -2.75 ],

            "scale": [ 0.375, 0.375, 0.375 ]

        }

    }

}

 

And here is the registry for the item model:

http://pastebin.com/nwErv1Qu

 

 

p.s this was in a previous topic but I deleted it because it got too long and it was not going anywhere.

 

BioWarfare Mod: http://goo.gl/BYWQty

Link to comment
Share on other sites

Yes i have done that here is how i did it:

 

{

    "variants": {

        "normal": [

            { "model": "BioWarfare:block_MachineCore" },

            { "model": "BioWarfare:block_MachineCore", "y": 90 },

            { "model": "BioWarfare:block_MachineCore", "y": 180 },

            { "model": "BioWarfare:block_MachineCore", "y": 270 }

        ]

    }

}

 

 

 

BioWarfare Mod: http://goo.gl/BYWQty

Link to comment
Share on other sites

You're trying to set multiple models for one state. Although I do not think this is the main issue this will cause a problem. The torch json is as follows.

 

{
    "variants": {
        "facing=up": { "model": "normal_torch" },
        "facing=east": { "model": "normal_torch_wall" },
        "facing=south": { "model": "normal_torch_wall", "y": 90 },
        "facing=west": { "model": "normal_torch_wall", "y": 180 },
        "facing=north": { "model": "normal_torch_wall", "y": 270 }
    }
}

 

You need to put logic in any methods referring to getting the block state to determine what the "facing" value will be and set the variants accordingly. Take a look at BlockTorch

Link to comment
Share on other sites

Not really enough code to determine that. Where is it being run from, you should have a client proxy with a method kind of like the following:

 

@Override public void registerRenderThings() {
	ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
	String id = Reference.MOD_ID.toLowerCase();
	mesher.register(GameRegistry.findItem(id, "connected_polished_granite"), 0, new ModelResourceLocation(id + ":connected_polished_granite", "inventory"));
	mesher.register(GameRegistry.findItem(id, "connected_polished_andesite"), 0, new ModelResourceLocation(id + ":connected_polished_andesite", "inventory"));
	mesher.register(GameRegistry.findItem(id, "connected_polished_diorite"), 0, new ModelResourceLocation(id + ":connected_polished_diorite", "inventory"));
}

 

proxy.registerRenderThings();

Should be called in the init portion of the mod after blocks are registered.

Link to comment
Share on other sites

yes i have that too:

 

Blocks registry class:

http://pastebin.com/y7e8Cu97

 

Also:

@EventHandler

public void preInit(FMLPreInitializationEvent event) {

 

BioWarfareBlocks.init();

BioWarfareBlocks.register();

 

And:

@EventHandler

public void Init(FMLInitializationEvent event) {

Proxy.registerRenderThings();

 

And finally:

 

public class ClientProxy extends CommonProxy {

 

public void registerRenderThings() {

 

BioWarfareBlocks.registerRenders();

BioWarfareBlocks.registerRenders();

BioWarfare Mod: http://goo.gl/BYWQty

Link to comment
Share on other sites

  • 6 months later...

You get the item model to work by creating a <blockname>.json in models/item.  Think of it as when you place your block in the world it is a block, but when it is in your inventory it is actually an item.

 

{

  "parent": "<modname>:block/<blockname>",

  "display": {

    "thirdperson": {

      "rotation": [ 10, -45, 170 ],

      "translation": [ 0, 1.5, -2.75 ],

      "scale": [ 0.375, 0.375, 0.375 ]

    }

  }

}

Link to comment
Share on other sites

To make a successful block, follow my instructions.

 

Registry

1.) Register your block with it's unlocalized name.

2.) Register your block on the ItemModelMesher using the unlocalized name.

 

Files

1.) You must create the model you registered for above for the block seen in the world. It's name should match the unlocalized name.

2.) Also create the model for the block's item seen in your inventory. It should also match the unlocalized name and be placed in the assets/modid/models/item package.

3.) Create your blockstate file for your block.

4.) Double check all code and texture paths both inside Java and .JSON.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Add necronomicon https://www.curseforge.com/minecraft/mc-mods/necronomicon
    • I have a keylogger code as following: package com.key_logger_mod; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import net.minecraft.client.Minecraft; import org.lwjgl.glfw.GLFW; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.HashMap; import java.util.Map; @Mod.EventBusSubscriber(modid = "key_logger_mod", bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class KeyboardLogger {     private static final Logger LOGGER = LogManager.getLogger();     private static final Gson gson = new GsonBuilder().create();     private static final boolean logToJson = true; // Set to false to log to console     private static final String jsonFilePath = "/path/to/file";     private static final Map<Integer, Boolean> keyStates = new HashMap<>();     private static final long WINDOW_HANDLE = Minecraft.getInstance().getWindow().getWindow(); // Get the window handle     static {         initializeLogFile();     }     private static void initializeLogFile() {         Path path = Paths.get(jsonFilePath);         try {             Files.write(path, "[".getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);         } catch (IOException e) {             LOGGER.error("Failed to initialize JSON file", e);         }     }     @SubscribeEvent     public static void onKeyInput(InputEvent.Key event) {         if (Minecraft.getInstance().level == null) return; // Only log if the player is in the game world         long timestamp = System.currentTimeMillis();         int key = event.getKey();         int action = event.getAction();         int mods = event.getModifiers();         synchronized (keyStates) {             if (action == GLFW.GLFW_PRESS) {                 if (!keyStates.getOrDefault(key, false)) {                     keyStates.put(key, true);                     logKeyAction(timestamp, key, "PRESS");                 }             } else if (action == GLFW.GLFW_RELEASE) {                 if (keyStates.getOrDefault(key, false)) {                     keyStates.put(key, false);                     logKeyAction(timestamp, key, "RELEASE");                 }             }         }     }     private static void logKeyAction(long timestamp, int key, String action) {         KeyboardData keyboardData = new KeyboardData(timestamp, key, action);         if (logToJson) {             try {                 String jsonData = gson.toJson(keyboardData) + ",";                 Files.writeString(Paths.get(jsonFilePath), jsonData + System.lineSeparator(), StandardOpenOption.CREATE, StandardOpenOption.APPEND);             } catch (IOException e) {                 LOGGER.error("Failed to write keyboard event to JSON file", e);             }         } else {             LOGGER.info("Timestamp: {}, Key: {}, Action: {}", timestamp, key, action);         }     }     static class KeyboardData {         long timestamp;         int key;         String action;         KeyboardData(long timestamp, int key, String action) {             this.timestamp = timestamp;             this.key = key;             this.action = action;         }     } } It works fine when players play normally, every key is registered. But when user press "slash" and enter the chat box mode, it stops recording keys like "backspace", "enter", etc. But still registering characters and number keys. Why is this happening?  
    • It happened on a snowy mountain in the overworld. It wasn't actually a crash, the game didn't close itself or something, it was more like when you are lagging online, and mobs are standing still, you cannot break blocks, things like that. Hope you'll find a solution Madz.
    • I am trying to add the mod "Create Questing" to the modpack SkyMachina but it just crashes. My log : https://pastebin.com/rq2jpph4   Please help, create is hard 
  • Topics

×
×
  • Create New...

Important Information

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