• 0

    posted a message on Blocks showing up in minecraft twice with the same id and one get textured and one does not.

    Bump No one has any advice for me on this? So no one can help me with this issue?

    Posted in: Modification Development
  • 0

    posted a message on Blocks showing up in minecraft twice with the same id and one get textured and one does not.

    Hello I was wondering if anyone might know why I am getting 2 walls showing up in Minecraft when my system.out.println say only one of each block is getting created.



    public class MBM_Blocks {
    	
    	public static final List<Block> blocks = new ArrayList<Block>();
    			
    	public static final void preinit() {
    		
    		// Blocks
    		ModInfo.blockBlueScreen = registerBlock("blockBlueScreen", new ChromakeyBlock(Material.CLAY));
    		ModInfo.blockGreenScreen = registerBlock("blockGreenScreen", new ChromakeyBlock(Material.CLAY));
    		
    		//Stairs
    		ModInfo.blockBlueScreenStairs = registerBlock("blockBlueScreenStairs", new ChromakeyStairs());
    		ModInfo.blockGreenScreenStairs = registerBlock("blockGreenScreenStairs", new ChromakeyStairs());
    		ModInfo.blockObsidianStairs = registerBlock("blockObsidianStairs", new ObsidianStairs());
    
    		for(int ci = 0; ci < ModInfo.MAX; ci++){
    			String block_name = ModInfo.woolColours[ci] + "Stairs";
    			ModInfo.blockWoolenStairs[ci] = registerBlock(block_name, new WoolenStairs());
    			System.out.println(" Creating Wool Stairs [ " + ModInfo.blockWoolenStairs[ci] + " ]");
    		}
    		
    		//Walls
    		ModInfo.blockBlueScreenWall = registerBlock("blockBlueScreenWall", new WoolenWalls(Blocks.CLAY));
    		ModInfo.blockGreenScreenWall = registerBlock("blockGreenScreenWall", new WoolenWalls(Blocks.CLAY));
    		ModInfo.blockObsidianWall = registerBlock("blockObsidianWall", new WoolenWalls(Blocks.OBSIDIAN));
    		
    		for(int ci = 0; ci < ModInfo.MAX; ci++){
    			String block_name = ModInfo.woolColours[ci] + "Wall";
    			ModInfo.blockWoolenWalls[ci] = registerBlock(block_name, new WoolenWalls(Blocks.WOOL));
    			System.out.println(" Creating Wool Wall [ " + ModInfo.blockWoolenWalls[ci] + " ]");
    		}
    		
    	}
    
    	public static final void registerRenders() { }
    	
    	private static final Block registerBlock(String n, Block  B) {
    		ResourceLocation r = new ResourceLocation(ModInfo.MODID, n);
    		
    		b.setUnlocalizedName(n);
    		b.setRegistryName(r);
    		b.setCreativeTab(MBM_Tabs.tabMissingBlocks);
    		
    		GameRegistry.register(b);
    		MBM_Items.registerItem(new ItemBlock(b), n);
    		blocks.add(b);
    		
    		return b;
    	}
    }




    and here is the class for my walls:

    public class WoolenWalls extends BlockWall {
    
    
     public WoolenWalls(Block  B) {
     super(b);
     this.useNeighborBrightness = true;
     this.setSoundType(SoundType.CLOTH);
     this.setHardness(0.8F).setResistance(4.0F);
     }
     
     public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) {
     
     if (state.isSideSolid(world, pos, EnumFacing.UP)) {
     
     return true; 
     }
     
     return this instanceof WoolenWalls;
     }
     
     public boolean isFullCube(IBlockState state) {
     
     return false;
     }
    
     public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
     
     return false;
     }
     
     public boolean isOpaqueCube(IBlockState state) {
     
     return false;
     }
    
     private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
     IBlockState iblockstate = worldIn.getBlockState(pos);
     Block block = iblockstate.getBlock();
     
     //*******_STILL NOT WORKING RIGHT_********
     if (((block instanceof BlockFenceGate)) || (block == Blocks.COBBLESTONE_WALL) || (block == ModInfo.blockWoolColoredWhiteWall) || ( block == ModInfo.blockWoolColoredYellowWall)) {
     
     return true;
     }
     
     return true;
     }
    
    }

    the walls are the only block showing up twice here is a screenshot in Minecraft of what it is doing. All the block does not have .json files yet but the first one I finished was white and you can see in the image what I am talking about.



    Duplicating Blocks


    EDITED the image was shrunk down for some reason so here is a link to the image

    Duplicate Blocks

    any help would be greatly appreciated


    Thanks In Advanced

    Posted in: Modification Development
  • 0

    posted a message on DivineRPG - 8 New Dimensions ♦ 115+ New Mobs/Bosses ♦ Hundreds of New Blocks and Items ♦ Unique Weapons and Armor

    Awesome job folks! this was one of the mods that i bought minecraft for I am glad to see if have been updated. Thank you.

    Posted in: Minecraft Mods
  • 0

    posted a message on How do I correctly render only the sides of the block that show.
    I noticed that when i place my blocks next to each other it renders all sides even though some of the sides have blocks that covers them.

    I tried this and it works as long as all the blocks are slabs, if I make them double slabs they draw all the sides again or if I place a full block next to them they draw all the sides again.

     
    @SideOnly(Side.CLIENT)
     public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_){
     
     if (this.field_150004_a){
     
     return super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
     }
     
     else if (p_149646_5_ != 1 && p_149646_5_ != 0 && !super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_)){
     
     return false;
     }
     
     else {
     
     int i1 = p_149646_2_ + Facing.offsetsXForSide[Facing.oppositeSide[p_149646_5_]];
     int j1 = p_149646_3_ + Facing.offsetsYForSide[Facing.oppositeSide[p_149646_5_]];
     int k1 = p_149646_4_ + Facing.offsetsZForSide[Facing.oppositeSide[p_149646_5_]];
     boolean flag = (p_149646_1_.getBlockMetadata(i1, j1, k1) & 8) != 0;
     return flag ? (p_149646_5_ == 0 ? true : (p_149646_5_ == 1 && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_) ? true : !func_150003_a(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)) || (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) & 8) == 0)) : (p_149646_5_ == 1 ? true : (p_149646_5_ == 0 && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_) ? true : !func_150003_a(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)) || (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) & 8) != 0));
     
     }
     
     }
    
    @SideOnly(Side.CLIENT)
     public boolean func_150003_a(Block p_150003_0_)
     {
     return p_150003_0_.getMaterial().isSolid();
     //return (p_150003_0_ instanceof BlockSlab) || (p_150003_0_ instanceof BlockStairs);
     //return p_150003_0_ == Blocks.stone_slab || p_150003_0_ == Blocks.wooden_slab;
     }
    here is a paste bin link for the code it much easier to read. http://pastebin.com/gUUg5Grp
    Posted in: Modification Development
  • 0

    posted a message on How do I call my metadata to get the right crafting Recipe to show up in the crafting table. [SOLVED]
    Quote from master801»
    Note, for ItemStacks, they use the parameters like so...

    Item item, int stackSize, int metadata
    //Or
    Block block, int stackSize, int metadata

    Thanks! I found out I needed to change my statement around a little for it to work with metadata blocks. this is what I ended up with for those that would like to know.


    GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 0), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 0)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 1), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 1)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 2), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 2)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 3), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 3)}); 
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 4), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 4)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 5), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 5)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 6), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 6)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 7), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 7)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab2, 6, 8), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 8)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab2, 6, 9), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 9)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab2, 6, 10), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 10)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab2, 6, 11), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 11)}); 
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab2, 6, 12), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 12)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab2, 6, 13), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 13)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab2, 6, 14), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 14)});
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab2, 6, 15), new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 15)});


    I changed:

    new Object[] {"###", '#', Blocks.stained_glass}); to new Object[] {"###", '#', new ItemStack(Blocks.stained_glass, 1, 15)}); // Black where the 15 is that is the metadata variable.
    Posted in: Modification Development
  • 0

    posted a message on Wondering if anyone would give me modding/java programming lessons
    Hi I just started out with modding my self. if you do a search on youtube for scratchforfun, or letsmodreboot by palimar you can get some good video tutorials. also http://www.minecraftforge.net/wiki/Tutorials has some good tutorial also.
    Posted in: Modification Development
  • 0

    posted a message on Custom Glass block "sees" thorugh world and other blocks... (Solved)
    Quote from Beamfield»
    Why people just can't look up the code in the vanilla's source? I always look it up if I don't know what it is.
    If you extend a class with an other for example Block your class will be able to override the Block's methods.

    Some people are new to minecraft modding and do not understand what each method actually does. I do not see why people have to write grip posts instead of writing something that will actually help some one out. it just as easy to post something usefull as it is to post a useless topic like this reply or your last post
    Posted in: Modification Development
  • 0

    posted a message on How do I call my metadata to get the right crafting Recipe to show up in the crafting table. [SOLVED]
    Hi could someone help me figure this out? I have a class that creates stained glass half slabs and double slabs. I am just trying to register the recipes for the half slabs. Here is my block class for them.

    BlockMBStainedGlassSlabs.java


    
    // Code Based off of https://github.com/Glitchfiend/BiomesOPlenty
    // Render Code based off of Minecraft ideal given by mathew_653
    
    package missingblocks.common.blocks;
    
    import java.util.List;
    import java.util.Random;
    
    import missingblocks.api.content.MBCBlocks;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockSlab;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.Entity;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.world.World;
    
    public class BlockMBStainedGlassSlabs extends BlockSlab{
     
     public static enum StainedGlassSlabCategory{
     
     SGLASS1, SGLASS2;
     }
     
     private static final String[] sGlassTypes = new String[] {"glass_white", "glass_orange", "glass_magenta", "glass_light_blue", "glass_yellow", 
     "glass_lime", "glass_pink", "glass_gray", "glass_silver", "glass_cyan", "glass_purple", "glass_blue", "glass_brown", "glass_green", "glass_red", "glass_black"};
     
     private IIcon[] textures;
     private final StainedGlassSlabCategory category;
    
    public BlockMBStainedGlassSlabs(boolean isDoubleSlab, Material material, StainedGlassSlabCategory cat){
     
     super(isDoubleSlab, material);
     
     category = cat;
     
     this.setHardness(0.3F);
     this.setResistance(1.5F);
     this.setHarvestLevel("", 0);
     this.setStepSound(Block.soundTypeGlass);
     this.useNeighborBrightness = true;
     
     
     if (!isDoubleSlab){
     
     this.setCreativeTab(CreativeTabs.tabBlock);
     }
     
     }
    
    @Override
     public void registerBlockIcons(IIconRegister iconRegister){
     
     textures = new IIcon[sGlassTypes.length];
    
    for (int i = 0; i < sGlassTypes.length; ++i){
     
     textures[i] = iconRegister.registerIcon("minecraft:"+ sGlassTypes[i]);
     }
     }
    
    @Override
     public IIcon getIcon(int side, int meta){
    
    return textures[getGlassType(meta)];
     }
    
    @Override
     @SuppressWarnings({ "rawtypes", "unchecked" })
     public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list){
     
     int max = 0;
    
    if (category == StainedGlassSlabCategory.SGLASS1) {
     max = 8;
     } 
     
     else if (category == StainedGlassSlabCategory.SGLASS2) {
     max = 8;
     }
    
    for (int i = 0; i < max; ++i) {
     list.add(new ItemStack(block, 1, i));
     }
     }
    
    @Override
     public String func_150002_b(int meta){
     
     if (category == StainedGlassSlabCategory.SGLASS1){
     
     return (new StringBuilder()).append(sGlassTypes[getGlassType(meta)]).append("Slab").toString();
     
     } 
     
     else if (category == StainedGlassSlabCategory.SGLASS2){
     
     return (new StringBuilder()).append(sGlassTypes[getGlassType(meta)]).append("Slab").toString();
     
     } 
     
     else {
     
     return null;
     } 
     }
    
    @Override
     public int damageDropped(int meta){
     
     return meta & 7;
     }
     
     protected boolean canSilkHarvest(){
     
     return true;
     }
    
    @Override
     public Item getItemDropped(int metadata, Random random, int fortune){
     
     if (field_150004_a){
     
     if (this == MBCBlocks.glassStainedDoubleSlab1)
     
     return Item.getItemFromBlock(MBCBlocks.glassStainedSingleSlab1);
     
     else
     
     return Item.getItemFromBlock(MBCBlocks.glassStainedSingleSlab2);
     
     }
     
     else
     
     return Item.getItemFromBlock(this);
     }
    
    @Override
     public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z){
    
    Block block = !field_150004_a ? this : (this == MBCBlocks.glassStainedDoubleSlab1 ? MBCBlocks.glassStainedSingleSlab1 : (this == MBCBlocks.glassStainedDoubleSlab2 ? MBCBlocks.glassStainedSingleSlab2 : MBCBlocks.stoneSingleSlab));
     
     return new ItemStack(block, 1, world.getBlockMetadata(x, y, z));
     }
    
    @Override
     protected ItemStack createStackedBlock(int meta){
     
     if (this == MBCBlocks.glassStainedDoubleSlab1){
     
     return new ItemStack(MBCBlocks.glassStainedSingleSlab1, 2, meta);
     
     } else if (this == MBCBlocks.glassStainedDoubleSlab2){
     
     return new ItemStack(MBCBlocks.glassStainedSingleSlab2, 2, meta);
     
     } else if (this == MBCBlocks.glassStainedSingleSlab1){
     
     return new ItemStack(MBCBlocks.glassStainedSingleSlab1, 1, meta);
     
     } else if (this == MBCBlocks.glassStainedSingleSlab2){
     
     return new ItemStack(MBCBlocks.glassStainedSingleSlab2, 1, meta);
     
     } else
     // return new ItemStack(this, 2, meta);
     return null;
     }
     
     public int getRenderBlockPass(){
     return 1;
     }
    
    private int getGlassType(int meta){
     
     meta = getTypeFromMeta(meta) + category.ordinal() * 8;
     
     if (meta < sGlassTypes.length)
     
     return meta;
    
    return 0;
     }
     
     private static int getTypeFromMeta(int meta){
     
     return meta & 7;
     }
     
     public boolean isOpaqueCube(){
     return false;
     }
     
     public boolean renderAsNormalBlock(){
     return false;
     }
     
     public int quantityDropped(Random p_149745_1_){
     return 0;
     }
    
    }
    
    




    Here is my custom Itemblock class


    
    // Code Based off of https://github.com/Glitchfiend/BiomesOPlenty
    
    package missingblocks.common.itemblocks;
    
    import missingblocks.common.blocks.BlockMBStainedGlassSlabs;
    import net.minecraft.block.Block;
    import net.minecraft.item.ItemSlab;
    import net.minecraft.item.ItemStack;
    
    public class ItemBlockMBStainedGlassSlabs extends ItemSlab{
     
     public ItemBlockMBStainedGlassSlabs(Block block, BlockMBStainedGlassSlabs singleSlab, BlockMBStainedGlassSlabs doubleSlab){
     
     super(block, singleSlab, doubleSlab, block == doubleSlab);
     }
    
    @Override
     public int getMetadata(int meta){
     
     return meta & 7;
     }
    
    @Override
     public String getUnlocalizedName(ItemStack itemStack){
     
     BlockMBStainedGlassSlabs slab = (BlockMBStainedGlassSlabs)Block.getBlockFromItem(itemStack.getItem());
    
    return super.getUnlocalizedName() + "." + (new StringBuilder()).append(slab.func_150002_b(itemStack.getItemDamage())).toString();
     }
     
     public boolean isOpaqueCube() {
     return false;
     }
     
     public boolean renderAsNormalBlock() {
     return false;
     }
    }
    
    


    and this is how I am calling / registering the blocks.


    
    // Code Based off of https://github.com/Glitchfiend/BiomesOPlenty
    
    package missingblocks.common.core;
    
    import missingblocks.api.content.MBCBlocks;
    import missingblocks.common.blocks.BlockMBStainedGlassSlabs;
    import missingblocks.common.blocks.BlockMBStainedGlassSlabs.StainedGlassSlabCategory;
    import missingblocks.common.itemblocks.ItemBlockMBMetadata;
    import missingblocks.common.itemblocks.ItemBlockMBStainedGlassSlabs;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockGlass;
    import net.minecraft.block.material.Material;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.ItemBlock;
    import cpw.mods.fml.common.registry.GameRegistry;
    
    public class MBBlocksStainedGlassSlabs{
    
     
    
    public static void init(){
     
     registerBlocks();
     
     }
    
    private static void registerBlocks(){
     
     BlockMBStainedGlassSlabs singleSlab = (BlockMBStainedGlassSlabs)new BlockMBStainedGlassSlabs(false, Material.glass, StainedGlassSlabCategory.SGLASS1).setBlockName("glassStainedSingleSlab1");
     BlockMBStainedGlassSlabs doubleSlab = (BlockMBStainedGlassSlabs)new BlockMBStainedGlassSlabs(true, Material.glass, StainedGlassSlabCategory.SGLASS1).setBlockName("glassStainedDoubleSlab1");
     
     MBCBlocks.glassStainedSingleSlab1 = registerBlock(singleSlab, ItemBlockMBStainedGlassSlabs.class, singleSlab, doubleSlab);
     MBCBlocks.glassStainedDoubleSlab1 = registerBlock(doubleSlab, ItemBlockMBStainedGlassSlabs.class, singleSlab, doubleSlab);
    
    singleSlab = (BlockMBStainedGlassSlabs)new BlockMBStainedGlassSlabs(false, Material.glass, StainedGlassSlabCategory.SGLASS2).setBlockName("glassStainedSingleSlab2");
     doubleSlab = (BlockMBStainedGlassSlabs)new BlockMBStainedGlassSlabs(true, Material.glass, StainedGlassSlabCategory.SGLASS2).setBlockName("glassStainedDoubleSlab2");
     
     MBCBlocks.glassStainedSingleSlab2 = registerBlock(singleSlab, ItemBlockMBStainedGlassSlabs.class, singleSlab, doubleSlab);
     MBCBlocks.glassStainedDoubleSlab2 = registerBlock(doubleSlab, ItemBlockMBStainedGlassSlabs.class, singleSlab, doubleSlab);
    
    }
     
     public static Block registerBlock(Block block)
     {
     GameRegistry.registerBlock(block, block.getUnlocalizedName().replace("tile.", ""));
     
     return block;
     }
     
     public static Block registerMetadataBlock(Block block)
     {
     registerBlock(block, ItemBlockMBMetadata.class);
     
     return block;
     }
     
     public static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlockClass)
     {
     GameRegistry.registerBlock(block, itemBlockClass, block.getUnlocalizedName().replace("tile.", ""));
     
     return block;
     }
     
     public static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlockClass, Object... constructorArgs)
     {
     GameRegistry.registerBlock(block, itemBlockClass, block.getUnlocalizedName().replace("tile.", ""), constructorArgs);
     
     return block;
     }
    
    }
    
    


    I need to figure out how to call each color so I can add a line like this to the crafting class

    
    GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 0), new Object[] {"###", '#', Blocks.stained_glass});
    
    


    if i just do that it does not matter what color of glass blocks I have it will only produce white slabs. because of the 6, 0 the 0 being the meta data. I tried something like this but it does not work either

    
    if (BlockMBStainedGlassSlabs.getBlockFromName("tile.glassStainedSingleSlab1.glass_whiteSlab.name") != null)
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 0), new Object[] {"###", '#', Blocks.stained_glass});
     
     else 
     GameRegistry.addRecipe(new ItemStack(MBCBlocks.glassStainedSingleSlab1, 6, 3), new Object[] {"###", '#', Blocks.stained_glass});
    
    


    it always comes up as blue slabs because the getBlockName is either false I do not know how to call the meta or name I think a select case statement would be better than a bunch of if else statements.



    If anyone could help me here it would be very appreciated.
    Posted in: Modification Development
  • 0

    posted a message on Custom Glass block "sees" thorugh world and other blocks... (Solved)
    Quote from PhoenixSmith»
    Could someone explain how I can get a block to not xray through everything?


    package com.Phoenix.PhoenixCraft.block;


    import net.minecraft.block.BlockGlass;
    import net.minecraft.block.material.Material;
    import java.util.Random;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;


    public class BlockPortHole extends BlockPC
    {
    public BlockPortHole() {
    super();
    this.setBlockName("blockporthole");
    this.setHardness(0.3F);
    this.setBlockTextureName("blockporthole");
    this.setStepSound(soundTypeGlass);
    this.setLightOpacity(1);
    this.
    }

    I added this when I was having the same problems


            public boolean isOpaqueCube() {
    return false;
    }

    public boolean renderAsNormalBlock() {
    return false;
    }
    Posted in: Modification Development
  • 0

    posted a message on Blocks not rendering right [Solved]
    I fixed bug number 3 by changing the code from this:

    @Override
     protected ItemStack createStackedBlock(int meta){
    
    return new ItemStack(this, 2, meta);
    
     }


    to this

    @Override
     protected ItemStack createStackedBlock(int meta){
     
     if (this == MBCBlocks.glassStainedDoubleSlab1){
     
     return new ItemStack(MBCBlocks.glassStainedSingleSlab1, 2, meta);
     
     } else if (this == MBCBlocks.glassStainedDoubleSlab2){
     
     return new ItemStack(MBCBlocks.glassStainedSingleSlab2, 2, meta);
     
     } else if (this == MBCBlocks.glassStainedSingleSlab1){
     
     return new ItemStack(MBCBlocks.glassStainedSingleSlab1, 1, meta);
     
     } else if (this == MBCBlocks.glassStainedSingleSlab2){
     
     return new ItemStack(MBCBlocks.glassStainedSingleSlab2, 1, meta);
     
     } else
     // return new ItemStack(this, 2, meta);
     return null;
     }


    and fixed bug 4 by adding

    protected boolean canSilkHarvest(){
     
     return true;
     }
    
    public int quantityDropped(Random p_149745_1_){
     return 0;
     }
    Posted in: Modification Development
  • 0

    posted a message on Eclipse Setup No Work!
    Mine seem to work with 1.8 also just fine. I have 1.7 installed but it keeps selecting 1.8
    Posted in: Modification Development
  • 0

    posted a message on Help Half Slabs wont Stack
    Quote from Killerjdog51»
    Hey, Ive created these half slabs but for some reason the half slabs dont stack on top of each other. can someone help me? i would really appreciate it, sincerely killerjdog51.

    Block.class

     
    smallwhitechocolatebrickdouble = (BlockSlab)(new BlockWhiteChocolateSmallBrickSlab(config.smallwhitechocolatebrickdoubleID, true)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundTypeStone).setBlockName("Chocolate:smallwhitechocolatebrickSlabDouble");;
     smallwhitechocolatebricksingle = (BlockSlab)(new BlockWhiteChocolateSmallBrickSlab(config.smallwhitechocolatebricksingleID, false)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundTypeStone).setBlockName("Chocolate:smallwhitechocolatebrickSlab").setCreativeTab(MainRegistry.tabChocolateBlocks);
    
     
    
    GameRegistry.registerBlock(smallwhitechocolatebrickdouble, smallwhitechocolatebrickdouble.getUnlocalizedName());
     GameRegistry.registerBlock(smallwhitechocolatebricksingle, smallwhitechocolatebricksingle.getUnlocalizedName());

    BlockWhiteChocolateSmallBrickSlab.class

     
     
    
    package com.chocolatemod.block;
    
    import java.util.List;
    import java.util.Random;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockSlab;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.item.ItemStack;
    import net.minecraft.world.World;
    
    public class BlockWhiteChocolateSmallBrickSlab extends BlockSlab
    {
    public static final String[] woodType = { "smallwhitechocolatebricks" };
    
    public BlockWhiteChocolateSmallBrickSlab(int par1, boolean par2)
    {
    super(par2, Material.rock);
    
    }
    
    public void registerIcons(IIconRegister par1IconRegister)
    {
    this.blockIcon = par1IconRegister.registerIcon("killerjdog51:chocolatebrick_white_small");
    }
    
    public Block idDropped(int par1, Random par2Random, int par3)
    {
    return Blocks.smallwhitechocolatebricksingle;
    }
    
    public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
    {
    if(par1World.getBlock(par2, par3 - 1, par4) == Blocks.smallwhitechocolatebricksingle)
    {
    par1World.setBlock(par2, par3, par4, null, 0, par4);
    par1World.setBlock(par2, par3 - 1, par4, Blocks.smallwhitechocolatebrickdouble);
    }
    if(par1World.getBlock(par2, par3 + 1, par4) == Blocks.smallwhitechocolatebricksingle)
    {
    par1World.setBlock(par2, par3, par4, null, 0, par4);
    par1World.setBlock(par2, par3 + 1, par4, Blocks.smallwhitechocolatebrickdouble);
    }
    }
    
    protected ItemStack createStackedBlock(int par1)
    {
    return new ItemStack(Blocks.smallwhitechocolatebricksingle, 2, par1 & 7);
    }
    
    public String getFullSlabName(int par1)
    {
     if ((par1 < 0) || (par1 >= woodType.length))
     {
     par1 = 0;
     }
    
    return super.getUnlocalizedName() + "." + woodType[par1];
    }
    
    public void getSubBlocks(Block par1, CreativeTabs par2CreativeTabs, List par3List)
    {
     if (par1 != Blocks.smallwhitechocolatebrickdouble)
     {
     par3List.add(new ItemStack(par1, 1, 0));
     }
    }
    
    @Override
    public String func_150002_b(int var1) {
     // TODO Auto-generated method stub
     return null;
    }
    
    }

    I had the same problem I could not get them to stack either and I searched the forums and found some code that a guys said you need something like it but when I went to stack the slabs it crashed minecraft people told me I was not initializing a field, but would not explain how I was not initializing it. and ever since I voiced my opinion about them just saying one or 2 word examples but not explaining why they say that no one has answered any of my posts since. But anyway if you download this:


    and look through there code you can see how they made their slabs stack. most of the 1.7 mods that gives you new slabs they don't stack either. But to save you some time if you check out my post here you can see the classes you need to make the slabs stack.

    Posted in: Modification Development
  • 0

    posted a message on Blocks not rendering right [Solved]
    Quote from CosmicDan»
    Screenshot link is broken FYI.

    Try adding these to your block classes:

    public boolean isOpaqueCube() {
    return false;
    }

    public boolean renderAsNormalBlock() {
    return false;
    }



    Thanks I added the code you suggested and it took care of the bug that let you see through the world. But I am still having problems with the slabs and double slabs rendering the textures right. Here is an image of the problem.




    as you can see on the left is the texture of the full block and the 2 on the right is the slab and double slab not rendering the texture right. the resource pack here is datacraft64 for 1.7.10. if I use the default textures the slab and double slabs show up as clear glass with colored highlights as in this image.



    as you can see the stained glass textures on the left and it not rendering right on the right
    Posted in: Modification Development
  • 0

    posted a message on Replacing/Overriding Vanilla Items
    Quote from PrinceCJC»
    Maybe, but I think that would just create a new class that is different, but would not override the old one.

    However I have found the solution online, you can override existing events (which is what I wanted) via the Forge Event Bus system (for anyone who's interested click here.)

    But thanks for the replies anyway :D

    - PrinceCJC

    Is it not exactly what Beamfield told you to to do? override the existing methods/events as you called them
    Posted in: Modification Development
  • 0

    posted a message on Blocks not rendering right [Solved]
    Hello. Would anyone know why my glass slabs are not rendering right?

    any ideals on how to fix these:

    Known Bugs:
    1 Textures not rendering right, it's ugly and opaque depending on texture pack being used.
    2 When placed as a double slab on the ground you can see through the world.
    3 When double slabs are broken with silk touch pick it gives 2 double slabs instead of 2 single slabs and when a half slab is broken with silk touch it gives 2 half slabs instead of 1 half slab..
    4 When broken by hand or any tool it gives back 2 single slabs instead of just destroying the block.

    Screenshot of the problem.



    EDIT: How come the image does not show up but you can right click and say open image in new tab?

    I think I need to somehow call something like Blocks.glass in my arguments but I do not know how to incorporate it into the class I added the parameters but it did not seem to work I guess I needed to cal the parameters some place else also.

    here is the code I am using ATM.

    BlockMBStainedGlassSlabs.java
    // Code Based off of https://github.com/Glitchfiend/BiomesOPlenty


    /*
    * Known Bugs:
    * Textures not rendering right, it's ugly and opaque depending on texture pack being used.
    * When placed as a double slab on the ground you can see through the world.
    * When broken with silk touch it gives 2 double slabs instead of 2 single slabs.
    * When broken by hand or any tool it gives back 2 single slabs instead of just destroying the block.
    */



    package missingblocks.common.blocks;

    import java.util.List;
    import java.util.Random;

    import missingblocks.api.content.MBCBlocks;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockSlab;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.Entity;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.world.World;



    public class BlockMBStainedGlassSlabs extends BlockSlab{

    public static enum StainedGlassSlabCategory{

    SGLASS1, SGLASS2;
    }

    private static final String[] sGlassTypes = new String[] {"glass_white", "glass_orange", "glass_magenta", "glass_light_blue", "glass_yellow",
    "glass_lime", "glass_pink", "glass_gray", "glass_silver", "glass_cyan", "glass_purple", "glass_blue", "glass_brown", "glass_green", "glass_red", "glass_black"};

    private IIcon[] textures;
    private final StainedGlassSlabCategory category;

    public BlockMBStainedGlassSlabs(boolean isDoubleSlab, Material material, StainedGlassSlabCategory cat){

    super(isDoubleSlab, material);

    category = cat;

    this.setHardness(0.3F);
    this.setResistance(1.5F);
    this.setHarvestLevel("", 0);
    this.setStepSound(Block.soundTypeGlass);
    this.useNeighborBrightness = true;


    if (!isDoubleSlab){

    this.setCreativeTab(CreativeTabs.tabBlock);
    }

    }

    @Override
    public void registerBlockIcons(IIconRegister iconRegister){

    textures = new IIcon[sGlassTypes.length];

    for (int i = 0; i < sGlassTypes.length; ++i){

    textures = iconRegister.registerIcon("minecraft:"+ sGlassTypes);
    }
    }

    @Override
    public IIcon getIcon(int side, int meta){

    return textures[getGlassType(meta)];
    }

    @Override
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list){

    int max = 0;

    if (category == StainedGlassSlabCategory.SGLASS1) {
    max = 8;
    }

    else if (category == StainedGlassSlabCategory.SGLASS2) {
    max = 8;
    }

    for (int i = 0; i < max; ++i) {
    list.add(new ItemStack(block, 1, i));
    }
    }

    @Override
    public String func_150002_b(int meta){

    if (category == StainedGlassSlabCategory.SGLASS1){

    return (new StringBuilder()).append(sGlassTypes[getGlassType(meta)]).append("Slab").toString();

    }

    else if (category == StainedGlassSlabCategory.SGLASS2){

    return (new StringBuilder()).append(sGlassTypes[getGlassType(meta)]).append("Slab").toString();

    }

    else {

    return null;
    }
    }

    @Override
    public int damageDropped(int meta){

    return meta & 7;
    }

    @Override
    public Item getItemDropped(int metadata, Random random, int fortune){

    if (field_150004_a){

    if (this == MBCBlocks.glassStainedDoubleSlab1)

    return Item.getItemFromBlock(MBCBlocks.glassStainedSingleSlab1);

    else

    return Item.getItemFromBlock(MBCBlocks.glassStainedSingleSlab2);

    }

    else

    return Item.getItemFromBlock(this);
    }

    @Override
    public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z){

    Block block = !field_150004_a ? this : (this == MBCBlocks.glassStainedDoubleSlab1 ? MBCBlocks.glassStainedSingleSlab1 : (this == MBCBlocks.glassStainedDoubleSlab2 ? MBCBlocks.glassStainedSingleSlab2 : MBCBlocks.stoneSingleSlab));

    return new ItemStack(block, 1, world.getBlockMetadata(x, y, z));
    }

    @Override
    protected ItemStack createStackedBlock(int meta){

    return new ItemStack(this, 2, meta);
    }

    private int getGlassType(int meta){

    meta = getTypeFromMeta(meta) + category.ordinal() * 8;

    if (meta < sGlassTypes.length)

    return meta;

    return 0;
    }

    private static int getTypeFromMeta(int meta){

    return meta & 7;
    }

    }


    MBBlocksStainedGlassSlabs.java

     // Code Based off of https://github.com/Glitchfiend/BiomesOPlenty
    
     
    
    package missingblocks.common.core;
    
    import missingblocks.api.content.MBCBlocks;
    import missingblocks.common.blocks.BlockMBStainedGlassSlabs;
    import missingblocks.common.blocks.BlockMBStainedGlassSlabs.StainedGlassSlabCategory;
    import missingblocks.common.itemblocks.ItemBlockMBMetadata;
    import missingblocks.common.itemblocks.ItemBlockMBStainedGlassSlabs;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockGlass;
    import net.minecraft.block.material.Material;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.ItemBlock;
    import cpw.mods.fml.common.registry.GameRegistry;
    
     
    
    public class MBBlocksStainedGlassSlabs{
    
     
    
    public static void init(){
     
     registerBlocks();
     
     }
    
    private static void registerBlocks(){
     
     BlockMBStainedGlassSlabs singleSlab = (BlockMBStainedGlassSlabs)new BlockMBStainedGlassSlabs(false, Material.glass, StainedGlassSlabCategory.SGLASS1).setBlockName("glassStainedSingleSlab1");
     BlockMBStainedGlassSlabs doubleSlab = (BlockMBStainedGlassSlabs)new BlockMBStainedGlassSlabs(true, Material.glass, StainedGlassSlabCategory.SGLASS1).setBlockName("glassStainedDoubleSlab1");
     
     MBCBlocks.glassStainedSingleSlab1 = registerBlock(singleSlab, ItemBlockMBStainedGlassSlabs.class, singleSlab, doubleSlab);
     MBCBlocks.glassStainedDoubleSlab1 = registerBlock(doubleSlab, ItemBlockMBStainedGlassSlabs.class, singleSlab, doubleSlab);
    
    singleSlab = (BlockMBStainedGlassSlabs)new BlockMBStainedGlassSlabs(false, Material.glass, StainedGlassSlabCategory.SGLASS2).setBlockName("glassStainedSingleSlab2");
     doubleSlab = (BlockMBStainedGlassSlabs)new BlockMBStainedGlassSlabs(true, Material.glass, StainedGlassSlabCategory.SGLASS2).setBlockName("glassStainedDoubleSlab2");
     
     MBCBlocks.glassStainedSingleSlab2 = registerBlock(singleSlab, ItemBlockMBStainedGlassSlabs.class, singleSlab, doubleSlab);
     MBCBlocks.glassStainedDoubleSlab2 = registerBlock(doubleSlab, ItemBlockMBStainedGlassSlabs.class, singleSlab, doubleSlab);
    
    }
     
     public static Block registerBlock(Block block)
     {
     GameRegistry.registerBlock(block, block.getUnlocalizedName().replace("tile.", ""));
     
     return block;
     }
     
     public static Block registerMetadataBlock(Block block)
     {
     registerBlock(block, ItemBlockMBMetadata.class);
     
     return block;
     }
     
     public static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlockClass)
     {
     GameRegistry.registerBlock(block, itemBlockClass, block.getUnlocalizedName().replace("tile.", ""));
     
     return block;
     }
     
     public static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlockClass, Object... constructorArgs)
     {
     GameRegistry.registerBlock(block, itemBlockClass, block.getUnlocalizedName().replace("tile.", ""), constructorArgs);
     
     return block;
     }
    
    }
    
    ['code] 
    ItemBlockMBStainedGlassSlabs.java

     // Code Based off of https://github.com/Glitchfiend/BiomesOPlenty
    
     
    
    package missingblocks.common.itemblocks;
    
    import missingblocks.common.blocks.BlockMBStainedGlassSlabs;
    import net.minecraft.block.Block;
    import net.minecraft.item.ItemSlab;
    import net.minecraft.item.ItemStack;
    
     
    
    public class ItemBlockMBStainedGlassSlabs extends ItemSlab{
     
     public ItemBlockMBStainedGlassSlabs(Block block, BlockMBStainedGlassSlabs singleSlab, BlockMBStainedGlassSlabs doubleSlab){
     
     super(block, singleSlab, doubleSlab, block == doubleSlab);
     }
    
    @Override
     public int getMetadata(int meta){
     
     return meta & 7;
     }
    
    @Override
     public String getUnlocalizedName(ItemStack itemStack){
     
     BlockMBStainedGlassSlabs slab = (BlockMBStainedGlassSlabs)Block.getBlockFromItem(itemStack.getItem());
    
    return super.getUnlocalizedName() + "." + (new StringBuilder()).append(slab.func_150002_b(itemStack.getItemDamage())).toString();
     }
    }
    .

    Posted in: Modification Development
  • To post a comment, please .