-
Posts
16 -
Joined
-
Last visited
Everything posted by TyrellPlayz
-
I'm trying to create a waterwheel for my mod and currently have this placement model for testing but its not showing correctly in game. How do I fix this? The github for the mod: https://github.com/TyrellPlayz/BigIndustries Waterwheel.java: https://github.com/TyrellPlayz/BigIndustries/blob/1.16-dev/src/main/java/com/tyrellplayz/big_industries/block/WaterwheelBlock.java Waterwheel blockstate: https://github.com/TyrellPlayz/BigIndustries/blob/1.16-dev/src/main/resources/assets/big_industries/blockstates/waterwheel.json Waterwheel model: https://github.com/TyrellPlayz/BigIndustries/blob/1.16-dev/src/main/resources/assets/big_industries/models/block/waterwheel.json Waterwheel OBJ: https://github.com/TyrellPlayz/BigIndustries/blob/1.16-dev/src/main/resources/assets/big_industries/models/block/mesh/waterwheel.obj (I know there are no textures yet and that's fine, they will be added later) The model (Created with Blockbench): What it looks like in game:
-
I created a core for all my mods but when I run a mod that uses my core the method 'Properties.create' can't be found as after building the core it turns into 'Properties.func_200945_a' How can I fix this? Error Log zCore Big Industries What shows when I run a client.
-
(1.13.2) Mods with GUIs not working on servers
TyrellPlayz replied to TyrellPlayz's topic in Support & Bug Reports
Its all good now, I fixed it. -
Let's try this again. I had someone who posted an issue on my mod. But I believe it maybe a problem with forge itself. https://github.com/TyrellPlayz/Big-Industries/issues/6#issuecomment-480408802 Something to do with client only classes running on a server, making it crash. I believe it maybe a bug.
-
This post may help: http://www.minecraftforge.net/forum/topic/69297-1132-world-ore-generation/
-
Should I have made BlockTarmacRoad implement ITileEntityProvider. So I use createNewTileEntity() instead of createTileEntity() as I found out from creating another block that somehow createTileEntity() didn't actually create a tile entity but createNewTileEntity() did. Plus most of the time getting the facing value returned a null. So my guess the tile entity was never created when I placed the block.
-
I want to have it that when the block state changes it changes the block model but It won't do that. Code explains it a bit at the onBlockActivated method package com.tyrellplayz.tcm.blocks; import java.util.Locale; import com.tyrellplayz.tcm.EnumModBlocks; import com.tyrellplayz.tcm.init.ModCreativeTabs; import net.minecraft.block.Block; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockRailBase; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; import net.minecraft.util.NonNullList; import net.minecraft.util.Rotation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3i; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import scala.swing.TextComponent; public class BlockTrafficLight extends ModBlock{ private static AxisAlignedBB AABB = new AxisAlignedBB(0.3D, 0.0D, 0.3D, 0.7D, 1.0D, 0.7D);; public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTrafficLight.Type.class); public BlockTrafficLight() { super(Material.IRON, EnumModBlocks.TRAFFICLIGHT); setLightLevel(0.0F); setCreativeTab(ModCreativeTabs.roadsTab ); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(TYPE, Type.OFF)); } @Override public boolean isFullBlock(IBlockState state) {return false;} @Override public boolean isFullCube(IBlockState state) {return false;} @Override public boolean isOpaqueCube(IBlockState state) {return false;} @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return AABB; } @Override public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return AABB; } /** * Convert the given metadata into a BlockState for this Block */ @Override public IBlockState getStateFromMeta(int meta){ return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)).withProperty(TYPE, Type.byMetadata(meta)); } /** * Convert the BlockState into the correct metadata value */ @Override public int getMetaFromState(IBlockState state){ return ((EnumFacing) state.getValue(FACING)).getHorizontalIndex(); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, FACING, TYPE); } @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { return state.withProperty(TYPE, Type.OFF); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { IBlockState s = state.getActualState(worldIn, pos); System.out.println("Value of TYPE: " + s.getValue(TYPE)); // This should change the value of TYPE to YELLOW // But it doesn't. s.withProperty(TYPE, Type.YELLOW); // The output of this should not be the same as the first // output, but it is. System.out.println("Value of TYPE: " + s.getValue(TYPE)); // This should set the block state to the block // Changing the block model worldIn.setBlockState(pos, s); return true; } @Override public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { IBlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand); return state.withProperty(FACING, placer.getHorizontalFacing()); } public static enum Type implements IStringSerializable{ RED(0, "red"), YELLOW(1, "yellow"), GREEN(2, "green"), OFF(3, "off"); private static BlockTrafficLight.Type[] META_LOOKUP = new BlockTrafficLight.Type[values().length]; private int meta; private String name; private Type(int meta, String name){ this.meta = meta; this.name = name; } public int getMetadata(){return this.meta;} @Override public String toString(){return this.name;} public static BlockTrafficLight.Type byMetadata(int meta){ if (meta < 0 || meta >= META_LOOKUP.length){ meta = 0; } return META_LOOKUP[meta]; } public String getName(){return this.name;} public Type getNext() { if(name().toLowerCase() == "off") { return Type.RED; }else if(name().toLowerCase() == "red") { return Type.YELLOW; }else if(name().toLowerCase() == "yellow") { return Type.GREEN; }else{ return Type.OFF; } } static{ for (BlockTrafficLight.Type blocktrafficlight$type : values()){ META_LOOKUP[blocktrafficlight$type.getMetadata()] = blocktrafficlight$type; } } } } And if you are looking for where I register the names of the block package com.tyrellplayz.tcm.blocks; import com.tyrellplayz.tcm.EnumModBlocks; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.util.EnumFacing; public class ModBlock extends Block { public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public ModBlock(Material materialIn, EnumModBlocks name) { super(materialIn); setUnlocalizedName(name.getUnlocalizedName()); setRegistryName(name.getRegistryName()); } public ModBlock(Material blockMaterialIn, MapColor blockMapColorIn, EnumModBlocks name) { super(blockMaterialIn, blockMapColorIn); setUnlocalizedName(name.getUnlocalizedName()); setRegistryName(name.getRegistryName()); } } Here is the blockstate file (you don't need the model files because the models do work) { "variants": { "facing=north,type=red": {"model": "tcm:traffic_light_red"}, "facing=east,type=red": {"model": "tcm:traffic_light_red", "y": 90}, "facing=south,type=red": {"model": "tcm:traffic_light_red", "y": 180}, "facing=west,type=red": {"model": "tcm:traffic_light_red", "y": 270}, "facing=north,type=yellow": {"model": "tcm:traffic_light_yellow"}, "facing=east,type=yellow": {"model": "tcm:traffic_light_yellow", "y": 90}, "facing=south,type=yellow": {"model": "tcm:traffic_light_yellow", "y": 180}, "facing=west,type=yellow": {"model": "tcm:traffic_light_yellow", "y": 270}, "facing=north,type=green": {"model": "tcm:traffic_light_green"}, "facing=east,type=green": {"model": "tcm:traffic_light_green", "y": 90}, "facing=south,type=green": {"model": "tcm:traffic_light_green", "y": 180}, "facing=west,type=green": {"model": "tcm:traffic_light_green", "y": 270}, "facing=north,type=off": {"model": "tcm:traffic_light_off"}, "facing=east,type=off": {"model": "tcm:traffic_light_off", "y": 90}, "facing=south,type=off": {"model": "tcm:traffic_light_off", "y": 180}, "facing=west,type=off": {"model": "tcm:traffic_light_off", "y": 270} } }
-
Thanks Choonster
-
I want to create a custom block state that will rotate the texture like EnumFacing but needs to also change it's texture. Here's what i have done so far (not 100% done) package com.tyrellplayz.tcm.blocks; import java.util.Locale; import com.tyrellplayz.tcm.EnumModBlocks; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockRailBase; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; public class BlockTrafficLight extends ModBlock{ public static final PropertyEnum<BlockTrafficLight.EnumTrafficLightType> LIGHTTYPE = PropertyEnum.<BlockTrafficLight.EnumTrafficLightType>create("lighttype", BlockTrafficLight.EnumTrafficLightType.class); public BlockTrafficLight() { super(Material.IRON, EnumModBlocks.TRAFFICLIGHT); this.setLightLevel(1.0F); this.setDefaultState(this.blockState.getBaseState().withProperty(LIGHTTYPE, BlockTrafficLight.EnumTrafficLightType.RED_ON_N)); } @Override public boolean isFullBlock(IBlockState state) {return false;} @Override public boolean isFullCube(IBlockState state) {return false;} @Override public boolean isOpaqueCube(IBlockState state) {return false;} public IProperty<BlockTrafficLight.EnumTrafficLightType> getLightProperty(){ return LIGHTTYPE; } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta){ return this.getDefaultState().withProperty(LIGHTTYPE, BlockTrafficLight.EnumTrafficLightType.byMetadata(meta)); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state){ return ((BlockTrafficLight.EnumTrafficLightType)state.getValue(LIGHTTYPE)).getMetadata(); } @Override protected BlockStateContainer createBlockState() {return new BlockStateContainer(this, LIGHTTYPE);} /* @Override public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { IBlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand); return state.withProperty(LIGHTTYPE, placer.getHorizontalFacing()); }*/ public static enum EnumTrafficLightType implements IStringSerializable{ RED_ON_N(0, "red_on_n", EnumFacing.NORTH), RED_ON_E(1, "red_on_e", EnumFacing.EAST), RED_ON_S(2, "red_on_s", EnumFacing.SOUTH), RED_ON_W(3, "red_on_w", EnumFacing.WEST), YELLOW_ON_N(4, "yellow_on_n", EnumFacing.NORTH), YELLOW_ON_E(5, "yellow_on_e", EnumFacing.EAST), YELLOW_ON_S(6, "yellow_on_s", EnumFacing.SOUTH), YELLOW_ON_W(7, "yellow_on_w", EnumFacing.WEST), GREEN_ON_N(8, "green_on_n", EnumFacing.NORTH), GREEN_ON_E(9, "green_on_e", EnumFacing.EAST), GREEN_ON_S(10, "green_on_s", EnumFacing.SOUTH), GREEN_ON_W(11, "green_on_w", EnumFacing.WEST), OFF_N(12, "off_n", EnumFacing.NORTH), OFF_E(13, "off_e", EnumFacing.EAST), OFF_S(14, "off_s", EnumFacing.SOUTH), OFF_W(15, "off_w", EnumFacing.WEST); private static final BlockTrafficLight.EnumTrafficLightType[] META_LOOKUP = new BlockTrafficLight.EnumTrafficLightType[values().length]; private final int meta; private final String name; private final EnumFacing facing; private EnumTrafficLightType(int meta, String name, EnumFacing facing){ this.meta = meta; this.name = name; this.facing = facing; } public int getMetadata(){return this.meta;} public EnumFacing getFacing(){return this.facing;} public String toString(){return this.name;} public static BlockTrafficLight.EnumTrafficLightType byMetadata(int meta){ if (meta < 0 || meta >= META_LOOKUP.length){ meta = 0; } return META_LOOKUP[meta]; } public String getName(){return this.name;} } }