oh thanks man i will try again.. im doing so well man, this MCreator is amazing for starters, it gives you 'will' to learn Java because you actually do a mod after 3 days working on it.. i made functional trees, crops, lights, containers, with custom sounds and stuff im loving this lol, you help m e alot thanks,
so i will try to insert all those codes on my block on MCreator code of that block (element) and after that i manually open that .json file on that folder and change it... will try today and let u know if it works
Everything except the last part is in your block class. The last part is in .json file in blockstates folder.
dude i start to mod 3 days ago,, what hell is wrong with this 'bright spark'guy :/ anyway.. could you tell me where i can find the .java files of the Vanilla Mobs? i really need the chicken model to fix some MCreator errors, i look so much on the internet and cant find it
In older version of MCreator it was at forge\build\tmp\recompSrc\net\minecraft\client\model , I am not sure how it is in current versions. In case that you are not able to find it here you need setup manully MDK workspace for Eclipse , then you should be able to find it in sources that it decompile.
such a diffence here.. you are such a gentleman man.. thank you very much for your support, and dont listen to those people i aint stole codes, the MCreator auto-generate them (im sure u know that), im sure you dont use it, but i have too, cause my brain only learn new stuff when i look the code ready, edit it, change it, learn it.. i cant help it its the way i operate. i try to learn Java from 0 and i have no patience...
The Meaning of Life, the Universe, and Everything.
Join Date:
10/31/2014
Posts:
241
Location:
Minecraft Lands
Member Details
I ain't gonna lie but this thread actually helped me figure out why my block resets direction in my 1.10 mod!!! Thank you Stone Miner. And sorry for the necro
I'm making a mod, and to reduce the amount of blocks I need, I want to make the block face a certain direction. Sort of the way stairs work. pls help
You need to use block states. You can look at the block stairs class for an example.
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
Wow. I looked and it looks complicated. I think I can do in though.
Wow. I didn't even see this. I'll try.
hey noob question; what file i change the variable (1st code) and where i change those methods (3rd code) ? thanks!
like
File: ?
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
Constructor ? where is it ?
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
File ? - is this the file of the block/item itself i can see the code on MCreator?
@Override
public IBlockState getStateForEntityRender(IBlockState state) {
return getDefaultState().withProperty(FACING, EnumFacing.SOUTH);
}
@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 BlockState createBlockState() {
return new BlockState(this, new IProperty[]{FACING});
}
thank you again!
oh thanks man i will try again.. im doing so well man, this MCreator is amazing for starters, it gives you 'will' to learn Java because you actually do a mod after 3 days working on it.. i made functional trees, crops, lights, containers, with custom sounds and stuff im loving this lol, you help m e alot thanks,
so i will try to insert all those codes on my block on MCreator code of that block (element) and after that i manually open that .json file on that folder and change it... will try today and let u know if it works
dude i start to mod 3 days ago,, what hell is wrong with this 'bright spark'guy :/ anyway.. could you tell me where i can find the .java files of the Vanilla Mobs? i really need the chicken model to fix some MCreator errors, i look so much on the internet and cant find it
such a diffence here.. you are such a gentleman man.. thank you very much for your support, and dont listen to those people i aint stole codes, the MCreator auto-generate them (im sure u know that), im sure you dont use it, but i have too, cause my brain only learn new stuff when i look the code ready, edit it, change it, learn it.. i cant help it its the way i operate. i try to learn Java from 0 and i have no patience...
what about this part :
and in constructor define default state:
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
what is constructor? is this on the block file too?
thanks!
dang i add those lines and change that file and got errors:
warning: [options] bootstrap class path not set in conjunction with -source 1.6
D:\MCreator170\forge\build\sources\main\java\mod\mcreator\mcreator_radioOff.java:44: error: illegal start of type
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
^
D:\MCreator170\forge\build\sources\main\java\mod\mcreator\mcreator_radioOff.java:44: error: ';' expected
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
^
D:\MCreator170\forge\build\sources\main\java\mod\mcreator\mcreator_radioOff.java:44: error: invalid method declaration; return type required
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
^
D:\MCreator170\forge\build\sources\main\java\mod\mcreator\mcreator_radioOff.java:44: error: <identifier> expected
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
^
D:\MCreator170\forge\build\sources\main\java\mod\mcreator\mcreator_radioOff.java:44: error: ';' expected
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
^
D:\MCreator170\forge\build\sources\main\java\mod\mcreator\mcreator_radioOff.java:44: error: illegal start of type
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
^
D:\MCreator170\forge\build\sources\main\java\mod\mcreator\mcreator_radioOff.java:44: error: <identifier> expected
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
^
D:\MCreator170\forge\build\sources\main\java\mod\mcreator\mcreator_radioOff.java:44: error: <identifier> expected
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
^
D:\MCreator170\forge\build\sources\main\java\mod\mcreator\mcreator_radioOff.java:44: error: ';' expected
this.setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
^
9 errors
1 warning
im not sure if i put each part of the code on the right part thou... btw how i paste the code 'the right way' as people talk here?
here is how my block code is now (i removed the constructor line):
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.SoundCategory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.init.Items;
import net.minecraft.init.Blocks;
import net.minecraft.entity.player.EntityPlayer;
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_radioOff {
public mcreator_radioOff() {
}
public static BlockRadioOff 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) {
}
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:RadioOff", "inventory"));
}
GameRegistry.addRecipe(
new ItemStack(block, 1),
new Object[]{"012", "345", "678", Character.valueOf('0'), Blocks.STONE, Character.valueOf('1'), Blocks.STONE_BUTTON,
Character.valueOf('2'), Blocks.STONE, Character.valueOf('3'), Blocks.PLANKS, Character.valueOf('4'), Blocks.JUKEBOX,
Character.valueOf('5'), Blocks.PLANKS, Character.valueOf('6'), Blocks.STONE, Character.valueOf('7'), Items.REDSTONE,
Character.valueOf('8'), Blocks.STONE,});
}
static {
block = (BlockRadioOff) (new BlockRadioOff().setHardness(2.0F).setResistance(10.0F).setLightLevel(0.0F).setUnlocalizedName("RadioOff")
.setLightOpacity(0).setCreativeTab(mcreator_wizardMinePlus.tab));
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 BlockRadioOff extends Block {
int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
boolean red = false;
protected BlockRadioOff() {
super(Material.WOOD);
GameRegistry.registerBlock(this, "RadioOff");
setSoundType(SoundType.WOOD);
}
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
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 onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entity, EnumHand hand, ItemStack heldItem,
EnumFacing side, float hitX, float hitY, float hitZ) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
if (true) {
world.playSound((EntityPlayer) null, (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D,
(net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation(
("block.stone_button.click_on"))), SoundCategory.NEUTRAL, 1.0F, 1.0F);
}
if (true) {
world.setBlockToAir(new BlockPos(i, j, k));
}
if (true) {
world.setBlockState(new BlockPos(i, j, k), mcreator_radio.block.getDefaultState(), 3);
}
if (true) {
world.playSound((EntityPlayer) null, (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D,
(net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation(
("TestEnvironmentMod:mod.radio.one"))), SoundCategory.NEUTRAL, 1.0F, 1.0F);
}
return true;
}
@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, 0.0D, 1.0D, 1.0D, 1.0D);
}
@Override
public int tickRate(World world) {
return 10;
}
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
@Override
public IBlockState getStateForEntityRender(IBlockState state) {
return getDefaultState().withProperty(FACING, EnumFacing.SOUTH);
}
@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 BlockState createBlockState() {
return new BlockState(this, new IProperty[]{FACING});
}
}
}
I ain't gonna lie but this thread actually helped me figure out why my block resets direction in my 1.10 mod!!! Thank you Stone Miner. And sorry for the necro