Jump to content

Recommended Posts

Posted

 

 

As the title says, I'm not sure why this method is causing a problem. I'm using the jar from gradle build, I have my sides properly set up (via IProxy), but this only breaks when I run this on a server. I know I'm probably missing something simple, but its not obvious to me. 

Crash Report:

  Reveal hidden contents
package com.cilka.telgt.block;

import com.cilka.telgt.Main;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.BlockRenderLayer;

public class BaseBlock extends Block {

	private String blockName;
	private BlockRenderLayer layer;
	private String tabName;
	public BaseBlock(String blockName) {
		
		super(Material.ROCK);
		setCreativeTab(CreativeTabs.MISC);
		setSoundType(SoundType.CLOTH);
		this.blockName = blockName;
		SetRegistrationFromFile();
	}
	
	public BaseBlock(String blockName, BlockOptions options)
	{
		super(options.GetMaterial());
		setCreativeTab(options.GetTab());
		setSoundType(options.GetSound());
		this.blockName = blockName;
		this.layer = options.GetLayer();
		SetRegistrationFromFile();
	}
	public String GetBlockName()
	{
		return blockName;
	
	}

	@Override
	public BlockRenderLayer getRenderLayer()
	{	
		return layer != null ? layer : super.getRenderLayer();
	}

	@Override 
	public boolean isOpaqueCube(IBlockState state)
	{

		return !getRenderLayer().equals(BlockRenderLayer.TRANSLUCENT);
	}
	private void SetRegistrationFromFile()
	{
		
		setRegistryName(Main.MODID, blockName);
		setTranslationKey(blockName);
	}
	

}

 

 

Posted
  On 10/2/2019 at 4:03 AM, Cilka said:

java.lang.NullPointerException: Can't use a null-name for the registry, object null.

Expand  

Somewhere you're trying to register a block to a null registry name. You should trace this back from EventSubscriber.registerBlocks() with the debugger to find out where the name isn't being set, if it's tricky enough.

 

Also: Code-Style #4

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
  On 10/2/2019 at 4:33 AM, SerpentDagger said:

Somewhere you're trying to register a block to a null registry name. You should trace this back from EventSubscriber.registerBlocks() with the debugger to find out where the name isn't being set, if it's tricky enough.

 

Also: Code-Style #4

Expand  

Originally I thought that too. I traced it back to the BaseBlock.isOpaqueBlock method and found that replacing the return with false makes the server happy. I can double check, and see what else I've missed.

Posted

Wait, where are you even getting the getRenderLayer() method from? It's not a method accessible via Block, so your compiler should be shouting about that. The method I've been using is Block#getBlockLayer(), which does what I think you want.

 

The only reference I've found to getRenderLayer() is MinecraftForgeClient#getRenderLayer().

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted

It is, however, getRenderLayer() in 1.14.4.

 

The thread title claims 1.12.2 -- has there been an attempt to copy/paste some 1.14.4 sample code into the 1.12.2 project, with unhappy results?

Posted
  On 10/2/2019 at 5:44 AM, SerpentDagger said:

Wait, where are you even getting the getRenderLayer() method from? It's not a method accessible via Block, so your compiler should be shouting about that. The method I've been using is Block#getBlockLayer(), which does what I think you want.

 

The only reference I've found to getRenderLayer() is MinecraftForgeClient#getRenderLayer().

Expand  

I just looked at the source of

 net.minecraft.block

and It had the getRenderLayer() method in there. If I try to use getBlockLayer(), the comipler complains that the method doesn't exist, which looking though source code it doesn't either. 

 

  On 10/2/2019 at 9:50 AM, Ommina said:

It is, however, getRenderLayer() in 1.14.4.

 

The thread title claims 1.12.2 -- has there been an attempt to copy/paste some 1.14.4 sample code into the 1.12.2 project, with unhappy results?

Expand  

I was using a 1.12.2 tutorial from Harry's Tech Reviews as my base. I did notice that many of the things that he does in the tutorial goes against forge coding standards, so something could be off when I copied that line. 

Posted (edited)

Hmm. It seems, then, that you've installed a 1.14 version by mistake?

Regardless, assuming it works the same way in 1.(?), Block#getBlockLayer() is annotated with @SideOnly(Side.CLIENT), so it only exists on the physical client. Block#isOpaqueCube(), however, is present on both the physical client and the physical server. So when you call getBlockLayer() within isOpaqeCube(), it'll crash a physical server.

 

Edit: Also, Block#isOpaqueCube() is deprecated. I think you only have to use Block#getBlockLayer() now.

Edited by SerpentDagger

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted (edited)
  On 10/2/2019 at 8:58 PM, SerpentDagger said:

Hmm. It seems, then, that you've installed a 1.14 version by mistake?

Regardless, assuming it works the same way in 1.(?), Block#getBlockLayer() is annotated with @SideOnly(Side.CLIENT), so it only exists on the physical client. Block#isOpaqueCube(), however, is present on both the physical client and the physical server. So when you call getBlockLayer() within isOpaqeCube(), it'll crash a physical server.

 

Edit: Also, Block#isOpaqueCube() is deprecated. I think you only have to use Block#getBlockLayer() now.

Expand  

I've looked in the .iml file and found that I am using version 1.12.2-14.23.5.2768 as evident here 

<libelement value="jar://$USER_HOME$/.gradle/caches/minecraft/net/minecraftforge/forge/1.12.2-14.23.5.2768/stable/39/forgeSrc-1.12.2-14.23.5.2768.jar!/" />

I'll see if updating forge to the latest version of 1.12.2 will work.

 

Edit: So I don't know why I didn't think of this before, but I have a work around now.

@Override 
public boolean isOpaqueCube(IBlockState state)
{

   return layer != null ? !layer.equals(BlockRenderLayer.TRANSLUCENT) : super.isOpaqueCube(state);
}

 The way I've initialize my blocks I will always use layer instead of getRenderLayer(). Slightly jank, but doesn't blow up my server. Thanks everyone!

Edited by Cilka
Solved my problem

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

    • Alright, here is the log file https://mclo.gs/5eCwafV
    • Please read the FAQ (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/) and post log files as described there, using a site such as https://mclo.gs/ and post the link here.  
    • I tried updating the mods in my modpack which caused incompatibilities so i have tried to revert them back to their older versions i was using before. In the logs it doesnt show me any clear incompatibilities except for tfmg & entity texture features, but when i try to remove those it still doesn't work. I have tried removing the forge-client.toml file which was a suggestion i found on  a few other posts. This is the log file i get. [inline log removed] Any help would be appreciated. Thanks in advance
    • I don't use KubeJS, never even heard of it. But after doing what "Ugdhar" suggested earlier in this post with the "config/Mekanism/generator-storage.toml", I tried going into an individual save's serverconfig folder, and just deleting everything except the parcool folder (I have that mod installed.) Then, a bit of loading and temporary freezing later, seems to have worked. Even when quitting to menu and loading back in, or also when quitting to menu, exiting to desktop, and re-launching MC, choose a save and loading it.
    • [Mekanism] Broken tags in Mekanism recipes detected, please check server logs for details. You will be missing some recipes and machines may not accept expected inputs. Do you use KubeJS? It is some kind of bug with it and not fixed A workaround is setting "allowAsyncStreams" to false in the KubeJS common config file https://github.com/KubeJS-Mods/KubeJS/issues/1016   For the rest of your issues, keep deleting these files - now it is the jei-server.toml file If the file is not in config, check the worldsave serverconfig folder These files usually break after updating mods, game crashes or force closing the game    
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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