Drachenbauer Posted February 19, 2019 Posted February 19, 2019 How do i make a block, that get´s it´s rotation like a furnace, if i place it, to place it in 4 rotations? It seams like the launcher has problems with: Spoiler public IBlockState withRotation(IBlockState state, Rotation rot) { return state.with(FACING, rot.rotate((EnumFacing) state.get(FACING))); } public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().with(FACING, placer.getHorizontalFacing().getOpposite()); } I found this in my error log: Quote java.lang.IllegalArgumentException: Cannot set property DirectionProperty{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in Block{null} Quote
Krevik Posted February 19, 2019 Posted February 19, 2019 To operate some property in the block, you must kind of registry it protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) { builder.add(FACING); } Quote
Drachenbauer Posted February 19, 2019 Author Posted February 19, 2019 (edited) i have this (in the constructor): this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH)); is it useless now? Edited February 19, 2019 by Drachenbauer Quote
Cadiboo Posted February 19, 2019 Posted February 19, 2019 No, both are necessary AFAIK. Look at the vanilla furnace, it does exactly what you want Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.