Jump to content

blinky000

Members
  • Posts

    265
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by blinky000

  1. the player only reacts to to Bounding Box
  2. yes to both. like i said arrow will hit/pass the collision box correctly it's just the player that won't
  3. Oh, and the collision boxes are there, i test by shooting arrows, the player just seems to be hitting a full block.
  4. Basically , can you have collision boxes on a obj model block? what worked on a json model dosn't seem to be working I.
  5. so that would mean, if i have a block with 4 styles, and 11 different blocks(all using the same class) i would have to instantiate 44 different blocks.
  6. OK. I try to use one class for as many blocks as i can. Not sure how they can totally get rid of metadata tho, unless facing becomes part of the block structure .
  7. This is what i came up with @SideOnly(Side.CLIENT) @Override public ItemStack getTabIconItem() { return new ItemStack(Item.getItemFromBlock(YobBlockInit.TUDOR_BLOCK), 1 , 6); } works perfect. thanks for your help
  8. If you mean in the TUDOR_BLOCK, it is, other wise not sure which class you refer to
  9. How do i put a custom block with states m as a tab icon i tried this , but no luck @SideOnly(Side.CLIENT) @Override public ItemStack getTabIconItem() { ItemStack is = new ItemStack(YobBlockInit.TUDOR_BLOCK, 1 , 1); return is; }
  10. I was afraid of that. So a custom ItemBlock , it must be lol
  11. the block has 2 properties {FACING,STYLE} the Unlocalized name is "yb_tudor_set_0" the only lag tag i see is "tile.yb_tudor_set_0" how do i name the individual STYLES , like i see for minecraft planks?
  12. found it, put the model rotation inside the transform block { "forge_marker": 1, "variants": { "facing=south,style=s0":{ "model": "yabm:wedge.obj", "textures":{ "#Material1": "blocks/stonebrick", "#particle": "blocks/stonebrick"}, "transform":{ "gui":{ "scale": [0.6 , 0.6, 0.6] }, "rotation": [ {"y": 180} ] //ROTATES THE MODEL }, "custom": { "flip-v": true }, "uvlock": true }, thanks for you help
  13. this almost works { "forge_marker": 1, "variants": { "facing=north,style=s0":{ "model": "yabm:wedge.obj", "textures":{ "#Material1": "blocks/stonebrick", "#particle": "blocks/stonebrick"}, "y": 90, "transform":{ "gui":{ "scale": [0.6 , 0.6, 0.6] } }, "custom": { "flip-v": true }, "uvlock": true }, ... except when the model is placed it ignores the :y: 90. I have also tried having the y: 90 in the model statement "model": "yabm:wedge.obj" , "y": 90 , "textures":{ no difference the rotation is ignored
  14. I was hoping 1.12 would help, but i still get the net.minecraft.client.renderer.block.model.ModelBlock@6dd1e22' can't have non-vanilla parent error if i can't use "parent" how can i point to a diferent model
  15. Very nice! Thanks you da !
  16. Ah Ha ! So for the block with the multiple states , besides registering the block, I also registers the states i want in the inventory ; Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "facing=north,style=s0"); Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 4, "facing=north,style=s1"); Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 8, "facing=north,style=s2"); Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 12, "facing=north,style=s3"); Actually much easier then ver. 1.10 once i got the kinks out Thanks for all your help
  17. so every state has to be registered with the ModleLoader. when i place the blocks they have texture, dosn't that mean they have been registered? since it's the inventory missing the textures wouldn't be i need to register the items. for the blockstates i show?
  18. ok, that worked half way. In inventory i have the four blocks based on sub blocks, and they work when placed, but i get no textures in the inventory
  19. overiding the GetMetaData() still returns just one state. the results i am hoping for is ; 4 entries in in the inventory with the states from the sub_blocks (metas : 0 4, 8 ,12) again thank you for you help
  20. wouldn't the the registerItemRenderer be differnt for multiple states? clientProxy ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(),id));
  21. HFSCB: HasFacingStyleCollisionBox . YobBlock creates the the itemBlock and sets the registryName (in this case "yabm:yb_tudor_set_0") YobItemInit.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName()));
  22. I really stink at explaining. here is the base class package com.steveT.yabm.objects.blocks; import java.util.List; import com.steveT.yabm.Main; import com.steveT.yabm.init.YobBlockInit; import com.steveT.yabm.init.YobItemInit; import com.steveT.yabm.util.IHasModel; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemMultiTexture; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; public class YobBlock extends Block implements IHasModel{ public YobBlock(String name, Material material,CreativeTabs tab) { this(name, material,tab,true); } public YobBlock(String name, Material material,CreativeTabs tab, Boolean createItem) { super(material); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(tab); YobBlockInit.BLOCKS.add(this); if(createItem) YobItemInit.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public void registerModels() { //System.out.println("--------------------------------------- YobBlock (blockbase)"); Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); } public String[] getSubTypes() { return null; } public void getSubBlocks(ItemMultiTexture item, CreativeTabs tudortab, List<ItemStack> list) { // TODO Auto-generated method stub } } child of YobBlock package com.steveT.yabm.blocks; import java.util.List; import com.google.common.collect.Lists; import com.steveT.yabm.objects.blocks.YobBlock; import com.steveT.yabm.util.YbFacingHelper; import com.steveT.yabm.util.YbStyleEnumHandler_4; import com.steveT.yabm.util.YbUtility; import net.minecraft.block.BlockHorizontal; 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.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public abstract class YobBlockHFSCB extends YobBlock implements YbFacingHelper,YbUtility{ public YobBlockHFSCB(String registryName, Material material, CreativeTabs tab) { super(registryName,material,tab); } public YobBlockHFSCB(String registryName, Material material, CreativeTabs tab, Boolean createItem) { super(registryName,material,tab,createItem); } public static final PropertyDirection FACING = BlockHorizontal.FACING; public static final PropertyEnum<YbStyleEnumHandler_4.EnumType> STYLE = PropertyEnum.<YbStyleEnumHandler_4.EnumType>create("style", YbStyleEnumHandler_4.EnumType.class); @Override protected BlockStateContainer createBlockState(){ return new BlockStateContainer(this, new IProperty[] {FACING,STYLE}); } @Override public IBlockState getStateFromMeta(int meta) { IBlockState bs = this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta & 3)).withProperty(STYLE,YbStyleEnumHandler_4.EnumType.byMetadata((meta & 15) >> 2)); return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta & 3)).withProperty(STYLE,YbStyleEnumHandler_4.EnumType.byMetadata((meta & 15) >> 2)); } @Override public int getMetaFromState(IBlockState state) { int i = 0; i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); i = i | (int)state.getValue(STYLE).getMeta() <<2; return i; } /** * returns a list of blocks with the same ID, but different meta */ @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) { // item , amount, meta list.add(new ItemStack(itemIn,1,2)); list.add(new ItemStack(itemIn, 1, 6)); list.add(new ItemStack(itemIn, 1, 10)); list.add(new ItemStack(itemIn, 1, 14)); } /** * Adds 4 Styles to inventory with extension of s0 ... */ public String[] getSubTypes(){ return new String[] {"s0", "s1", "s2", "s3"}; } /** * when choosing block from the map, sets the correct meta * to match inventory */ @Override public int damageDropped(IBlockState state) { // metadata: (s0)0-3, (s1)4-7,(s2)8-11,(s3) 12-15 int r = 2 ; int meta = getMetaFromState(state); switch(meta/4) { case 1: r = 6; break; case 2: r = 10; break; case 3: r = 14; } return r; } public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn) { for( AxisAlignedBB aabb: getCollisionBoxList(state)){ addCollisionBoxToList(pos, entityBox, collidingBoxes, aabb); } } /** * If you don't override is child class, collision box is a full block */ protected List<AxisAlignedBB> getCollisionBoxList(IBlockState state) { List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList(); list.add(new AxisAlignedBB (0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)); return list; } @Override public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) { List<RayTraceResult> list = Lists.<RayTraceResult>newArrayList(); if(blockState == null) { System.out.println("Block State Error!"); } for (AxisAlignedBB axisalignedbb : getCollisionBoxList(blockState)) { list.add(this.rayTrace(pos, start, end, axisalignedbb)); } RayTraceResult raytraceresult1 = null; double d1 = 0.0D; for (RayTraceResult raytraceresult : list) { if (raytraceresult != null) { double d0 = raytraceresult.hitVec.squareDistanceTo(end); if (d0 > d1) { raytraceresult1 = raytraceresult; d1 = d0; } } } return raytraceresult1; } } here is the class i create int BlockInit() package com.steveT.yabm.blocks; import java.util.List; import com.google.common.collect.Lists; import com.steveT.yabm.Main; import com.steveT.yabm.objects.blocks.YobBlock; import com.steveT.yabm.util.YbConstants; import com.steveT.yabm.util.YbStyleEnumHandler_4; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class YobBlockMultiBlockWF extends YobBlockHFSCB implements YbConstants{ public final static AxisAlignedBB AABB = new AxisAlignedBB ( CU0, CU0,CU0 , CU16, CU16, CU16); public YobBlockMultiBlockWF(String registryNameBase, Material material, CreativeTabs tab, int numBlocks){ super(registryNameBase+"0", material,tab); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING,EnumFacing.NORTH).withProperty(STYLE,YbStyleEnumHandler_4.EnumType.S1 )); //yobBlockRegisterWFS(this); for(int i = 1 ; i <= numBlocks ; i++) { //new YobBlockMultiBlockWF(registryNameBase+i, material, tab); } } public YobBlockMultiBlockWF(String registryName, Material material, CreativeTabs tab){ super(registryName,material,tab); //yobBlockRegisterWFS(this); } protected List<AxisAlignedBB> getCollisionBoxList(IBlockState state) { List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList(); list.add(AABB); return list; } @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack){ YbStyleEnumHandler_4.EnumType bs = state.getValue(STYLE); EnumFacing playerFacing = getPlayerFacing(pos, placer); if(playerFacing == EnumFacing.DOWN || playerFacing == EnumFacing.UP){ world.setBlockToAir(pos); return; } world.setBlockState(pos, state.withProperty(FACING, getFacingFromEntity(pos, placer)).withProperty(STYLE,bs), 2); } @Override @SideOnly(Side.CLIENT) public void getSubBlocks(CreativeTabs whichTab, NonNullList<ItemStack> items) { items.add(new ItemStack(this, 1, 0)); items.add(new ItemStack(this, 1, 4)); items.add(new ItemStack(this, 1, 8)); items.add(new ItemStack(this, 1, 12)); } @Override public void registerModels() { Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); } } I know the blocks/items in the inventory are meta 0 because the block when placed is the blank texture state of the block. thank you for helping
  23. I'm trying to migrate from 1.10.2 to 1.12.2 I followed a tutorial and have simple blocks and items working, when it comes to blocks with multiple states, no luck. My block has getSubBlocks as @SideOnly(Side.CLIENT) public void getSubBlocks(CreativeTabs whichTab, NonNullList<ItemStack> items) { items.add(new ItemStack(this, 1, 0)); items.add(new ItemStack(this, 1, 4)); items.add(new ItemStack(this, 1, 8)); items.add(new ItemStack(this, 1, 12)); } My client proxy has public void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(),id)); } and i get 4 blocks in the inventory, all with no textures and all with meta = 0. I have tried searching the net, but all i can find pertains to simple blocks. any help would be appreciated
  24. I tried : blockstate (partial) : "facing=north,style=s0": {"model": "yabm:yb_INT_slope", "y": 90 }, yb_INT__slope : { "parent": "yabm:block/wedge.obj", "textures": { "#Material1": "blocks/stonebrick", "#particle": "blocks/stonebrick" } } I get an error : java.lang.IllegalStateException: vanilla model 'net.minecraft.client.renderer.block.model.ModelBlock@62cf8fda' can't have non-vanilla parent not sure what to do, is there something else beside "parent" ?
  25. so the blockstate can point to a .json whcih points to the .obj ?
×
×
  • Create New...

Important Information

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