Jump to content

Recommended Posts

Posted

Hi all first time post so please be nice  :)

 

my first time modding for minecraft and with forge, I have followed a tutorial done by MrCrayfish on youtube and got it working just the basic item/block, but now I'm trying to do a little more advance advance stuff and cannot understand why its not working :( as far as I'm aware I have all the paths set correctly and right elements but I still get this error: 

 

 

[14:02:37] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=east,in_wall=true,open=false,powered=false not found

[14:02:37] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=south,in_wall=true,open=true,powered=true not found

[14:02:37] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=west,in_wall=false,open=false,powered=false not found

[14:02:37] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=north,in_wall=false,open=true,powered=true not found

[14:02:37] [Client thread/ERROR] [FML]: Supressed additional 33 model loading errors for domain wm

 

 

 

log report

 

 

2016-02-10 14:53:13,496 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-02-10 14:53:13,499 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

[14:53:13] [main/INFO] [GradleStart]: Extra: []

[14:53:13] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/dot_d/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken{REDACTED}, --version, 1.8.9, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]

[14:53:13] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[14:53:13] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[14:53:13] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker

[14:53:13] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker

[14:53:13] [main/INFO] [FML]: Forge Mod Loader version 11.15.1.1722 for Minecraft 1.8.9 loading

[14:53:13] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.8.0_71, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_71

[14:53:13] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[14:53:13] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker

[14:53:13] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin

[14:53:13] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin

[14:53:13] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[14:53:13] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[14:53:13] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[14:53:13] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[14:53:13] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[14:53:13] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[14:53:13] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!

[14:53:14] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing

[14:53:14] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[14:53:14] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[14:53:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[14:53:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker

[14:53:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker

[14:53:15] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

2016-02-10 14:53:16,063 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-02-10 14:53:16,093 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-02-10 14:53:16,095 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

[14:53:16] [Client thread/INFO]: Setting user: Player767

[14:53:19] [Client thread/INFO]: LWJGL Version: 2.9.4

[14:53:19] [Client thread/WARN] [FML]: =============================================================

[14:53:19] [Client thread/WARN] [FML]: MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML!

[14:53:19] [Client thread/WARN] [FML]: Offendor: com/sun/jna/Native.main([Ljava/lang/String;)V

[14:53:19] [Client thread/WARN] [FML]: Use FMLCommonHandler.exitJava instead

[14:53:19] [Client thread/WARN] [FML]: =============================================================

[14:53:20] [Client thread/INFO] [sTDOUT]: [net.minecraftforge.fml.client.SplashProgress:start:246]: ---- Minecraft Crash Report ----

// Hi. I'm Minecraft, and I'm a crashaholic.

 

Time: 10/02/16 2:53 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.8.9

Operating System: Windows 10 (amd64) version 10.0

Java Version: 1.8.0_71, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 834811352 bytes (796 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: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 361.75' Renderer: 'GeForce GTX 760/PCIe/SSE2'

[14:53:20] [Client thread/INFO] [FML]: MinecraftForge v11.15.1.1722 Initialized

[14:53:20] [Client thread/INFO] [FML]: Replaced 204 ore recipies

[14:53:20] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer

[14:53:20] [Client thread/INFO] [FML]: Searching C:\Users\dot_d\Desktop\MinecraftModding\Minecraft\run\mods for mods

[14:53:21] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load

[14:53:22] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, wm] at CLIENT

[14:53:22] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, wm] at SERVER

[14:53:22] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Windows Mod

[14:53:22] [Client thread/INFO] [FML]: Processing ObjectHolder annotations

[14:53:22] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations

[14:53:22] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations

[14:53:22] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations

[14:53:22] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0

[14:53:22] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json

[14:53:22] [Client thread/INFO] [FML]: Applying holder lookups

[14:53:22] [Client thread/INFO] [FML]: Holder lookups applied

[14:53:22] [Client thread/INFO] [FML]: Injecting itemstacks

[14:53:22] [Client thread/INFO] [FML]: Itemstack injection complete

[14:53:23] [sound Library Loader/INFO]: Starting up SoundSystem...

[14:53:23] [Thread-9/INFO]: Initializing LWJGL OpenAL

[14:53:23] [Thread-9/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[14:53:23] [Thread-9/INFO]: OpenAL initialized.

[14:53:23] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Found status: UP_TO_DATE Target: null

[14:53:23] [sound Library Loader/INFO]: Sound engine started

[14:53:28] [Client thread/INFO] [FML]: Max texture size: 16384

[14:53:28] [Client thread/INFO]: Created: 16x16 textures-atlas

[14:53:29] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=east,in_wall=true,open=false,powered=false not found

[14:53:29] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=south,in_wall=true,open=true,powered=true not found

[14:53:29] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=west,in_wall=false,open=false,powered=false not found

[14:53:29] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=north,in_wall=false,open=true,powered=true not found

[14:53:29] [Client thread/ERROR] [FML]: Supressed additional 33 model loading errors for domain wm

[14:53:29] [Client thread/INFO] [FML]: Injecting itemstacks

[14:53:29] [Client thread/INFO] [FML]: Itemstack injection complete

[14:53:29] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods

[14:53:29] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Windows Mod

[14:53:29] [Client thread/INFO]: SoundSystem shutting down...

[14:53:29] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

[14:53:29] [sound Library Loader/INFO]: Starting up SoundSystem...

[14:53:30] [Thread-11/INFO]: Initializing LWJGL OpenAL

[14:53:30] [Thread-11/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[14:53:30] [Thread-11/INFO]: OpenAL initialized.

[14:53:30] [sound Library Loader/INFO]: Sound engine started

[14:53:34] [Client thread/INFO] [FML]: Max texture size: 16384

[14:53:34] [Client thread/INFO]: Created: 512x512 textures-atlas

[14:53:35] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=east,in_wall=true,open=false,powered=false not found

[14:53:35] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=south,in_wall=true,open=true,powered=true not found

[14:53:35] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=west,in_wall=false,open=false,powered=false not found

[14:53:35] [Client thread/ERROR] [FML]: Model definition for location wm:block_window#facing=north,in_wall=false,open=true,powered=true not found

[14:53:35] [Client thread/ERROR] [FML]: Supressed additional 33 model loading errors for domain wm

[14:53:36] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id

[14:53:38] [Client thread/INFO]: Stopping!

[14:53:38] [Client thread/INFO]: SoundSystem shutting down...

[14:53:38] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

Java HotSpot 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

 

here is my entire mod:

WindowsMod.java

package com.dot6.windows;

import com.dot6.windows.init.WindowBlocks;
import com.dot6.windows.init.WindowItems;
import com.dot6.windows.proxy.CommonProxy;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
public class WindowsMod {
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{

	WindowBlocks.init();
	WindowBlocks.register();
	//WindowItems.init();
	//WindowItems.register();

}

@EventHandler
public void preInit(FMLInitializationEvent event)
{

}

@EventHandler
public void preInit(FMLPostInitializationEvent event)
{
	proxy.registerRenders();
}

}

Reference.java

package com.dot6.windows;

public class Reference {
public static final String MOD_ID = "wm";
public static final String MOD_NAME = "Windows Mod";
public static final String VERSION = "1.0";
public static final String CLIENT_PROXY_CLASS = "com.dot6.windows.proxy.ClientProxy";
public static final String SERVER_PROXY_CLASS = "com.dot6.windows.proxy.CommonProxy";
}

ClientProxy.java

package com.dot6.windows.proxy;

import com.dot6.windows.init.WindowItems;
import com.dot6.windows.init.WindowBlocks;

public class ClientProxy extends CommonProxy{
@Override 
public void registerRenders(){
	WindowBlocks.registerRenders();
	//WindowItems.registerRenders();
	            		
}
}

CommonProxy.java

package com.dot6.windows.proxy;

public class CommonProxy {
public void registerRenders(){

}
}

WindowBlock.java

package com.dot6.windows.init;

import com.dot6.windows.Reference;
import com.dot6.windows.blocks.BlockWindow;

import net.minecraft.block.Block;
import net.minecraft.block.BlockPlanks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class WindowBlocks {
public static Block block_window;

public static void init()	{

	block_window = new BlockWindow(BlockPlanks.EnumType.OAK).setUnlocalizedName("block_window");
}

public static void register()
{
	GameRegistry.registerBlock(block_window, block_window.getUnlocalizedName().substring(5));
}

public static void registerRenders() 
{
	registedrRender(block_window);
}

public static void registedrRender(Block block) 
{
	Item item = Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}

BlockWindow.java

package com.dot6.windows.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockWindow extends BlockDirectional
{
    public static final PropertyBool OPEN = PropertyBool.create("open");
    public static final PropertyBool POWERED = PropertyBool.create("powered");
    public static final PropertyBool IN_WALL = PropertyBool.create("in_wall");

    public BlockWindow(BlockPlanks.EnumType p_i46394_1_)
    {
        super(Material.wood, p_i46394_1_.func_181070_c());
        this.setDefaultState(this.blockState.getBaseState().withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false)));
       
        this.setCreativeTab(CreativeTabs.tabRedstone);
    }

    /**
     * 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)
    {
        EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis();

        if (enumfacing$axis == EnumFacing.Axis.Z && (worldIn.getBlockState(pos.west()).getBlock() == Blocks.cobblestone_wall || worldIn.getBlockState(pos.east()).getBlock() == Blocks.cobblestone_wall) || enumfacing$axis == EnumFacing.Axis.X && (worldIn.getBlockState(pos.north()).getBlock() == Blocks.cobblestone_wall || worldIn.getBlockState(pos.south()).getBlock() == Blocks.cobblestone_wall))
        {
            state = state.withProperty(IN_WALL, Boolean.valueOf(true));
        }

        return state;
    }

    public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
    {
        return worldIn.getBlockState(pos.down()).getBlock().getMaterial().isSolid() ? super.canPlaceBlockAt(worldIn, pos) : false;
    }

    public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
    {
        if (((Boolean)state.getValue(OPEN)).booleanValue())
        {
            return null;
        }
        else
        {
            EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis();
            return enumfacing$axis == EnumFacing.Axis.Z ? new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)((float)pos.getZ() + 0.375F), (double)(pos.getX() + 1), (double)((float)pos.getY() + 1.5F), (double)((float)pos.getZ() + 0.625F)) : new AxisAlignedBB((double)((float)pos.getX() + 0.375F), (double)pos.getY(), (double)pos.getZ(), (double)((float)pos.getX() + 0.625F), (double)((float)pos.getY() + 1.5F), (double)(pos.getZ() + 1));
        }
    }

    public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
    {
        EnumFacing.Axis enumfacing$axis = ((EnumFacing)worldIn.getBlockState(pos).getValue(FACING)).getAxis();

        if (enumfacing$axis == EnumFacing.Axis.Z)
        {
            this.setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 1.0F, 0.625F);
        }
        else
        {
            this.setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 1.0F, 1.0F);
        }
    }

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

    public boolean isFullCube()
    {
        return false;
    }

    public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
    {
        return ((Boolean)worldIn.getBlockState(pos).getValue(OPEN)).booleanValue();
    }

    /**
     * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
     * IBlockstate
     */
    public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
    {
        return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false));
    }

    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (((Boolean)state.getValue(OPEN)).booleanValue())
        {
            state = state.withProperty(OPEN, Boolean.valueOf(false));
            worldIn.setBlockState(pos, state, 2);
        }
        else
        {
            EnumFacing enumfacing = EnumFacing.fromAngle((double)playerIn.rotationYaw);

            if (state.getValue(FACING) == enumfacing.getOpposite())
            {
                state = state.withProperty(FACING, enumfacing);
            }

            state = state.withProperty(OPEN, Boolean.valueOf(true));
            worldIn.setBlockState(pos, state, 2);
        }

        worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0);
        return true;
    }

    /**
     * Called when a neighboring block changes.
     */    
    public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
    {
        if (!worldIn.isRemote)
        {
            boolean flag = worldIn.isBlockPowered(pos);

            if (flag || neighborBlock.canProvidePower())
            {
                if (flag && !((Boolean)state.getValue(OPEN)).booleanValue() && !((Boolean)state.getValue(POWERED)).booleanValue())
                {
                    worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(true)).withProperty(POWERED, Boolean.valueOf(true)), 2);
                    worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1003, pos, 0);
                }
                else if (!flag && ((Boolean)state.getValue(OPEN)).booleanValue() && ((Boolean)state.getValue(POWERED)).booleanValue())
                {
                    worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)), 2);
                    worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1006, pos, 0);
                }
                else if (flag != ((Boolean)state.getValue(POWERED)).booleanValue())
                {
                    worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(flag)), 2);
                }
            }
        }
    }

    @SideOnly(Side.CLIENT)
    public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
    {
        return true;
    }

    /**
     * Convert the given metadata into a BlockState for this Block
     */
    public IBlockState getStateFromMeta(int meta)
    {
        return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)).withProperty(OPEN, Boolean.valueOf((meta & 4) != 0)).withProperty(POWERED, Boolean.valueOf((meta &  != 0));
    }

    /**
     * Convert the BlockState into the correct metadata value
     */
    public int getMetaFromState(IBlockState state)
    {
        int i = 0;
        i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();

        if (((Boolean)state.getValue(POWERED)).booleanValue())
        {
            i |= 8;
        }

        if (((Boolean)state.getValue(OPEN)).booleanValue())
        {
            i |= 4;
        }

        return i;
    }

    protected BlockState createBlockState()
    {
        return new BlockState(this, new IProperty[] {FACING, OPEN, POWERED, IN_WALL});
    }
    
}

block_window.json

{
    "variants": {
        "facing=south,in_wall=false,open=false": { "model": "wm:oak_window_closed" },
        "facing=west,in_wall=false,open=false":  { "model": "wm:oak_window_closed", "y": 90, "uvlock": true },
        "facing=north,in_wall=false,open=false": { "model": "wm:oak_window_closed", "y": 180, "uvlock": true },
        "facing=east,in_wall=false,open=false":  { "model": "wm:oak_window_closed", "y": 270, "uvlock": true },
        "facing=south,in_wall=false,open=true": { "model": "wm:oak_window_open" },
        "facing=west,in_wall=false,open=true":  { "model": "wm:oak_window_open", "y": 90, "uvlock": true },
        "facing=north,in_wall=false,open=true": { "model": "wm:oak_window_open", "y": 180, "uvlock": true },
        "facing=east,in_wall=false,open=true":  { "model": "wm:oak_window_open", "y": 270, "uvlock": true },
        "facing=south,in_wall=true,open=false": { "model": "wm:oak_wall_window_closed" },
        "facing=west,in_wall=true,open=false":  { "model": "wm:oak_wall_window_closed", "y": 90, "uvlock": true },
        "facing=north,in_wall=true,open=false": { "model": "wm:oak_wall_window_closed", "y": 180, "uvlock": true },
        "facing=east,in_wall=true,open=false":  { "model": "wm:oak_wall_window_closed", "y": 270, "uvlock": true },
        "facing=south,in_wall=true,open=true": { "model": "wm:oak_wall_window_open" },
        "facing=west,in_wall=true,open=true":  { "model": "wm:oak_wall_window_open", "y": 90, "uvlock": true },
        "facing=north,in_wall=true,open=true": { "model": "wm:oak_wall_window_open", "y": 180, "uvlock": true },
        "facing=east,in_wall=true,open=true":  { "model": "wm:oak_wall_window_open", "y": 270, "uvlock": true }
    }
}

oak_wall_window_closed.json

{
    "parent": "wm:block/oak_window_closed",
    "textures": {
        "texture": "blocks/planks_oak"
    }
}

oak_wall_window_open.json

{
    "parent": "wm:block/oak_window_open",
    "textures": {
        "texture": "blocks/planks_oak"
    }
}

oak_window_closed.json

{
    "parent": "wm:block/window_closed",
    "textures": {
        "texture": "blocks/planks_oak"
    }
}

oak_window_open.json

{
    "parent": "wm:block/window_open",
    "textures": {
        "texture": "blocks/planks_oak"
    }
}

window_closed.json

{
    "textures": {
        "particle" : "#texture"
    },
    "elements": [
        {   "__comment": "Left-hand post",
            "from": [ 0, 5, 7 ],
            "to": [ 2, 16, 9 ],
            "faces": {
                "down":  { "uv": [ 0, 7, 2,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 0, 7, 2,  9 ], "texture": "#texture" },
                "north": { "uv": [ 0, 0, 2, 11 ], "texture": "#texture" },
                "south": { "uv": [ 0, 0, 2, 11 ], "texture": "#texture" },
                "west":  { "uv": [ 7, 0, 9, 11 ], "texture": "#texture", "cullface": "west" },
                "east":  { "uv": [ 7, 0, 9, 11 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Right-hand post",
            "from": [ 14, 5, 7 ],
            "to": [ 16, 16, 9 ],
            "faces": {
                "down":  { "uv": [ 14, 7, 16,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 14, 7, 16,  9 ], "texture": "#texture" },
                "north": { "uv": [ 14, 0, 16, 11 ], "texture": "#texture" },
                "south": { "uv": [ 14, 0, 16, 11 ], "texture": "#texture" },
                "west":  { "uv": [  7, 0,  9, 11 ], "texture": "#texture" },
                "east":  { "uv": [  7, 0,  9, 11 ], "texture": "#texture", "cullface": "east" }
            }
        },
        {   "__comment": "Inner vertical post of left-hand gate door",
            "from": [ 6, 6, 7 ],
            "to": [ 8, 15, 9 ],
            "faces": {
                "down":  { "uv": [ 6, 7, 8,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 6, 7, 8,  9 ], "texture": "#texture" },
                "north": { "uv": [ 6, 1, 8, 10 ], "texture": "#texture" },
                "south": { "uv": [ 6, 1, 8, 10 ], "texture": "#texture" },
                "west":  { "uv": [ 7, 1, 9, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 7, 1, 9, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Inner vertical post of right-hand gate door",
            "from": [ 8, 6, 7 ],
            "to": [ 10, 15, 9 ],
            "faces": {
                "down":  { "uv": [ 8, 7, 10,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 8, 7, 10,  9 ], "texture": "#texture" },
                "north": { "uv": [ 8, 1, 10, 10 ], "texture": "#texture" },
                "south": { "uv": [ 8, 1, 10, 10 ], "texture": "#texture" },
                "west":  { "uv": [ 7, 1,  9, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 7, 1,  9, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Lower horizontal bar of left-hand gate door",
            "from": [ 2, 6, 7 ],
            "to": [ 6, 9, 9 ],
            "faces": {
                "down":  { "uv": [ 2, 7, 6,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 2, 7, 6,  9 ], "texture": "#texture" },
                "north": { "uv": [ 2, 7, 6, 10 ], "texture": "#texture" },
                "south": { "uv": [ 2, 7, 6, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Upper horizontal bar of left-hand gate door",
            "from": [ 2, 12, 7 ],
            "to": [ 6, 15, 9 ],
            "faces": {
                "down":  { "uv": [ 2, 7, 6, 9 ], "texture": "#texture" },
                "up":    { "uv": [ 2, 7, 6, 9 ], "texture": "#texture" },
                "north": { "uv": [ 2, 1, 6, 4 ], "texture": "#texture" },
                "south": { "uv": [ 2, 1, 6, 4 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Lower horizontal bar of right-hand gate door",
            "from": [ 10, 6, 7 ],
            "to": [ 14, 9, 9 ],
            "faces": {
                "down":  { "uv": [ 10, 7, 14,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 10, 7, 14,  9 ], "texture": "#texture" },
                "north": { "uv": [ 10, 7, 14, 10 ], "texture": "#texture" },
                "south": { "uv": [ 10, 7, 14, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Upper horizontal bar of right-hand gate door",
            "from": [ 10, 12, 7 ],
            "to": [ 14, 15, 9 ],
            "faces": {
                "down":  { "uv": [ 10, 7, 14, 9 ], "texture": "#texture" },
                "up":    { "uv": [ 10, 7, 14, 9 ], "texture": "#texture" },
                "north": { "uv": [ 10, 1, 14, 4 ], "texture": "#texture" },
                "south": { "uv": [ 10, 1, 14, 4 ], "texture": "#texture" }
            }
        }
    ]
}

window_open.json

{
    "textures": {
        "particle" : "#texture"
    },
    "elements": [
        {   "__comment": "Left-hand post",
            "from": [ 0, 5, 7 ],
            "to": [ 2, 16, 9 ],
            "faces": {
                "down":  { "uv": [ 0, 7, 2,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 0, 7, 2,  9 ], "texture": "#texture" },
                "north": { "uv": [ 0, 0, 2, 11 ], "texture": "#texture" },
                "south": { "uv": [ 0, 0, 2, 11 ], "texture": "#texture" },
                "west":  { "uv": [ 7, 0, 9, 11 ], "texture": "#texture", "cullface": "west" },
                "east":  { "uv": [ 7, 0, 9, 11 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Right-hand post",
            "from": [ 14, 5, 7 ],
            "to": [ 16, 16, 9 ],
            "faces": {
                "down":  { "uv": [ 14, 7, 16,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 14, 7, 16,  9 ], "texture": "#texture" },
                "north": { "uv": [ 14, 0, 16, 11 ], "texture": "#texture" },
                "south": { "uv": [ 14, 0, 16, 11 ], "texture": "#texture" },
                "west":  { "uv": [  7, 0,  9, 11 ], "texture": "#texture" },
                "east":  { "uv": [  7, 0,  9, 11 ], "texture": "#texture", "cullface": "east" }
            }
        },
        {   "__comment": "Inner vertical post of left-hand gate door",
            "from": [ 0, 6, 13 ],
            "to": [ 2, 15, 15 ],
            "faces": {
                "down":  { "uv": [  0, 13,  2, 15 ], "texture": "#texture" },
                "up":    { "uv": [  0, 13,  2, 15 ], "texture": "#texture" },
                "north": { "uv": [  0,  1,  2, 10 ], "texture": "#texture" },
                "south": { "uv": [  0,  1,  2, 10 ], "texture": "#texture" },
                "west":  { "uv": [ 13,  1, 15, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 13,  1, 15, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Inner vertical post of right-hand gate door",
            "from": [ 14, 6, 13 ],
            "to": [ 16, 15, 15 ],
            "faces": {
                "down":  { "uv": [ 14, 13, 16, 15 ], "texture": "#texture" },
                "up":    { "uv": [ 14, 13, 16, 15 ], "texture": "#texture" },
                "north": { "uv": [ 14,  1, 16, 10 ], "texture": "#texture" },
                "south": { "uv": [ 14,  1, 16, 10 ], "texture": "#texture" },
                "west":  { "uv": [ 13,  1, 15, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 13,  1, 15, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Lower horizontal bar of left-hand gate door",
            "from": [ 0, 6, 9 ],
            "to": [ 2, 9, 13 ],
            "faces": {
                "down":  { "uv": [  0, 9,  2, 13 ], "texture": "#texture" },
                "up":    { "uv": [  0, 9,  2, 13 ], "texture": "#texture" },
                "west":  { "uv": [ 13, 7, 15, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 13, 7, 15, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Upper horizontal bar of left-hand gate door",
            "from": [ 0, 12, 9 ],
            "to": [ 2, 15, 13 ],
            "faces": {
                "down":  { "uv": [  0, 9,  2, 13 ], "texture": "#texture" },
                "up":    { "uv": [  0, 9,  2, 13 ], "texture": "#texture" },
                "west":  { "uv": [ 13, 1, 15,  4 ], "texture": "#texture" },
                "east":  { "uv": [ 13, 1, 15,  4 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Lower horizontal bar of left-hand gate door",
            "from": [ 14, 6, 9 ],
            "to": [ 16, 9, 13 ],
            "faces": {
                "down":  { "uv": [ 14, 9, 16, 13 ], "texture": "#texture" },
                "up":    { "uv": [ 14, 9, 16, 13 ], "texture": "#texture" },
                "west":  { "uv": [ 13, 7, 15, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 13, 7, 15, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Upper horizontal bar of left-hand gate door",
            "from": [ 14, 12, 9 ],
            "to": [ 16, 15, 13 ],
            "faces": {
                "down":  { "uv": [ 14, 9, 16, 13 ], "texture": "#texture" },
                "up":    { "uv": [ 14, 9, 16, 13 ], "texture": "#texture" },
                "west":  { "uv": [ 13, 1, 15,  4 ], "texture": "#texture" },
                "east":  { "uv": [ 13, 1, 15,  4 ], "texture": "#texture" }
            }
        }
    ]
}

item_window.json

{
    "parent": "wm:block/oak_window_closed",
    "display": {
        "thirdperson": {
            "rotation": [ 0, -90, 170 ],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375 ]
        },
        "firstperson": {
            "rotation": [ 0, 90, 0 ],
            "translation": [ 0, 0, 0 ],
            "scale": [ 1, 1, 1 ]
        }
    }
}

eclips file structure

width=484 height=639http://s21.postimg.org/ez3o2le2f/exlips_explorer.png[/img]

 

 

any help on this matter will be greatly appreciated I have searched high and low for the answer and cannot find a solution my goal is to create some basic windows using the functions of a gate as you can see in the image I have tried to use my own texture and still I received the same errors I have checked and double checked the spellings of everything and still no avail, I have even tried converting this:

"facing=east,in_wall=true,open=false":  { "model": "wm:oak_wall_window_closed", "y": 270, "uvlock":

 

to this:

"facing=east,in_wall=true,open=false,powered=false":  { "model": "wm:oak_wall_window_closed", "y": 270, "uvlock": 

and it produces same error

 

please help! :)

Posted

It looks like your rendering will not depend on "powered", but your error message shows that MC is trying to use it. You need to tell MC to ignore that property. In client proxy, call StateMap.Builder ().addPropertiesToIgnore(...). One of mine looks like this:

 

  @Override
  public void preInit(FMLPreInitializationEvent e) {
    Builder sm = new StateMap.Builder ();

    super.preInit (e);

    sm.addPropertiesToIgnore
        (BlockFenceGate.FACING, BlockFenceGate.IN_WALL, BlockFenceGate.OPEN, BlockFenceGate.POWERED);
    ModelLoader.setCustomStateMapper (AnystoneWallsMod.blockIronGate, sm.build ());

    iwall1 = (ItemWall) Item.getItemFromBlock (AnystoneWallsMod.blockAnystoneWall);
    iwall2 = (ItemWall) Item.getItemFromBlock (AnystoneWallsMod.blockAnystoneWall2);

    addVariants (iwall1);
    addVariants (iwall2);
  }

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

Hello and THANK YOU so much its now rendering in the world, but not inventory :( it  says:

 

[FML]: Model definition for location wm:block_window#inventory not found

 

I have uncommitted the creation of

WindowItems.init();

WindowItems.register();

so it gets created and still caused the [FML]: Model definition for location wm:block_window#inventory not found error

 

changes I made

WindowsBlock.java

 

 

package com.dot6.windows.init;

import com.dot6.windows.Reference;
import com.dot6.windows.blocks.BlockWindow;

import net.minecraft.block.Block;
import net.minecraft.block.BlockPlanks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class WindowBlocks {
public static Block block_window;

public static void init()	{

	block_window = new BlockWindow(BlockPlanks.EnumType.OAK).setUnlocalizedName("block_window");
}

public static void register()
{
	GameRegistry.registerBlock(block_window, block_window.getUnlocalizedName().substring(5));
}

public static void registerRenders() 
{
	registedrRender(block_window);
}

public static void registedrRender(Block block) 
{
	Item item = Item.getItemFromBlock(block);
	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}

 

 

WindowsMod.java

 

 

package com.dot6.windows;

import com.dot6.windows.blocks.BlockWindow;
import com.dot6.windows.init.WindowBlocks;
import com.dot6.windows.init.WindowItems;
import com.dot6.windows.proxy.CommonProxy;

import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.client.renderer.block.statemap.StateMap.Builder;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
public class WindowsMod {
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{

	WindowBlocks.init();
	WindowBlocks.register();
	WindowItems.init();
	WindowItems.register();

	Builder sm = new StateMap.Builder ();		
	sm.ignore(BlockWindow.POWERED);
	ModelLoader.setCustomStateMapper (WindowBlocks.block_window, sm.build ());		
}

@EventHandler
public void preInit(FMLInitializationEvent event)
{

}

@EventHandler
public void preInit(FMLPostInitializationEvent event)
{
	proxy.registerRenders();
}

}

 

 

 

 

 

 

Posted

Sounds like you're not registering the itemblock to the ItemMesher

 

Nevermind it's just missing. What do your JSONs look like?

 

Hi, thanks for the quick replay :) if you look in my initial post under the item_window.json heading that is what it looks like :)

 

I should note I have since changed WindowItem.java

to:

 

 

package com.dot6.windows.init;

import com.dot6.windows.Reference;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class WindowItems {
public static Item item_window;

public static void init(){
	item_window = new Item().setUnlocalizedName("item_window");

}

public static void register(){
	GameRegistry.registerItem(item_window, item_window.getUnlocalizedName().substring(5)); //"tile.test_item"		
}

public static void registerRenders(){
	registerRender(item_window);
}

public static void registerRender(Item item){
	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}

 

 

 

and if I change item_window,json to block_window.json it removes the error but will not render in the inventory :(

Posted

- Replace

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register

with

ModelLoader.setCustomModelResourceLocation

.

- Do not use the unlocalized name for registering your blocks.

- You unlocalized names should include your ModID.

- "wm" is not a good choice for a ModID, it should be longer.

 

Hi and thank you :) just a couple of questions, should I be using:

  getLocalizedName() instead of UnLocalizedName?

 

You unlocalized names should include your ModID. I don't understand what you mean by this?

isn't ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), including this?

or are you referring to the when the block/item is being created so

 

block_window = new BlockWindow(BlockPlanks.EnumType.OAK).setUnlocalizedName("block_window");

would look like this

block_window = new BlockWindow(BlockPlanks.EnumType.OAK).setUnlocalizedName(Reference.MOD_ID + ":" + "block_window");

 

"wm" is not a good choice for a ModID, it should be longer.: thank you for this tip its my first time and every bit of help is appreciated :)

Posted

I would just like to thank everyone for their help I have now got it rendering in minecraft world and I have change it to use setRegistryName I still cannot it to render in the inventory though so I'm going to need to read up a bit on how that works and realizing the difference between item and block and see if i can figure out why mine is not working. Thank you all you have been a great help.

 

 

Posted

here is the updated code, I have changed item_window to block_window.json and removed item_window from main class and proxy class

 

WindowsMod.java

 

 

package com.dot6.windows;

import com.dot6.windows.blocks.BlockWindow;
import com.dot6.windows.init.WindowBlocks;
//import com.dot6.windows.init.WindowItems;
import com.dot6.windows.proxy.CommonProxy;

import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.client.renderer.block.statemap.StateMap.Builder;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
public class WindowsMod {
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{

	WindowBlocks.init();
	WindowBlocks.register();
	//WindowItems.init();
	//WindowItems.register();

	Builder sm = new StateMap.Builder ();		
	sm.ignore(BlockWindow.POWERED);
	ModelLoader.setCustomStateMapper (WindowBlocks.oak_window, sm.build ());		
}

@EventHandler
public void preInit(FMLInitializationEvent event)
{

}

@EventHandler
public void preInit(FMLPostInitializationEvent event)
{
	proxy.registerRenders();
}
}

 

 

Reference.java

 

 

package com.dot6.windows;

public class Reference {
public static final String MOD_ID = "wm";
public static final String MOD_NAME = "Windows Mod";
public static final String VERSION = "1.0";
public static final String CLIENT_PROXY_CLASS = "com.dot6.windows.proxy.ClientProxy";
public static final String SERVER_PROXY_CLASS = "com.dot6.windows.proxy.CommonProxy";
}

 

 

WindowsBlock.java

 

 

import com.dot6.windows.Reference;
import com.dot6.windows.blocks.BlockWindow;

import net.minecraft.block.Block;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockPlanks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class WindowBlocks {
public static Block oak_window;

public static void init()	{

	oak_window = (new BlockWindow(BlockPlanks.EnumType.OAK).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setRegistryName(Reference.MOD_ID + ":" + "oak_window").setUnlocalizedName("block_window"));//BlockPlanks.EnumType.OAK).setRegistryName(Reference.MOD_ID + ":" + "block_window");
         
}

public static void register()
{
	GameRegistry.registerBlock(oak_window);
}

public static void registerRenders() 
{
	registedrRender(oak_window);
}

public static void registedrRender(Block block) 
{
	Item item = Item.getItemFromBlock(block);
	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
        
}
}

 

 

BlockWindow.java

 

 

package com.dot6.windows.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockWindow extends BlockDirectional
{
    public static final PropertyBool OPEN = PropertyBool.create("open");
    public static final PropertyBool POWERED = PropertyBool.create("powered");
    public static final PropertyBool IN_WALL = PropertyBool.create("in_wall");

    public BlockWindow(BlockPlanks.EnumType p_i46394_1_)
    {
        super(Material.wood, p_i46394_1_.func_181070_c());
        this.setDefaultState(this.blockState.getBaseState().withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false)));
       
        this.setCreativeTab(CreativeTabs.tabRedstone);
    }

    /**
     * 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)
    {
        EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis();

        if (enumfacing$axis == EnumFacing.Axis.Z && (worldIn.getBlockState(pos.west()).getBlock() == Blocks.cobblestone_wall || worldIn.getBlockState(pos.east()).getBlock() == Blocks.cobblestone_wall) || enumfacing$axis == EnumFacing.Axis.X && (worldIn.getBlockState(pos.north()).getBlock() == Blocks.cobblestone_wall || worldIn.getBlockState(pos.south()).getBlock() == Blocks.cobblestone_wall))
        {
            state = state.withProperty(IN_WALL, Boolean.valueOf(true));
        }

        return state;
    }

    public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
    {
        return worldIn.getBlockState(pos.down()).getBlock().getMaterial().isSolid() ? super.canPlaceBlockAt(worldIn, pos) : false;
    }

    public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
    {
        if (((Boolean)state.getValue(OPEN)).booleanValue())
        {
            return null;
        }
        else
        {
            EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis();
            return enumfacing$axis == EnumFacing.Axis.Z ? new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)((float)pos.getZ() + 0.375F), (double)(pos.getX() + 1), (double)((float)pos.getY() + 1.5F), (double)((float)pos.getZ() + 0.625F)) : new AxisAlignedBB((double)((float)pos.getX() + 0.375F), (double)pos.getY(), (double)pos.getZ(), (double)((float)pos.getX() + 0.625F), (double)((float)pos.getY() + 1.5F), (double)(pos.getZ() + 1));
        }
    }

    public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
    {
        EnumFacing.Axis enumfacing$axis = ((EnumFacing)worldIn.getBlockState(pos).getValue(FACING)).getAxis();

        if (enumfacing$axis == EnumFacing.Axis.Z)
        {
            this.setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 1.0F, 0.625F);
        }
        else
        {
            this.setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 1.0F, 1.0F);
        }
    }

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

    public boolean isFullCube()
    {
        return false;
    }

    public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
    {
        return ((Boolean)worldIn.getBlockState(pos).getValue(OPEN)).booleanValue();
    }

    /**
     * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
     * IBlockstate
     */
    public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
    {
        return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false));
    }

    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (((Boolean)state.getValue(OPEN)).booleanValue())
        {
            state = state.withProperty(OPEN, Boolean.valueOf(false));
            worldIn.setBlockState(pos, state, 2);
        }
        else
        {
            EnumFacing enumfacing = EnumFacing.fromAngle((double)playerIn.rotationYaw);

            if (state.getValue(FACING) == enumfacing.getOpposite())
            {
                state = state.withProperty(FACING, enumfacing);
            }

            state = state.withProperty(OPEN, Boolean.valueOf(true));
            worldIn.setBlockState(pos, state, 2);
        }

        worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0);
        return true;
    }

    /**
     * Called when a neighboring block changes.
     */    
    public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
    {
        if (!worldIn.isRemote)
        {
            boolean flag = worldIn.isBlockPowered(pos);

            if (flag || neighborBlock.canProvidePower())
            {
                if (flag && !((Boolean)state.getValue(OPEN)).booleanValue() && !((Boolean)state.getValue(POWERED)).booleanValue())
                {
                    worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(true)).withProperty(POWERED, Boolean.valueOf(true)), 2);
                    worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1003, pos, 0);
                }
                else if (!flag && ((Boolean)state.getValue(OPEN)).booleanValue() && ((Boolean)state.getValue(POWERED)).booleanValue())
                {
                    worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)), 2);
                    worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1006, pos, 0);
                }
                else if (flag != ((Boolean)state.getValue(POWERED)).booleanValue())
                {
                    worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(flag)), 2);
                }
            }
        }
    }

    @SideOnly(Side.CLIENT)
    public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
    {
        return true;
    }

    /**
     * Convert the given metadata into a BlockState for this Block
     */
    public IBlockState getStateFromMeta(int meta)
    {
        return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)).withProperty(OPEN, Boolean.valueOf((meta & 4) != 0)).withProperty(POWERED, Boolean.valueOf((meta &  != 0));
    }

    /**
     * Convert the BlockState into the correct metadata value
     */
    public int getMetaFromState(IBlockState state)
    {
        int i = 0;
        i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();

        if (((Boolean)state.getValue(POWERED)).booleanValue())
        {
            i |= 8;
        }

        if (((Boolean)state.getValue(OPEN)).booleanValue())
        {
            i |= 4;
        }

        return i;
    }

    protected BlockState createBlockState()
    {
        return new BlockState(this, new IProperty[] {FACING, OPEN, POWERED, IN_WALL});
    }
    
}

 

 

ClientProxy.java

 

 

package com.dot6.windows.proxy;

import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.client.renderer.block.statemap.StateMap.Builder;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import com.dot6.windows.init.WindowBlocks;
//import com.dot6.windows.init.WindowItems;

public class ClientProxy extends CommonProxy{
@Override 
public void registerRenders(){

	WindowBlocks.registerRenders();
	//WindowItems.registerRenders();		            		
}

}

 

 

CommonProxy.java

 

 

package com.dot6.windows.proxy;

public class CommonProxy {
public void registerRenders(){

}
}

 

 

BlockStates/oak_window.json

 

 

{
    "variants": {
        "facing=south,in_wall=false,open=false": { "model": "wm:oak_window_closed" },
        "facing=west,in_wall=false,open=false":  { "model": "wm:oak_window_closed", "y": 90, "uvlock": true },
        "facing=north,in_wall=false,open=false": { "model": "wm:oak_window_closed", "y": 180, "uvlock": true },
        "facing=east,in_wall=false,open=false":  { "model": "wm:oak_window_closed", "y": 270, "uvlock": true },
        "facing=south,in_wall=false,open=true": { "model": "wm:oak_window_open" },
        "facing=west,in_wall=false,open=true":  { "model": "wm:oak_window_open", "y": 90, "uvlock": true },
        "facing=north,in_wall=false,open=true": { "model": "wm:oak_window_open", "y": 180, "uvlock": true },
        "facing=east,in_wall=false,open=true":  { "model": "wm:oak_window_open", "y": 270, "uvlock": true },
        "facing=south,in_wall=true,open=false": { "model": "wm:oak_wall_window_closed" },
        "facing=west,in_wall=true,open=false":  { "model": "wm:oak_wall_window_closed", "y": 90, "uvlock": true },
        "facing=north,in_wall=true,open=false": { "model": "wm:oak_wall_window_closed", "y": 180, "uvlock": true },
        "facing=east,in_wall=true,open=false":  { "model": "wm:oak_wall_window_closed", "y": 270, "uvlock": true },
        "facing=south,in_wall=true,open=true": { "model": "wm:oak_wall_window_open" },
        "facing=west,in_wall=true,open=true":  { "model": "wm:oak_wall_window_open", "y": 90, "uvlock": true },
        "facing=north,in_wall=true,open=true": { "model": "wm:oak_wall_window_open", "y": 180, "uvlock": true },
        "facing=east,in_wall=true,open=true":  { "model": "wm:oak_wall_window_open", "y": 270, "uvlock": true }
    }
}

 

 

models/block/

 

 

oak_wall_window_closed.json

{
    "parent": "wm:block/oak_window_closed",
    "textures": {
        "texture": "blocks/planks_oak"
    }
}

oak_wall_window_open.json

{
    "parent": "wm:block/oak_window_open",
    "textures": {
        "texture": "blocks/planks_oak"
    }
}

oak_window_closed.json

{
    "parent": "wm:block/window_closed",
    "textures": {
        "texture": "blocks/planks_oak"
    }
}

oak_window_open.json

{
    "parent": "wm:block/window_open",
    "textures": {
        "texture": "blocks/planks_oak"
    }
}

window_closed.json

{
    "textures": {
        "particle" : "#texture"
    },
    "elements": [
        {   "__comment": "Left-hand post",
            "from": [ 0, 5, 7 ],
            "to": [ 2, 16, 9 ],
            "faces": {
                "down":  { "uv": [ 0, 7, 2,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 0, 7, 2,  9 ], "texture": "#texture" },
                "north": { "uv": [ 0, 0, 2, 11 ], "texture": "#texture" },
                "south": { "uv": [ 0, 0, 2, 11 ], "texture": "#texture" },
                "west":  { "uv": [ 7, 0, 9, 11 ], "texture": "#texture", "cullface": "west" },
                "east":  { "uv": [ 7, 0, 9, 11 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Right-hand post",
            "from": [ 14, 5, 7 ],
            "to": [ 16, 16, 9 ],
            "faces": {
                "down":  { "uv": [ 14, 7, 16,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 14, 7, 16,  9 ], "texture": "#texture" },
                "north": { "uv": [ 14, 0, 16, 11 ], "texture": "#texture" },
                "south": { "uv": [ 14, 0, 16, 11 ], "texture": "#texture" },
                "west":  { "uv": [  7, 0,  9, 11 ], "texture": "#texture" },
                "east":  { "uv": [  7, 0,  9, 11 ], "texture": "#texture", "cullface": "east" }
            }
        },
        {   "__comment": "Inner vertical post of left-hand gate door",
            "from": [ 6, 6, 7 ],
            "to": [ 8, 15, 9 ],
            "faces": {
                "down":  { "uv": [ 6, 7, 8,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 6, 7, 8,  9 ], "texture": "#texture" },
                "north": { "uv": [ 6, 1, 8, 10 ], "texture": "#texture" },
                "south": { "uv": [ 6, 1, 8, 10 ], "texture": "#texture" },
                "west":  { "uv": [ 7, 1, 9, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 7, 1, 9, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Inner vertical post of right-hand gate door",
            "from": [ 8, 6, 7 ],
            "to": [ 10, 15, 9 ],
            "faces": {
                "down":  { "uv": [ 8, 7, 10,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 8, 7, 10,  9 ], "texture": "#texture" },
                "north": { "uv": [ 8, 1, 10, 10 ], "texture": "#texture" },
                "south": { "uv": [ 8, 1, 10, 10 ], "texture": "#texture" },
                "west":  { "uv": [ 7, 1,  9, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 7, 1,  9, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Lower horizontal bar of left-hand gate door",
            "from": [ 2, 6, 7 ],
            "to": [ 6, 9, 9 ],
            "faces": {
                "down":  { "uv": [ 2, 7, 6,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 2, 7, 6,  9 ], "texture": "#texture" },
                "north": { "uv": [ 2, 7, 6, 10 ], "texture": "#texture" },
                "south": { "uv": [ 2, 7, 6, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Upper horizontal bar of left-hand gate door",
            "from": [ 2, 12, 7 ],
            "to": [ 6, 15, 9 ],
            "faces": {
                "down":  { "uv": [ 2, 7, 6, 9 ], "texture": "#texture" },
                "up":    { "uv": [ 2, 7, 6, 9 ], "texture": "#texture" },
                "north": { "uv": [ 2, 1, 6, 4 ], "texture": "#texture" },
                "south": { "uv": [ 2, 1, 6, 4 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Lower horizontal bar of right-hand gate door",
            "from": [ 10, 6, 7 ],
            "to": [ 14, 9, 9 ],
            "faces": {
                "down":  { "uv": [ 10, 7, 14,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 10, 7, 14,  9 ], "texture": "#texture" },
                "north": { "uv": [ 10, 7, 14, 10 ], "texture": "#texture" },
                "south": { "uv": [ 10, 7, 14, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Upper horizontal bar of right-hand gate door",
            "from": [ 10, 12, 7 ],
            "to": [ 14, 15, 9 ],
            "faces": {
                "down":  { "uv": [ 10, 7, 14, 9 ], "texture": "#texture" },
                "up":    { "uv": [ 10, 7, 14, 9 ], "texture": "#texture" },
                "north": { "uv": [ 10, 1, 14, 4 ], "texture": "#texture" },
                "south": { "uv": [ 10, 1, 14, 4 ], "texture": "#texture" }
            }
        }
    ]
}

window_open.json

{
    "textures": {
        "particle" : "#texture"
    },
    "elements": [
        {   "__comment": "Left-hand post",
            "from": [ 0, 5, 7 ],
            "to": [ 2, 16, 9 ],
            "faces": {
                "down":  { "uv": [ 0, 7, 2,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 0, 7, 2,  9 ], "texture": "#texture" },
                "north": { "uv": [ 0, 0, 2, 11 ], "texture": "#texture" },
                "south": { "uv": [ 0, 0, 2, 11 ], "texture": "#texture" },
                "west":  { "uv": [ 7, 0, 9, 11 ], "texture": "#texture", "cullface": "west" },
                "east":  { "uv": [ 7, 0, 9, 11 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Right-hand post",
            "from": [ 14, 5, 7 ],
            "to": [ 16, 16, 9 ],
            "faces": {
                "down":  { "uv": [ 14, 7, 16,  9 ], "texture": "#texture" },
                "up":    { "uv": [ 14, 7, 16,  9 ], "texture": "#texture" },
                "north": { "uv": [ 14, 0, 16, 11 ], "texture": "#texture" },
                "south": { "uv": [ 14, 0, 16, 11 ], "texture": "#texture" },
                "west":  { "uv": [  7, 0,  9, 11 ], "texture": "#texture" },
                "east":  { "uv": [  7, 0,  9, 11 ], "texture": "#texture", "cullface": "east" }
            }
        },
        {   "__comment": "Inner vertical post of left-hand gate door",
            "from": [ 0, 6, 13 ],
            "to": [ 2, 15, 15 ],
            "faces": {
                "down":  { "uv": [  0, 13,  2, 15 ], "texture": "#texture" },
                "up":    { "uv": [  0, 13,  2, 15 ], "texture": "#texture" },
                "north": { "uv": [  0,  1,  2, 10 ], "texture": "#texture" },
                "south": { "uv": [  0,  1,  2, 10 ], "texture": "#texture" },
                "west":  { "uv": [ 13,  1, 15, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 13,  1, 15, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Inner vertical post of right-hand gate door",
            "from": [ 14, 6, 13 ],
            "to": [ 16, 15, 15 ],
            "faces": {
                "down":  { "uv": [ 14, 13, 16, 15 ], "texture": "#texture" },
                "up":    { "uv": [ 14, 13, 16, 15 ], "texture": "#texture" },
                "north": { "uv": [ 14,  1, 16, 10 ], "texture": "#texture" },
                "south": { "uv": [ 14,  1, 16, 10 ], "texture": "#texture" },
                "west":  { "uv": [ 13,  1, 15, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 13,  1, 15, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Lower horizontal bar of left-hand gate door",
            "from": [ 0, 6, 9 ],
            "to": [ 2, 9, 13 ],
            "faces": {
                "down":  { "uv": [  0, 9,  2, 13 ], "texture": "#texture" },
                "up":    { "uv": [  0, 9,  2, 13 ], "texture": "#texture" },
                "west":  { "uv": [ 13, 7, 15, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 13, 7, 15, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Upper horizontal bar of left-hand gate door",
            "from": [ 0, 12, 9 ],
            "to": [ 2, 15, 13 ],
            "faces": {
                "down":  { "uv": [  0, 9,  2, 13 ], "texture": "#texture" },
                "up":    { "uv": [  0, 9,  2, 13 ], "texture": "#texture" },
                "west":  { "uv": [ 13, 1, 15,  4 ], "texture": "#texture" },
                "east":  { "uv": [ 13, 1, 15,  4 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Lower horizontal bar of left-hand gate door",
            "from": [ 14, 6, 9 ],
            "to": [ 16, 9, 13 ],
            "faces": {
                "down":  { "uv": [ 14, 9, 16, 13 ], "texture": "#texture" },
                "up":    { "uv": [ 14, 9, 16, 13 ], "texture": "#texture" },
                "west":  { "uv": [ 13, 7, 15, 10 ], "texture": "#texture" },
                "east":  { "uv": [ 13, 7, 15, 10 ], "texture": "#texture" }
            }
        },
        {   "__comment": "Upper horizontal bar of left-hand gate door",
            "from": [ 14, 12, 9 ],
            "to": [ 16, 15, 13 ],
            "faces": {
                "down":  { "uv": [ 14, 9, 16, 13 ], "texture": "#texture" },
                "up":    { "uv": [ 14, 9, 16, 13 ], "texture": "#texture" },
                "west":  { "uv": [ 13, 1, 15,  4 ], "texture": "#texture" },
                "east":  { "uv": [ 13, 1, 15,  4 ], "texture": "#texture" }
            }
        }
    ]
}

 

 

 

models/item/

 

 

block_window.json

{
    "parent": "wm:block/oak_window_closed",
    "display": {
        "thirdperson": {
            "rotation": [ 0, -90, 170 ],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375 ]
        },
        "firstperson": {
            "rotation": [ 0, 90, 0 ],
            "translation": [ 0, 0, 0 ],
            "scale": [ 1, 1, 1 ]
        }
    }
}

 

 

       

Posted

your right I was not careful when copying and pasting now updated the main class changed the block name to oak_window

 

 

 

WindowMod.java

package com.dot6.windows;

import com.dot6.windows.blocks.BlockWindow;
import com.dot6.windows.init.WindowBlocks;
//import com.dot6.windows.init.WindowItems;
import com.dot6.windows.proxy.CommonProxy;

import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.client.renderer.block.statemap.StateMap.Builder;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
public class WindowsMod {
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{

	WindowBlocks.init();
	WindowBlocks.register();
	//WindowItems.init();
	//WindowItems.register();

	Builder sm = new StateMap.Builder ();		
	sm.ignore(BlockWindow.POWERED);
	ModelLoader.setCustomStateMapper (WindowBlocks.oak_window, sm.build ());
                proxy.registerRenders();		
}

@EventHandler
public void init(FMLInitializationEvent event)
{

}

@EventHandler
public void postInit(FMLPostInitializationEvent event)
{

}

}

WindowBlocks.java

package com.dot6.windows.init;

import com.dot6.windows.Reference;
import com.dot6.windows.blocks.BlockWindow;

import net.minecraft.block.Block;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockPlanks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class WindowBlocks {
public static Block oak_window;

public static void init()	
{

	oak_window = (new BlockWindow(BlockPlanks.EnumType.OAK).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setRegistryName(Reference.MOD_ID + ":" + "oak_window").setUnlocalizedName("oak_window"));
         
}

public static void register()
{
	GameRegistry.registerBlock(oak_window);
}

public static void registerRenders() 
{
	registedrRender(oak_window);
}

public static void registedrRender(Block block) 
{
	Item item = Item.getItemFromBlock(block);
	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
        
}
}

 

 

 

have renamed file models/item/block_window.json to models/item/oak_window.json

 

latest folder layout:

 

 

 

ok re-edited this after re-reading your last post I understand what you were saying an now have moved the registerRenderer() to preInit() and everything is working as it should THANK YOU so much you have been a massive help to me thank you once again this can now be marked as solved

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.