Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I have made a custom Slab and Double slab, but it seems, when in Creative mode, and one middle-clicks it on an empty slot, it gives me a Stone Slab, instead of my Block.

This is my ItemSlab Code

package com.strebornella.adrtwo.blocks.slabs.compressed;

import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.item.ItemSlab;

public class CCobblestone_ItemSlab extends ItemSlab {
public CCobblestone_ItemSlab(Block block){
	super(block, (BlockSlab)CCobblestone_Slabs.ccslab, (BlockSlab)CCobblestone_Slabs.ccDoubleSlab, false);
	setHasSubtypes(true);
}
}

 

and this is the Slab code

 

package com.strebornella.adrtwo.blocks.slabs.compressed;

import java.util.Random;
import com.strebornella.adrtwo.StringRefs;
import com.strebornella.adrtwo.tabs.creative.ADRTabs;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;

public class CCobblestone_Slabs extends BlockSlab{
public CCobblestone_Slabs(boolean isDouble, Material material) {
	super(isDouble, material);
	setLightOpacity(0);
	useNeighborBrightness = true;
}

public static Block ccslab;
public static Block ccDoubleSlab;
public static IIcon bottom;
public static IIcon top;
public static IIcon side1;
public static IIcon side2;
public static IIcon side3;
public static IIcon side4;

public static void mainRegistry(){
	ccslab = new CCobblestone_Slabs(false, Material.rock)
		.setBlockName("compcobblestoneslab")
		.setHardness(20.0F)
		.setResistance(280.0F)
		.setCreativeTab(ADRTabs.adrBlocks)
		.setStepSound(soundTypeStone);
	ccslab.setHarvestLevel("pickaxe", 1);
	ccslab.isToolEffective("pickaxe", 1);

	ccDoubleSlab = new CCobblestone_Slabs(true, Material.rock)
		.setBlockName("compcobblestonedoubleslab")
		.setHardness(16.0F)
		.setResistance(240.0F)
		.setStepSound(soundTypeStone);
	ccDoubleSlab.setHarvestLevel("pickaxe", 1);
	ccDoubleSlab.isToolEffective("pickaxe", 1);

	GameRegistry.registerBlock(ccslab, CCobblestone_ItemSlab.class, ccslab.getUnlocalizedName());
	GameRegistry.registerBlock(ccDoubleSlab, CCobblestone_ItemSlab.class, ccDoubleSlab.getUnlocalizedName());
}

@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister icon){
	this.bottom = icon.registerIcon(StringRefs.MODID + ":comp/compressed_cobblestone");
	this.top = icon.registerIcon(StringRefs.MODID + ":comp/compressed_cobblestone");
	this.side1 = icon.registerIcon(StringRefs.MODID + ":compressed_cobblestone_slab_side");
	this.side2 = icon.registerIcon(StringRefs.MODID + ":compressed_cobblestone_slab_side");
	this.side3 = icon.registerIcon(StringRefs.MODID + ":compressed_cobblestone_slab_side");
	this.side4 = icon.registerIcon(StringRefs.MODID + ":compressed_cobblestone_slab_side");
}

@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int meta){
	if (side == 0) return bottom;
	else if (side == 1) return top;
	else if (side == 2) return side1;
	else if (side == 3) return side2;
	else if (side == 4) return side3;
	else if (side == 5) return side4;
	else return bottom;
}

public Item getItemDropped(int meta, Random random, int fortune) {
	return Item.getItemFromBlock(ccslab);
}

protected ItemStack createStackedBlock() {
	return new ItemStack(Item.getItemFromBlock(ccslab), 2);
}

public String getFullSlabName(int par1) {
	return getUnlocalizedName();
}

@Override
public String func_150002_b(int par1) {
	return getFullSlabName(par1);
}
}

 

Why this is happening, I don't know.

 

Override createStackedBlock for your Block class.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.