Jump to content

[1.10] Trouble with custom wall blocks. [RESOLVED]


Recommended Posts

Posted

Hello I made some custom wall blocks and for some reason they show up twice in the creative inventory. They all have the same name unlocalized name and block ID number but only one is textured.  I do not understand why I am getting 2 block for each block registered as I do not get them with my custom stair blocks or blocks, but you can still select both wall blocks and place them in the world. My System.out.println statement shows only one block being created is this a bug in forge itself dealing with wall blocks?

 

Here is my wall block class

 

WoolenWalls.java

 

public class WoolenWalls extends BlockWall {


public WoolenWalls( Block  B ) {
super( b );
this.useNeighborBrightness = true;
this.setSoundType(SoundType.CLOTH);
this.setHardness(0.8F).setResistance(4.0F);
}

public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) {

if (state.isSideSolid(world, pos, EnumFacing.UP)) {

return true; 
}

return this instanceof WoolenWalls;
}

public boolean isFullCube(IBlockState state) {

return false;
}

public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {

return false;
}

 

 

and here is how i am registering my blocks.

 

MBM_Blocks.java

 

public class MBM_Blocks {

public static final List<Block> blocks = new ArrayList<Block>();

public static final void preinit() {

	// Blocks
	ModInfo.blockBlueScreen = registerBlock("blockBlueScreen", new ChromakeyBlock(Material.CLAY));
	ModInfo.blockGreenScreen = registerBlock("blockGreenScreen", new ChromakeyBlock(Material.CLAY));

	//Stairs
	ModInfo.blockBlueScreenStairs = registerBlock("blockBlueScreenStairs", new ChromakeyStairs());
	ModInfo.blockGreenScreenStairs = registerBlock("blockGreenScreenStairs", new ChromakeyStairs());
	ModInfo.blockObsidianStairs = registerBlock("blockObsidianStairs", new ObsidianStairs());

	for(int ci = 0; ci < ModInfo.MAX; ci++){
		String block_name = ModInfo.woolColours[ci] + "Stairs";
		ModInfo.blockWoolenStairs[ci] = registerBlock(block_name, new WoolenStairs());
		System.out.println(" Creating Wool Stairs [ " + ModInfo.blockWoolenStairs[ci] + " ]");
	}

	//Walls
	ModInfo.blockBlueScreenWall = registerBlock("blockBlueScreenWall", new WoolenWalls(Blocks.CLAY));
	ModInfo.blockGreenScreenWall = registerBlock("blockGreenScreenWall", new WoolenWalls(Blocks.CLAY));
	ModInfo.blockObsidianWall = registerBlock("blockObsidianWall", new WoolenWalls(Blocks.OBSIDIAN));

	for(int ci = 0; ci < ModInfo.MAX; ci++){
		String block_name = ModInfo.woolColours[ci] + "Wall";
		ModInfo.blockWoolenWalls[ci] = registerBlock(block_name, new WoolenWalls(Blocks.WOOL));
		System.out.println(" Creating Wool Wall [ " + ModInfo.blockWoolenWalls[ci] + " ]");
	}

}

 

 

and here is an image I made to show what it is doing in the creative tabs.

 

 

6igkmjpcd

 

 

I do not know why the image is not showing up so here is a direct link to the image also.

https://postimg.org/image/6igkmjpcd/

 

anyhelp would be greatly appreciated!

Thanks in advance.

 

 

Posted

BlockWall has variants for cobblestone and mossy cobblestone walls.

I'm pretty sure you are creating them also(without you knowing this). You prob see this in the console.

I think because you create them and there aren't any variants defined in your blockstate for cobble and mossycobble they have no texture and show up in the creative tab as "doubles" without textures.

You need to make your own class for walls.

I made my own abstract class for walls and extend from that. Counterpart of this is, it will no longer be a child of BlockWall.

Post the log from the console so we can help you better.

 

Also i think your code looks pretty complicated, not to say chaotic. Everyone has his/her own style, but still....

Like Diesieben7 said, use metadata.

Posted

 

When you use postimg, don't get the first URL it gives you, get the second one ("direct link").

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

BlockWall has variants for cobblestone and mossy cobblestone walls.

I'm pretty sure you are creating them also(without you knowing this). You prob see this in the console.

I think because you create them and there aren't any variants defined in your blockstate for cobble and mossycobble they have no texture and show up in the creative tab as "doubles" without textures.

You need to make your own class for walls.

I made my own abstract class for walls and extend from that. Counterpart of this is, it will no longer be a child of BlockWall.

Post the log from the console so we can help you better.

 

It is not duplicating the default Minecraft walls it is only duplicating my walls. I have my own class for creating the walls I posted it in my initial forum post. and the only walls are my blocks being duplicated twice as i explained in the post and in the image I posted my walls same name same block Id one with a texture and one without.

 

 

Why are you creating separate wall instances for every color? Why not use metadata?

 

Because if I remembered right when i did this in 1.7.10 when I placed the walls in different directions it changed the textures of the block like the stairs did.  I am a beginner to modding and I thought this was pretty simple code. the only complicated part was the for loop that registered all 16 colors in 3 lines instead of typing out 16 separate lines, but if you can show me how to register them with one instance of the class with the metadata it would be greatly appreciated.

 

Also please post the console output.

 

Console output

 

2016-11-02 12:26:15,139 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2016-11-02 12:26:15,140 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
[12:26:15] [main/INFO] [GradleStart]: Extra: []
[12:26:15] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Justcus/.gradle/caches/minecraft/assets, --assetIndex, 1.10, --accessToken{REDACTED}, --version, 1.10.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[12:26:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[12:26:15] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[12:26:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[12:26:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[12:26:15] [main/INFO] [FML]: Forge Mod Loader version 12.18.2.2118 for Minecraft 1.10.2 loading
[12:26:15] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_112, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jdk1.8.0_112\jre
[12:26:15] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[12:26:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[12:26:15] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[12:26:15] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[12:26:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[12:26:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[12:26:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[12:26:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[12:26:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[12:26:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[12:26:15] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
[12:26:16] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[12:26:16] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[12:26:16] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[12:26:17] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[12:26:17] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[12:26:17] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[12:26:17] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
2016-11-02 12:26:17,782 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2016-11-02 12:26:17,815 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2016-11-02 12:26:17,818 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
[12:26:18] [Client thread/INFO]: Setting user: Player990
[12:26:21] [Client thread/WARN]: Skipping bad option: lastServer:
[12:26:21] [Client thread/INFO]: LWJGL Version: 2.9.4
[12:26:22] [Client thread/INFO] [sTDOUT]: [net.minecraftforge.fml.client.SplashProgress:start:221]: ---- Minecraft Crash Report ----
// Uh... Did I do that?

Time: 11/2/16 12:26 PM
Description: Loading screen debug info

This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.10.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.8.0_112, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 705677336 bytes (672 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13417 Compatibility Profile Context 15.301.1901.0' Renderer: 'AMD Radeon HD 5700 Series'
[12:26:22] [Client thread/INFO] [FML]: MinecraftForge v12.18.2.2118 Initialized
[12:26:22] [Client thread/INFO] [FML]: Replaced 231 ore recipes
[12:26:23] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer
[12:26:23] [Client thread/INFO] [FML]: Searching F:\modding\missingblocksmod\run\mods for mods
[12:26:24] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
[12:26:24] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, missingblocksmod] at CLIENT
[12:26:24] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, missingblocksmod] at SERVER
[12:26:25] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Missing Blocks Mod
[12:26:25] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
[12:26:25] [Client thread/INFO] [FML]: Found 423 ObjectHolder annotations
[12:26:25] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations
[12:26:25] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[12:26:25] [Client thread/INFO] [FML]: Applying holder lookups
[12:26:25] [Client thread/INFO] [FML]: Holder lookups applied
[12:26:25] [Client thread/INFO] [FML]: Applying holder lookups
[12:26:25] [Client thread/INFO] [FML]: Holder lookups applied
[12:26:25] [Client thread/INFO] [FML]: Applying holder lookups
[12:26:25] [Client thread/INFO] [FML]: Holder lookups applied
[12:26:25] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[12:26:25] [Client thread/INFO] [FML]: **********_Mod PreInit_**********
[12:26:25] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredWhiteStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredOrangeStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredMagentaStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredLightblueStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredYellowStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredLimeStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredPinkStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredGrayStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredSilverStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredCyanStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredPurpleStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredBlueStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredBrownStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredGreenStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredRedStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:39]:  Creating Wool Stairs [ Block{missingblocksmod:blockWoolColoredBlackStairs} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredWhiteWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredOrangeWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredMagentaWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredLightblueWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredYellowWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredLimeWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredPinkWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredGrayWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredSilverWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredCyanWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredPurpleWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredBlueWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredBrownWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredGreenWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredRedWall} ]
[12:26:25] [Client thread/INFO] [sTDOUT]: [spectregames.missingblocksmod.inits.MBM_Blocks:preinit:52]:  Creating Wool Wall [ Block{missingblocksmod:blockWoolColoredBlackWall} ]
[12:26:25] [Client thread/INFO] [FML]: Applying holder lookups
[12:26:25] [Client thread/INFO] [FML]: Holder lookups applied
[12:26:25] [Client thread/INFO] [FML]: Injecting itemstacks
[12:26:25] [Client thread/INFO] [FML]: Itemstack injection complete
[12:26:25] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Found status: AHEAD Target: null
[12:26:28] [sound Library Loader/INFO]: Starting up SoundSystem...
[12:26:28] [Thread-8/INFO]: Initializing LWJGL OpenAL
[12:26:28] [Thread-8/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[12:26:28] [Thread-8/INFO]: OpenAL initialized.
[12:26:28] [sound Library Loader/INFO]: Sound engine started
[12:26:31] [Client thread/INFO] [FML]: Max texture size: 16384
[12:26:31] [Client thread/INFO]: Created: 16x16 textures-atlas
[12:26:33] [Client thread/INFO] [FML]: **********_Mod Init_**********
[12:26:33] [Client thread/INFO] [FML]: Injecting itemstacks
[12:26:33] [Client thread/INFO] [FML]: Itemstack injection complete
[12:26:33] [Client thread/INFO] [FML]: **********_Mod PostInit_**********
[12:26:33] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods
[12:26:33] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Missing Blocks Mod
[12:26:35] [Client thread/INFO]: SoundSystem shutting down...
[12:26:36] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
[12:26:36] [sound Library Loader/INFO]: Starting up SoundSystem...
[12:26:36] [Thread-10/INFO]: Initializing LWJGL OpenAL
[12:26:36] [Thread-10/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[12:26:36] [Thread-10/INFO]: OpenAL initialized.
[12:26:36] [sound Library Loader/INFO]: Sound engine started
[12:26:38] [Client thread/INFO] [FML]: Max texture size: 16384
[12:26:39] [Client thread/INFO]: Created: 512x512 textures-atlas
[12:26:40] [Client thread/WARN]: Skipping bad option: lastServer:
[12:26:41] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id
[12:26:43] [Client thread/INFO]: Stopping!
[12:26:43] [Client thread/INFO]: SoundSystem shutting down...
[12:26:43] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

Thanks for answering everyone

 

EDIT I forgot to say none of my other blocks are duplicating and the stairs and the wall blocks are almost identical code.

Posted

I think Winnetrie has a point. You extended BlockWall, which has a state with a two-value property. I don't see you overriding it, so you could get two versions of your wall.

 

Investigate what your wall's parent class is doing to you.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

I did not say it is duplicating minecraft walls.

What i was saying is that BlockWall creates 2 walls and you are extending it!! Somehow 1 gets more or less overwrited but the other 1 not, because you did not defined it in the blockstate wich ofc you didn't because you don't want that.

 

You did not create your own wall class, you extend BlockWall class.

If you extend a class you take everything inside that class to your class extending it. Unless you override it. You can even add new stuff, but you can't remove things. At least not that i know.

I'm not sure you can override these variants, i wasn't able to do so. I think they will co-exist, even if you add your own.

 

If you can override this:

public static final PropertyEnum<BlockWall.EnumType> VARIANT = PropertyEnum.<BlockWall.EnumType>create("variant", BlockWall.EnumType.class);

I think you can't. If i'm wrong i'll be happy to hear about it.

As long as you can't, this will keep messing with your walls.

 

EDIT:

 

Just tested it your way just to make sure and this is what i get:

 

Exception loading model for variant tem:testwall#east=false,north=false,south=true,up=true,variant=cobblestone,west=false for blockstate "tem:testwall[east=false,north=false,south=true,up=true,variant=cobblestone,west=false]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model tem:testwall#east=false,north=false,south=true,up=true,variant=cobblestone,west=false with loader VariantLoader.INSTANCE,

 

Strange i don't see this in your log.

And guess what happens too? I made 1 wall and i have 2 in the creative tab.

Posted

I did not say it is duplicating minecraft walls.

What i was saying is that BlockWall creates 2 walls and you are extending it!! Somehow 1 gets more or less overwrited but the other 1 not, because you did not defined it in the blockstate wich ofc you didn't because you don't want that.

 

You did not create your own wall class, you extend BlockWall class.

If you extend a class you take everything inside that class to your class extending it. Unless you override it. You can even add new stuff, but you can't remove things. At least not that i know.

I'm not sure you can override these variants, i wasn't able to do so. I think they will co-exist, even if you add your own.

 

If you can override this:

public static final PropertyEnum<BlockWall.EnumType> VARIANT = PropertyEnum.<BlockWall.EnumType>create("variant", BlockWall.EnumType.class);

I think you can't. If i'm wrong i'll be happy to hear about it.

As long as you can't, this will keep messing with your walls.

 

EDIT:

 

Just tested it your way just to make sure and this is what i get:

 

Exception loading model for variant tem:testwall#east=false,north=false,south=true,up=true,variant=cobblestone,west=false for blockstate "tem:testwall[east=false,north=false,south=true,up=true,variant=cobblestone,west=false]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model tem:testwall#east=false,north=false,south=true,up=true,variant=cobblestone,west=false with loader VariantLoader.INSTANCE,

 

Strange i don't see this in your log.

And guess what happens too? I made 1 wall and i have 2 in the creative tab.

 

This my new class

 

package spectregames.missingblocksmod.block;

import java.util.List;

import javax.annotation.Nullable;

import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockWall;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import spectregames.missingblocksmod.ModInfo;

public class WoolenWalls  extends Block {

    public static final PropertyBool UP = PropertyBool.create("up");
    public static final PropertyBool NORTH = PropertyBool.create("north");
    public static final PropertyBool EAST = PropertyBool.create("east");
    public static final PropertyBool SOUTH = PropertyBool.create("south");
    public static final PropertyBool WEST = PropertyBool.create("west");
    public static final PropertyEnum<EnumType> VARIANT = PropertyEnum.create("variant", EnumType.class);
    protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[] {new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)};
    protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[] {AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D), AABB_BY_INDEX[15].setMaxY(1.5D)};

    public WoolenWalls(Block block) {
        super(Material.CLOTH);
        this.setDefaultState(this.blockState.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(VARIANT, EnumType.WHITE));
        this.setHardness(this.blockHardness);
        this.setResistance(this.blockResistance / 3.0F);
        this.setSoundType(this.blockSoundType);
        this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
    }

    public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
        state = this.getActualState(state, source, pos);
        return AABB_BY_INDEX[getAABBIndex(state)];
    }

    @Nullable
    public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) {
        blockState = this.getActualState(blockState, worldIn, pos);
        return CLIP_AABB_BY_INDEX[getAABBIndex(blockState)];
    }

    private static int getAABBIndex(IBlockState state) {
        int i = 0;

        if (((Boolean)state.getValue(NORTH)).booleanValue()) {
        	i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
        }

        if (((Boolean)state.getValue(EAST)).booleanValue())
        {
            i |= 1 << EnumFacing.EAST.getHorizontalIndex();
        }

        if (((Boolean)state.getValue(SOUTH)).booleanValue())
        {
            i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
        }

        if (((Boolean)state.getValue(WEST)).booleanValue())
        {
            i |= 1 << EnumFacing.WEST.getHorizontalIndex();
        }

        return i;
    }

    /**
     * Gets the localized name of this block. Used for the statistics page.
     */
    public String getLocalizedName()
    {
        return I18n.translateToLocal(this.getUnlocalizedName() + "." + BlockWall.EnumType.NORMAL.getUnlocalizedName() + ".name");
    }

    public boolean isFullCube(IBlockState state)
    {
        return false;
    }

    public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
    {
        return false;
    }

    /**
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
     */
    public boolean isOpaqueCube(IBlockState state)
    {
        return false;
    }

    private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();
        return block == Blocks.BARRIER ? false : (block != this && !(block instanceof BlockFenceGate) ? (this.blockMaterial.isOpaque() && iblockstate.isFullCube() ? this.blockMaterial != Material.GOURD : false) : true);
    }

    /**
     * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
     */
    @SideOnly(Side.CLIENT)
    public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
    {
        for (BlockWall.EnumType blockwall$enumtype : BlockWall.EnumType.values())
        {
            list.add(new ItemStack(itemIn, 1, blockwall$enumtype.getMetadata()));
        }
    }

    /**
     * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
     * returns the metadata of the dropped item based on the old metadata of the block.
     */
    public int damageDropped(IBlockState state)
    {
        return ((EnumType)state.getValue(VARIANT)).getMetadata();
    }

    @SideOnly(Side.CLIENT)
    public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
    {
        return side == EnumFacing.DOWN ? super.shouldSideBeRendered(blockState, blockAccess, pos, side) : true;
    }

    /**
     * Convert the given metadata into a BlockState for this Block
     */
    public IBlockState getStateFromMeta(int meta)
    {
        return this.getDefaultState().withProperty(VARIANT, EnumType.byMetadata(meta));
    }

    /**
     * Convert the BlockState into the correct metadata value
     */
    public int getMetaFromState(IBlockState state)
    {
        return ((EnumType)state.getValue(VARIANT)).getMetadata();
    }

    /**
     * Get the actual Block state of this Block at the given position. This applies properties not visible in the
     * metadata, such as fence connections.
     */
    public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
    {
        boolean flag = this.canConnectTo(worldIn, pos.north());
        boolean flag1 = this.canConnectTo(worldIn, pos.east());
        boolean flag2 = this.canConnectTo(worldIn, pos.south());
        boolean flag3 = this.canConnectTo(worldIn, pos.west());
        boolean flag4 = flag && !flag1 && flag2 && !flag3 || !flag && flag1 && !flag2 && flag3;
        return state.withProperty(UP, Boolean.valueOf(!flag4 || !worldIn.isAirBlock(pos.up()))).withProperty(NORTH, Boolean.valueOf(flag)).withProperty(EAST, Boolean.valueOf(flag1)).withProperty(SOUTH, Boolean.valueOf(flag2)).withProperty(WEST, Boolean.valueOf(flag3));
    }

    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, new IProperty[] {UP, NORTH, EAST, WEST, SOUTH, VARIANT});
    }

    public static enum EnumType implements IStringSerializable
    {
        WHITE(0, "mbm_wool_white"),
        ORANGE(1, "mbm_wool_orange"),
    	MAGENTA(2, "mbm_wool_magents"),
    	LIGHT_BLUE(3, "mbm_wool_light_blue"),
    	YELLOW(4, "mbm_wool_yellow"),
    	LIME(5, "mbm_wool_lime"),
    	PINK(6, "mbm_wool_pink"),
    	GRAY(7, "mbm_wool_gray"),
    	SILVER(8, "mbm_wool_silver"),
    	CYAN(9, "mbm_wool_cyan"),
    	PURPLE(10, "mbm_wool_purple"),
    	BLUE(11, "mbm_wool_blue"),
    	BROWN(12, "mbm_wool_brown"),
    	GREEN(13, "mbm_wool_green"),
    	RED(14, "mbm_wool_red"),
    	BLACK(15, "mbm_wool_black");
    	

        private static final EnumType[] META_LOOKUP;
        private final int meta;
        private final String name;
        //private final String unlocalizedName;

        private EnumType(int meta, String name)
        {
            this.meta = meta;
            this.name = name;
        }

        public int getMetadata()
        {
            return this.meta;
        }

        public String toString()
        {
            return this.name;
        }

        public static EnumType byMetadata(int meta)
        {
            if (meta < 0 || meta >= META_LOOKUP.length)
            {
                meta = 0;
            }

            return META_LOOKUP[meta];
        }

        public String getName()
        {
            return this.name;
        }

        static
        {
        META_LOOKUP= new EnumType[values().length];;
            }
        }
    }


/*	public WoolenWalls(Block b) {
	super(b);
    this.useNeighborBrightness = true;
        this.setSoundType(SoundType.CLOTH);
        this.setHardness(0.8F).setResistance(4.0F);
}*/

 

 

and this is the error I get now.

 

 

Time: 11/2/16 7:20 PM
Description: Initializing game

java.lang.IllegalArgumentException: Cannot set property PropertyEnum{name=variant, clazz=class spectregames.missingblocksmod.block.WoolenWalls$EnumType, values=[mbm_wool_white, mbm_wool_orange, mbm_wool_magents, mbm_wool_light_blue, mbm_wool_yellow, mbm_wool_lime, mbm_wool_pink, mbm_wool_gray, mbm_wool_silver, mbm_wool_cyan, mbm_wool_purple, mbm_wool_blue, mbm_wool_brown, mbm_wool_green, mbm_wool_red, mbm_wool_black]} to null on block missingblocksmod:blockWoolColoredWhiteWall, it is not an allowed value
at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:222)
at spectregames.missingblocksmod.block.WoolenWalls.getStateFromMeta(WoolenWalls.java:154)
at net.minecraftforge.fml.common.registry.GameData$BlockCallbacks.onAdd(GameData.java:309)
at net.minecraftforge.fml.common.registry.GameData$BlockCallbacks.onAdd(GameData.java:284)
at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:601)
at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.add(FMLControlledNamespacedRegistry.java:499)
at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.register(FMLControlledNamespacedRegistry.java:852)
at net.minecraftforge.fml.common.registry.GameData.register_impl(GameData.java:254)
at net.minecraftforge.fml.common.registry.GameRegistry.register(GameRegistry.java:153)
at spectregames.missingblocksmod.inits.MBM_Blocks.registerBlock(MBM_Blocks.java:66)
at spectregames.missingblocksmod.inits.MBM_Blocks.preinit(MBM_Blocks.java:46)
at spectregames.missingblocksmod.proxy.CommonProxy.preInit(CommonProxy.java:25)
at spectregames.missingblocksmod.proxy.ClientProxy.preInit(ClientProxy.java:12)
at spectregames.missingblocksmod.MissingBlocksMod.preInit(MissingBlocksMod.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:602)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:614)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:257)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)
at net.minecraft.client.Minecraft.run(Minecraft.java:386)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

 

 

When I did this in 1.7.10 Yeah I know 1.10 is different  butI never had to add all these extra method while extending BlockWall I had like  10 lines of code in my WoolenWall class and My WoolenFence and dthey never made duplicates.

 

Also I think the reason the other stuff never showed up in my console window is that I have the .json files for the blocks I am creating  it takes like 10+ .json file for each wall block  1 block state, 6+ block models and an item Block model

the .json files names are

 

BlockState: blockWoolColoredWhiteWall.json

Block Models: blockWoolColoredWhiteWall_Inventory.json, blockWoolColoredWhiteWall_ne.json, blockWoolColoredWhiteWall_ns_above.json, blockWoolColoredWhiteWall_ns.json, blockWoolColoredWhiteWall_nse.json, blockWoolColoredWhiteWall_nsew.json, blockWoolColoredWhiteWall_wall_post.json, and blockWoolColoredWhiteWall_side.json

Item Block:blockWoolColoredWhiteWall.json

 

when I run the loop I do get the errors you had but when you have 14 blocks without .json files the rest of what you wanted got left out of the buffer so i had to just create the white and yellow blocks that I do have the .json files for.

 

EDITED for spelling and added my .json file names

Posted

You never fill META_LOOKUP with any values.  You create the array, but it is full of null.

Also, get rid of it.  enum type objects already have a

Enum#values()

array getter that returns an ordered array of all its values.

 

public static EnumType byMetadata(int meta) {
    return EnumType.values()[meta];
}

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

You never fill META_LOOKUP with any values.  You create the array, but it is full of null.

Also, get rid of it.  enum type objects already have a

Enum#values()

array getter that returns an ordered array of all its values.

 

public static EnumType byMetadata(int meta) {
    return EnumType.values()[meta];
}

 

I guess I do not understand the code then because it is the EXACT code that is in BloackWall with the exception the enums for my block. and I get this error saying it cant set the enums it not allowed.

 

 

Cannot set property PropertyEnum{name=variant, clazz=class spectregames.missingblocksmod.block.WoolenWalls$EnumType, values=[mbm_wool_white, mbm_wool_orange, mbm_wool_magents, mbm_wool_light_blue, mbm_wool_yellow, mbm_wool_lime, mbm_wool_pink, mbm_wool_gray, mbm_wool_silver, mbm_wool_cyan, mbm_wool_purple, mbm_wool_blue, mbm_wool_brown, mbm_wool_green, mbm_wool_red, mbm_wool_black]} to null on block missingblocksmod:blockWoolColoredWhiteWall, it is not an allowed value
at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:222)
at spectregames.missingblocksmod.block.WoolenWalls.getStateFromMeta(WoolenWalls.java:132)
at net.minecraftforge.fml.common.registry.GameData$BlockCallbacks.onAdd(GameData.java:309)
at net.minecraftforge.fml.common.registry.GameData$BlockCallbacks.onAdd(GameData.java:284)
at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:601)
at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.add(FMLControlledNamespacedRegistry.java:499)
at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.register(FMLControlledNamespacedRegistry.java:852)
at net.minecraftforge.fml.common.registry.GameData.register_impl(GameData.java:254)
at net.minecraftforge.fml.common.registry.GameRegistry.register(GameRegistry.java:153)
at spectregames.missingblocksmod.inits.MBM_Blocks.registerBlock(MBM_Blocks.java:69)
at spectregames.missingblocksmod.inits.MBM_Blocks.preinit(MBM_Blocks.java:54)
at spectregames.missingblocksmod.proxy.CommonProxy.preInit(CommonProxy.java:25)
at spectregames.missingblocksmod.proxy.ClientProxy.preInit(ClientProxy.java:12)
at spectregames.missingblocksmod.MissingBlocksMod.preInit(MissingBlocksMod.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:602)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:614)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:257)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)
at net.minecraft.client.Minecraft.run(Minecraft.java:386)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

 

 

EDIT it seems i missed this part of the code when I copied it from the other class

		        EnumType[] var0 = values();
	        int var1 = var0.length;
	           
	          for (int var2 = 0; var2 < var1; var2++) {
	        	  EnumType var3 = var0[var2];
	        	  META_LOOKUP[var3.getMetadata()] = var3;
	           }
	    	}	

 

but now instead of only having 2 of each blocks I have 16

 

 

 

OK I changed the EnumType from the 16 different colors to just this

 

    public static enum EnumType implements IStringSerializable {

       

    NORMAL(0, "mbm_woolen_walls", "normal");

         

and it is only giving me 1 copy of the walls now is this the way it suppose to be done or is this a hack or workaround?  if it is the way it is suppose to be done then I can mark this post Resolved? Let me know and TYVM everyone whom helped me get this far.

 

Posted

Btw You don't need all those .json files anymore. Just use the new forge blockstates.

I have made walls for all 16 hardened clay colors and i have only 1 .json file(the blockstate file). nothing more!

 

here is my blockstate file claywall.json :

 

{
    "forge_marker": 1,
    "defaults": {
        "model": "tem:dummy",
        "textures": {
            "particle": "#wall"
        }    
    },
    
    "variants": {
        "up": {
            "true": {
                "submodel": {"wall_up": {"model": "wall_post"}}
            },
            "false": {}
        },
        "north": {
            "true": {
                "submodel": {"wall_north": {"model": "wall_side","uvlock": true}}
            },
            "false": {}
        },
        "east": {
            "true": {
                "submodel": {"wall_east": {"model": "wall_side","y": 90,"uvlock": true}}
            },
            "false": {}
        },
        "south": {
            "true": {
                "submodel": {"wall_south": {"model": "wall_side","y": 180,"uvlock": true}}
            },
            "false": {}
        },
        "west": {
            "true": {
                "submodel": {"wall_west": {"model": "wall_side","y": 270,"uvlock": true}}
            },
            "false": {}
        },
        
        "type": {
            "white": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_white"
                }
            },
            "orange": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_orange"
                }
            },
            "magenta": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_magenta"
                }
            },
            "light_blue": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_light_blue"
                }
            },
            "yellow": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_yellow"
                }
            },
            "lime": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_lime"
                }
            },
            "pink": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_pink"
                }
            },
            "gray": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_gray"
                }
            },
            "silver": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_silver"
                }
            },
            "cyan": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_cyan"
                }
            },
            "purple": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_purple"
                }
            },
            "blue": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_blue"
                }
            },
            "brown": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_brown"
                }
            },
            "green": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_green"
                }
            },
            "red": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_red"
                }
            },
            "black": {
                "textures": {
                    "wall": "minecraft:blocks/hardened_clay_stained_black"
                }
            }
        },
        "type=white": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_white"
                
            }
        
        },
        "type=orange": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_orange"
                
            }
        },
        "type=magenta": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_magenta"
                
            }
        },
        "type=lightblue": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_light_blue"
                
            }
        },
        "type=yellow": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_yellow"
                
            }
        },
        "type=lime": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_lime"
                
            }
        },
        "type=pink": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_pink"
                
            }
        },
        "type=gray": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_gray"
                
            }
        },
        "type=silver": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_silver"
                
            }
        },
        "type=cyan": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_cyan"
                
            }
        },
        "type=purple": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_purple"
                
            }
        },
        "type=blue": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_blue"
                
            }
        },
        "type=brown": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_brown"
                
            }
        },
        "type=green": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_green"
                
            }
        },
        "type=red": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_red"
                
            }
        },
        "type=black": {
            "model": "wall_inventory",
            "textures": {
                "wall": "minecraft:blocks/hardened_clay_stained_black"
                
            }
        }
    }
}

 

 

Pretty cool he?

 

Is everything working now for you or not?

Posted

Btw You don't need all those .json files anymore. Just use the new forge blockstates.

I have made walls for all 16 hardened clay colors and i have only 1 .json file. nothing more!

 

Is everything working now for you or not?

 

Would you have a link to something describing the new forge json files you mentioned because the blockstate files that are in the current minecraft only have 5 multistate references to 2 other files wall_post and wall_side

 

EDIT sorry I did not see the hidden tag in your post

Posted

I edited my previous post.

I created a dummy model to use as a default (wich does nothing except for having a comment)

The first 16 color types are for the blocks the next 16 colors are for the items.

 

i register the render like this:

registerMetaRender(claywall,0,"type=white");
registerMetaRender(claywall,1,"type=orange");
registerMetaRender(claywall,2,"type=magenta");
registerMetaRender(claywall,3,"type=lightblue");
registerMetaRender(claywall,4,"type=yellow");
registerMetaRender(claywall,5,"type=lime");
registerMetaRender(claywall,6,"type=pink");
registerMetaRender(claywall,7,"type=gray");
registerMetaRender(claywall,8,"type=silver");
registerMetaRender(claywall,9,"type=cyan");
registerMetaRender(claywall,10,"type=purple");
registerMetaRender(claywall,11,"type=blue");
registerMetaRender(claywall,12,"type=brown");
registerMetaRender(claywall,13,"type=green");
registerMetaRender(claywall,14,"type=red");
registerMetaRender(claywall,15,"type=black");

 

Posted

Yeah I guess everything is working ok now except for the walls does not want to connect to other wall types but I guess that is for a new topic.

I think you place this here too. It's still "trouble with custom wall blocks".

 

I made an abstract wall class where all the basic things are inside needed for the walls.

Like this:

 

public abstract class BlockCustomWall extends Block
{
    public static final PropertyBool UP = PropertyBool.create("up");
    public static final PropertyBool NORTH = PropertyBool.create("north");
    public static final PropertyBool EAST = PropertyBool.create("east");
    public static final PropertyBool SOUTH = PropertyBool.create("south");
    public static final PropertyBool WEST = PropertyBool.create("west");
    protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[] {new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)};
    protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[] {AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D), AABB_BY_INDEX[15].setMaxY(1.5D)};
    public BlockCustomWall(Material material)
    {
        super(material);
    }
    public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
    {
        state = this.getActualState(state, source, pos);
        return AABB_BY_INDEX[getAABBIndex(state)];
    }
    @Nullable
    public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
    {
        blockState = this.getActualState(blockState, worldIn, pos);
        return CLIP_AABB_BY_INDEX[getAABBIndex(blockState)];
    }
    private static int getAABBIndex(IBlockState state)
    {
        int i = 0;

        if (((Boolean)state.getValue(NORTH)).booleanValue())
        {
            i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
        }

        if (((Boolean)state.getValue(EAST)).booleanValue())
        {
            i |= 1 << EnumFacing.EAST.getHorizontalIndex();
        }

        if (((Boolean)state.getValue(SOUTH)).booleanValue())
        {
            i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
        }

        if (((Boolean)state.getValue(WEST)).booleanValue())
        {
            i |= 1 << EnumFacing.WEST.getHorizontalIndex();
        }

        return i;
    }
    public boolean isFullCube(IBlockState state)
    {
        return false;
    }
    public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
    {
        return false;
    }  
    public boolean isOpaqueCube(IBlockState state)
    {
        return false;
    }
    private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();
        return block == Blocks.BARRIER || block == this || block instanceof BlockWall || block instanceof BlockCustomWall || block instanceof BlockFenceGate || block instanceof BlockFence || (block.isOpaqueCube(iblockstate) && iblockstate.isFullCube());
    }
    
    @SideOnly(Side.CLIENT)
    public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
    {
        return side == EnumFacing.DOWN ? super.shouldSideBeRendered(blockState, blockAccess, pos, side) : true;
    }   
    public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
    {
        boolean flag = this.canConnectTo(worldIn, pos.north());
        boolean flag1 = this.canConnectTo(worldIn, pos.east());
        boolean flag2 = this.canConnectTo(worldIn, pos.south());
        boolean flag3 = this.canConnectTo(worldIn, pos.west());
        boolean flag4 = flag && !flag1 && flag2 && !flag3 || !flag && flag1 && !flag2 && flag3;
        return state.withProperty(UP, Boolean.valueOf(!flag4 || !worldIn.isAirBlock(pos.up()))).withProperty(NORTH, Boolean.valueOf(flag)).withProperty(EAST, Boolean.valueOf(flag1)).withProperty(SOUTH, Boolean.valueOf(flag2)).withProperty(WEST, Boolean.valueOf(flag3));
    } 
    public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos){	
    	return true;	
    }  
}

 

That basic class i named it BlockCustomWalls.class (but you name it whatever you like)

 

So from now on if i want to create walls i can create a class for each wall type that extends BlockCustomWalls

In there i define all the subtypes it looks like this:

 

public class BlockClayWall extends BlockCustomWall implements IMetaBlockName{
    
    public static final PropertyEnum<EnumType> TYPE = PropertyEnum.<EnumType>create("type", EnumType.class);
    
    public BlockClayWall()
    {
        super(Material.ROCK);
        setHardness(1.25F);
        setResistance(7.0F);
        setSoundType(SoundType.STONE);
        this.setDefaultState(this.blockState.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(TYPE, EnumType.WHITE));
        this.setCreativeTab(Tem.wallstab);
        setUnlocalizedName(References.temBlocks.CLAYWALL.getUnlocalizedName());
	setRegistryName(References.temBlocks.CLAYWALL.getRegistryName());
    }
    
    public String getUnlocalizedName(int meta){
	return this.getUnlocalizedName() + "_" + EnumType.values()[meta];
}
    @Override
public String getSpecialName(ItemStack stack) {
	return EnumType.values()[stack.getItemDamage()].name().toLowerCase();
}
    @SideOnly(Side.CLIENT)
    public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
    {
        for (EnumType blockwall$enumtype : EnumType.values())
        {
            list.add(new ItemStack(itemIn, 1, blockwall$enumtype.getMetadata()));
        }
    }

  
    public int damageDropped(IBlockState state)
    {
        return ((EnumType)state.getValue(TYPE)).getMetadata();
    }

    public IBlockState getStateFromMeta(int meta)
    {
        return this.getDefaultState().withProperty(TYPE, EnumType.byMetadata(meta));
    }
        
    public int getMetaFromState(IBlockState state)
    {
        return ((EnumType)state.getValue(TYPE)).getMetadata();
    }

    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, new IProperty[] {UP, NORTH, EAST, WEST, SOUTH, TYPE});
    }

    public static enum EnumType implements IStringSerializable
    {
    	WHITE(0, "white"), ORANGE(1, "orange"), MAGENTA(2, "magenta"), LIGHTBLUE(3, "light_blue"), YELLOW(4, "yellow"), LIME(5, "lime"), PINK(6, "pink"), GRAY(7, "gray"), 
	SILVER(8, "silver"), CYAN(9, "cyan"), PURPLE(10, "purple"), BLUE(11, "blue"), BROWN(12, "brown"), GREEN(13, "green"), RED(14, "red"), BLACK(15, "black");

        private static final EnumType[] META_LOOKUP = new EnumType[values().length];
        private final int meta;
        private final String name;
        

        private EnumType(int meta, String name)
        {
            this.meta = meta;
            this.name = name;
            
        }

        public int getMetadata()
        {
            return this.meta;
        }

        public String toString()
        {
            return this.name;
        }

        public static EnumType byMetadata(int meta)
        {
            if (meta < 0 || meta >= META_LOOKUP.length)
            {
                meta = 0;
            }

            return META_LOOKUP[meta];
        }

        public String getName()
        {
            return this.name;
        }


        static
        {
            for (EnumType blockwall$enumtype : values())
            {
                META_LOOKUP[blockwall$enumtype.getMetadata()] = blockwall$enumtype;
            }
        }
    }


}

 

 

For the connections, look at the BlockCustomWall. You might also want to be able to place torches on top of the wall.

Posted

I have almost the exact code for my walls I changed it to be generic but I never thought of extending the custom class. I am able to place torches ok but I believe my problem is in the canConnectTo method I need to look at your code and the several 1.10 wall code I found on GIT but it seems almost everyone does it completely differently :P

Posted

Your custom walls should reach only to the edges of their own cubes. If they're not connecting to vanilla walls, it's because the vanilla walls are too stupid to reach back.

 

My custom walls include their own cobble and mossy-cobble variants so vanilla's walls can be completely avoided.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

Your custom walls should reach only to the edges of their own cubes. If they're not connecting to vanilla walls, it's because the vanilla walls are too stupid to reach back.

 

My custom walls include their own cobble and mossy-cobble variants so vanilla's walls can be completely avoided.

 

My walls do not connect to themselves either white wool wont connect to any other color or any other custom walls I created but i guess i could remake the cobble and mossy-cobble and overwrite the default ones since I am using the default texture pack as my images so it does not matter what texture pack is used they will  or should look the same

Posted

If they do not connect to themself, you do something wrong in here:

 

private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();
        return block == Blocks.BARRIER || block == this || block instanceof BlockWall || block instanceof BlockCustomWall || block instanceof BlockFenceGate || block instanceof BlockFence || (block.isOpaqueCube(iblockstate) && iblockstate.isFullCube());
    }

block==this

block instanceof (your own custom wall class here)

 

Those 2 should be enough to connect to themself

 

Show you code again so we can see what's wrong

 

Your custom walls should reach only to the edges of their own cubes. If they're not connecting to vanilla walls, it's because the vanilla walls are too stupid to reach back.

 

My custom walls include their own cobble and mossy-cobble variants so vanilla's walls can be completely avoided.

Do you let them co-exists in the game or do you completely replace them or do you replace only the recipe so your walls will be returned instead?

If any other mod requires for some reason a vanilla cobblestone wall in a recipe, you will have a problem if it isn't obtaineble.

Ofcourse the oredictionary can solve this, but only other mods use it. There is also no common name for walls in the oredictionary. So other mods can name it wall, Wall, blockwall, blockWall, BlockWall, Blockwall etc etc.

Too many option i think. I 'solved' this more or less in my 1.7.10 mod to include a vanillawand. Placing it in the crafting grid together with the 'new' wall will return the 'old wall.

I don't know any other (better) way.

Posted

If they do not connect to themself, you do something wrong in here:

 

private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();
        return block == Blocks.BARRIER || block == this || block instanceof BlockWall || block instanceof BlockCustomWall || block instanceof BlockFenceGate || block instanceof BlockFence || (block.isOpaqueCube(iblockstate) && iblockstate.isFullCube());
    }

block==this

block instanceof (your own custom wall class here)

 

Those 2 should be enough to connect to themself

 

Show you code again so we can see what's wrong

 

Your custom walls should reach only to the edges of their own cubes. If they're not connecting to vanilla walls, it's because the vanilla walls are too stupid to reach back.

 

My custom walls include their own cobble and mossy-cobble variants so vanilla's walls can be completely avoided.

Do you let them co-exists in the game or do you completely replace them or do you replace only the recipe so your walls will be returned instead?

If any other mod requires for some reason a vanilla cobblestone wall in a recipe, you will have a problem if it isn't obtaineble.

Ofcourse the oredictionary can solve this, but only other mods use it. There is also no common name for walls in the oredictionary. So other mods can name it wall, Wall, blockwall, blockWall, BlockWall, Blockwall etc etc.

Too many option i think. I 'solved' this more or less in my 1.7.10 mod to include a vanillawand. Placing it in the crafting grid together with the 'new' wall will return the 'old wall.

I don't know any other (better) way.

 

Yeah I only have the default code in there I need to add my custom blocks and classes in there I just have not gotten around to it yet I did try  to add them in when I was extending BlockWall instead of block

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

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

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