Should I just move the registryItems method to the client proxy class?
No. Items must be registered on both sides, so keep the call to ModItems.registerItems in your main class.
Move the calls to ClientProxy.registerItemRender to a client-only class (either ClientProxy itself or the dedicated model registration class I've been telling you to create). Model registration is client-only, it must not be done on the dedicated server.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
When I moved all of my calls of ClientProxy.registerItemRender to ClientProxy the game crashed. Here is my ACTUAL latest FML log.
Do you know what could be causing this? Thanks in advance and sorry about not being active the past 10 days
There's no crash in that log, though there are some model errors:
[20:31:44] [Client thread/ERROR] [FML/]: Exception loading model for variant bleachcraft:TestFluidBlock#fluid for blockstates ["bleachcraft:TestFluidBlock[level=3]", "bleachcraft:TestFluidBlock[level=2]", "bleachcraft:TestFluidBlock[level=1]", "bleachcraft:TestFluidBlock[level=0]", "bleachcraft:TestFluidBlock[level=7]", "bleachcraft:TestFluidBlock[level=6]", "bleachcraft:TestFluidBlock[level=5]", "bleachcraft:TestFluidBlock[level=4]", "bleachcraft:TestFluidBlock[level=11]", "bleachcraft:TestFluidBlock[level=10]", "bleachcraft:TestFluidBlock[level=9]", "bleachcraft:TestFluidBlock[level=8]", "bleachcraft:TestFluidBlock[level=15]", "bleachcraft:TestFluidBlock[level=14]", "bleachcraft:TestFluidBlock[level=13]", "bleachcraft:TestFluidBlock[level=12]"]
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model bleachcraft:TestFluidBlock#fluid with loader VariantLoader.INSTANCE, skipping
...
Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException
...
[20:31:44] [Client thread/ERROR] [FML/]: Exception loading blockstate for the variant bleachcraft:TestFluidBlock#fluid:
java.lang.Exception: Could not load model definition for variant bleachcraft:TestFluidBlock
...
Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of model bleachcraft:blockstates/TestFluidBlock.json
...
Caused by: java.io.FileNotFoundException: bleachcraft:blockstates/TestFluidBlock.json
The TestFluidBlock blockstates file doesn't exist.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Are you sure that's the latest log? I can't see any reference to anything called TestFluidBlock anywhere in your code and the log doesn't show a crash.
Side note: I'd recommend using a proper Git client (e.g. GitHub Desktop or the Git plugin for your IDE) to commit your changes rather than editing individual files on GitHub.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
java.lang.NullPointerException
at net.bleachcraft.Proxy.ClientProxy.registerItemRender(ClientProxy.java:52) ~[bin/:?]
at net.bleachcraft.Proxy.ClientProxy.preInit(ClientProxy.java:42) ~[bin/:?]
at net.bleachcraft.BleachCraft.preInit(BleachCraft.java:37) ~[bin/:?]
You're attempting to register models for the Item fields of ClientProxy, but these are null because you never assign values to them. Delete these fields from ClientProxy and reference the fields of ModItems instead.
Don't just create arbitrary fields when you need a value of a specific type, they'll only hold the default value of that type until you assign them a value.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Oops... Ok. that worked. The game now loads without crashing and everything appears to work fine! there are no errors in my FML log also! Is there anything else you would recommend for my code. I also created a ModelRegistery only class for registering models from ClientProxy. The code on GitHub is updated and I have one last question.
In Minecraft the names of my fluid/fluid bucket are as follows:
What would I put in my .lang file to make custom localized names?
Those are the unlocalised names, you need to add translations for them (tile.bleachcraft:ChlorineBlock.name and fluid.chlorine) in your lang files.
If you add a translation for your Fluid, the universal bucket will automatically use that.
As for general recommendations:
Don't use CreativeTabs.getNextID, use the CreativeTabs(String) constructor.
Use lowercase package names.
Don't use the net.bleachcraft package unless you own bleachcraft.net.
Your Git repository should be in the root directory of your mod (where src and build.gradle are) and include the buildscript. See my mod for an example of the structure I'm talking about.
I recommend naming the classes in the init package ModX or BleachcraftX rather than just X.
Use enums instead of hardcoded values where appropriate, e.g. EnumDyeColor to get dye and coloured block metadata.
Import the ModItems class normally instead of referring to it by its full name.
Consider creating a base class for simple items with no custom behaviour like this one. This will eliminate the need to create a new class every time you add a simple item.
There's no need to call Item#setMaxStackSize with the default max stack size (64).
Delete the ChlorineBucket class now that you're using the universal bucket.
I recommend following MCP naming conventions by prefixing each class name with its root supertype (e.g. ItemBleachBottle, BlockFluidChlorine, FluidChlorine).
Convert your mod ID to lowercase and use the BleachCraft.MODID field instead of hardcoding your mod ID everywhere.
Your model registration class should be completely unrelated to your client proxy class (except for the fact that the client proxy calls one or more methods in the model registration class). Move ClientProxyModelRegistery to net.bleachcraft.client (or a sub-package), rename it ModelRegistry (note the corrected spelling) and stop it from extending ClientProxy.
The proxy system is designed to be used for sided code, I recommend moving any common code into your @Mod class and having two proxy classes (client and server) that implement a common interface (called something like IProxy) and don't extend any class. Use this interface as the type of your @SidedProxy field. You can see an example of this here.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Don't use CreativeTabs.getNextID, use the CreativeTabs(String) constructor.
Use enums instead of hardcoded values where appropriate, e.g. EnumDyeColor to get dye and coloured block metadata.
1)What's wrong with CreativeTabs.getNextID and how would I use CreativeTabs(String)?
2)If I used to use new ItemStack(Items.DYE,1,15) how would I adapt this to use EnumDyeColor.BLACK ?
1)What's wrong with CreativeTabs.getNextID and how would I use CreativeTabs(String)?
The CreativeTabs(String) constructor already assigns the next ID for you, there's no reason to do it yourself. To use this constructor from your class, simply call super in your constructor with the tab's name instead of the ID and the name.
2)If I used to use new ItemStack(Items.DYE,1,15) how would I adapt this to use EnumDyeColor.BLACK ?
Use EnumDyeColor#getMetadata to get the metadata for coloured blocks or EnumDyeColor#getDyeDamage to get the metadata for dye.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Is there an equivalent to this universal bucket thing in 1.7.10? I want to create a fluid, this is what I have so far
public final class ModFluids
{
private ModFluids(){}
public static final Fluid moltenRedstoneAlloy = new Fluid("moltenRedstoneAlloy");
public static final BlockFluidFinite blockMoltenRedstoneAlloy =(BlockFluidFinite) new BlockFluidFinite(moltenRedstoneAlloy, Material.water).setMaxScaledLight(15).setLightLevel(7);
public static void preInit()
{
FluidRegistry.registerFluid(moltenRedstoneAlloy);
GameRegistry.registerBlock(blockMoltenRedstoneAlloy, "blockMoltenRedstoneAlloy");
}
}
Should I just move the registryItems method to the client proxy class?
A lso what would I use for my .lang files for the chlorine block tile and the chlorine bucket item?
No. Items must be registered on both sides, so keep the call to ModItems.registerItems in your main class.
Move the calls to ClientProxy.registerItemRender to a client-only class (either ClientProxy itself or the dedicated model registration class I've been telling you to create). Model registration is client-only, it must not be done on the dedicated server.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
When I moved all of my calls of ClientProxy.registerItemRender to ClientProxy the game crashed.
Here is my ACTUAL latest FML log.
Do you know what could be causing this? Thanks in advance and sorry about not being active the past 10 days
There's no crash in that log, though there are some model errors:
The TestFluidBlock blockstates file doesn't exist.
Update your code on GitHub.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I updated It
Are you sure that's the latest log? I can't see any reference to anything called TestFluidBlock anywhere in your code and the log doesn't show a crash.
Side note: I'd recommend using a proper Git client (e.g. GitHub Desktop or the Git plugin for your IDE) to commit your changes rather than editing individual files on GitHub.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I think that if I create a file on Pastebin with the same name as a previous one I created, it uses the previous file. Here is my actual latest FML log with a different name!
You're attempting to register models for the Item fields of ClientProxy, but these are null because you never assign values to them. Delete these fields from ClientProxy and reference the fields of ModItems instead.
Don't just create arbitrary fields when you need a value of a specific type, they'll only hold the default value of that type until you assign them a value.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Oops... Ok. that worked. The game now loads without crashing and everything appears to work fine! there are no errors in my FML log also! Is there anything else you would recommend for my code. I also created a ModelRegistery only class for registering models from ClientProxy. The code on GitHub is updated and I have one last question.
In Minecraft the names of my fluid/fluid bucket are as follows:
Chlorine Bucket: tile.bleachcraft:ChlorineBlock.name
Chlorine Fluid: fluid.Chlorine bucket
What would I put in my .lang file to make custom localized names?
Those are the unlocalised names, you need to add translations for them (tile.bleachcraft:ChlorineBlock.name and fluid.chlorine) in your lang files.
If you add a translation for your Fluid, the universal bucket will automatically use that.
As for general recommendations:
Don't use CreativeTabs.getNextID, use the CreativeTabs(String) constructor.
Use lowercase package names.
Don't use the net.bleachcraft package unless you own bleachcraft.net.
Your Git repository should be in the root directory of your mod (where src and build.gradle are) and include the buildscript. See my mod for an example of the structure I'm talking about.
I recommend naming the classes in the init package ModX or BleachcraftX rather than just X.
Use enums instead of hardcoded values where appropriate, e.g. EnumDyeColor to get dye and coloured block metadata.
Import the ModItems class normally instead of referring to it by its full name.
Consider creating a base class for simple items with no custom behaviour like this one. This will eliminate the need to create a new class every time you add a simple item.
There's no need to call Item#setMaxStackSize with the default max stack size (64).
Delete the ChlorineBucket class now that you're using the universal bucket.
I recommend following MCP naming conventions by prefixing each class name with its root supertype (e.g. ItemBleachBottle, BlockFluidChlorine, FluidChlorine).
Convert your mod ID to lowercase and use the BleachCraft.MODID field instead of hardcoding your mod ID everywhere.
Your model registration class should be completely unrelated to your client proxy class (except for the fact that the client proxy calls one or more methods in the model registration class). Move ClientProxyModelRegistery to net.bleachcraft.client (or a sub-package), rename it ModelRegistry (note the corrected spelling) and stop it from extending ClientProxy.
The proxy system is designed to be used for sided code, I recommend moving any common code into your @Mod class and having two proxy classes (client and server) that implement a common interface (called something like IProxy) and don't extend any class. Use this interface as the type of your @SidedProxy field. You can see an example of this here.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
1)What's wrong with CreativeTabs.getNextID and how would I use CreativeTabs(String)?
2)If I used to use new ItemStack(Items.DYE,1,15) how would I adapt this to use EnumDyeColor.BLACK ?
The CreativeTabs(String) constructor already assigns the next ID for you, there's no reason to do it yourself. To use this constructor from your class, simply call super in your constructor with the tab's name instead of the ID and the name.
Use EnumDyeColor#getMetadata to get the metadata for coloured blocks or EnumDyeColor#getDyeDamage to get the metadata for dye.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Is there an equivalent to this universal bucket thing in 1.7.10? I want to create a fluid, this is what I have so far
Now I need the bucket, right? Oh and the texture!
nope, you have to do it yourself.
here's the source for the 1.7.10 version of tinkers construct, I suggest to use that as reference.
https://github.com/SlimeKnights/TinkersConstruct/tree/1.7.10