Jump to content

archieab

Members
  • Posts

    33
  • Joined

  • Last visited

Everything posted by archieab

  1. The tutorial I’m following must be incorrect. Could you suggest a way to decide the block’s direction?
  2. I've just made a new topic including my BlockDrill.java if you'd like to continue over there.
  3. Hello! I recently added the propertyDirection tag to my block "Drill". No errors are shown in the console or FML log, but the block for some reason doesn't follow the direction it should be placed in. (Minecraft Forge 1.10.2 in Eclipse) Block (BlockDrill.java) package archieab.andustry.blocks; import java.util.List; import archieab.andustry.Reference; import archieab.andustry.blocks.item.IMetaBlockName; import archieab.andustry.handlers.EnumHandler.MacTypes; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; public class BlockDrill extends Block implements IMetaBlockName { public static final PropertyEnum TYPE = PropertyEnum.create("type", MacTypes.class); public static final PropertyDirection FACING = PropertyDirection.create("facing"); public BlockDrill(String unlocalizedName) { super(Material.IRON); this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName)); this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, MacTypes.BASIC).withProperty(FACING, EnumFacing.NORTH)); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {TYPE,FACING}); } @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return super.onBlockPlaced(worldIn, pos, BlockPistonBase.getFacingFromEntity(pos, placer), hitX, hitY, hitZ, meta, placer); } @Override public int getMetaFromState(IBlockState state) { MacTypes type = (MacTypes) state.getValue(TYPE); return type.getID(); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(TYPE, MacTypes.values()[meta]); } @Override public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) { for(int i = 0; i < MacTypes.values().length; i++) { list.add(new ItemStack(itemIn, 1, i)); } } @Override public String getSpecialName(ItemStack stack) { return MacTypes.values()[stack.getItemDamage()].getName(); } @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(Item.getItemFromBlock(this), 1, getMetaFromState(world.getBlockState(pos))); } @Override public int damageDropped(IBlockState state) { return getMetaFromState(state); } } Blockstate json (drill.json) Basic drill model (block_drill_basic.json) Advanced drill model (block_drill_advanced.json) Basic drill item model (block_drill_basic.json) Advanced drill item model (block_drill_advanced.json) Any help would be greatly appreciated.
  4. I've fixed all the errors, but for some reason, the block still doesn't follow the direction when placed! Any other suggestions? (thanks for troubleshooting the errors btw)
  5. As far as I'm concerned, all my JSON files are correctly formatted. Blockstate json (drill.json) Basic drill model (block_drill_basic.json) Advanced drill model (block_drill_advanced.json) Basic drill item model (block_drill_basic.json) Advanced drill item model (block_drill_advanced.json)
  6. Okay Draco18s, do you know why I'm receiving this error?
  7. Hello, fellow modders! I've encountered an issue with a depricated tag, .onBlockPlaced. What could I replace it with? I'm modding on 1.10.2 version of Forge in Eclipse. Any help would be appreciated! The ".onBlockPlaced" is crossed out, meaning it is depricated. (Not sure what to replace the code with)Many thanks in advance,- archieab
  8. Hello! I'm currently modding for 1.10.2, and I've recently ran into a blockstates issue. When running the client, the console outputs a error about an exception loading model variant. My block texture shows perfectly in the inventory, but when I place the block, it shows the ERROR texture. I checked my FML logs, and I think I found the error. Any help would be greatly appreciated. (PS. I'm presuming it's an issue with the blockstate file) Main block file Blockstate file Error received in FML log Once again, any help would be greatly appreciated!
×
×
  • Create New...

Important Information

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