Jump to content

JimiIT92

Members
  • Posts

    866
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JimiIT92

  1. OK, so 'ive tried adding this code from the grass.json file to my both upper and half slab .json files "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "up", "tintindex": 0 }, "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "north" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "south" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "west" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "east" } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "north" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "south" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "west" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "east" } } } ] So i now have this half_grass_slab.json file { "parent": "block/half_slab", "textures": { "particle": "blocks/dirt", "bottom": "blocks/dirt", "top": "blocks/grass_top", "side": "blocks/grass_side", "overlay": "blocks/grass_side_overlay" }, "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "up", "tintindex": 0 }, "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "north" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "south" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "west" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "east" } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "north" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "south" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "west" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "east" } } } ] } and this upper_grass_slab.json file { "parent": "block/upper_slab", "textures": { "particle": "blocks/dirt", "bottom": "blocks/dirt", "top": "blocks/grass_top", "side": "blocks/grass_side", "overlay": "blocks/grass_side_overlay" }, "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "up", "tintindex": 0 }, "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "north" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "south" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "west" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "east" } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "north" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "south" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "west" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "east" } } } ] } But i have errors in Eclipse, saying: 13:35:55] [Client thread/ERROR] [FML]: Exception loading model mw:block/upper_grass_slab with loader instance, skipping com.google.gson.JsonParseException: BlockModel requires either elements or parent, found both at net.minecraft.client.renderer.block.model.ModelBlock$Deserializer.parseModelBlock(ModelBlock.java:256) ~[ModelBlock$Deserializer.class:?] at net.minecraft.client.renderer.block.model.ModelBlock$Deserializer.deserialize(ModelBlock.java:323) ~[ModelBlock$Deserializer.class:?] at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?] at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?] at net.minecraft.client.renderer.block.model.ModelBlock.deserialize(ModelBlock.java:47) ~[ModelBlock.class:?] at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:269) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$900(ModelLoader.java:67) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:451) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:92) [ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadAnyModel(ModelLoader.java:187) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.getModel(ModelLoader.java:170) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:342) [ModelLoader$WeightedRandomModel.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:140) [ModelLoader.class:?] at net.minecraft.client.resources.model.ModelBakery.loadVariants(ModelBakery.java:122) [ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:121) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:91) [ModelLoader.class:?] at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:767) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:306) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:521) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:356) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51] 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(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] [13:35:55] [Client thread/ERROR] [FML]: Exception loading model mw:block/half_grass_slab with loader instance, skipping com.google.gson.JsonParseException: BlockModel requires either elements or parent, found both at net.minecraft.client.renderer.block.model.ModelBlock$Deserializer.parseModelBlock(ModelBlock.java:256) ~[ModelBlock$Deserializer.class:?] at net.minecraft.client.renderer.block.model.ModelBlock$Deserializer.deserialize(ModelBlock.java:323) ~[ModelBlock$Deserializer.class:?] at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?] at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?] at net.minecraft.client.renderer.block.model.ModelBlock.deserialize(ModelBlock.java:47) ~[ModelBlock.class:?] at net.minecraft.client.resources.model.ModelBakery.loadModel(ModelBakery.java:269) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$900(ModelLoader.java:67) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:451) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:92) [ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadAnyModel(ModelLoader.java:187) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.getModel(ModelLoader.java:170) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:342) [ModelLoader$WeightedRandomModel.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:140) [ModelLoader.class:?] at net.minecraft.client.resources.model.ModelBakery.loadVariants(ModelBakery.java:122) [ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:121) [ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:91) [ModelLoader.class:?] at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:767) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:306) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:521) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:356) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51] 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(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] How can i solve that?
  2. i have that methods in my class but it doesn't work
  3. As by title, i'm trying to make a slab that looks like grass, but i have incorrect textures when placing the single slab (the double slab looks like a grass bock as i want) This is the code for my Slab class package mw.blocks.vanilla; import java.util.List; import java.util.Random; import mw.core.MWMetadataBlocks; import mw.core.MWTabs; import mw.core.MWVanillaSlabs; import net.minecraft.block.BlockSlab; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; 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.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.IStringSerializable; import net.minecraft.world.ColorizerGrass; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeColorHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BlockGrassSlab extends BlockSlab { public static final PropertyBool seamlessBool = PropertyBool.create("seamless"); public static final PropertyEnum typeVar = PropertyEnum.create("variant", BlockGrassSlab.EnumType.class); public BlockGrassSlab() { super(Material.grass); IBlockState iblockstate = this.blockState.getBaseState(); if (this.isDouble()) { iblockstate = iblockstate.withProperty(seamlessBool, Boolean.valueOf(false)); } else { iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); } this.setDefaultState(iblockstate.withProperty(typeVar, BlockGrassSlab.EnumType.NORMAL)); this.setCreativeTab(MWTabs.tabBlock); this.setHardness(0.7F); this.setResistance(0.0F); this.useNeighborBrightness = !this.isDouble(); this.setStepSound(soundTypeGrass); } @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT_MIPPED; } @SideOnly(Side.CLIENT) public int getBlockColor() { return ColorizerGrass.getGrassColor(0.5D, 1.0D); } @SideOnly(Side.CLIENT) public int getRenderColor(IBlockState state) { return this.getBlockColor(); } @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) { return BiomeColorHelper.getGrassColorAtPos(worldIn, pos); } public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(MWVanillaSlabs.grass_single_slab); } @SideOnly(Side.CLIENT) public Item getItem(World worldIn, BlockPos pos) { return Item.getItemFromBlock(MWVanillaSlabs.grass_single_slab); } public String getUnlocalizedName(int meta) { return "tile." + BlockGrassSlab.EnumType.func_176625_a(meta).func_176627_c(); } public IProperty getVariantProperty() { return typeVar; } public Object getVariant(ItemStack stack) { return BlockGrassSlab.EnumType.func_176625_a(stack.getMetadata() & 7); } @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { if (itemIn != Item.getItemFromBlock(MWVanillaSlabs.grass_double_slab)) { BlockGrassSlab.EnumType[] aenumtype = BlockGrassSlab.EnumType.values(); int i = aenumtype.length; for (int j = 0; j < i; ++j) { BlockGrassSlab.EnumType enumtype = aenumtype[j]; list.add(new ItemStack(itemIn, 1, enumtype.func_176624_a())); } } } public IBlockState getStateFromMeta(int meta) { IBlockState iblockstate = this.getDefaultState().withProperty(typeVar, BlockGrassSlab.EnumType.func_176625_a(meta & 7)); if (this.isDouble()) { iblockstate = iblockstate.withProperty(seamlessBool, Boolean.valueOf((meta & != 0)); } else { iblockstate = iblockstate.withProperty(HALF, (meta & == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); } return iblockstate; } public int getMetaFromState(IBlockState state) { byte b0 = 0; int i = b0 | ((BlockGrassSlab.EnumType)state.getValue(typeVar)).func_176624_a(); if (this.isDouble()) { if (((Boolean)state.getValue(seamlessBool)).booleanValue()) { i |= 8; } } else if (state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) { i |= 8; } return i; } protected BlockState createBlockState() { return this.isDouble() ? new BlockState(this, new IProperty[] {seamlessBool, typeVar}): new BlockState(this, new IProperty[] {HALF, typeVar}); } public int damageDropped(IBlockState state) { return ((BlockGrassSlab.EnumType)state.getValue(typeVar)).func_176624_a(); } public static enum EnumType implements IStringSerializable { // VARIANT(META, "VAR NAME", "UNL.NAME"); NORMAL(0, "normal", "grass_single_slab"); private static final BlockGrassSlab.EnumType[] field_176640_i = new BlockGrassSlab.EnumType[values().length]; private final int meta; private final String variantName; private final String name; private EnumType(int meta, String name) { this(meta, name, name); } private EnumType(int meta, String variantName, String name) { this.meta = meta; this.variantName = variantName; this.name = name; } public int func_176624_a() { return this.meta; } public String toString() { return this.variantName; } public static BlockGrassSlab.EnumType func_176625_a(int meta) { if (meta < 0 || meta >= field_176640_i.length) { meta = 0; } return field_176640_i[meta]; } public String getName() { return this.variantName; } public String func_176627_c() { return this.name; } static { BlockGrassSlab.EnumType[] var0 = values(); int var1 = var0.length; for (int var2 = 0; var2 < var1; ++var2) { BlockGrassSlab.EnumType var3 = var0[var2]; field_176640_i[var3.func_176624_a()] = var3; } } } @Override public boolean isDouble() { return false; } @Override public boolean isSideSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side) { if(side == EnumFacing.UP) return true; else return false; } } And here is a screenshot of what the single slab looks like in inventory, on ground and on the upper half of a block Basically is not painting the grass top grass texture Also, there is a better way to make a slab that has no variant (just 1 type of slab, for example: only grass or only stone....)? Thanks in advance to all who will help me
  4. I've solved that Fortunately i've found this post and it worked http://www.minecraftforge.net/forum/index.php?topic=28643.0 Thanks to everyone for helping me
  5. I've tried to do this as my item model file: { "parent": "builtin/entity", "textures": { "layer0": "mw:blocks/colors/planks_oak_colored_white" } } but nothing happens, still render as a normal chest
  6. delpi i think that is the name of he's item class with all the packages path returned by the toString method
  7. Ehm.... i don't speak german but standing to what Google Translate says i can tell you this: that code might work but there are tons of methods that are surely better than that. And because he is a modder longer than me and he helps me a lot too, i suggest to follow his answer Mine might work and you could be ignore the other answer, it's just a your choice
  8. Ok, quick update Thanks to your answer i now have particles, i've made this blockstate file: { "variants": { "facing=east": { "model": "mw:white_chest" }, "facing=west": { "model": "mw:white_chest" }, "facing=north": { "model": "mw:white_chest" }, "facing=south": { "model": "mw:white_chest" } } } and this block model file: { "parent": "block/cube", "textures": { "particle": "mw:blocks/colors/planks_oak_colored_white" } } Still try to understand how to change it's rendering in inventory
  9. Glad that it worked, by the way you should follow the diesieben tip, maybe my "solution" could cause some issues in future (he's a better modder than me )
  10. Maybe i don't understand your question. Here is what i've understand: You have an item called (for example) "Super Sword" It's unlocalized name will be: "item.super_sword.name" This name must be colored in yellow but the name of the item must be "Super Sword" instead of "item.super_sword.name". If i'm right you want to know the translated string corresponding to "item.super_sword.name", so you should use this code: your_item.getLocalizedName(); wich will return the translated name for your item (in this case if you item in the code is called "sword" and you do sword.getLocalizedName(); you will get "Super Sword" as result)
  11. Thanks for your answer For the item i can't understand how to change that texture since for the chest i don't have an icon (it's just the texture for the model like normal one), so how can i tell in the json file: "use this texture but be careful beacuse is not an icon but a texture for a model?" Or perhaps there is a way to tell what specific TileEntitySpecialRender it will use? I know how to make a normal item json file Same for the model, how can i tell him that "it's not a normal block, it's a chest, and there's no "normal" texture, only for the model"? I'm literally going crazy about this The only references for blockstates and block/item model json files i found are for normal blocks/items (wich i know how to make them), but for the chest in particular (ora any other block that has a texture made by an entity) i don't find anything
  12. As you can see the instruction toString() returns you the reference of the class of the Item You should change that to return your Item name
  13. Hi, thanks for your response So, i've now a chest rendering in my inventory but it's a normal chest. I mean: i expect to render a white chest in inventory. The #1 problem was that i don't have a "white_chest.json" file in my item folder, and all the content of that file is: { "parent": "builtin/entity" } How can i change that? Is it related to the fact that the BlockWhiteChest is extending the BlockChest? This is the block class package mw.blocks.colored.chests; import java.util.Iterator; import mw.core.utils.Utils; import mw.entities.tileentity.colored.TileEntityWhiteChest; import net.minecraft.block.Block; import net.minecraft.block.BlockChest; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.inventory.InventoryLargeChest; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.ILockableContainer; import net.minecraft.world.World; public class BlockWhiteChest extends BlockChest { private int chestType; public BlockWhiteChest(int type, String name) { super(type); this.chestType = type; this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); Utils.setColorChestBlockInfo(this, name, 2.5F, Block.soundTypeWood); } public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite(); state = state.withProperty(FACING, enumfacing); BlockPos blockpos1 = pos.north(); BlockPos blockpos2 = pos.south(); BlockPos blockpos3 = pos.west(); BlockPos blockpos4 = pos.east(); boolean flag = this == worldIn.getBlockState(blockpos1).getBlock(); boolean flag1 = this == worldIn.getBlockState(blockpos2).getBlock(); boolean flag2 = this == worldIn.getBlockState(blockpos3).getBlock(); boolean flag3 = this == worldIn.getBlockState(blockpos4).getBlock(); if (!flag && !flag1 && !flag2 && !flag3) { worldIn.setBlockState(pos, state, 3); } else if (enumfacing.getAxis() == EnumFacing.Axis.X && (flag || flag1)) { if (flag) { worldIn.setBlockState(blockpos1, state, 3); } else { worldIn.setBlockState(blockpos2, state, 3); } worldIn.setBlockState(pos, state, 3); } else if (enumfacing.getAxis() == EnumFacing.Axis.Z && (flag2 || flag3)) { if (flag2) { worldIn.setBlockState(blockpos3, state, 3); } else { worldIn.setBlockState(blockpos4, state, 3); } worldIn.setBlockState(pos, state, 3); } if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityWhiteChest) { ((TileEntityWhiteChest)tileentity).setCustomName(stack.getDisplayName()); } } } public ILockableContainer getLockableContainer(World worldIn, BlockPos pos) { TileEntity tileentity = worldIn.getTileEntity(pos); if (!(tileentity instanceof TileEntityWhiteChest)) { return null; } else { Object object = (TileEntityWhiteChest)tileentity; if (this.isBlocked(worldIn, pos)) { return null; } else { Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator(); while (iterator.hasNext()) { EnumFacing enumfacing = (EnumFacing)iterator.next(); BlockPos blockpos1 = pos.offset(enumfacing); Block block = worldIn.getBlockState(blockpos1).getBlock(); if (block == this) { if (this.isBlocked(worldIn, blockpos1)) { return null; } TileEntity tileentity1 = worldIn.getTileEntity(blockpos1); if (tileentity1 instanceof TileEntityWhiteChest) { if (enumfacing != EnumFacing.WEST && enumfacing != EnumFacing.NORTH) { object = new InventoryLargeChest("container.chestDouble.white", (ILockableContainer)object, (TileEntityWhiteChest)tileentity1); } else { object = new InventoryLargeChest("container.chestDouble.white", (TileEntityWhiteChest)tileentity1, (ILockableContainer)object); } } } } return (ILockableContainer)object; } } } /** * Returns a new instance of a block's tile entity class. Called on placing the block. */ public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityWhiteChest(this.chestType); } public int isProvidingWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) { if (!this.canProvidePower()) { return 0; } else { int i = 0; TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityWhiteChest) { i = ((TileEntityWhiteChest)tileentity).numPlayersUsing; } return MathHelper.clamp_int(i, 0, 15); } } private boolean isBlocked(World worldIn, BlockPos pos) { return this.isBelowSolidBlock(worldIn, pos) || this.isOcelotSittingOnChest(worldIn, pos); } private boolean isBelowSolidBlock(World worldIn, BlockPos pos) { return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); } private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) { Iterator iterator = worldIn.getEntitiesWithinAABB(EntityOcelot.class, new AxisAlignedBB((double)pos.getX(), (double)(pos.getY() + 1), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 2), (double)(pos.getZ() + 1))).iterator(); EntityOcelot entityocelot; do { if (!iterator.hasNext()) { return false; } Entity entity = (Entity)iterator.next(); entityocelot = (EntityOcelot)entity; } while (!entityocelot.isSitting()); return true; } } I also notice that breaking the chest gives the "Missing Texture" particles, i'm sure it's realted to the fact that i don't have a block model file for the chest (but as i said above, i don't know how to write it, since i have no reference for chests in particular). Here is two screenshots to better show you what i've described (i know my english is bad, sorry ) Unfortunately problems #2 and #3 are still there, i know how to make blockstates but i don't know how to make it for a chest I'm sorry if i'm making too much questions, but unfortunately i haven't found tutorials or references about the chests in particular
  14. Hi guys, i'm making a custom chest and i have some little problems. Now, the chest itself works fine, but i still have 3 problems: 1. Chest is not rendering in inventory (it's just rendering as a block with missing texture) How can i rendering it properly? In 1.7 i used this class package mw.entities.renderer.colored; import net.minecraft.client.model.ModelChest; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.client.IItemRenderer.ItemRendererHelper; import net.minecraftforge.fml.client.FMLClientHandler; import org.lwjgl.opengl.GL11; public class RenderColoredChest implements IItemRenderer { private ModelChest chestModel; private int num; private ResourceLocation forge = new ResourceLocation("mw:textures/entities/chest/normal_white.png"); public RenderColoredChest(int i){ chestModel = new ModelChest(); num = i; } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch (type) { case ENTITY: { renderStratosChest(0.5F, 0.5F, 0.5F); break; } case EQUIPPED: { renderStratosChest(1.0F, 1.0F, 1.0F); break; } case EQUIPPED_FIRST_PERSON: { renderStratosChest(1.0F, 1.0F, 1.0F); break; } case INVENTORY: { renderStratosChest(0.0F, 0.075F, 0.0F); break; } default: break; } } private void renderStratosChest(float x, float y, float z) { forge = new ResourceLocation("mw:textures/entities/chest/normal_" + EnumDyeColor.byDyeDamage(num).getUnlocalizedName() + ".png"); FMLClientHandler.instance().getClient().renderEngine.bindTexture(forge); GL11.glPushMatrix(); //start GL11.glTranslatef(x, y, z); //size GL11.glRotatef(180, 1, 0, 0); GL11.glRotatef(-90, 0, 1, 0); chestModel.renderAll(); GL11.glPopMatrix(); //end } } Wich i also use for other chests, but it seems that this no longer works, so how should i change that? 2. Forge is asking me for the blockstate files of the chest (legit, but i don't have a "vanilla" chest blockstate file for reference) [11:41:34] [Client thread/ERROR] [FML]: Model definition for location mw:white_chest#facing=south not found [11:41:34] [Client thread/ERROR] [FML]: Model definition for location mw:white_chest#facing=north not found [11:41:34] [Client thread/ERROR] [FML]: Model definition for location mw:white_chest#inventory not found [11:41:34] [Client thread/ERROR] [FML]: Model definition for location mw:white_chest#facing=west not found [11:41:34] [Client thread/ERROR] [FML]: Model definition for location mw:white_chest#facing=east not found Where can i found a reference file for this? Or would i make a "fake" file for that? 3. Chest is not rendered if i rotate my view (video below) https://www.youtube.com/watch?v=bqZrT2qpdO8 Actually this problem was there since 1.6, but i've never find out how to solve that Here is the rendering class for the TileEntity of the White Chest package mw.entities.tileentity.colored.renderer; import java.util.Calendar; import mw.blocks.colored.chests.BlockWhiteChest; import mw.entities.tileentity.colored.TileEntityWhiteChest; import net.minecraft.block.Block; import net.minecraft.client.model.ModelChest; import net.minecraft.client.model.ModelLargeChest; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class TileEntityWhiteChestRenderer extends TileEntitySpecialRenderer { private static final ResourceLocation textureTrappedDouble = new ResourceLocation("mw:textures/entities/chest/trapped_double_white.png"); private static final ResourceLocation textureNormalDouble = new ResourceLocation("mw:textures/entities/chest/normal_double_white.png"); private static final ResourceLocation textureTrapped = new ResourceLocation("mw:textures/entities/chest/trapped_white.png"); private static final ResourceLocation textureNormal = new ResourceLocation("mw:textures/entities/chest/normal_white.png"); private static final ResourceLocation textureChristmasDouble = new ResourceLocation("textures/entity/chest/christmas_double.png"); private static final ResourceLocation textureChristmas = new ResourceLocation("textures/entity/chest/christmas.png"); private ModelChest simpleChest = new ModelChest(); private ModelChest largeChest = new ModelLargeChest(); private boolean isChristams; public TileEntityWhiteChestRenderer() { Calendar calendar = Calendar.getInstance(); if (calendar.get(2) + 1 == 12 && calendar.get(5) >= 24 && calendar.get(5) <= 26) { this.isChristams = true; } } public void func_180538_a(TileEntityWhiteChest tileentitywhitechest, double par2, double par3, double par4, float par5, int par6) { int j; if (!tileentitywhitechest.hasWorldObj()) { j = 0; } else { Block block = tileentitywhitechest.getBlockType(); j = tileentitywhitechest.getBlockMetadata(); if (block instanceof BlockWhiteChest && j == 0) { ((BlockWhiteChest)block).checkForSurroundingChests(tileentitywhitechest.getWorld(), tileentitywhitechest.getPos(), tileentitywhitechest.getWorld().getBlockState(tileentitywhitechest.getPos())); j = tileentitywhitechest.getBlockMetadata(); } tileentitywhitechest.checkForAdjacentChests(); } if (tileentitywhitechest.adjacentChestZNeg == null && tileentitywhitechest.adjacentChestXNeg == null) { ModelChest modelchest; if (tileentitywhitechest.adjacentChestXPos == null && tileentitywhitechest.adjacentChestZPos == null) { modelchest = this.simpleChest; if (par6 >= 0) { this.bindTexture(DESTROY_STAGES[par6]); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(4.0F, 4.0F, 1.0F); GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); GlStateManager.matrixMode(5888); } else if (tileentitywhitechest.getChestType() == 1) { this.bindTexture(textureTrapped); } else if (this.isChristams) { this.bindTexture(textureChristmas); } else { this.bindTexture(textureNormal); } } else { modelchest = this.largeChest; if (par6 >= 0) { this.bindTexture(DESTROY_STAGES[par6]); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(8.0F, 4.0F, 1.0F); GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); GlStateManager.matrixMode(5888); } else if (tileentitywhitechest.getChestType() == 1) { this.bindTexture(textureTrappedDouble); } else if (this.isChristams) { this.bindTexture(textureChristmasDouble); } else { this.bindTexture(textureNormalDouble); } } GlStateManager.pushMatrix(); GlStateManager.enableRescaleNormal(); if (par6 < 0) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } GlStateManager.translate((float)par2, (float)par3 + 1.0F, (float)par4 + 1.0F); GlStateManager.scale(1.0F, -1.0F, -1.0F); GlStateManager.translate(0.5F, 0.5F, 0.5F); short short1 = 0; if (j == 2) { short1 = 180; } if (j == 3) { short1 = 0; } if (j == 4) { short1 = 90; } if (j == 5) { short1 = -90; } if (j == 2 && tileentitywhitechest.adjacentChestXPos != null) { GlStateManager.translate(1.0F, 0.0F, 0.0F); } if (j == 5 && tileentitywhitechest.adjacentChestZPos != null) { GlStateManager.translate(0.0F, 0.0F, -1.0F); } GlStateManager.rotate((float)short1, 0.0F, 1.0F, 0.0F); GlStateManager.translate(-0.5F, -0.5F, -0.5F); float f1 = tileentitywhitechest.prevLidAngle + (tileentitywhitechest.lidAngle - tileentitywhitechest.prevLidAngle) * par5; float f2; if (tileentitywhitechest.adjacentChestZNeg != null) { f2 = tileentitywhitechest.adjacentChestZNeg.prevLidAngle + (tileentitywhitechest.adjacentChestZNeg.lidAngle - tileentitywhitechest.adjacentChestZNeg.prevLidAngle) * par5; if (f2 > f1) { f1 = f2; } } if (tileentitywhitechest.adjacentChestXNeg != null) { f2 = tileentitywhitechest.adjacentChestXNeg.prevLidAngle + (tileentitywhitechest.adjacentChestXNeg.lidAngle - tileentitywhitechest.adjacentChestXNeg.prevLidAngle) * par5; if (f2 > f1) { f1 = f2; } } f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; modelchest.chestLid.rotateAngleX = -(f1 * (float)Math.PI / 2.0F); modelchest.renderAll(); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (par6 >= 0) { GlStateManager.matrixMode(5890); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); } } } public void renderTileEntityAt(TileEntity tileentitywhitechest, double posX, double posZ, double par4, float par5, int par6) { this.func_180538_a((TileEntityWhiteChest)tileentitywhitechest, posX, posZ, par4, par5, par6); } } Of course it has been properly registered in the Client Proxy with ClientRegistry.bindTileEntitySpecialRenderer(TileEntityWhiteChest.class, new TileEntityWhiteChestRenderer()); If any other files or informations are needed please aks them Thanks in advance for all who will help me, have a nice day
  15. Ok, so i found the solution. You need to add to override the function getIsRepairable in your ItemArmor class (wich of course it must extend the vanilla ItemArmor class) or in your custom Tool class. To do this you need to add this lines @Override public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { if(repair.getItem().equals(-MY ARMOR ITEM (example: Obsidian))) return true; else return false; } Basically what you need to check is if the Item in the second andvil slot is equal to an item that you want (in this case you check if that item is an obsidian block, so you can repair an obsidian armor/tool). Hope this helped, at least for armor it works for me
  16. I bunce into this discussion, so we can solve two problems at once I have my custom ItemArmor class, now to say at the game "if i have a ruby armor and i'm using a ruby in the anvil than repair my armor" how could i do? I think is the same question that the guy above is making package mw.items; import mw.core.MW; import mw.core.MWItems; import mw.core.utils.Utils; import net.minecraft.entity.Entity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; public class ItemArmorMW extends ItemArmor { private String material; public ItemArmorMW(ArmorMaterial par1, int par2, int par3, String name) { super(par1, par2, par3); Utils.setCombatItemInfo(this, name); this.material = par1.name().toLowerCase(); } public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if(slot == 2) return MW.MODID + ":" + "textures/models/armor/" + this.material + "_2.png"; else return MW.MODID + ":" + "textures/models/armor/" + this.material + "_1.png"; } @Override public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { if(repair.equals(MWItems.ruby) && toRepair.equals(this)) return true; else return false; } } I've tried overriding the getIsRepairable method but is not working
  17. To override the getRepairItemStack he need to create a custom Tool Material class, i guess
  18. D'oh, i don't know why Eclipse doesn't warned me, maybe is tired Anyway that works, so thank for the help Just for curiosity, why extending BlockContainer makes an invisible block?
  19. Try overriding the getIsRepairable method, not sure if it still works
×
×
  • Create New...

Important Information

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