Started by
Nuparu00
on
Topic category: User side tutorials
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
@#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.
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);
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?
@#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?
@#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
@#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
@#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
@#50.1.1.2 Does your code import net.minecraftforge.oredict.OreDictionary ?
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
@#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
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.
Yay! You best Klemen!
Any news on block rotation for 1.11.2? I'm using a block model and it's really bugging me.
Managed to get it working! Thanks for the help!