Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Minus

Members
  • Posts

    12
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Personal Text
    Where's my code...

Minus's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hi everyone! I was making some world generation for structures lately and I'm facing some kind of issue right now. I'd like to add structure generation like in normal minecraft (like mineshafts, woodland mansion, villages etc.), but my current approach isn't quite good. I'm currently using normal worldgen that is beeing called after whole world is created. I'd like to create new structure and place it before trees, foliage, caves etc. Is that even possible to do? I've been looking through vanilla code, but couldn't find there any solution. Thanks for any information!
  2. Block is two block height and every part is rendered as normal block without texture (Item is registered as Item, because it's door) Also JSON files and almost every line of code is copied from original doors files from minecraft. It just can't load model. It says that I'm missing glass_door.JSON in models/block directory, but in door class and in any of JSON files there isn't any definition for glass_door model. to TGG: I looked to your troubleshooting guide but none of ideas listed in it worked. Edit: Probably I miss something in my code. How to register block variants without ItemBlock? Normal block have also item, which is item block - in door we have only block and attached to it item (not ItemBlock)
  3. When I'm launching game with my custom doors it looks for file called glass_door in models, but this file is located in blockstates. It looks like minecraft is trying to obtain model without using block state ingame. Just uses unlocalized name. Please help... What I'm doing wrong? Do custom doors require any kind of model registration in proxy? error from console: [22:40:21] [Client thread/ERROR] [FML]: Exception loading model additionalcraft:models/block/glass_door with vanilla loader, skipping java.io.FileNotFoundException: additionalcraft:models/block/glass_door.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:70) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1200(ModelLoader.java:51) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:417) [ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:92) [ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadAnyModel(ModelLoader.java:165) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.getModel(ModelLoader.java:148) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:320) [ModelLoader$WeightedRandomModel.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:120) [ModelLoader.class:?] at net.minecraft.client.resources.model.ModelBakery.loadVariants(ModelBakery.java:122) [ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:98) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:68) [ModelLoader.class:?] at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:124) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:470) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?] at GradleStart.main(GradleStart.java:45) [start/:?] ACDoor.java: package net.minus.additionalcraft.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minus.additionalcraft.proxy.common.ACBlocks; import net.minus.additionalcraft.proxy.common.ACItems; public class ACDoor extends Block { public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public static final PropertyBool OPEN = PropertyBool.create("open"); public static final PropertyEnum HINGE = PropertyEnum.create("hinge", ACDoor.EnumHingePosition.class); public static final PropertyBool POWERED = PropertyBool.create("powered"); public static final PropertyEnum HALF = PropertyEnum.create("half", ACDoor.EnumDoorHalf.class); public ACDoor(Material materialIn) { super(materialIn); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(OPEN, Boolean.valueOf(false)).withProperty(HINGE, ACDoor.EnumHingePosition.LEFT).withProperty(POWERED, Boolean.valueOf(false)).withProperty(HALF, ACDoor.EnumDoorHalf.LOWER)); this.createBlockState(); } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isPassable(IBlockAccess worldIn, BlockPos pos) { return isOpen(combineMetadata(worldIn, pos)); } @Override public boolean isFullCube() { return false; } @Override @SideOnly(Side.CLIENT) public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) { this.setBlockBoundsBasedOnState(worldIn, pos); return super.getSelectedBoundingBox(worldIn, pos); } @Override public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) { this.setBlockBoundsBasedOnState(worldIn, pos); return super.getCollisionBoundingBox(worldIn, pos, state); } @Override public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) { this.setBoundBasedOnMeta(combineMetadata(worldIn, pos)); } private void setBoundBasedOnMeta(int combinedMeta) { float f = 0.1875F; this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); EnumFacing enumfacing = getFacing(combinedMeta); boolean flag = isOpen(combinedMeta); boolean flag1 = isHingeLeft(combinedMeta); if (flag) { if (enumfacing == EnumFacing.EAST) { if (!flag1) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); } else { this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); } } else if (enumfacing == EnumFacing.SOUTH) { if (!flag1) { this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } else { this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); } } else if (enumfacing == EnumFacing.WEST) { if (!flag1) { this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); } else { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); } } else if (enumfacing == EnumFacing.NORTH) { if (!flag1) { this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); } else { this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } } } else if (enumfacing == EnumFacing.EAST) { this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); } else if (enumfacing == EnumFacing.SOUTH) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); } else if (enumfacing == EnumFacing.WEST) { this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } else if (enumfacing == EnumFacing.NORTH) { this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); } } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { if (this.blockMaterial == Material.iron) { return false; //Allow items to interact with the door } else { BlockPos blockpos1 = state.getValue(HALF) == ACDoor.EnumDoorHalf.LOWER ? pos : pos.down(); IBlockState iblockstate1 = pos.equals(blockpos1) ? state : worldIn.getBlockState(blockpos1); if (iblockstate1.getBlock() != this) { return false; } else { state = iblockstate1.cycleProperty(OPEN); worldIn.setBlockState(blockpos1, state, 2); worldIn.markBlockRangeForRenderUpdate(blockpos1, pos); worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0); return true; } } } public void toggleDoor(World worldIn, BlockPos pos, boolean open) { IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == this) { BlockPos blockpos1 = iblockstate.getValue(HALF) == ACDoor.EnumDoorHalf.LOWER ? pos : pos.down(); IBlockState iblockstate1 = pos == blockpos1 ? iblockstate : worldIn.getBlockState(blockpos1); if (iblockstate1.getBlock() == this && ((Boolean)iblockstate1.getValue(OPEN)).booleanValue() != open) { worldIn.setBlockState(blockpos1, iblockstate1.withProperty(OPEN, Boolean.valueOf(open)), 2); worldIn.markBlockRangeForRenderUpdate(blockpos1, pos); worldIn.playAuxSFXAtEntity((EntityPlayer)null, open ? 1003 : 1006, pos, 0); } } } @Override public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) { if (state.getValue(HALF) == ACDoor.EnumDoorHalf.UPPER) { BlockPos blockpos1 = pos.down(); IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); if (iblockstate1.getBlock() != this) { worldIn.setBlockToAir(pos); } else if (neighborBlock != this) { this.onNeighborBlockChange(worldIn, blockpos1, iblockstate1, neighborBlock); } } else { boolean flag1 = false; BlockPos blockpos2 = pos.up(); IBlockState iblockstate2 = worldIn.getBlockState(blockpos2); if (iblockstate2.getBlock() != this) { worldIn.setBlockToAir(pos); flag1 = true; } if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down())) { worldIn.setBlockToAir(pos); flag1 = true; if (iblockstate2.getBlock() == this) { worldIn.setBlockToAir(blockpos2); } } if (flag1) { if (!worldIn.isRemote) { this.dropBlockAsItem(worldIn, pos, state, 0); } } else { boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(blockpos2); if ((flag || neighborBlock.canProvidePower()) && neighborBlock != this && flag != ((Boolean)iblockstate2.getValue(POWERED)).booleanValue()) { worldIn.setBlockState(blockpos2, iblockstate2.withProperty(POWERED, Boolean.valueOf(flag)), 2); if (flag != ((Boolean)state.getValue(OPEN)).booleanValue()) { worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2); worldIn.markBlockRangeForRenderUpdate(pos, pos); worldIn.playAuxSFXAtEntity((EntityPlayer)null, flag ? 1003 : 1006, pos, 0); } } } } } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return state.getValue(HALF) == ACDoor.EnumDoorHalf.UPPER ? null : this.getItem(); } @Override public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) { this.setBlockBoundsBasedOnState(worldIn, pos); return super.collisionRayTrace(worldIn, pos, start, end); } @Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); } @Override public int getMobilityFlag() { return 1; } public static int combineMetadata(IBlockAccess worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); int i = iblockstate.getBlock().getMetaFromState(iblockstate); boolean flag = isTop(i); IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); int j = iblockstate1.getBlock().getMetaFromState(iblockstate1); int k = flag ? j : i; IBlockState iblockstate2 = worldIn.getBlockState(pos.up()); int l = iblockstate2.getBlock().getMetaFromState(iblockstate2); int i1 = flag ? i : l; boolean flag1 = (i1 & 1) != 0; boolean flag2 = (i1 & 2) != 0; return removeHalfBit(k) | (flag ? 8 : 0) | (flag1 ? 16 : 0) | (flag2 ? 32 : 0); } @Override @SideOnly(Side.CLIENT) public Item getItem(World worldIn, BlockPos pos) { return this.getItem(); } private Item getItem() { if(this == ACBlocks.glassDoor) { return ACItems.glassDoor; } return null; } @Override public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { BlockPos blockpos1 = pos.down(); if (player.capabilities.isCreativeMode && state.getValue(HALF) == ACDoor.EnumDoorHalf.UPPER && worldIn.getBlockState(blockpos1).getBlock() == this) { worldIn.setBlockToAir(blockpos1); } } @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { IBlockState iblockstate1; if (state.getValue(HALF) == ACDoor.EnumDoorHalf.LOWER) { iblockstate1 = worldIn.getBlockState(pos.up()); if (iblockstate1.getBlock() == this) { state = state.withProperty(HINGE, iblockstate1.getValue(HINGE)).withProperty(POWERED, iblockstate1.getValue(POWERED)); } } else { iblockstate1 = worldIn.getBlockState(pos.down()); if (iblockstate1.getBlock() == this) { state = state.withProperty(FACING, iblockstate1.getValue(FACING)).withProperty(OPEN, iblockstate1.getValue(OPEN)); } } return state; } @Override public IBlockState getStateFromMeta(int meta) { return (meta & > 0 ? this.getDefaultState().withProperty(HALF, ACDoor.EnumDoorHalf.UPPER).withProperty(HINGE, (meta & 1) > 0 ? ACDoor.EnumHingePosition.RIGHT : ACDoor.EnumHingePosition.LEFT).withProperty(POWERED, Boolean.valueOf((meta & 2) > 0)) : this.getDefaultState().withProperty(HALF, ACDoor.EnumDoorHalf.LOWER).withProperty(FACING, EnumFacing.getHorizontal(meta & 3).rotateYCCW()).withProperty(OPEN, Boolean.valueOf((meta & 4) > 0)); } @Override @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT; } @Override public int getMetaFromState(IBlockState state) { byte b0 = 0; int i; if (state.getValue(HALF) == ACDoor.EnumDoorHalf.UPPER) { i = b0 | 8; if (state.getValue(HINGE) == ACDoor.EnumHingePosition.RIGHT) { i |= 1; } if (((Boolean)state.getValue(POWERED)).booleanValue()) { i |= 2; } } else { i = b0 | ((EnumFacing)state.getValue(FACING)).rotateY().getHorizontalIndex(); if (((Boolean)state.getValue(OPEN)).booleanValue()) { i |= 4; } } return i; } protected static int removeHalfBit(int meta) { return meta & 7; } public static boolean isOpen(IBlockAccess worldIn, BlockPos pos) { return isOpen(combineMetadata(worldIn, pos)); } public static EnumFacing getFacing(IBlockAccess worldIn, BlockPos pos) { return getFacing(combineMetadata(worldIn, pos)); } public static EnumFacing getFacing(int combinedMeta) { return EnumFacing.getHorizontal(combinedMeta & 3).rotateYCCW(); } protected static boolean isOpen(int combinedMeta) { return (combinedMeta & 4) != 0; } protected static boolean isTop(int meta) { return (meta & != 0; } protected static boolean isHingeLeft(int combinedMeta) { return (combinedMeta & 16) != 0; } @Override protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {HALF, FACING, OPEN, HINGE, POWERED}); } public static enum EnumDoorHalf implements IStringSerializable { UPPER, LOWER; @Override public String toString() { return this.getName(); } public String getName() { return this == UPPER ? "upper" : "lower"; } } public static enum EnumHingePosition implements IStringSerializable { LEFT, RIGHT; @Override public String toString() { return this.getName(); } public String getName() { return this == LEFT ? "left" : "right"; } } } ACDoorItem: package net.minus.additionalcraft.items; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minus.additionalcraft.creativetab.ACCreativeTabs; import net.minus.additionalcraft.blocks.ACDoor; public class ACDoorItem extends Item { private Block block; public ACDoorItem(Block block) { this.block = block; this.setCreativeTab(ACCreativeTabs.tabACBlock); } @Override public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { if (side != EnumFacing.UP) { return false; } else { IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); if (!block.isReplaceable(worldIn, pos)) { pos = pos.offset(side); } if (!playerIn.canPlayerEdit(pos, side, stack)) { return false; } else if (!this.block.canPlaceBlockAt(worldIn, pos)) { return false; } else { placeDoor(worldIn, pos, EnumFacing.fromAngle((double)playerIn.rotationYaw), this.block); --stack.stackSize; return true; } } } public static void placeDoor(World worldIn, BlockPos pos, EnumFacing facing, Block door) { BlockPos blockpos1 = pos.offset(facing.rotateY()); BlockPos blockpos2 = pos.offset(facing.rotateYCCW()); int i = (worldIn.getBlockState(blockpos2).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getBlockState(blockpos2.up()).getBlock().isNormalCube() ? 1 : 0); int j = (worldIn.getBlockState(blockpos1).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getBlockState(blockpos1.up()).getBlock().isNormalCube() ? 1 : 0); boolean flag = worldIn.getBlockState(blockpos2).getBlock() == door || worldIn.getBlockState(blockpos2.up()).getBlock() == door; boolean flag1 = worldIn.getBlockState(blockpos1).getBlock() == door || worldIn.getBlockState(blockpos1.up()).getBlock() == door; boolean flag2 = false; if (flag && !flag1 || j > i) { flag2 = true; } BlockPos blockpos3 = pos.up(); IBlockState iblockstate = door.getDefaultState().withProperty(ACDoor.FACING, facing).withProperty(ACDoor.HINGE, flag2 ? ACDoor.EnumHingePosition.RIGHT : ACDoor.EnumHingePosition.LEFT); worldIn.setBlockState(pos, iblockstate.withProperty(ACDoor.HALF, ACDoor.EnumDoorHalf.LOWER), 2); worldIn.setBlockState(blockpos3, iblockstate.withProperty(ACDoor.HALF, ACDoor.EnumDoorHalf.UPPER), 2); worldIn.notifyNeighborsOfStateChange(pos, door); worldIn.notifyNeighborsOfStateChange(blockpos3, door); } } glass_door.JSON from blockstates: { "variants": { "facing=east,half=lower,hinge=left,open=false": { "model": "additionalcraft:glass_door_bottom" }, "facing=south,half=lower,hinge=left,open=false": { "model": "additionalcraft:glass_door_bottom", "y": 90 }, "facing=west,half=lower,hinge=left,open=false": { "model": "additionalcraft:glass_door_bottom", "y": 180 }, "facing=north,half=lower,hinge=left,open=false": { "model": "additionalcraft:glass_door_bottom", "y": 270 }, "facing=east,half=lower,hinge=right,open=false": { "model": "additionalcraft:glass_door_bottom_rh" }, "facing=south,half=lower,hinge=right,open=false": { "model": "additionalcraft:glass_door_bottom_rh", "y": 90 }, "facing=west,half=lower,hinge=right,open=false": { "model": "additionalcraft:glass_door_bottom_rh", "y": 180 }, "facing=north,half=lower,hinge=right,open=false": { "model": "additionalcraft:glass_door_bottom_rh", "y": 270 }, "facing=east,half=lower,hinge=left,open=true": { "model": "additionalcraft:glass_door_bottom_rh", "y": 90 }, "facing=south,half=lower,hinge=left,open=true": { "model": "additionalcraft:glass_door_bottom_rh", "y": 180 }, "facing=west,half=lower,hinge=left,open=true": { "model": "additionalcraft:glass_door_bottom_rh", "y": 270 }, "facing=north,half=lower,hinge=left,open=true": { "model": "additionalcraft:glass_door_bottom_rh" }, "facing=east,half=lower,hinge=right,open=true": { "model": "additionalcraft:glass_door_bottom", "y": 270 }, "facing=south,half=lower,hinge=right,open=true": { "model": "additionalcraft:glass_door_bottom" }, "facing=west,half=lower,hinge=right,open=true": { "model": "additionalcraft:glass_door_bottom", "y": 90 }, "facing=north,half=lower,hinge=right,open=true": { "model": "additionalcraft:glass_door_bottom", "y": 180 }, "facing=east,half=upper,hinge=left,open=false": { "model": "additionalcraft:glass_door_top" }, "facing=south,half=upper,hinge=left,open=false": { "model": "additionalcraft:glass_door_top", "y": 90 }, "facing=west,half=upper,hinge=left,open=false": { "model": "additionalcraft:glass_door_top", "y": 180 }, "facing=north,half=upper,hinge=left,open=false": { "model": "additionalcraft:glass_door_top", "y": 270 }, "facing=east,half=upper,hinge=right,open=false": { "model": "additionalcraft:glass_door_top_rh" }, "facing=south,half=upper,hinge=right,open=false": { "model": "additionalcraft:glass_door_top_rh", "y": 90 }, "facing=west,half=upper,hinge=right,open=false": { "model": "additionalcraft:glass_door_top_rh", "y": 180 }, "facing=north,half=upper,hinge=right,open=false": { "model": "additionalcraft:glass_door_top_rh", "y": 270 }, "facing=east,half=upper,hinge=left,open=true": { "model": "additionalcraft:glass_door_top_rh", "y": 90 }, "facing=south,half=upper,hinge=left,open=true": { "model": "additionalcraft:glass_door_top_rh", "y": 180 }, "facing=west,half=upper,hinge=left,open=true": { "model": "additionalcraft:glass_door_top_rh", "y": 270 }, "facing=north,half=upper,hinge=left,open=true": { "model": "additionalcraft:glass_door_top_rh" }, "facing=east,half=upper,hinge=right,open=true": { "model": "additionalcraft:glass_door_top", "y": 270 }, "facing=south,half=upper,hinge=right,open=true": { "model": "additionalcraft:glass_door_top" }, "facing=west,half=upper,hinge=right,open=true": { "model": "additionalcraft:glass_door_top", "y": 90 }, "facing=north,half=upper,hinge=right,open=true": { "model": "additionalcraft:glass_door_top", "y": 180 } } }
  4. Yeah i found that planks.json was causing my problem. In variant name I used only name of variant (without variant=) and now textures are correctly displayed in world too. Thank you
  5. Thanks Grey. added this.setHasSubtypes(true); and now I see metadata correctly. Also I've looked to models and blockstates to check if there are no problems. Still can't see textures if I place them in the world. In console I found something like that: [11:38:37] [Client thread/ERROR] [FML]: Exception loading model additionalcraft:models/block/planks with vanilla loader, skipping java.io.FileNotFoundException: additionalcraft:models/block/planks.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:70) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:260) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1200(ModelLoader.java:51) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:417) [ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:92) [ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadAnyModel(ModelLoader.java:165) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.getModel(ModelLoader.java:148) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:320) [ModelLoader$WeightedRandomModel.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:120) [ModelLoader.class:?] at net.minecraft.client.resources.model.ModelBakery.loadVariants(ModelBakery.java:122) [ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:98) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:68) [ModelLoader.class:?] at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:124) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:470) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?] at GradleStart.main(GradleStart.java:45) [start/:?] It shows twice, so probably forge tries to load models, but don't see my model names from planks.json. It's like it skip any information about variants and still try to load model for block like normal variant (In planks.json I have only 2 variants - cherry and dev).
  6. I've tried code from TheGreyGhost and also some vanilla blocks with meta, but everytime I register them game shows only ID (F3+H). When I look on planks or logs I see ID/meta and when looking on my custom planks I see only ID. I want to create planks just like in game, so separate blockstates files and of course metadata. Please help me. Maybe I miss something importnat, or done something stupid, but not see it... My ClientProxy class for registering blocks package net.minus.additionalcraft.proxy.client; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minus.additionalcraft.blocks.ACPlanks; public class ACBlocksClient { public static void preInitClient() { Item itemBlockVariants = GameRegistry.findItem("additionalcraft", "planks"); ModelBakery.addVariantName(itemBlockVariants, "additionalcraft:cherry_planks", "additionalcraft:dev_planks"); } public static void initClient() { final String modid = "additionalcraft"; final int DEFAULT_ITEM_SUBTYPE = 0; registerInventoryBlock(modid, "aluminum_ore"); registerInventoryBlock(modid, "ruby_ore"); registerInventoryBlock(modid, "aluminum_block"); registerInventoryBlock(modid, "ruby_block"); registerInventoryBlock(modid, "inverted_lamp_on"); registerInventoryBlock(modid, "inverted_lamp_off"); //Registering with metadata Item tempMetadataItem; ModelResourceLocation itemModelResourceLocation; tempMetadataItem = GameRegistry.findItem(modid, "planks"); itemModelResourceLocation = new ModelResourceLocation("additionalcraft:cherry_planks", "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(tempMetadataItem, ACPlanks.EnumType.CHERRY.getMetadata(), itemModelResourceLocation); tempMetadataItem = GameRegistry.findItem(modid, "planks"); itemModelResourceLocation = new ModelResourceLocation("additionalcraft:dev_planks", "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(tempMetadataItem, ACPlanks.EnumType.DEV.getMetadata(), itemModelResourceLocation); } package net.minus.additionalcraft.proxy.common; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minus.additionalcraft.blocks.*; import net.minus.additionalcraft.creativetab.ACCreativeTabs; import net.minus.additionalcraft.items.ACDoorItem; import net.minus.additionalcraft.items.ACPlanksItem; also blocks class for commonProxy public class ACBlocks { //Ores public static Block aluminumOre; public static Block rubyOre; //Blocks public static Block aluminumBlock; public static Block rubyBlock; //LAMPS public static Block invertedRedstoneLamp_On; public static Block invertedRedstoneLamp_Off; //DOORS public static Block glassDoor; //WOOD public static Block ACplanks; public static void preInitCommon() { //Ores aluminumOre = new ACOre(Material.rock).setUnlocalizedName("aluminum_ore"); GameRegistry.registerBlock(aluminumOre, "aluminum_ore"); rubyOre = new ACOre(Material.rock).setUnlocalizedName("ruby_ore"); GameRegistry.registerBlock(rubyOre, "ruby_ore"); //Blocks aluminumBlock = new ACBlock(Material.iron).setUnlocalizedName("aluminum_block"); GameRegistry.registerBlock(aluminumBlock, "aluminum_block"); rubyBlock = new ACBlock(Material.rock).setUnlocalizedName("ruby_block"); GameRegistry.registerBlock(rubyBlock, "ruby_block"); //Mechanics invertedRedstoneLamp_On = new InvertedLamp(true).setUnlocalizedName("inverted_lamp_on").setStepSound(Block.soundTypeGlass).setCreativeTab(ACCreativeTabs.tabACBlock); GameRegistry.registerBlock(invertedRedstoneLamp_On, "inverted_lamp_on"); invertedRedstoneLamp_Off = new InvertedLamp(false).setUnlocalizedName("inverted_lamp_off").setStepSound(Block.soundTypeGlass); GameRegistry.registerBlock(invertedRedstoneLamp_Off, "inverted_lamp_off"); glassDoor = new ACDoor(Material.glass).setUnlocalizedName("glass_door").setStepSound(Block.soundTypeGlass).setHardness(3.0F); GameRegistry.registerBlock(glassDoor, ACDoorItem.class, "glass_door"); //Wood ACplanks = new ACPlanks().setUnlocalizedName("planks"); GameRegistry.registerBlock(ACplanks, ACPlanksItem.class, "planks"); } My custom planks class package net.minus.additionalcraft.blocks; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IStringSerializable; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minus.additionalcraft.creativetab.ACCreativeTabs; public class ACPlanks extends Block { public static final PropertyEnum VARIANT = PropertyEnum.create("variant", ACPlanks.EnumType.class); //private static final String __OBFID = "CL_00002082"; public ACPlanks() { super(Material.wood); this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, ACPlanks.EnumType.CHERRY)); this.setCreativeTab(ACCreativeTabs.tabACBlock); } @Override public int damageDropped(IBlockState state) { return ((ACPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); } @Override @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { ACPlanks.EnumType[] aenumtype = ACPlanks.EnumType.values(); int i = aenumtype.length; for (int j = 0; j < i; ++j) { ACPlanks.EnumType enumtype = aenumtype[j]; list.add(new ItemStack(itemIn, 1, enumtype.getMetadata())); } } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(VARIANT, ACPlanks.EnumType.byMetadata(meta)); } @Override public int getMetaFromState(IBlockState state) { return ((ACPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); } @Override protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {VARIANT}); } public static enum EnumType implements IStringSerializable { CHERRY(0, "cherry"), DEV(1, "dev"); private static final ACPlanks.EnumType[] META_LOOKUP = new ACPlanks.EnumType[values().length]; private final int meta; private final String name; private final String unlocalizedName; //private static final String __OBFID = "CL_00002081"; private EnumType(int meta, String name) { this(meta, name, name); } private EnumType(int meta, String name, String unlocalizedName) { this.meta = meta; this.name = name; this.unlocalizedName = unlocalizedName; } public int getMetadata() { return this.meta; } @Override public String toString() { return this.name; } public static ACPlanks.EnumType byMetadata(int meta) { if (meta < 0 || meta >= META_LOOKUP.length) { meta = 0; } return META_LOOKUP[meta]; } public String getName() { return this.name; } public String getUnlocalizedName() { return this.unlocalizedName; } static { ACPlanks.EnumType[] var0 = values(); int var1 = var0.length; for (int var2 = 0; var2 < var1; ++var2) { ACPlanks.EnumType var3 = var0[var2]; META_LOOKUP[var3.getMetadata()] = var3; } } } } And custom planks item package net.minus.additionalcraft.items; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minus.additionalcraft.blocks.ACPlanks; public class ACPlanksItem extends ItemBlock { public ACPlanksItem(Block block) { super(block); } @Override public int getMetadata(int metadata) { return metadata; } @Override public String getUnlocalizedName(ItemStack stack) { ACPlanks.EnumType type = ACPlanks.EnumType.byMetadata(stack.getMetadata()); return super.getUnlocalizedName() + "." + type.toString(); } }
  7. I'm pretty new to java and forge, can you explain to me how to do that, or just give me link to more information.
  8. As subjects says. Is there any way to get Creative Tabs in own file (not in main mod file)? I want to make them like vanilla tabs. Because I don't want to set everything in main mod file...
  9. When I'm trying to start game from eclipse in console I have this: [20:53:18] [main/INFO] [GradleStart]: No arguments specified, assuming client. [20:53:18] [main/INFO] [GradleStart]: Extra: [] Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\Hitagi\.gradle\caches\minecraft\assets\indexes\{ASSET_INDEX}.json (Nie można odnaleźć określonego pliku) at com.google.common.base.Throwables.propagate(Throwables.java:160) at GradleStart.setupAssets(GradleStart.java:260) at GradleStart.startClient(GradleStart.java:82) at GradleStart.main(GradleStart.java:56) Caused by: java.io.FileNotFoundException: C:\Users\Hitagi\.gradle\caches\minecraft\assets\indexes\{ASSET_INDEX}.json (Nie można odnaleźć określonego pliku) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(Unknown Source) at java.io.FileReader.<init>(Unknown Source) at GradleStart.loadAssetsIndex(GradleStart.java:266) at GradleStart.setupAssets(GradleStart.java:204) ... 2 more Any ideas what went wrong? I can add that this is clear installation of forge 10.13.0.1180...
  10. I don't have it. Reinstalling with gradle not creating it. I have only makeStart and expandedArchives directories. Gradle just not deobfuscate jars. I'm surprised because I can develop mods and test them in Eclipse, but I will try to build my mod. I think that gradle will throw some errors... edit: Gradle has just build my mod without errors... edit2: I've had to remove old folder which uses gradle...
  11. Hello, after installing forge 10.13.0.1180 I can't find source from vanilla minecraft. I remember that it was in build\tmp, but now there is only directories with GradleStart and forge/FML patches. Any ideas how to get vanilla source back? I'm still learning how to mod minecraft and my knowledge about it is not so big. Please help me (If my english is bad, well... sorry )
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.