Jump to content

TyrellPlayz

Members
  • Posts

    16
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    https://www.youtube.com/legotyrell
  • Location
    Australia

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TyrellPlayz's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. 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:
  2. 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.
  3. 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.
  4. This post may help: http://www.minecraftforge.net/forum/topic/69297-1132-world-ore-generation/
  5. 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.
  6. Could you please provide an example of the built-in syncing of Tile Entities
  7. Here's my code. Link The item in question in it is ItemWallet. That has a container
  8. Can anyone please provide an example of a block storing the Facing property in a tile entity. The block I want to do this for is BlockTarmacRoad and here's the GitHub link to its code. Code
  9. 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} } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.