Nuparu00 or others that can rotate

Started by LueLusten on

Topic category: Help with MCreator software

Joined Nov 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nuparu00 or others that can rotate

Hey there, @Nuparu00 or others could you please post the fill block code for 1.10.2 and 1.11.2
I watched the video and I am dyslexic so my brain is not able to put the code in place, if you could 
post a default block with the rotation for them two version I sure I can do the json file part, long as 
I edit the right json file.

Please guys I know this is a pest but this is how I can learn and others, I really did try watch the
video and I not getting it, but if I have the code I can look at a plane one and the modded one and learn

Please I know I am asking to take your time up here but it really would help, thanks.

And will it work on a model like so

Code:
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraft.world.World;
import net.minecraft.world.IBlockAccess;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.Minecraft;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.material.Material;
import net.minecraft.block.SoundType;
import net.minecraft.block.Block;

import java.util.Random;

public class mcreator_testt {

     public mcreator_testt() {
     }

     public static BlockTestt block;

     public static Object instance;

     public int addFuel(ItemStack fuel) {
          return 0;
     }

     public void serverLoad(FMLServerStartingEvent event) {
     }

     public void preInit(FMLPreInitializationEvent event) {
     }

     public void registerRenderers() {
     }

     public void load(FMLInitializationEvent event) {
          if (event.getSide() == Side.CLIENT) {
               Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
                         .register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("TestEnvironmentMod:Testt", "inventory"));
          }
     }

     static {

          block = (BlockTestt) (new BlockTestt().setHardness(2.0F).setResistance(10.0F).setLightLevel(0.0F).setUnlocalizedName("Testt")
                    .setLightOpacity(0).setCreativeTab(CreativeTabs.BUILDING_BLOCKS));
          block.setHarvestLevel("axe", 0);
     }

     public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
     }

     public void generateNether(World world, Random random, int chunkX, int chunkZ) {
     }

     static class BlockTestt extends Block {

          int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;

          boolean red = false;

          protected BlockTestt() {
               super(Material.WOOD);
               GameRegistry.registerBlock(this, "Testt");
               setSoundType(SoundType.WOOD);

          }
         
          @Override
          public boolean isFullCube(IBlockState state) { 
               return false; 
          }
          
          @Override
          public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
               int i = pos.getX();
               int j = pos.getY();
               int k = pos.getZ();
               world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));

          }

          @Override
          public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
               return red ? 15 : 0;
          }

          @Override
          public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
               return red ? 15 : 0;
          }

          @Override
          public boolean isOpaqueCube(IBlockState state) {
               return false;
          }

          @SideOnly(Side.CLIENT)
          @Override
          public BlockRenderLayer getBlockLayer() {
               return BlockRenderLayer.SOLID;
          }

          @Override
          public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
               return new AxisAlignedBB(0.0D, 0.0D, 1.0D, 1.0D, 1.0D, 0.87D);
          }

          @Override
          public int tickRate(World world) {
               return 10;
          }

          @Override
          public int quantityDropped(Random par1Random) {
               return 1;
          }

     }
}
JSON:
{
    "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
    "textures": {
        "0": "blocks/planks_birch"
    },
    "elements": [
        {
            "name": "Top",
            "from": [ 0.0, 15.0, 14.0 ], 
            "to": [ 16.0, 16.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 16.0, 6.0, 0.0, 7.0 ], "rotation": 180 },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 16.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 16.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 16.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }
            }
        },
        {
            "name": "Side1",
            "from": [ 0.0, 0.0, 15.0 ], 
            "to": [ 1.0, 15.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
            }
        },
        {
            "name": "Side2",
            "from": [ 15.0, 0.0, 15.0 ], 
            "to": [ 16.0, 15.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
            }
        },
        {
            "name": "Side3",
            "from": [ 2.0, 0.0, 15.0 ], 
            "to": [ 3.0, 15.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
            }
        },
        {
            "name": "Side4",
            "from": [ 13.0, 0.0, 15.0 ], 
            "to": [ 14.0, 15.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
            }
        },
        {
            "name": "Side5",
            "from": [ 4.0, 0.0, 15.0 ], 
            "to": [ 5.0, 15.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
            }
        },
        {
            "name": "Side6",
            "from": [ 11.0, 0.0, 15.0 ], 
            "to": [ 12.0, 15.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
            }
        },
        {
            "name": "Side7",
            "from": [ 6.0, 0.0, 15.0 ], 
            "to": [ 7.0, 15.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
            }
        },
        {
            "name": "Side8",
            "from": [ 9.0, 0.0, 15.0 ], 
            "to": [ 10.0, 15.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 15.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
            }
        },
        {
            "name": "Middle1",
            "from": [ 7.0, 10.0, 15.0 ], 
            "to": [ 9.0, 12.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 13.0, 7.0, 15.0, 9.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "south": { "texture": "#0", "uv": [ 12.0, 3.0, 14.0, 5.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "up": { "texture": "#0", "uv": [ 13.0, 7.0, 15.0, 8.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }
            }
        },
        {
            "name": "Middle2",
            "from": [ 7.0, 6.0, 15.0 ], 
            "to": [ 9.0, 8.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 13.0, 7.0, 15.0, 9.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "south": { "texture": "#0", "uv": [ 12.0, 7.0, 14.0, 9.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                "up": { "texture": "#0", "uv": [ 13.0, 7.0, 15.0, 8.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }
            }
        },
        {
            "name": "Bottom",
            "from": [ 0.0, 0.0, 14.0 ], 
            "to": [ 16.0, 1.0, 15.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 1.0 ], "rotation": 180 },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }
            }
        }
    ]
}

Having to make this model again 6 times is painful so far this means this item would have 12 blocks in game for only 2 block useages just because my dyslexia is blocking me to understand something.

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have just created a block
Mon, 10/16/2017 - 10:14

I have just created a block with the exact name as yours, copied your code in, used your blockstate .json file and it works pretty well. Unless you want log like rotation. However, you didn't state anything about it + also it is not what the tutorial is about.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:I have just created a block
Tue, 10/17/2017 - 11:49

@#10 Shoot. I thought this would work for log-like rotation. The block i was testing had all the same side textures, that's why it did not appear to be working. 

At least now I know what to do to make it work. I think I can use this to make log-like rotating blocks feasible with only two seperate blocks though. Thanks for all the help.

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can do it this way:
Tue, 10/17/2017 - 14:43

You can do it this way: extend BlockRotatedPillar and instead of the parts of code from the video use this alternative code (simply replace the most similar thing to it , other code from the video just remove):

this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.Y));

And the blockstate file:
{
    "variants": {
        "axis=y": { "model": "testenvironmentmod:smokyquartzpillar" },
        "axis=z": { "model": "testenvironmentmod:smokyquartzpillar", "x": 90 },
        "axis=x": { "model": "testenvironmentmod:smokyquartzpillar", "x": 90, "y": 90 }
    }
}

 

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:You can do it this way:
Tue, 10/17/2017 - 17:22

@#11

So This:

this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.Y));

Should replace all of this [spoiler]

@Override           public IBlockState getStateFromMeta(int meta) {                EnumFacing facing = EnumFacing.getFront(meta);                if(facing.getAxis()==EnumFacing.Axis.Y) {                         facing=EnumFacing.NORTH;                }                return getDefaultState().withProperty(FACING, facing);           }           @Override           public int getMetaFromState(IBlockState state) {                return ((EnumFacing) state.getValue(FACING)).getIndex();           }           @Override           protected BlockStateContainer createBlockState() {               return new BlockStateContainer(this, new IProperty[]{FACING});           }           @Override           public IBlockState getStateForPlacement(World worldIn, BlockPos pos,EnumFacing facing, float hitX, float hitY, float hitZ, int meta,EntityLivingBase placer) {              return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());           }   @Override public void onBlockAdded(World world, BlockPos pos, IBlockState state) { int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));   }

[/spoiler]?

And then this

{
    "variants": {
        "axis=y": { "model": "testenvironmentmod:smokyquartzpillar" },
        "axis=z": { "model": "testenvironmentmod:smokyquartzpillar", "x": 90 },
        "axis=x": { "model": "testenvironmentmod:smokyquartzpillar", "x": 90, "y": 90 }
    }
}

replaces this in the blocksate json?

[spoiler]

  "facing=up": { "model": "testenvironmentmod:smokyquartzpillar" }, "facing=south": { "model": "testenvironmentmod:smokyquartzpillar" }, "facing=east": { "model": "testenvironmentmod:smokyquartzpillar","y":90 }, "facing=west": { "model": "testenvironmentmod:smokyquartzpillar","y":270 }, "facing=north": { "model": "testenvironmentmod:smokyquartzpillar","y":180 }     }

[/spoiler]

or do I still need that?

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Practically remove all code
Tue, 10/17/2017 - 17:32

Practically remove all code from the tutorial  extend  BlockRotatedPillar and put this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.Y)); to the constructor.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Practically remove all code
Tue, 10/17/2017 - 22:24

@#12

I'm sorry, but I don't exactly know for sure what you mean. 

If its not too much trouble, could you post an example code for this log-like rotation like you did on comment #3 of this forum topic?

Thanks.

Joined Nov 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Right if you was able to
Wed, 10/18/2017 - 12:00

Right if you was able to remake the block can you please post like I ask very nicely in the first time around the block code and json file for 1.10.2, I read the hole of the posts here but you confused me more, I am no where near closer to been able to understand this.

So please can you post the code for the block and the json for file 1.10.2 so I can compaire the two and learn that way I made it very clear I am dysliexc and saying change this and that without seeing what this and that is for me does not work, please can you respect this and please for love and money just post the two files, its way less work then having to remake someones block and telling them it works your end/

Please I know your trying to get people to learn for them selves and this is how I learn so please, the block code and json for 1.10.2

I know this wont sound very good but like I said dyslexic and this as now stressed me out as I come back and the post seems be it don't work it sould work kinda of thing, please help a panda out here.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Right if you was able to
Wed, 10/18/2017 - 12:54

@#13

The code does work, I just misunderstood HOW it works. The code in the video is meant for blocks where the side textures are different, and it will rotate the block to have the "front" face the direction it was placed in.

What I thought it was, and what I want to get from it is to make it rotate like a log or pillar, that is, have the "top" texture face the direction it was placed.

Regarding the original code from the video, I can put together a comparison between two of my blocks, one that rotates and one that does not for you later today. It will help me out some too.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Never mind, apparantly I can
Wed, 10/18/2017 - 17:04

Never mind, apparantly I can't. For some reason, the new block (called rotationtest) I made for the purpose of comparing it to my working block (called smokyQuartzPillar) is not working. But here it is anyways.

Bolded text is all stuff from the code of the working block that I added in. If it is not bold, it was already there, so you can get the original block's code by deleting everything that is bold

[spoiler]

package mod.mcreator;

 

import net.minecraftforge.fml.relauncher.SideOnly;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.common.registry.GameRegistry;

import net.minecraftforge.fml.common.event.FMLServerStartingEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

 

import net.minecraft.world.World;

import net.minecraft.world.IBlockAccess;

import net.minecraft.util.math.BlockPos;

import net.minecraft.util.math.AxisAlignedBB;

import net.minecraft.util.EnumFacing;

import net.minecraft.util.BlockRenderLayer;

import net.minecraft.item.ItemStack;

import net.minecraft.item.ItemBlock;

import net.minecraft.item.Item;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;

import net.minecraft.client.Minecraft;

import net.minecraft.block.state.IBlockState;

import net.minecraft.block.material.Material;

import net.minecraft.block.SoundType;

import net.minecraft.block.Block;

 

import java.util.Random;

 

public class mcreator_rotationtest {

 

                public mcreator_rotationtest() {

                }

 

                public static BlockRotationtest block;

 

                public static Object instance;

          public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);

 

 

                public int addFuel(ItemStack fuel) {

                                return 0;

                }

 

                public void serverLoad(FMLServerStartingEvent event) {

                }

 

                public void preInit(FMLPreInitializationEvent event) {

                                block.setRegistryName("rotationtest");

                                GameRegistry.register(block);

                                GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));

                }

 

                public void registerRenderers() {

                }

 

                public void load(FMLInitializationEvent event) {

                                if (event.getSide() == Side.CLIENT) {

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

                                                                                .register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("testenvironmentmod:rotationtest", "inventory"));

                                }

                }

 

                static {

 

                                block = (BlockRotationtest) (new BlockRotationtest().setHardness(2.0F).setResistance(10.0F).setLightLevel(0.0F)

                                                                .setUnlocalizedName("Rotationtest").setLightOpacity(0).setCreativeTab(mcreator_modBlocks.tab));

                                block.setHarvestLevel("pickaxe", 4);

                }

 

                public void generateSurface(World world, Random random, int chunkX, int chunkZ) {

                }

 

                public void generateNether(World world, Random random, int chunkX, int chunkZ) {

                }

 

                static class BlockRotationtest extends Block {

 

                                int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;

 

                                boolean red = false;

 

                                protected BlockRotationtest() {

                                                super(Material.GROUND);

 

                                                setSoundType(SoundType.WOOD);

this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));

 

                                }

                               

                                @Override

          public IBlockState getStateFromMeta(int meta) {

               EnumFacing facing = EnumFacing.getFront(meta);

               if(facing.getAxis()==EnumFacing.Axis.Y) {

                        facing=EnumFacing.NORTH;

               }

               return getDefaultState().withProperty(FACING, facing);

          }

          @Override

          public int getMetaFromState(IBlockState state) {

               return ((EnumFacing) state.getValue(FACING)).getIndex();

          }

          @Override

          protected BlockStateContainer createBlockState() {

              return new BlockStateContainer(this, new IProperty[]{FACING});

          }

          @Override

          public IBlockState getStateForPlacement(World worldIn, BlockPos pos,EnumFacing facing, float hitX, float hitY, float hitZ, int meta,EntityLivingBase placer) {

             return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());

          }

 

 

                                @Override

                                public void onBlockAdded(World world, BlockPos pos, IBlockState state) {

                                                int i = pos.getX();

                                                int j = pos.getY();

                                                int k = pos.getZ();

                                                world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));

 

                                }

 

                                @Override

                                public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {

                                                return red ? 15 : 0;

                                }

 

                                @Override

                                public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {

                                                return red ? 15 : 0;

                                }

 

                                @SideOnly(Side.CLIENT)

                                @Override

                                public BlockRenderLayer getBlockLayer() {

                                                return BlockRenderLayer.SOLID;

                                }

 

                                @Override

                                public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {

                                                return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);

                                }

 

                                @Override

                                public int tickRate(World world) {

                                                return 10;

                                }

 

                                @Override

                                public int quantityDropped(Random par1Random) {

                                                return 1;

                                }

 

                }

}

[/spoiler]

This is the code of the block I got to work properly:

[spoiler]

    import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent;   import net.minecraft.world.World; import net.minecraft.world.IBlockAccess; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.EnumFacing; import net.minecraft.util.BlockRenderLayer; import net.minecraft.item.ItemStack; import net.minecraft.item.Item; import net.minecraft.entity.EntityLivingBase; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.Minecraft; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.IProperty; import net.minecraft.block.material.Material; import net.minecraft.block.SoundType; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock;   import java.util.Random;     public class mcreator_smokyQuartzPillar {   public mcreator_smokyQuartzPillar() { }   public static BlockSmokyQuartzPillar block;   public static Object instance;         public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);   public int addFuel(ItemStack fuel) { return 0; }   public void serverLoad(FMLServerStartingEvent event) { }   public void preInit(FMLPreInitializationEvent event) { block.setRegistryName("smokyquartzpillar"); GameRegistry.register(block); GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName())); }   public void registerRenderers() { }   public void load(FMLInitializationEvent event) { if (event.getSide() == Side.CLIENT) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("testenvironmentmod:smokyquartzpillar", "inventory")); }   GameRegistry.addRecipe(new ItemStack(block, 2), new Object[]{"XXX", "X4X", "X7X", Character.valueOf('4'), mcreator_smokyquartzBlock.block, Character.valueOf('7'), mcreator_smokyquartzBlock.block,}); }   static {   block = (BlockSmokyQuartzPillar) (new BlockSmokyQuartzPillar().setHardness(0.8F).setResistance(4.0F).setLightLevel(0.0F) .setUnlocalizedName("SmokyQuartzPillar").setLightOpacity(0).setCreativeTab(mcreator_modBlocks.tab)); block.setHarvestLevel("pickaxe", 1); }   public void generateSurface(World world, Random random, int chunkX, int chunkZ) { }   public void generateNether(World world, Random random, int chunkX, int chunkZ) { }   static class BlockSmokyQuartzPillar extends Block {   int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;   boolean red = false;   protected BlockSmokyQuartzPillar() { super(Material.ROCK);   setSoundType(SoundType.STONE);   }          @Override           public IBlockState getStateFromMeta(int meta) {                EnumFacing facing = EnumFacing.getFront(meta);                if(facing.getAxis()==EnumFacing.Axis.Y) {                         facing=EnumFacing.NORTH;                }                return getDefaultState().withProperty(FACING, facing);           }           @Override           public int getMetaFromState(IBlockState state) {                return ((EnumFacing) state.getValue(FACING)).getIndex();           }           @Override           protected BlockStateContainer createBlockState() {               return new BlockStateContainer(this, new IProperty[]{FACING});           }           @Override           public IBlockState getStateForPlacement(World worldIn, BlockPos pos,EnumFacing facing, float hitX, float hitY, float hitZ, int meta,EntityLivingBase placer) {              return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());           }   @Override public void onBlockAdded(World world, BlockPos pos, IBlockState state) { int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));   }   @Override public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return red ? 15 : 0; }   @Override public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return red ? 15 : 0; }   @SideOnly(Side.CLIENT) @Override public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.SOLID; }   @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); }   @Override public int tickRate(World world) { return 10; }   @Override public int quantityDropped(Random par1Random) { return 1; }   } }

[/spoiler]

I've spent over an hour nit-picking these codes, trying to find out why my new block won't work, and I've got nothing.

By the way, this is the error message I get in the console log when I try recompiling the new block:

[spoiler]

#################################################
:clean
:deobfCompileDummyTask
:deobfProvidedDummyTask
:sourceApiJava
:compileApiJava UP-TO-DATE
:processApiResources UP-TO-DATE
:apiClasses UP-TO-DATE
:sourceMainJava
C:\Pylo\MCreator175\forge\build\sources\main\java\mod\mcreator\mcreator_rotationtest.java:36: error: cannot find symbol
          public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
                              ^
  symbol:   class PropertyDirection
  location: class mcreator_rotationtest
C:\Pylo\MCreator175\forge\build\sources\main\java\mod\mcreator\mcreator_rotationtest.java:102: error: cannot find symbol
          protected BlockStateContainer createBlockState() {
                    ^
  symbol:   class BlockStateContainer
  location: class BlockRotationtest
C:\Pylo\MCreator175\forge\build\sources\main\java\mod\mcreator\mcreator_rotationtest.java:106: error: cannot find symbol
          public IBlockState getStateForPlacement(World worldIn, BlockPos pos,EnumFacing facing, float hitX, float hitY, float hitZ, int meta,EntityLivingBase placer) {
                                                                                                                                              ^
  symbol:   class EntityLivingBase
  location: class BlockRotationtest
C:\Pylo\MCreator175\forge\build\sources\main\java\mod\mcreator\mcreator_rotationtest.java:36: error: cannot find symbol
          public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
                                                         ^
  symbol:   variable PropertyDirection
  location: class mcreator_rotationtest
C:\Pylo\MCreator175\forge\build\sources\main\java\mod\mcreator\mcreator_rotationtest.java:103: error: cannot find symbol
              return new BlockStateContainer(this, new IProperty[]{FACING});
                         ^
  symbol:   class BlockStateContainer
  location: class BlockRotationtest
C:\Pylo\MCreator175\forge\build\sources\main\java\mod\mcreator\mcreator_rotationtest.java:103: error: cannot find symbol
              return new BlockStateContainer(this, new IProperty[]{FACING});
                                                       ^
  symbol:   class IProperty
  location: class BlockRotationtest
6 errors
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
BUILD FAILED
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Total time: 14.253 secs

[/spoiler]

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You have forgotten these
Wed, 10/18/2017 - 17:10

You have forgotten these imports:​

import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.IProperty;
Joined Nov 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think you will find you
Wed, 10/18/2017 - 17:47

I think you will find you named that block rotationtest

Joined Nov 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
OK I added ur working block
Wed, 10/18/2017 - 17:56

OK I added ur working block and I get this error on building 

[spoiler]

Executing gradle command: clean build
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.
D:\Apps\MCreator174>cd forge
D:\Apps\MCreator174\forge>SET "JAVA_HOME=D:\Apps\MCreator174\jdk64\"
D:\Apps\MCreator174\forge>SET JAVA_EXE=%JAVA_HOME%\bin\java.exe
D:\Apps\MCreator174\forge>SET PATH=%JAVA_HOME%\bin\;%PATH%
D:\Apps\MCreator174\forge>gradlew -Dorg.gradle.jvmargs="-Xms625m -Xmx8192m" clean build
#################################################
         ForgeGradle 2.2-SNAPSHOT-d13a6c8        
  https://github.com/MinecraftForge/ForgeGradle  
#################################################
               Powered by MCP unknown               
             http://modcoderpack.com             
         by: Searge, ProfMobius, Fesh0r,         
         R4wk, ZeuX, IngisKahn, bspkrs           
#################################################
:clean
:deobfCompileDummyTask
:getVersionJson
:extractUserdev UP-TO-DATE
:downloadClient SKIPPED
:downloadServer SKIPPED
:splitServerJar SKIPPED
:mergeJars SKIPPED
:applyBinaryPatches SKIPPED
:deobfProvidedDummyTask
:extractDependencyATs SKIPPED
:extractMcpData SKIPPED
:extractMcpMappings SKIPPED
:genSrgs SKIPPED
:deobfMcMCP SKIPPED
:sourceApiJava
:compileApiJava UP-TO-DATE
:processApiResources UP-TO-DATE
:apiClasses UP-TO-DATE
:sourceMainJava
D:\Apps\MCreator174\forge\build\sources\main\java\mod\mcreator\mcreator_rotationtest.java:136: error: cannot find symbol
      protected BlockStateContainer createBlockState() {
                ^
  symbol:   class BlockStateContainer
  location: class BlockRotationtest
D:\Apps\MCreator174\forge\build\sources\main\java\mod\mcreator\mcreator_rotationtest.java:83: error: cannot find symbol
      .setUnlocalizedName("Rotationtest").setLightOpacity(0).setCreativeTab(CreativeTabs.BUILDING_BLOCKS));
                                                                            ^
:compileJava FAILED
  symbol:   variable CreativeTabs
  location: class mcreator_rotationtest
D:\Apps\MCreator174\forge\build\sources\main\java\mod\mcreator\mcreator_rotationtest.java:138BUILD FAILED
: error: cannot find symbol
Total time: 16.332 secs
         return new BlockStateContainer(this, new IProperty[]{FACING});
                    ^
  symbol:   class BlockStateContainer
  location: class BlockRotationtest
D:\Apps\MCreator174\forge\build\sources\main\java\mod\mcreator\mcreator_rotationtest.java:142: error: method does not override or implement a method from a supertype
      @Override
      ^
4 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
D:\Apps\MCreator174\forge>
Task completed with return code 0 in 16738 milliseconds

[/spoiler]

Joined Nov 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also I made it clear I can't
Wed, 10/18/2017 - 18:04

Also I made it clear I can't understand the video so can we keep my topic please I really getting upset with this now, I asked for help and it seems my help as moved else where, I asked nicely for the 1.10.2 code what works your code does not work.

I am not asking for someone to do my work for me, I just asking for that simple block what already works so I can learn from it, I feel this code you posted is for 1.11.2 as it's not working in 1.10.2.

You might say yours works from the video but this is not what this topic was about I was unable to understand the changes from his video, so I am lost and asked here but it seems you two are talking another language as what I asked as been over looked, so please back on track.

 

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The actual code is pretty
Wed, 10/18/2017 - 21:40

The actual code is pretty much same for both 1.10.2 and 1.11.2. There are some differences in code, but they should be just in the MCreator generated one. (For example, in 1.10.2 it generates: GameRegistry.registerBlock() , in 1.11.2: GameRegistry.register().
The error says that the code cannot find a class with name BlockStateContainer. I do not know how exactly your code looks, however, this class exists in 1.10.2, so most likely you have not import for the class. 

So you can use that "Fix imports button", or if that won't help, you can manually add:
import net.minecraft.block.state.BlockStateContainer;

Hopefully, this will work.