How to make Rotatable Block [VIDEO TUTORIAL]

Started by Nuparu00 on

Topic category: User side tutorials

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make Rotatable Block [VIDEO TUTORIAL]
Wed, 01/04/2017 - 20:31 (edited)

Hi. Because there is not his feature in MCreater itself and many of you need it for your mod , I decided to make a video tutorial how to make custom block rotatable , using PropertyDirection.
LINK

 

 

Edited by Klemen on Wed, 01/04/2017 - 20:31
Joined Oct 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:So something like this?
Sun, 03/05/2017 - 20:12

@#9 Yes this is what I mean. Also, after I change the code, and save it then come back after closing MCreator my code is reverted back to the default. Any, idea why? I will add my code shortly.

 

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Something like this should
Sun, 03/05/2017 - 22:37

Something like this should work:
world.setBlockState(new BlockPos(i, j, k),
mcreator_heaterOn.block.getStateFromMeta(mcreator_heater.block.getMetaFromState(world.getBlockState(new BlockPos(i,j,k)))), 3);

Joined Oct 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried the same code from
Tue, 03/14/2017 - 02:43

I tried the same code from your tutorial for the new version of MCreator and Minecraft 1.11.2. It didn't work. I have been looking for blocks with MCP, but not sure what block to use. What would you suggest looking at?

 

Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Something like this should
Tue, 03/14/2017 - 15:27

@#50 

Hi sorry
I do not know how to get help
No one answers me
if someone could help me
I would be very grateful since I am making a mod
And my programming is very limited, to one who spent whole days reading,
The programming without anyone explaining is very difficult

GameRegistry.addShapelessRecipe(recStack, new Object[]{new ItemStack(Blocks.wool, 1, 15),});
    }

 

This line of code, Comprises a block of black wool

How do I change the code, so that it accepts any type of wool, regardless of the color?

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:Something like this should
Tue, 03/14/2017 - 17:33

@#50.1 Hello. In your recipe code : GameRegistry.addShapelessRecipe(recStack, new Object[]{new ItemStack(Blocks.wool, 1, 15),});
    }

 15 - is metadata. There are multiple ways to make it accept all types, but the best one is probably just replacing it by OreDictionary.WILDCARD_VALUE

Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:RE:Something like this should
Wed, 03/15/2017 - 09:31

@#50.1.1 Hello nuparu, as I tell you my knowledge is very low, if you could explain where I put that exactly or teach me how I do thank you. I do not want to bother you more than necessary
A greeting wolferinet

Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:RE:Something like this should
Wed, 03/15/2017 - 18:00

@#50.1.1 

C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rLanaXHilo.java:24: error: cannot find symbol
      GameRegistry.addShapelessRecipe(recStack, new Object[]{new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE),});
                                                                                           ^
  symbol:   variable OreDictionary
  location: class mcreator_rLanaXHilo
1 error

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:RE:RE:Something like this should
Wed, 03/15/2017 - 18:06

@#50.1.1.2 Does your code import net.minecraftforge.oredict.OreDictionary ?

Joined Mar 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
well i dont get it by the
Wed, 03/15/2017 - 18:47

well i dont get it by the code but i can hard to see your vides what you say but i have to learn on my own 

Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:RE:RE:RE:Something like this should
Wed, 03/22/2017 - 16:45

@#50.1.1.2.1  ok ya pude solucionarlo con un mods que me deja modificar las recetas , un saludo y muchas gracias por todo

Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can i have some help. This is
Thu, 03/23/2017 - 18:19

Can i have some help. This is my block code:

[spoiler]

package mod.mcreator;

import net.minecraft.world.World;

import net.minecraft.world.IBlockAccess;

import net.minecraft.util.MathHelper;

import net.minecraft.util.IIcon;

import net.minecraft.item.ItemStack;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.client.Minecraft;

import net.minecraft.block.material.Material;

import net.minecraft.block.Block;

import java.util.Random;

import cpw.mods.fml.relauncher.SideOnly;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.event.FMLServerStartingEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import net.minecraft.entity.*;

public class mcreator_Stair {

   public mcreator_Stair() {

   }

   public static BlockStair block;

   public static Object instance;

   public int addFuel(ItemStack fuel) {

       return 0;

   }

   public void serverLoad(FMLServerStartingEvent event) {

   }

   public void preInit(FMLPreInitializationEvent event) {

       GameRegistry.registerBlock(block, "Stair");

   }

   public void registerRenderers() {

   }

   public void load() {

   }

   static {

       block = (BlockStair) (new BlockStair().setHardness(2.0F).setResistance(10.0F).setLightLevel(0.0F).setBlockName("Stair")

               .setBlockTextureName("RedwoodPlank").setLightOpacity(0).setStepSound(Block.soundTypeStone).setCreativeTab(CreativeTabs.tabBlock));

       block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);

       Block.blockRegistry.addObject(419, "Stair", block);

       block.setHarvestLevel("pickaxe", 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 BlockStair extends Block {

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

       Random field_149942_b = new Random();

       IIcon gor = null, dol = null, st1 = null, st2 = null, st3 = null, st4 = null;

       boolean red = false;

       protected BlockStair() {

           super(Material.ground);

       }

       public void onBlockAdded(World world, int i, int j, int k) {

           EntityPlayer entity = Minecraft.getMinecraft().thePlayer;

           if (entity != null && world != null) {

               int le = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

               world.setBlockMetadataWithNotify(i, j, k, le, 2);

           }

           world.scheduleBlockUpdate(i, j, k, this, this.tickRate(world));

       }

       public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {

           return red ? 1 : 0;

       }

         @SideOnly(Side.CLIENT)

   @Override

   public IIcon getIcon(int side, int meta) {

      

       

       

        if(meta == 0){

         if(side == 0){

             return gor;

         }

         if(side == 0){

             return dol;

         }

         if (side == 2){

             return st2;

         }

               

        }

        if(meta == 1){

         if(side == 0){

             return gor;

         }

         if(side == 0){

             return dol;

         }

         if (side == 5){

            return st2;

         }

               

        }

             if(meta == 2){

         if(side == 0){

             return gor;

         }

         if(side == 0){

             return dol;

         }

         if (side == 3){

             return st2;

         }

               

        }

         if(meta == 3){

         if(side == 0){

             return gor;

         }

         if(side == 0){

             return dol;

         }

         if (side == 4){

             return st2;

         }

               

        }

           

           return st1;

   }

   public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLivingBase, ItemStack itemStack) {

int l = MathHelper.floor_double((double)(entityLivingBase.rotationYaw * 4.0F /360.0F) + 0.5D) & 3;

world.setBlockMetadataWithNotify(x,y,z,l,2);

}

   

       @SideOnly(Side.CLIENT)

       @Override

       public void registerBlockIcons(IIconRegister reg) {

           this.gor = reg.registerIcon("RedwoodPlank");

           this.dol = reg.registerIcon("Ender_quartz_block_lines_top");

           this.st1 = reg.registerIcon("Squartz_block_lines");

           this.st2 = reg.registerIcon("Squartz_block_lines");

           this.st3 = reg.registerIcon("Squartz_block_lines");

           this.st4 = reg.registerIcon("darkportal_single");

       }

       public int getRenderType() {

           return 0;

       }

       @Override

       public int tickRate(World world) {

           return 10;

       }

       public int quantityDropped(Random par1Random) {

           return 1;

       }

   }

}[/spoiler]

And this is the error i got:

[spoiler]

 

C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_stair.java:20: error: class mcreator_Stair is public, should be declared in a file named mcreator_Stair.java

public class mcreator_Stair {

      ^

C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\TestEnvironmentMod.java:90: error: cannot find symbol

  mcreator_stair mcreator_46 = new mcreator_stair();

  ^

 symbol:   class mcreator_stair

 location: class TestEnvironmentMod

C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\TestEnvironmentMod.java:90: error: cannot find symbol

  mcreator_stair mcreator_46 = new mcreator_stair();

                                   ^

 symbol:   class mcreator_stair

 location: class TestEnvironmentMod

3 errors

:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':compileJava'.

> CompilationTotal time: 18.903 secs

failed; see the compiler error output fo* Try:

r details.

BUILD FAILED

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

C:\Pylo\MCreator172\forge>

Task completed with return code 0 in 19260 milliseconds

[/spoiler]

I have little experience with java and have like no idea what im doing wrong.

Joined Mar 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yay​! You best Klemen!
Fri, 03/24/2017 - 09:10

Yay​! You best Klemen!

Joined Sep 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Need Block Rotation For My 1.11.2 Blocks
Sun, 03/26/2017 - 15:02

Any news on block rotation for 1.11.2? I'm using a block model and it's really bugging me.

Joined Sep 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Got it Working!
Sun, 03/26/2017 - 23:28

Managed to get it working! Thanks for the help!