How to make Rotatable Block [VIDEO TUTORIAL]

Started by Nuparu00 on

Topic category: User side tutorials

Active 1 year ago
Joined Aug 2013
Points:
1163

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
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
Active 1 year ago
Joined Aug 2013
Points:
1163

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
"register IIcons" is supposed
Wed, 01/04/2017 - 20:24

"register IIcons" is supposed to be one single word (it is name of the void) (so for ex. "registerIIcons"), same thing also for "get IIcon" and "register IIcon"

Active 3 years ago
Joined Jul 2015
Points:
881

User statistics:

  • Modifications: 6
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 133
Umm... This made my block
Wed, 01/04/2017 - 21:28

Umm... This made my block have the unknown texture thing, where it's purple and black...

Active 1 year ago
Joined Aug 2013
Points:
1163

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
Of course ,because you must
Wed, 01/04/2017 - 21:55

Of course ,because you must assign to the IIcon variables valeus that had the MCreator generated ones

Active 8 years ago
Joined Jan 2017
Points:
703

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
i dont know how to do this
Wed, 01/04/2017 - 22:18

i dont know how to do this because it wont load past "downloading dependencies and compiling" any help?

 

Active 6 years ago
Joined Apr 2016
Points:
995

User statistics:

  • Modifications: 4
  • Forum topics: 22
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 273
I'm still getting errors:
Thu, 01/05/2017 - 02:30

I'm still getting errors:

[spoiler]

:compileApiJava UP-TO-DATE
:processApiResources UP-TO-DATE
:apiClasses UP-TO-DATE
:sourceMainJava
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:93: error: '(' expected
    public void register IIcons( IIconRegister  IIconRegister) {
                         ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:94: error: not a statement
        this.block IIcon =  IIconRegister.registerIIcon("SmokyquartzPillar_ IIcon");
            ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:94: error: ';' expected
        this.block IIcon =  IIconRegister.registerIIcon("SmokyquartzPillar_ IIcon");
                  ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:155: error: ';' expected
            return block IIcon;
                        ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:155: error: not a statement
            return block IIcon;
                         ^
5 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:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3 mins 43.901 secs
Picked up _JAVA_OPTIONS: -Xmx256M
C:\Pylo\MCreator172\forge>
Task completed with return code 0 in 233562 milliseconds [/spoiler]

Active 1 year ago
Joined Aug 2013
Points:
1163

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
"register IIcons" does not
Thu, 01/05/2017 - 12:06

"register IIcons" does not seem like a single word :D

Active 6 years ago
Joined Apr 2016
Points:
995

User statistics:

  • Modifications: 4
  • Forum topics: 22
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 273
But before you said it should
Fri, 01/06/2017 - 01:24

But before you said it should be. Was that a mistake?

Active 6 years ago
Joined Apr 2016
Points:
995

User statistics:

  • Modifications: 4
  • Forum topics: 22
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 273
Regardless, I still tried it
Fri, 01/06/2017 - 14:49

Regardless, I still tried it and got this error:
[spoiler]
Powered By MCP:               http://modcoderpack.com/      Searge, ProfMobius, Fesh0r,   R4wk, ZeuX, IngisKahn, bspkrs  MCP Data version : unknown **************************** :compileApiJava UP-TO-DATE :processApiResources UP-TO-DATE :apiClasses UP-TO-DATE :sourceMainJava C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:89: error: ';' expected     public void register IIcons( IIconRegister  IIconRegister) {                         ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:89: error: ')' expected     public void register IIcons( IIconRegister  IIconRegister) {                                               ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:89: error: illegal start of expression     public void register IIcons( IIconRegister  IIconRegister) {                                                              ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:89: error: ';' expected     public void register IIcons( IIconRegister  IIconRegister) {                                                               ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:90: error: not a statement         this.block IIcon =  IIconRegister.register IIcon("SmokyquartzPillar_ IIcon");             ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:90: error: ';' expected         this.block IIcon =  IIconRegister.register IIcon("SmokyquartzPillar_ IIcon");                   ^ :compileJava FAILED C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smoky: error: ';' expected quartzPillar.java:90BUILD FAILED Total time: 52.163 secs         this.block IIcon =  IIconRegister.register IIcon("SmokyquartzPillar_ IIcon");                                                   ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:91: error: ';' expected         this.bottom =  IIconRegister.register IIcon("SmokyquartzPillar_bottom");                                              ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:92: error: ';' expected         this.top =  IIconRegister.register IIcon("SmokyquartzPillar_top");                                           ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:93: error: ';' expected         this.side =  IIconRegister.register IIcon("SmokyquartzPillar_side");                                            ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:94: error: ';' expected         this.front =  IIconRegister.register IIcon("SmokyquartzPillar_front");                                             ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:151: error: ';' expected             return block IIcon;                         ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:151: error: not a statement             return block IIcon;                          ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:162: error: illegal start of type          super(Material.ground);          ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:162: error:   expected          super(Material.ground);                               ^ C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_smokyquartzPillar.java:234: error: class, interface, or enum expected } ^ 16 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. Picked up _JAVA_OPTIONS: -Xmx256M C:\Pylo\MCreator172\forge> Task completed with return code 0 in 54297 milliseconds [/spoiler]

Active 1 year ago
Joined Aug 2013
Points:
1163

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
:D I am trying to say here
Fri, 01/06/2017 - 17:40

:D I am trying to say here that your "register IIcons" is supposed rto be one word "registerIIcons"
Anyway, I have better idea , I am now installing MCreator for 1.7.10 so it will be easier.So the following code is resul (and be sure that working result):

[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 net.minecraft.entity.*;
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;

public class mcreator_test {

    public mcreator_test() {
    }

    public static BlockTest 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, "Test");
    }

    public void registerRenderers() {
    }

    public void load() {
    }

    static {

        block = (BlockTest) (new BlockTest().setHardness(2.0F).setResistance(10.0F).setLightLevel(0.0F).setBlockName("Test")
                .setBlockTextureName("bottom").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(176, "Test", 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 BlockTest 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 BlockTest() {
            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("bottom");
            this.dol = reg.registerIcon("top");
            this.st1 = reg.registerIcon("side");
            this.st2 = reg.registerIcon("front");
            this.st3 = reg.registerIcon("side");
            this.st4 = reg.registerIcon("side");
        }

        public int getRenderType() {
            return 0;
        }

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

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

    }
}

[/spoiler]

Active 6 years ago
Joined Apr 2016
Points:
995

User statistics:

  • Modifications: 4
  • Forum topics: 22
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 273
So that code is the entire
Sat, 01/07/2017 - 23:09

So that code is the entire code for a new block you made named BlockTest that should rotate?

Does that then mean that this string is what I should use to make my own blocks rotate:

[spoiler] 

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("bottom");
            this.dol = reg.registerIcon("top");
            this.st1 = reg.registerIcon("side");
            this.st2 = reg.registerIcon("front");
            this.st3 = reg.registerIcon("side");
            this.st4 = reg.registerIcon("side");
        }

        public int getRenderType() {
            return 0;
        }

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

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

    }
} [/spoiler]

I just want to clarify. I'm a little confused.

Active 1 year ago
Joined Aug 2013
Points:
1163

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
Method registerBlockIcons()
Sun, 01/08/2017 - 00:29

Method registerBlockIcons() definitelly keep the orginal one (it has paths to textures) (the main methods you need replace are: getIcon() and onBlockPlacedBy()) , also you need add this import: import net.minecraft.entity.*;

Active 6 years ago
Joined Apr 2016
Points:
995

User statistics:

  • Modifications: 4
  • Forum topics: 22
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 273
Something still isn't right.
Sun, 01/08/2017 - 01:25

Something still isn't right. I made a new block called RotationTest to experiment with, and edited the code like you explained. Now it looks like this:

[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_rotationTest {

    public mcreator_rotationTest() {
    }

    public static BlockRotationTest 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, "RotationTest");
    }

    public void registerRenderers() {
    }

    public void load() {
    }

    static {

        block = (BlockRotationTest) (new BlockRotationTest().setHardness(2.0F).setResistance(10.0F).setLightLevel(0.0F).setBlockName("RotationTest")
                .setBlockTextureName("SpidereyeBlock").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, "RotationTest", 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 BlockRotationTest 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 BlockRotationTest() {
            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 i, int par2) {

            if (i == 0)
                return gor;

            else if (i == 1)
                return dol;

            else if (i == 2)
                return st1;

            else if (i == 3)
                return st2;

            else if (i == 4)
                return st4;

            else if (i == 5)
                return st3;

            else
                return gor;

        }
          @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("bottom");
            this.dol = reg.registerIcon("top");
            this.st1 = reg.registerIcon("side");
            this.st2 = reg.registerIcon("front");
            this.st3 = reg.registerIcon("side");
            this.st4 = reg.registerIcon("side");
        }

        public int getRenderType() {
            return 0;
        }

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

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

    }
}

        @SideOnly(Side.CLIENT)
        @Override
        public void registerBlockIcons(IIconRegister reg) {
            this.gor = reg.registerIcon("SpidereyeBlock");
            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]

Unfortunately, I got this error code:

[spoiler]

:compileApiJava UP-TO-DATE
:processApiResources UP-TO-DATE
:apiClasses UP-TO-DATE
:sourceMainJava
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:218: error: class, interface, or enum expected
      public void registerBlockIcons(IIconRegister reg) {
             ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:220: error: class, interface, or enum expected
         this.dol = reg.registerIcon("Ender_quartz_block_lines_top");
         ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:221: error: class, interface, or enum expected
         this.st1 = reg.registerIcon("Squartz_block_lines");
         ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:222: error: class, interface, or enum expected
         this.st2 = reg.registerIcon("Squartz_block_lines");
         ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:223: error: class, interface, or enum expected
         this.st3 = reg.registerIcon("Squartz_block_lines");
         ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:224: error: class, interface, or enum expected
         this.st4 = reg.registerIcon("darkportal_single");
         ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:225: error: class, interface, or enum expected
      }
      ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:227: error: class, interface, or enum expected
      public int getRenderType() {
             ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:229: error: class, interface, or enum expected
      }
      ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:232: error: class, interface, or enum expected
      public int tickRate(World world) {
             ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:234: error: class, interface, or enum expected
      }
      ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:236: error: class, interface, or enum expected
      public int quantityDropped(Random par1Random) {
             ^
C:\Pylo\MCreator172\forge\build\sources\java\mod\mcreator\mcreator_rotationTest.java:238: error: class, interface, or enum expected
      }
      ^
13 errors
:compileJava FAILED
FAILURE: Build failed with an exception.
BUILD FAILED
* 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.
Total time: 37.058 secs
Picked up _JAVA_OPTIONS: -Xmx256M
C:\Pylo\MCreator172\forge>
Task completed with return code 0 in 39267 milliseconds [/spoiler]

Active 1 year ago
Joined Aug 2013
Points:
1163

User statistics:

  • Modifications: 4
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 737
The feature of highliting
Sun, 01/08/2017 - 08:55

The feature of highliting brackets is not in MCreator just for fun. And also I think that it is not big deal to delete/or not copy the parts that I didn't mention:
[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_rotationTest {

    public mcreator_rotationTest() {
    }

    public static BlockRotationTest 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, "RotationTest");
    }

    public void registerRenderers() {
    }

    public void load() {
    }

    static {

        block = (BlockRotationTest) (new BlockRotationTest().setHardness(2.0F).setResistance(10.0F).setLightLevel(0.0F).setBlockName("RotationTest")
                .setBlockTextureName("SpidereyeBlock").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, "RotationTest", 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 BlockRotationTest 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 BlockRotationTest() {
            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("SpidereyeBlock");
            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]

Active 8 years ago
Joined Sep 2016
Points:
711

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 3
Hello, I need help with this:
Sun, 01/08/2017 - 09:58

Hello, I need help with this:

world.setBlockState(new BlockPos(i, j, k),
mcreator_heaterOn.block.getStateFromMeta(mcreator_heaterOn.block.FACING,((mcreator_heater.block)world.getBlockState(new
BlockPos(i,j,k).getBlock()).getMetaFromState(world.getBlockState(new BlockPos(i,j,k))))), 3);

 

I want my block to face the same way when it gets powered.

[spoiler]

C:\Users\Lian Angelo\Desktop\Mcreator\forge\build\sources\main\java\mod\mcreator\mcreator_heater.java:182: error: cannot find symbol
mcreator_heaterOn.block.getStateFromMeta(mcreator_heaterOn.block.FACING,((mcreator_heater.block)world.getBlockState(new
                                                                                         ^
  symbol:   class block
  location: class mcreator_heater
C:\Users\Lian Angelo\Desktop\Mcreator\forge\build\sources\main\java\mod\mcreator\mcreator_heater.java:183: error: cannot find symbol
BlockPos(i,j,k).getBlock()).getMetaFromState(world.getBlockState(new BlockPos(i,j,k))))), 3);
               ^
  symbol:   method getBlock()
  location: class BlockPos
2 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:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

[/spoiler]