Jump to content

FacelessTiger

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by FacelessTiger

  1. Yeah, it was the missing variant. I was just using normal instead of "facing=north": { "model": "mm:custom_furnace_active" }, "facing=south": { "model": "mm:custom_furnace_active", "y": 180 }, "facing=west": { "model": "mm:custom_furnace_active", "y": 270 }, "facing=east": { "model": "mm:custom_furnace_active", "y": 90 }
  2. Ah, you're right. I thought that was just a don't worry about it console message, my bad. It's working now, thank you.
  3. common mistake lol The register renders are in my block class package com.facelesstiger.mod.init; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; import com.facelesstiger.mod.MyMod; import com.facelesstiger.mod.Reference; import com.facelesstiger.mod.blocks.BlockTest; import com.facelesstiger.mod.blocks.CustomFurnace; import com.facelesstiger.mod.blocks.TileEntityCustomFurnace; public class Blocks { public static Block test_block; public static Block custom_furnace_idle; public static Block custom_furnace_active; public static void init() { test_block = new BlockTest(Material.cloth).setUnlocalizedName("test_block").setCreativeTab(MyMod.tab); custom_furnace_idle = new CustomFurnace(false).setUnlocalizedName("custom_furnace_idle").setCreativeTab(MyMod.tab).setHardness(3.5f); custom_furnace_active = new CustomFurnace(true).setUnlocalizedName("custom_furnace_active").setHardness(3.5f).setLightLevel(0.9f); } public static void register() { GameRegistry.registerBlock(test_block, test_block.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(custom_furnace_idle, custom_furnace_idle.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(custom_furnace_active, custom_furnace_active.getUnlocalizedName().substring(5)); GameRegistry.registerTileEntity(TileEntityCustomFurnace.class, "tile_entity_custom_furnace"); } public static void registerRenders() { registerRender(test_block); registerRender(custom_furnace_idle); registerRender(custom_furnace_active); } public static void registerRender(Block block) { Item item = Item.getItemFromBlock(block); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } } The blockstate JSON is src/main/resources/assets/mm/blockstates { "variants": { "normal": {"model": "mm:custom_furnace_active"} } } both active and idle are the same except using a different model directory
  4. Ah, sorry I should of payed more attention to arguments you gave. But still it has the same effect. package com.facelesstiger.mod.blocks; import java.util.Random; import javax.swing.Icon; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.facelesstiger.mod.init.Blocks; public class CustomFurnace extends Block { private final boolean isActive; private Icon iconFront; public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public CustomFurnace(boolean isActive) { super(Material.rock); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.isActive = isActive; } // IGNORE ICONS, USE JSON public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(Blocks.custom_furnace_idle); } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { super.onBlockAdded(worldIn, pos, state); this.setDefaultDirection(worldIn, pos, state); } private void setDefaultDirection(World world, BlockPos pos, IBlockState state) { if(!world.isRemote) { Block block = world.getBlockState(pos.north()).getBlock(); Block block1 = world.getBlockState(pos.south()).getBlock(); Block block2 = world.getBlockState(pos.west()).getBlock(); Block block3 = world.getBlockState(pos.east()).getBlock(); EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock()) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock()) { enumfacing = EnumFacing.NORTH; } else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock()) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock()) { enumfacing = EnumFacing.WEST; } world.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); } } public TileEntity createTileEntity(World world, IBlockState state) { return new TileEntityCustomFurnace(); } public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2); if(stack.hasDisplayName()) { ((TileEntityCustomFurnace)worldIn.getTileEntity(pos)).setGuiDisplayName(stack.getDisplayName()); } } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {FACING}); } public boolean hasTileEntity(IBlockState state) { return true; } public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } }
  5. That seemed to make no difference, I might just be dumb and doing it wrong so I'll post the new code here. package com.facelesstiger.mod.blocks; import java.util.Random; import javax.swing.Icon; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.facelesstiger.mod.init.Blocks; public class CustomFurnace extends Block { private final boolean isActive; private Icon iconFront; public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public CustomFurnace(boolean isActive) { super(Material.rock); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.isActive = isActive; } // IGNORE ICONS, USE JSON public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(Blocks.custom_furnace_idle); } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { super.onBlockAdded(worldIn, pos, state); this.setDefaultDirection(worldIn, pos, state); } private void setDefaultDirection(World world, BlockPos pos, IBlockState state) { if(!world.isRemote) { Block block = world.getBlockState(pos.north()).getBlock(); Block block1 = world.getBlockState(pos.south()).getBlock(); Block block2 = world.getBlockState(pos.west()).getBlock(); Block block3 = world.getBlockState(pos.east()).getBlock(); EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock()) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock()) { enumfacing = EnumFacing.NORTH; } else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock()) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock()) { enumfacing = EnumFacing.WEST; } world.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); } } public TileEntity createTileEntity(World world, IBlockState state) { return new TileEntityCustomFurnace(); } public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2); if(stack.hasDisplayName()) { ((TileEntityCustomFurnace)worldIn.getTileEntity(pos)).setGuiDisplayName(stack.getDisplayName()); } } public int getRenderType() { return 3; } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {FACING}); } public boolean hasTileEntity() { return true; } public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } }
  6. Hello, I have been trying to make a custom furnace. But suddenly the texture stopped working in the world but continued to work in my hand. I have searched through the console about 1000 times and have found no console errors. models.block.custom_furnace_active.json { "textures": { "0": "mm:blocks/custom_furnace_front_active", "1": "mm:blocks/custom_furnace_side" }, "elements": [ { "name": "Cube", "from": [ 0.0, 0.0, 0.0 ], "to": [ 16.0, 16.0, 16.0 ], "faces": { "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "south": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "up": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "down": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } } } ] } models.block.custom_furnace_idle.json { "textures": { "0": "mm:blocks/custom_furnace_front_idle", "1": "mm:blocks/custom_furnace_side" }, "elements": [ { "name": "Cube", "from": [ 0.0, 0.0, 0.0 ], "to": [ 16.0, 16.0, 16.0 ], "faces": { "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "south": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "up": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "down": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } } } ] } CustomFurnace.java package com.facelesstiger.mod.blocks; import java.util.Random; import javax.swing.Icon; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.facelesstiger.mod.init.Blocks; public class CustomFurnace extends BlockContainer { private final boolean isActive; private Icon iconFront; public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public CustomFurnace(boolean isActive) { super(Material.rock); //this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.isActive = isActive; } // IGNORE ICONS, USE JSON public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(Blocks.custom_furnace_idle); } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { super.onBlockAdded(worldIn, pos, state); this.setDefaultDirection(worldIn, pos, state); } private void setDefaultDirection(World world, BlockPos pos, IBlockState state) { if(!world.isRemote) { Block block = world.getBlockState(pos.north()).getBlock(); Block block1 = world.getBlockState(pos.south()).getBlock(); Block block2 = world.getBlockState(pos.west()).getBlock(); Block block3 = world.getBlockState(pos.east()).getBlock(); EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock()) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock()) { enumfacing = EnumFacing.NORTH; } else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock()) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock()) { enumfacing = EnumFacing.WEST; } world.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); } } public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityCustomFurnace(); } public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2); if(stack.hasDisplayName()) { ((TileEntityCustomFurnace)worldIn.getTileEntity(pos)).setGuiDisplayName(stack.getDisplayName()); } } public int getRenderType() { return 3; } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {FACING}); } public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } } TileEntityCustomFurnace.java package com.facelesstiger.mod.blocks; import net.minecraft.tileentity.TileEntity; public class TileEntityCustomFurnace extends TileEntity { private String localizedName; public void setGuiDisplayName(String displayName) { this.localizedName = displayName; } }
×
×
  • Create New...

Important Information

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