Jump to content

[SOLVED][1.8.9] Trying to add slabs with metadata.


SuperGeniusZeb

Recommended Posts

UPDATE 5-8-2016: I have now figured out how to get my slabs working, and I have updated this post with the working code. The original post can be seen in the spoiler at the bottom. Thanks for the help, everyone! If you have any questions about certain parts of my code or suggestions on how to do it better let me know!

 

Working Code for slabs with additional blockstates/metadata in Minecraft 1.8.9:

 

 

My code package structure (for reference):

colore

-client

--render

-common

--blocks

--creativeTabs

--init

--items

--worldGeneration

-proxy

-utility

 

//common.blocks package//

 

BlockColoreSlab.java

package com.supergeniuszeb.colore.common.blocks;

import java.util.Random;

import net.minecraft.block.BlockSlab;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

//An abstract class for both half-slabs and full/double slabs.
public abstract class BlockColoreSlab extends BlockSlab implements IMetaBlockName{

public BlockColoreSlab(String unlocalizedName) {
	super(Material.rock);
	this.setHardness(1.5f);
	this.setHarvestLevel("pickaxe", 0);
	this.setResistance(10.0f);
	this.setUnlocalizedName(unlocalizedName);
	this.useNeighborBrightness = !this.isDouble();

	//Sets default state depending on whether block is a half-slab or double-slab.
	IBlockState blockState = this.blockState.getBaseState();
        blockState = blockState.withProperty(SHADE, EnumShade.NORMAL);
        if (!this.isDouble()) {
            blockState = blockState.withProperty(HALF, EnumBlockHalf.BOTTOM);
        }

        this.setDefaultState(blockState);
}

public enum EnumShade implements IStringSerializable {
	NORMAL(0, "normal"),
	LIGHT(1, "light"),
	LIGHTER(2, "lighter"),
	DARK(3, "dark"),
	DARKER(4, "darker");

	private int ID;
	private String name;

	private EnumShade(int ID, String name) {
		this.ID = ID;
		this.name = name;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public String toString() {
		return getName();
	}

	public int getID() {
        return ID;
    }

}

//The shade ("light", "dark", etc.) of the slab. The "HALF" property is defined in the vanilla BlockSlab class so I don't need to make my own.
public static final PropertyEnum SHADE = PropertyEnum.create("shade", BlockColoreSlab.EnumShade.class);

//Function to get the variant property created above based on the item.
@Override
public final Object getVariant(final ItemStack itemstack) {
	return getStateFromMeta(itemstack.getMetadata()).getValue(SHADE);
}

//Function to get the variant property.
@Override
public final IProperty getVariantProperty() {
	return SHADE;
}

//I feel like there must be a simpler way to do this, but here's how I make the
//double slabs drop their corresponding half slabs. Note my use of the getHalfSlab()
//method I created for indirectly obtaining the value of ItemSlab's singleSlab
//param, which is private.
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune){
	int meta = this.getMetaFromState(state);
	Item item = Item.getItemFromBlock(((ItemBlockColoreSlab) Item.getItemFromBlock(this)).getHalfSlab());
	switch (meta) {
		case 0:
		case 5:
			return new ItemStack(item, 2, 0).getItem();
		case 1:
		case 6:
			return new ItemStack(item, 2, 1).getItem();
		case 2:
		case 7:
			return new ItemStack(item, 2, 2).getItem();
		case 3:
		case 8:
			return new ItemStack(item, 2, 3).getItem();
		case 4:
		case 9:
			return new ItemStack(item, 2, 4).getItem();
		default:
			return new ItemStack(item, 2, 0).getItem();
	}
}

@Override
protected BlockState createBlockState() {
	return new BlockState(this, new IProperty[] {SHADE, HALF});
}

//Converts an IBlockState into metadata.
@Override
public IBlockState getStateFromMeta(int meta) {

	//A blockState is created, which is assigned the SHADE property depending on its metadata, as well as the HALF property, if it is a half-slab.
	IBlockState blockState = this.getDefaultState();

	if (!this.isDouble()) { //If the block is a BlockColoreHalfSlab
		switch (meta) {
			case 0:
				blockState = blockState.withProperty(SHADE, EnumShade.NORMAL).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break; //Note-to-self: DON'T FORGET TO USE THIS IN SWITCH STATEMENTS IF RETURN STATEMENTS AREN'T INVOLVED!
			case 1:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHT).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break;
			case 2:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHTER).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break;
			case 3:
				blockState = blockState.withProperty(SHADE, EnumShade.DARK).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break;
			case 4:
				blockState = blockState.withProperty(SHADE, EnumShade.DARKER).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break;
			case 5:
				blockState = blockState.withProperty(SHADE, EnumShade.NORMAL).withProperty(HALF, EnumBlockHalf.TOP);
				break;
			case 6:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHT).withProperty(HALF, EnumBlockHalf.TOP);
				break;
			case 7:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHTER).withProperty(HALF, EnumBlockHalf.TOP);
				break;
			case 8:
				blockState = blockState.withProperty(SHADE, EnumShade.DARK).withProperty(HALF, EnumBlockHalf.TOP);
				break;
			case 9:
				blockState = blockState.withProperty(SHADE, EnumShade.DARKER).withProperty(HALF, EnumBlockHalf.TOP);
				break;
			default:
				blockState = blockState.withProperty(SHADE, EnumShade.NORMAL).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break;
		}
	} else { //If the block is a BlockColoreDoubleSlab
		switch (meta) {
			case 0:
				blockState = blockState.withProperty(SHADE, EnumShade.NORMAL);
				break;
			case 1:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHT);
				break;
			case 2:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHTER);
				break;
			case 3:
				blockState = blockState.withProperty(SHADE, EnumShade.DARK);
				break;
			case 4:
				blockState = blockState.withProperty(SHADE, EnumShade.DARKER);
				break;
			default:
				blockState = blockState.withProperty(SHADE, EnumShade.NORMAL);
				break;
		}
	}

	return blockState;
}

//Converts metadata into an IBlockState.
@Override
public int getMetaFromState(IBlockState state) {

    EnumShade shade = (EnumShade) state.getValue(SHADE);
    
    if (!this.isDouble()) {
    	EnumBlockHalf half = (EnumBlockHalf) state.getValue(HALF);
    	
    	//0-4 are bottom slabs, and 5-9 are the top slabs, so if the HALF property = top,
    	//then 5 is added to the ID integer assigned to the SHADE property. This is done
    	//to match up with how I've assigned the 10 different metadata values. (I hope
    	//this comment made sense so I don't come back later trying to find out why I did
    	//this and get disappointed with my former self's explanatory skills...)
    	if (half == EnumBlockHalf.TOP) {
    		return shade.getID() + 5; 
    	}
    }
    
    return shade.getID();
}

//This insures that  the meta block drops an item-block with the correct metadata when mined. This is
//somewhat trickier than with a regular block since you don't want to drop a "top" or "bottom" half slab.
//You only want to drop... well, just a slab! (Or more technically, a default, or bottom, half slab.
//Of course, if you're breaking a double-slab, it shouldn't drop a block with the HALF property at all.
@Override
public int damageDropped(IBlockState state) {
	if (!this.isDouble()) {
		//Using my neat math tricks in conjuction with how I've set up the 9 metadata values so that
		//0-4 are bottom slabs and 5-9 are top slabs.
		if (getMetaFromState(state) > 4) { //If the block is a top slab, then drop a bottom slab.
			return getMetaFromState(state) - 5;
		}
	}
	//If the block is a bottom slab or double slab, then drop a block with a metadata between 0-4.
	//The value of the SHADE property is assigned to the same 5 integers for both bottom half slabs
	//and double slabs, so this works. Hooray for clever metadata-blockstate-math-stuff!
    return getMetaFromState(state);
}

//Used to get the last part of the unlocalized name for the item-block.
//The structure of the unlocalized name is: tile.blockname.specialname.name
@Override
public String getSpecialName(ItemStack stack) {
	switch (stack.getItemDamage()) {
		case 0:
			return "normal";
		case 1:
			return "light";
		case 2:
			return "lighter";
		case 3:
			return "dark";
		case 4:
			return "darker";
		default:
			return "normal";
	}
}

@Override
    public final String getUnlocalizedName(final int meta) {
        return this.getUnlocalizedName();
    }

//This ensures that the pick-block button (normally middle-click) will give
//an item-block with the correct metadata. Top & bottom half slabs will both
//return bottom slabs, and double slabs will return themselves.
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) {
	int meta = this.getMetaFromState(world.getBlockState(pos));
	if (meta > 4) { //If the block is a top half slab
		meta = meta - 5; //Pick-block should return a bottom half slab...
	}
    return new ItemStack(Item.getItemFromBlock(this), 1, meta);
}
}

 

BlockColoreSlabHalf.java

package com.supergeniuszeb.colore.common.blocks;

public class BlockColoreSlabHalf extends BlockColoreSlab {

public BlockColoreSlabHalf(String unlocalizedName) {
	super(unlocalizedName);
}

@Override
public boolean isDouble() {
	return false;
}

}

 

BlockColoreSlabDouble.java

package com.supergeniuszeb.colore.common.blocks;

public class BlockColoreSlabDouble extends BlockColoreSlab {

public BlockColoreSlabDouble(String unlocalizedName) {
	super(unlocalizedName);
}

@Override
public boolean isDouble() {
	return true;
}

}

 

ItemBlockColoreSlab.java

package com.supergeniuszeb.colore.common.blocks;

import java.util.ArrayList;
import java.util.List;

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

/*
* Wrapper class to make sure that GameRegistry.registerBlock() calls the right constructor.
*/
public class ItemBlockColoreSlab extends ItemSlab {

public ItemBlockColoreSlab(final Block block, final BlockColoreSlabHalf singleSlab, final BlockColoreSlabDouble doubleSlab) {
	super(block, singleSlab, doubleSlab);
	this.setHasSubtypes(true);
        this.getSubBlocks(slabList, this, 5);
        this.setHalfSlab(singleSlab);
}

//This variable and the setter & getter that follow were made by me to get the value of the private
//param this.singleSlab from ItemSlab's constructor. This is my indirect and probably inefficient
//way to make my double slabs drop their half slab counterparts. See usage in BlockColoreSlab.getItemDropped().
private BlockSlab halfSlab;

public void setHalfSlab(BlockSlab slab) {
	this.halfSlab = slab;
}

public BlockSlab getHalfSlab() {
	return this.halfSlab;
}

@Override
    public String getUnlocalizedName(ItemStack stack) {
	//If the block is a double slab, "double_" will be added to the unlocalized name.
	//Note how "tile." is removed via .substring after "tile.double_" is added so that
	//"double_" can be effectively added to the unlocalizedName after the "tile."
	//It's kind of messy, but at least it works.
	if (((BlockColoreSlab) this.getBlock()).isDouble()) {
		return "tile.double_" + super.getUnlocalizedName(stack).substring(5) + "." + ((IMetaBlockName)this.block).getSpecialName(stack);
	}
        return super.getUnlocalizedName(stack) + "." + ((IMetaBlockName)this.block).getSpecialName(stack);
}

public static List slabList = new ArrayList<Item>(5) {};

	//This will add all the different metadata variations of the slabs
	//as "ItemStack"s to the slabList list. Used when adding metadata
	//blocks to the creative tabs.
	public void getSubBlocks(List slabList, Item item, int range) {
		//This prevents any double slabs from showing up in the creative tab.
		if (!((BlockColoreSlab) Block.getBlockFromItem(item)).isDouble()) {
			for (int i = 0; i < range; ++i) {
	            slabList.add(new ItemStack(item, 1, i));
	        }
		}
	}

}

 

 

//common.init package//

 

ModBlocks.java (renamed from BlockRegistry.java)

package com.supergeniuszeb.colore.common.init;

import com.supergeniuszeb.colore.common.blocks.BlockColore;
import com.supergeniuszeb.colore.common.blocks.BlockColoreOre;
import com.supergeniuszeb.colore.common.blocks.BlockColoreSlab;
import com.supergeniuszeb.colore.common.blocks.BlockColoreSlabDouble;
import com.supergeniuszeb.colore.common.blocks.BlockColoreSlabHalf;
import com.supergeniuszeb.colore.common.blocks.ItemBlockColore;
import com.supergeniuszeb.colore.common.blocks.ItemBlockColoreSlab;

import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModBlocks {

//regular blocks
public static BlockColore block_of_red;
public static BlockColore block_of_reddish_orange;
public static BlockColore block_of_orange;
public static BlockColore block_of_orangish_yellow;
public static BlockColore block_of_yellow;
public static BlockColore block_of_yellowish_green;
public static BlockColore block_of_green;
public static BlockColore block_of_cyan;
public static BlockColore block_of_blue;
public static BlockColore block_of_indigo;
public static BlockColore block_of_purple;
public static BlockColore block_of_magenta;
public static BlockColore block_of_brown;
public static BlockColore block_of_grayscale;

//half slabs
public static BlockColoreSlab slab_of_red = new BlockColoreSlabHalf("slab_of_red");
public static BlockColoreSlab slab_of_reddish_orange = new BlockColoreSlabHalf("slab_of_reddish_orange");
public static BlockColoreSlab slab_of_orange = new BlockColoreSlabHalf("slab_of_orange");
public static BlockColoreSlab slab_of_orangish_yellow = new BlockColoreSlabHalf("slab_of_orangish_yellow");
public static BlockColoreSlab slab_of_yellow = new BlockColoreSlabHalf("slab_of_yellow");
public static BlockColoreSlab slab_of_yellowish_green = new BlockColoreSlabHalf("slab_of_yellowish_green");
public static BlockColoreSlab slab_of_green = new BlockColoreSlabHalf("slab_of_green");
public static BlockColoreSlab slab_of_cyan = new BlockColoreSlabHalf("slab_of_cyan");
public static BlockColoreSlab slab_of_blue = new BlockColoreSlabHalf("slab_of_blue");
public static BlockColoreSlab slab_of_indigo = new BlockColoreSlabHalf("slab_of_indigo");
public static BlockColoreSlab slab_of_purple = new BlockColoreSlabHalf("slab_of_purple");
public static BlockColoreSlab slab_of_magenta = new BlockColoreSlabHalf("slab_of_magenta");
public static BlockColoreSlab slab_of_brown = new BlockColoreSlabHalf("slab_of_brown");
public static BlockColoreSlab slab_of_grayscale = new BlockColoreSlabHalf("slab_of_grayscale");

//double slabs
public static BlockColoreSlab double_slab_of_red = new BlockColoreSlabDouble("double_slab_of_red");
public static BlockColoreSlab double_slab_of_reddish_orange = new BlockColoreSlabDouble("double_slab_of_reddish_orange");
public static BlockColoreSlab double_slab_of_orange = new BlockColoreSlabDouble("double_slab_of_orange");
public static BlockColoreSlab double_slab_of_orangish_yellow = new BlockColoreSlabDouble("double_slab_of_orangish_yellow");
public static BlockColoreSlab double_slab_of_yellow = new BlockColoreSlabDouble("double_slab_of_yellow");
public static BlockColoreSlab double_slab_of_yellowish_green = new BlockColoreSlabDouble("double_slab_of_yellowish_green");
public static BlockColoreSlab double_slab_of_green = new BlockColoreSlabDouble("double_slab_of_green");
public static BlockColoreSlab double_slab_of_cyan = new BlockColoreSlabDouble("double_slab_of_cyan");
public static BlockColoreSlab double_slab_of_blue = new BlockColoreSlabDouble("double_slab_of_blue");
public static BlockColoreSlab double_slab_of_indigo = new BlockColoreSlabDouble("double_slab_of_indigo");
public static BlockColoreSlab double_slab_of_purple = new BlockColoreSlabDouble("double_slab_of_purple");
public static BlockColoreSlab double_slab_of_magenta = new BlockColoreSlabDouble("double_slab_of_magenta");
public static BlockColoreSlab double_slab_of_brown = new BlockColoreSlabDouble("double_slab_of_brown");
public static BlockColoreSlab double_slab_of_grayscale = new BlockColoreSlabDouble("double_slab_of_grayscale");

//ore blocks	
public static BlockColoreOre essence_ore;

public static void registerBlocks() {
	//regular blocks
	GameRegistry.registerBlock(block_of_red = new BlockColore("block_of_red"), ItemBlockColore.class, "block_of_red");
	GameRegistry.registerBlock(block_of_reddish_orange = new BlockColore("block_of_reddish_orange"), ItemBlockColore.class, "block_of_reddish_orange");
	GameRegistry.registerBlock(block_of_orange = new BlockColore("block_of_orange"), ItemBlockColore.class, "block_of_orange");
	GameRegistry.registerBlock(block_of_orangish_yellow = new BlockColore("block_of_orangish_yellow"), ItemBlockColore.class, "block_of_orangish_yellow");
	GameRegistry.registerBlock(block_of_yellow = new BlockColore("block_of_yellow"), ItemBlockColore.class, "block_of_yellow");
	GameRegistry.registerBlock(block_of_yellowish_green = new BlockColore("block_of_yellowish_green"), ItemBlockColore.class, "block_of_yellowish_green");
	GameRegistry.registerBlock(block_of_green = new BlockColore("block_of_green"), ItemBlockColore.class, "block_of_green");
	GameRegistry.registerBlock(block_of_cyan = new BlockColore("block_of_cyan"), ItemBlockColore.class, "block_of_cyan");
	GameRegistry.registerBlock(block_of_blue = new BlockColore("block_of_blue"), ItemBlockColore.class, "block_of_blue");
	GameRegistry.registerBlock(block_of_indigo = new BlockColore("block_of_indigo"), ItemBlockColore.class, "block_of_indigo");
	GameRegistry.registerBlock(block_of_purple = new BlockColore("block_of_purple"), ItemBlockColore.class, "block_of_purple");
	GameRegistry.registerBlock(block_of_magenta = new BlockColore("block_of_magenta"), ItemBlockColore.class, "block_of_magenta");
	GameRegistry.registerBlock(block_of_brown = new BlockColore("block_of_brown"), ItemBlockColore.class, "block_of_brown");
	GameRegistry.registerBlock(block_of_grayscale = new BlockColore("block_of_grayscale"), ItemBlockColore.class, "block_of_grayscale");

	//half slabs
	GameRegistry.registerBlock(slab_of_red, ItemBlockColoreSlab.class, "slab_of_red", slab_of_red, double_slab_of_red);
	GameRegistry.registerBlock(slab_of_reddish_orange, ItemBlockColoreSlab.class, "slab_of_reddish_orange", slab_of_reddish_orange, double_slab_of_reddish_orange);
	GameRegistry.registerBlock(slab_of_orange, ItemBlockColoreSlab.class, "slab_of_orange", slab_of_orange, double_slab_of_orange);
	GameRegistry.registerBlock(slab_of_orangish_yellow, ItemBlockColoreSlab.class, "slab_of_orangish_yellow", slab_of_orangish_yellow, double_slab_of_orangish_yellow);
	GameRegistry.registerBlock(slab_of_yellow, ItemBlockColoreSlab.class, "slab_of_yellow", slab_of_yellow, double_slab_of_yellow);
	GameRegistry.registerBlock(slab_of_yellowish_green, ItemBlockColoreSlab.class, "slab_of_yellowish_green", slab_of_yellowish_green, double_slab_of_yellowish_green);
	GameRegistry.registerBlock(slab_of_green, ItemBlockColoreSlab.class, "slab_of_green", slab_of_green, double_slab_of_green);
	GameRegistry.registerBlock(slab_of_cyan, ItemBlockColoreSlab.class, "slab_of_cyan", slab_of_cyan, double_slab_of_cyan);
	GameRegistry.registerBlock(slab_of_blue, ItemBlockColoreSlab.class, "slab_of_blue", slab_of_blue, double_slab_of_blue);
	GameRegistry.registerBlock(slab_of_indigo, ItemBlockColoreSlab.class, "slab_of_indigo", slab_of_indigo, double_slab_of_indigo);
	GameRegistry.registerBlock(slab_of_purple, ItemBlockColoreSlab.class, "slab_of_purple", slab_of_purple, double_slab_of_purple);
	GameRegistry.registerBlock(slab_of_magenta, ItemBlockColoreSlab.class, "slab_of_magenta", slab_of_magenta, double_slab_of_magenta);
	GameRegistry.registerBlock(slab_of_brown, ItemBlockColoreSlab.class, "slab_of_brown", slab_of_brown, double_slab_of_brown);
	GameRegistry.registerBlock(slab_of_grayscale, ItemBlockColoreSlab.class, "slab_of_grayscale", slab_of_grayscale, double_slab_of_grayscale);

	//double slabs
	GameRegistry.registerBlock(double_slab_of_red, ItemBlockColoreSlab.class, "double_slab_of_red", slab_of_red, double_slab_of_red);
	GameRegistry.registerBlock(double_slab_of_reddish_orange, ItemBlockColoreSlab.class, "double_slab_of_reddish_orange", slab_of_reddish_orange, double_slab_of_reddish_orange);
	GameRegistry.registerBlock(double_slab_of_orange, ItemBlockColoreSlab.class, "double_slab_of_orange", slab_of_orange, double_slab_of_orange);
	GameRegistry.registerBlock(double_slab_of_orangish_yellow, ItemBlockColoreSlab.class, "double_slab_of_orangish_yellow", slab_of_orangish_yellow, double_slab_of_orangish_yellow);
	GameRegistry.registerBlock(double_slab_of_yellow, ItemBlockColoreSlab.class, "double_slab_of_yellow", slab_of_yellow, double_slab_of_yellow);
	GameRegistry.registerBlock(double_slab_of_yellowish_green, ItemBlockColoreSlab.class, "double_slab_of_yellowish_green", slab_of_yellowish_green, double_slab_of_yellowish_green);
	GameRegistry.registerBlock(double_slab_of_green, ItemBlockColoreSlab.class, "double_slab_of_green", slab_of_green, double_slab_of_green);
	GameRegistry.registerBlock(double_slab_of_cyan, ItemBlockColoreSlab.class, "double_slab_of_cyan", slab_of_cyan, double_slab_of_cyan);
	GameRegistry.registerBlock(double_slab_of_blue, ItemBlockColoreSlab.class, "double_slab_of_blue", slab_of_blue, double_slab_of_blue);
	GameRegistry.registerBlock(double_slab_of_indigo, ItemBlockColoreSlab.class, "double_slab_of_indigo", slab_of_indigo, double_slab_of_indigo);
	GameRegistry.registerBlock(double_slab_of_purple, ItemBlockColoreSlab.class, "double_slab_of_purple", slab_of_purple, double_slab_of_purple);
	GameRegistry.registerBlock(double_slab_of_magenta, ItemBlockColoreSlab.class, "double_slab_of_magenta", slab_of_magenta, double_slab_of_magenta);
	GameRegistry.registerBlock(double_slab_of_brown, ItemBlockColoreSlab.class, "double_slab_of_brown", slab_of_brown, double_slab_of_brown);
	GameRegistry.registerBlock(double_slab_of_grayscale, ItemBlockColoreSlab.class, "double_slab_of_grayscale", slab_of_grayscale, double_slab_of_grayscale);

	GameRegistry.registerBlock(essence_ore = new BlockColoreOre("essence_ore"), ItemBlockColore.class, "essence_ore");
}
}

 

 

//client.render package//

 

BlockRenders.java (renamed from BlockRenderRegistry.java)

	package com.supergeniuszeb.colore.client.render;

import com.supergeniuszeb.colore.Reference;
import com.supergeniuszeb.colore.common.init.ModBlocks;
import com.supergeniuszeb.colore.utility.ModUtilities;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;

//All this handles are the item-block models, not the actual block models, which are
//defined in the .json files.
public class BlockRenders {

//This method is called by the registerRenders method every time it adds an item-block model without metadata specified.
public static void registerRender(Block block) {
	Item item = Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
}

//This method is called by the init method every time it adds an item-block model with metadata specified.
public static void registerRender(Block block, int meta, String metaName) {
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), meta, new ModelResourceLocation(block.getRegistryName() + "_" + metaName, "inventory"));
}

public static void preInit() {
	for (String color : ModUtilities.colorList) {
		for (String shade : ModUtilities.shadeList) {
			for (String blockType : ModUtilities.blockTypeList) {
				//standard blocks, half slabs, & double slabs
				ModelBakery.registerItemVariants(Item.getItemFromBlock(GameRegistry.findBlock(Reference.MOD_ID, blockType + "_of_" + color)), new ResourceLocation(Reference.MOD_ID, blockType + "_of_" + color + "_" + shade));
			}
		}
	}
	for (String color : ModUtilities.baseColorList) {
		//ore blocks
		ModelBakery.registerItemVariants(Item.getItemFromBlock(ModBlocks.essence_ore), new ResourceLocation(Reference.MOD_ID, "essence_ore_" + color));
	}
}

public static void init() {
	int i = 0;
	for (String shade : ModUtilities.shadeList) {
		for (String color : ModUtilities.colorList) {
			for (String blockType : ModUtilities.blockTypeList) {
				//standard blocks, half slabs, & double slabs
				registerRender(GameRegistry.findBlock(Reference.MOD_ID, blockType + "_of_" + color), i, shade);
			}
		}
		i++;
	}
	i = 0;
	for (String color : ModUtilities.baseColorList) {
		//ore blocks
		registerRender(ModBlocks.essence_ore, i, color);
		i++;
	}
}

}

 

 

//utility package//

 

ModUtilities.java

package com.supergeniuszeb.colore.utility;

/*
* A class used for storing various arrays and such that are convenient for things
* like iterating through the list of block colors in a for each loop to reduce the
* size of code when performing various functions.
*/
public class ModUtilities {

/*
 * The list of block types in the mod.
 */
public static String[] blockTypeList = new String[] {
	"block", "slab", "double_slab"
};

/*
 * A simple list of the half slab types.
 * Currently unused.
 */
public static String[] halfSlabTypeList = new String[] {
	"bottom", "top"
};

/*
 * The list of shades for the blocks and items in the mod.
 */
public static String[] shadeList = new String[] {
	"normal", "light", "lighter", "dark", "darker"
};

/*
 * The list of colors for the blocks and items in the mod.
 */
public static String[] colorList = new String[] {
	"red", "reddish_orange", "orange", "orangish_yellow", "yellow",
	"yellowish_green", "green", "cyan", "blue", "indigo", "purple",
	"magenta", "brown", "grayscale"
};

/*
 * The list of base (or ore) colors in the mod.
 */
public static String[] baseColorList = new String[] {
	"red", "yellow", "blue", "brown", "white", "black"
};
}

 

 

 

 

Original Post:

 

I'm trying to add slabs with metadata to my mod, but so far I'm not having too much success. I know how slabs work in game (they're 2 different blocks: a half-slab block with at least 2 blockstates and a double slab block that's basically just a normal block that drops 2 of the former) and that you're supposed to have an abstract slab class (BlockColoreSlab), a half slab class (BlockColoreSlabHalf), a double slab class (BlockColoreSlabDouble), and an item-block class (ItemBlockColoreSlab), but I have no idea how to get them working right. I have the metadata on the slabs set up with 2 properties: "SHADE" and "HALF". "SHADE" has 5 different values: normal, light, lighter, dark, and darker, and "HALF" has, of course, just 2 values and determines whether the block is a top slab of bottom slab (if it is even a half slab.) So for example I'm trying to add a Slab of Red that uses the metadata to determine both the color and which type of slab it is. (Values 0-4 are bottom slabs and 5-9 are top slabs. Double slabs just have values 0-4.) At this point I haven't created any model, texture, or other .json files for any of the slabs, and neither have I put them in the .lang file, as I'm just trying to get them functional right now.

 

Here's what happens when I launch the game:

The game doesn't crash, and the half-slabs can be placed like regular slabs, and have the same hitboxes. However, they can't be stacked into double slabs. Both the regular and the double slabs show up in the creative tab I have created for them, though the double slabs shouldn't be there. Both the half and double variants of the slabs have the same name in the creative menu. (For example, the slab_of_red with a SHADE state of "NORMAL" shows as tile.slab_of_red.normal.name, and its double variant shows with the exact same name, but when viewed in F3+H mode, you can see their actual code names of colore:slab_of_red and colore:slab_of_red_double... I'm not sure if this is normal or not, as I have not tried to create any .json files or textures yet.)

 

Anyway, here are the slab classes and the classes I use to register my blocks. If you need to see any more, just let me know. See the top of the post for the current state of how things are working. (I'll update it as I fix things and make progress...)

 

BlockColoreSlab (abstract slab class):

package com.supergeniuszeb.colore.common.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import com.supergeniuszeb.colore.common.registry.CreativeTabRegistry;

//An abstract class for both half-slabs and full/double slabs.
public abstract class BlockColoreSlab extends BlockSlab implements IMetaBlockName{

public BlockColoreSlab(String unlocalizedName) {
	super(Material.rock);
	this.setHardness(1.5f);
	this.setHarvestLevel("pickaxe", 0);
	this.setResistance(10.0f);
	this.setUnlocalizedName(unlocalizedName);
	this.useNeighborBrightness = !this.isDouble();
	if (!this.isDouble()) {
            this.setCreativeTab(CreativeTabRegistry.slabTab);
        }

	//Sets default state depending on whether block is a half-slab or double-slab.
	IBlockState blockState = this.blockState.getBaseState();
        blockState = blockState.withProperty(SHADE, EnumShade.NORMAL);
        if (!this.isDouble()) {
            blockState = blockState.withProperty(HALF, EnumBlockHalf.BOTTOM);
        }

        this.setDefaultState(blockState);
}

public enum EnumShade implements IStringSerializable {
	NORMAL(0, "normal"),
	LIGHT(1, "light"),
	LIGHTER(2, "lighter"),
	DARK(3, "dark"),
	DARKER(4, "darker");

	private int ID;
	private String name;

	private EnumShade(int ID, String name) {
		this.ID = ID;
		this.name = name;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public String toString() {
		return getName();
	}

	public int getID() {
        return ID;
    }

}

//The shade ("light", "dark", etc.) of the slab. The "HALF" property is defined in the vanilla BlockSlab class so I don't need to make my own.
public static final PropertyEnum SHADE = PropertyEnum.create("shade", BlockColoreSlab.EnumShade.class);

//Function to get the variant property created above based on the item.
@Override
public final Object getVariant(final ItemStack itemstack) {
	return itemstack.getMetadata();
}

//Function to get the variant property.
@Override
public final IProperty getVariantProperty() {
	return SHADE;
}

@SideOnly(Side.CLIENT)
    @Override
    public final net.minecraft.item.Item getItem(
        final net.minecraft.world.World world,
        final net.minecraft.util.BlockPos blockPos) {
        String blockId = this.getUnlocalizedName();
        return Item.getItemFromBlock(Block.getBlockFromName(blockId));
    }

@Override
protected BlockState createBlockState() {
	return new BlockState(this, new IProperty[] {SHADE, HALF});
}

//Converts an IBlockState into metadata.
@Override
public IBlockState getStateFromMeta(int meta) {

	//A blockState is created, which is assigned the SHADE property depending on its metadata, as well as the HALF property, if it is a half-slab.
	IBlockState blockState = this.getDefaultState();

	if (!this.isDouble()) { //If the block is a BlockColoreHalfSlab
		switch (meta) {
			case 0:
				blockState = blockState.withProperty(SHADE, EnumShade.NORMAL).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break; //Note-to-self: NEVER EVER FORGET TO USE THIS IF RETURN STATEMENTS AREN'T INVOLVED!
			case 1:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHT).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break;
			case 2:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHTER).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break;
			case 3:
				blockState = blockState.withProperty(SHADE, EnumShade.DARK).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break;
			case 4:
				blockState = blockState.withProperty(SHADE, EnumShade.DARKER).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break;
			case 5:
				blockState = blockState.withProperty(SHADE, EnumShade.NORMAL).withProperty(HALF, EnumBlockHalf.TOP);
				break;
			case 6:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHT).withProperty(HALF, EnumBlockHalf.TOP);
				break;
			case 7:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHTER).withProperty(HALF, EnumBlockHalf.TOP);
				break;
			case 8:
				blockState = blockState.withProperty(SHADE, EnumShade.DARK).withProperty(HALF, EnumBlockHalf.TOP);
				break;
			case 9:
				blockState = blockState.withProperty(SHADE, EnumShade.DARKER).withProperty(HALF, EnumBlockHalf.TOP);
				break;
			default:
				blockState = blockState.withProperty(SHADE, EnumShade.NORMAL).withProperty(HALF, EnumBlockHalf.BOTTOM);
				break;
		}
	} else { //If the block is a BlockColoreDoubleSlab
		switch (meta) {
			case 0:
				blockState = blockState.withProperty(SHADE, EnumShade.NORMAL);
				break;
			case 1:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHT);
				break;
			case 2:
				blockState = blockState.withProperty(SHADE, EnumShade.LIGHTER);
				break;
			case 3:
				blockState = blockState.withProperty(SHADE, EnumShade.DARK);
				break;
			case 4:
				blockState = blockState.withProperty(SHADE, EnumShade.DARKER);
				break;
			default:
				blockState = blockState.withProperty(SHADE, EnumShade.NORMAL);
				break;
		}
	}

	return blockState;
}

//Converts metadata into an IBlockState.
@Override
public int getMetaFromState(IBlockState state) {

    EnumShade shade = (EnumShade) state.getValue(SHADE);
    
    if (!this.isDouble()) {
    	EnumBlockHalf half = (EnumBlockHalf) state.getValue(HALF);
    	
    	//0-4 are bottom slabs, and 5-9 are the top slabs, so if the HALF property = top,
    	//then 5 is added to the ID integer assigned to the SHADE property. This is done
    	//to match up with how I've assigned the 9 different metadata values. (I hope
    	//this comment made sense so I don't come back later trying to find out why I did
    	//this and get disappointed with my former self's explanatory skills...)
    	if (half == EnumBlockHalf.TOP) {
    		return shade.getID() + 5; 
    	}
    }
    
    return shade.getID();
}

//This insures that  the meta block drops an item-block with the correct metadata when mined. This is
//somewhat trickier than with a regular block since you don't want to drop a "top" or "bottom" half slab.
//You only want to drop... well, just a slab! (Or more technically, a default, or bottom, half slab.
//Of course, if you're breaking a double-slab, it shouldn't drop a block with the HALF property at all.
@Override
public int damageDropped(IBlockState state) {
	if (!this.isDouble()) {
		//Using my neat math tricks in conjuction with how I've set up the 9 metadata values so that
		//0-4 are bottom slabs and 5-9 are top slabs.
		if (getMetaFromState(state) > 5) { //If the block is a top slab, then drop a bottom slab.
			return getMetaFromState(state) - 5;
		}
	}
	//If the block is a bottom slab or double slab, then drop a block with a metadata between 0-4.
	//The value of the SHADE property is assigned to the same 5 integers for both bottom half slabs
	//and double slabs, so this works. Hooray for clever metadata-blockstate-math-stuff!
    return getMetaFromState(state);
}

//Used to get the last part of the unlocalized name for the item-block.
//The structure of the unlocalized name is: tile.blockname.specialname.name
@Override
public String getSpecialName(ItemStack stack) {
	switch (stack.getItemDamage()) {
		case 0:
			return "normal";
		case 1:
			return "light";
		case 2:
			return "lighter";
		case 3:
			return "dark";
		case 4:
			return "darker";
		default:
			return "normal";
	}
}

@Override
    public final String getUnlocalizedName(final int metadata) {
        return this.getUnlocalizedName();
    }

//This ensures that the pick-block button (normally middle-click) will give
//an item-block with the correct metadata.
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) {
    return new ItemStack(Item.getItemFromBlock(this), 1, this.getMetaFromState(world.getBlockState(pos)));
}

//WIP BEYOND THIS POINT

}

 

BlockColoreSlabHalf:

package com.supergeniuszeb.colore.common.blocks;

import net.minecraft.block.properties.IProperty;
import net.minecraft.item.ItemStack;

public class BlockColoreSlabHalf extends BlockColoreSlab {

public BlockColoreSlabHalf(String unlocalizedName) {
	super(unlocalizedName);
}

@Override
public boolean isDouble() {
	return false;
}

}

 

BlockColoreSlabDouble:

package com.supergeniuszeb.colore.common.blocks;

public class BlockColoreSlabDouble extends BlockColoreSlab {

public BlockColoreSlabDouble(String unlocalizedName) {
	super(unlocalizedName);
}

@Override
public boolean isDouble() {
	return true;
}
}

 

ItemBlockColoreSlab:

package com.supergeniuszeb.colore.common.blocks;

import java.util.ArrayList;
import java.util.List;

import com.supergeniuszeb.colore.common.registry.BlockRegistry;

import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;

/*
* Wrapper class to make sure that GameRegistry.registerBlock() calls the right constructor.
*/
public class ItemBlockColoreSlab extends ItemSlab {

public ItemBlockColoreSlab(final Block block, final BlockColoreSlabHalf slab, final BlockColoreSlabDouble doubleSlab, final Boolean stacked) {
	super(block, slab, doubleSlab);
	this.setHasSubtypes(true);
        this.getSubBlocks(slabList, this, 5);
}

public int getMetadata(int damage)
    {
        return damage;
    }

@Override
    public String getUnlocalizedName(ItemStack stack) {
        return super.getUnlocalizedName(stack) + "." + ((IMetaBlockName)this.block).getSpecialName(stack);
    }

public static List slabList = new ArrayList<Item>(5) {};

	//This will add all the different metadata variations of the slabs
	//as "ItemStack"s to the slabList list. Used when adding metadata
	//blocks to the creative tabs.
	public void getSubBlocks(List slabList, Item item, int range) {
		for (int i = 0; i < range; ++i) {
            slabList.add(new ItemStack(item, 1, i));
        }
	}

}

 

(I've commented out the other slabs, since all I really need is to get the red slab working, and then I can just do copying-and-pasting for all the others.)

BlockRegistry (used to register instances of blocks):

package com.supergeniuszeb.colore.common.registry;

import net.minecraftforge.fml.common.registry.GameRegistry;

import com.supergeniuszeb.colore.common.blocks.BlockColore;
import com.supergeniuszeb.colore.common.blocks.BlockColoreOre;
import com.supergeniuszeb.colore.common.blocks.BlockColoreSlab;
import com.supergeniuszeb.colore.common.blocks.BlockColoreSlabDouble;
import com.supergeniuszeb.colore.common.blocks.BlockColoreSlabHalf;
import com.supergeniuszeb.colore.common.blocks.ItemBlockColore;
import com.supergeniuszeb.colore.common.blocks.ItemBlockColoreSlab;

public class BlockRegistry {

//regular blocks
public static BlockColore block_of_red;
public static BlockColore block_of_reddish_orange;
public static BlockColore block_of_orange;
public static BlockColore block_of_orangish_yellow;
public static BlockColore block_of_yellow;
public static BlockColore block_of_yellowish_green;
public static BlockColore block_of_green;
public static BlockColore block_of_cyan;
public static BlockColore block_of_blue;
public static BlockColore block_of_indigo;
public static BlockColore block_of_purple;
public static BlockColore block_of_magenta;
public static BlockColore block_of_brown;
public static BlockColore block_of_grayscale;

//half slabs
public static BlockColoreSlab slab_of_red = new BlockColoreSlabHalf("slab_of_red");
/*	public static BlockColoreSlabHalf slab_of_reddish_orange;
public static BlockColoreSlabHalf slab_of_orange;
public static BlockColoreSlabHalf slab_of_orangish_yellow;
public static BlockColoreSlabHalf slab_of_yellow;
public static BlockColoreSlabHalf slab_of_yellowish_green;
public static BlockColoreSlabHalf slab_of_green;
public static BlockColoreSlabHalf slab_of_cyan;
public static BlockColoreSlabHalf slab_of_blue;
public static BlockColoreSlabHalf slab_of_indigo;
public static BlockColoreSlabHalf slab_of_purple;
public static BlockColoreSlabHalf slab_of_magenta;
public static BlockColoreSlabHalf slab_of_brown;
public static BlockColoreSlabHalf slab_of_grayscale;
*/
//double slabs
public static BlockColoreSlab slab_of_red_double = new BlockColoreSlabDouble("slab_of_red_double");
/*public static BlockColoreSlabDouble slab_of_reddish_orange_double;
public static BlockColoreSlabDouble slab_of_orange_double;
public static BlockColoreSlabDouble slab_of_orangish_yellow_double;
public static BlockColoreSlabDouble slab_of_yellow_double;
public static BlockColoreSlabDouble slab_of_yellowish_green_double;
public static BlockColoreSlabDouble slab_of_green_double;
public static BlockColoreSlabDouble slab_of_cyan_double;
public static BlockColoreSlabDouble slab_of_blue_double;
public static BlockColoreSlabDouble slab_of_indigo_double;
public static BlockColoreSlabDouble slab_of_purple_double;
public static BlockColoreSlabDouble slab_of_magenta_double;
public static BlockColoreSlabDouble slab_of_brown_double;
public static BlockColoreSlabDouble slab_of_grayscale_double;*/

//ore blocks	
public static BlockColoreOre essence_ore;

public static void registerBlocks() {
	//regular blocks
	GameRegistry.registerBlock(block_of_red = new BlockColore("block_of_red"), ItemBlockColore.class, "block_of_red");
	GameRegistry.registerBlock(block_of_reddish_orange = new BlockColore("block_of_reddish_orange"), ItemBlockColore.class, "block_of_reddish_orange");
	GameRegistry.registerBlock(block_of_orange = new BlockColore("block_of_orange"), ItemBlockColore.class, "block_of_orange");
	GameRegistry.registerBlock(block_of_orangish_yellow = new BlockColore("block_of_orangish_yellow"), ItemBlockColore.class, "block_of_orangish_yellow");
	GameRegistry.registerBlock(block_of_yellow = new BlockColore("block_of_yellow"), ItemBlockColore.class, "block_of_yellow");
	GameRegistry.registerBlock(block_of_yellowish_green = new BlockColore("block_of_yellowish_green"), ItemBlockColore.class, "block_of_yellowish_green");
	GameRegistry.registerBlock(block_of_green = new BlockColore("block_of_green"), ItemBlockColore.class, "block_of_green");
	GameRegistry.registerBlock(block_of_cyan = new BlockColore("block_of_cyan"), ItemBlockColore.class, "block_of_cyan");
	GameRegistry.registerBlock(block_of_blue = new BlockColore("block_of_blue"), ItemBlockColore.class, "block_of_blue");
	GameRegistry.registerBlock(block_of_indigo = new BlockColore("block_of_indigo"), ItemBlockColore.class, "block_of_indigo");
	GameRegistry.registerBlock(block_of_purple = new BlockColore("block_of_purple"), ItemBlockColore.class, "block_of_purple");
	GameRegistry.registerBlock(block_of_magenta = new BlockColore("block_of_magenta"), ItemBlockColore.class, "block_of_magenta");
	GameRegistry.registerBlock(block_of_brown = new BlockColore("block_of_brown"), ItemBlockColore.class, "block_of_brown");
	GameRegistry.registerBlock(block_of_grayscale = new BlockColore("block_of_grayscale"), ItemBlockColore.class, "block_of_grayscale");

	//half slabs
	GameRegistry.registerBlock(slab_of_red, ItemBlockColoreSlab.class, "slab_of_red", slab_of_red, slab_of_red_double, false);
	/*GameRegistry.registerBlock(slab_of_reddish_orange = new BlockColoreSlabHalf("slab_of_reddish_orange"), ItemBlockColoreSlab.class, "slab_of_reddish_orange");
	GameRegistry.registerBlock(slab_of_orange = new BlockColoreSlabHalf("slab_of_orange"), ItemBlockColoreSlab.class, "slab_of_orange");
	GameRegistry.registerBlock(slab_of_orangish_yellow = new BlockColoreSlabHalf("slab_of_orangish_yellow"), ItemBlockColoreSlab.class, "slab_of_orangish_yellow");
	GameRegistry.registerBlock(slab_of_yellow = new BlockColoreSlabHalf("slab_of_yellow"), ItemBlockColoreSlab.class, "slab_of_yellow");
	GameRegistry.registerBlock(slab_of_yellowish_green = new BlockColoreSlabHalf("slab_of_yellowish_green"), ItemBlockColoreSlab.class, "slab_of_yellowish_green");
	GameRegistry.registerBlock(slab_of_green = new BlockColoreSlabHalf("slab_of_green"), ItemBlockColoreSlab.class, "slab_of_green");
	GameRegistry.registerBlock(slab_of_cyan = new BlockColoreSlabHalf("slab_of_cyan"), ItemBlockColoreSlab.class, "slab_of_cyan");
	GameRegistry.registerBlock(slab_of_blue = new BlockColoreSlabHalf("slab_of_blue"), ItemBlockColoreSlab.class, "slab_of_blue");
	GameRegistry.registerBlock(slab_of_indigo = new BlockColoreSlabHalf("slab_of_indigo"), ItemBlockColoreSlab.class, "slab_of_indigo");
	GameRegistry.registerBlock(slab_of_purple = new BlockColoreSlabHalf("slab_of_purple"), ItemBlockColoreSlab.class, "slab_of_purple");
	GameRegistry.registerBlock(slab_of_magenta = new BlockColoreSlabHalf("slab_of_magenta"), ItemBlockColoreSlab.class, "slab_of_magenta");
	GameRegistry.registerBlock(slab_of_brown = new BlockColoreSlabHalf("slab_of_brown"), ItemBlockColoreSlab.class, "slab_of_brown");
	GameRegistry.registerBlock(slab_of_grayscale = new BlockColoreSlabHalf("slab_of_grayscale"), ItemBlockColoreSlab.class, "slab_of_grayscale");
	*/
	//double slabs
	GameRegistry.registerBlock(slab_of_red_double, ItemBlockColoreSlab.class, "slab_of_red_double", slab_of_red, slab_of_red_double, true);
	/*GameRegistry.registerBlock(slab_of_reddish_orange_double = new BlockColoreSlabDouble("slab_of_reddish_orange_double"), ItemBlockColoreSlab.class, "slab_of_reddish_orange_double");
	GameRegistry.registerBlock(slab_of_orange_double = new BlockColoreSlabDouble("slab_of_orange_double"), ItemBlockColoreSlab.class, "slab_of_orange_double");
	GameRegistry.registerBlock(slab_of_orangish_yellow_double = new BlockColoreSlabDouble("slab_of_orangish_yellow_double"), ItemBlockColoreSlab.class, "slab_of_orangish_yellow_double");
	GameRegistry.registerBlock(slab_of_yellow_double = new BlockColoreSlabDouble("slab_of_yellow_double"), ItemBlockColoreSlab.class, "slab_of_yellow_double");
	GameRegistry.registerBlock(slab_of_yellowish_green_double = new BlockColoreSlabDouble("slab_of_yellowish_green_double"), ItemBlockColoreSlab.class, "slab_of_yellowish_green_double");
	GameRegistry.registerBlock(slab_of_green_double = new BlockColoreSlabDouble("slab_of_green_double"), ItemBlockColoreSlab.class, "slab_of_green_double");
	GameRegistry.registerBlock(slab_of_cyan_double = new BlockColoreSlabDouble("slab_of_cyan_double"), ItemBlockColoreSlab.class, "slab_of_cyan_double");
	GameRegistry.registerBlock(slab_of_blue_double = new BlockColoreSlabDouble("slab_of_blue_double"), ItemBlockColoreSlab.class, "slab_of_blue_double");
	GameRegistry.registerBlock(slab_of_indigo_double = new BlockColoreSlabDouble("slab_of_indigo_double"), ItemBlockColoreSlab.class, "slab_of_indigo_double");
	GameRegistry.registerBlock(slab_of_purple_double = new BlockColoreSlabDouble("slab_of_purple_double"), ItemBlockColoreSlab.class, "slab_of_purple_double");
	GameRegistry.registerBlock(slab_of_magenta_double = new BlockColoreSlabDouble("slab_of_magenta_double"), ItemBlockColoreSlab.class, "slab_of_magenta_double");
	GameRegistry.registerBlock(slab_of_brown_double = new BlockColoreSlabDouble("slab_of_brown_double"), ItemBlockColoreSlab.class, "slab_of_brown_double");
	GameRegistry.registerBlock(slab_of_grayscale_double = new BlockColoreSlabDouble("slab_of_grayscale_double"), ItemBlockColoreSlab.class, "slab_of_grayscale_double");
*/
	GameRegistry.registerBlock(essence_ore = new BlockColoreOre("essence_ore"), ItemBlockColore.class, "essence_ore");
}
}

 

BlockRenderRegistry (used to register block models and item-block models... I am aware I haven't registered the slab models or anything yet, but nothing in this class affects the functionality of the blocks, so I'm not going to add anything here until the slabs work as intended and all that's left is the rendering side of things.):

	package com.supergeniuszeb.colore.client.render;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;

import com.supergeniuszeb.colore.Reference;
import com.supergeniuszeb.colore.common.registry.BlockRegistry;
import com.supergeniuszeb.colore.utility.ModUtilities;

//All this handles are the item-block models, not the actual block models, which are
//defined in the .json files.
public class BlockRenderRegistry {

//This method is called by the registerRenders method every time it adds an item-block model.
public static void registerRender(Block block) {
	Item item = Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}

//This method is called by the init method every time it adds a meta item-block model.
public static void registerRender(Block block, int meta, String fileName) {
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), meta, new ModelResourceLocation(Reference.MOD_ID + ":" + fileName, "inventory"));
}

public static void preInit() {

	for (String shade : ModUtilities.shadeList) {
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_red), new ResourceLocation(Reference.MOD_ID, "block_of_red_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_reddish_orange), new ResourceLocation(Reference.MOD_ID, "block_of_reddish_orange_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_orange), new ResourceLocation(Reference.MOD_ID, "block_of_orange_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_orangish_yellow), new ResourceLocation(Reference.MOD_ID, "block_of_orangish_yellow_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_yellow), new ResourceLocation(Reference.MOD_ID, "block_of_yellow_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_yellowish_green), new ResourceLocation(Reference.MOD_ID, "block_of_yellowish_green_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_green), new ResourceLocation(Reference.MOD_ID, "block_of_green_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_cyan), new ResourceLocation(Reference.MOD_ID, "block_of_cyan_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_blue), new ResourceLocation(Reference.MOD_ID, "block_of_blue_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_indigo), new ResourceLocation(Reference.MOD_ID, "block_of_indigo_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_purple), new ResourceLocation(Reference.MOD_ID, "block_of_purple_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_magenta), new ResourceLocation(Reference.MOD_ID, "block_of_magenta_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_brown), new ResourceLocation(Reference.MOD_ID, "block_of_brown_" + shade));
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.block_of_grayscale), new ResourceLocation(Reference.MOD_ID, "block_of_grayscale_" + shade));
	}

	for (String color : ModUtilities.baseColorList) {
		ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.essence_ore), new ResourceLocation(Reference.MOD_ID, "essence_ore_" + color));
	}
}

public static void init() {

	int i = 0;
	for (String shade : ModUtilities.shadeList) {
		registerRender(BlockRegistry.block_of_red, i, "block_of_red_" + shade);
		registerRender(BlockRegistry.block_of_reddish_orange, i, "block_of_reddish_orange_" + shade);
		registerRender(BlockRegistry.block_of_orange, i, "block_of_orange_" + shade);
		registerRender(BlockRegistry.block_of_orangish_yellow, i, "block_of_orangish_yellow_" + shade);
		registerRender(BlockRegistry.block_of_yellow, i, "block_of_yellow_" + shade);
		registerRender(BlockRegistry.block_of_yellowish_green, i, "block_of_yellowish_green_" + shade);
		registerRender(BlockRegistry.block_of_green, i, "block_of_green_" + shade);
		registerRender(BlockRegistry.block_of_cyan, i, "block_of_cyan_" + shade);
		registerRender(BlockRegistry.block_of_blue, i, "block_of_blue_" + shade);
		registerRender(BlockRegistry.block_of_indigo, i, "block_of_indigo_" + shade);
		registerRender(BlockRegistry.block_of_purple, i, "block_of_purple_" + shade);
		registerRender(BlockRegistry.block_of_magenta, i, "block_of_magenta_" + shade);
		registerRender(BlockRegistry.block_of_brown, i, "block_of_brown_" + shade);
		registerRender(BlockRegistry.block_of_grayscale, i, "block_of_grayscale_" + shade);
		i++;
	}

	i = 0;
	for (String color : ModUtilities.baseColorList) {
		registerRender(BlockRegistry.essence_ore, i, "essence_ore_" + color);
		i++;
	}
}

}

 

If you need to see any other classes, just let me know and I'll update this post.

 

Colore - The mod that adds monochrome blocks in every color of the rainbow!

http://www.minecraftforge.net/forum/index.php?topic=35149

 

If you're looking to learn how to make mods for 1.9.4, I wrote a helpful article with links to a lot of useful resources for learning Minecraft 1.9.4 modding!

 

http://supergeniuszeb.com/mods/a-helpful-list-of-minecraft-1-9-4-modding-resources/

Link to comment
Share on other sites

Are you sure that you need BlockSlabHalf and BlockSlabDouble? I'm not seeing such an arrangement in Vanilla slabs. It sounds like your mechanism for changing one into the other is incomplete.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

  • 1 month later...

...And, 2 months later, after a lot of time being busy and being unable to work on my mod, I have recently been able to get my slabs working! Yay! ;D

 

Are you sure that you need BlockSlabHalf and BlockSlabDouble? I'm not seeing such an arrangement in Vanilla slabs. It sounds like your mechanism for changing one into the other is incomplete.

Vanilla does have similar classes... see BlockHalfStoneSlab and BlockDoubleStoneSlab.

Hi

 

Look in ItemSlab.onItemUse() to see how vanilla turns two half-slabs into a whole slab

 

-TGG

 

Thanks for the suggestion! After looking around in the ItemSlab class I was able to figure out how to get the half-slabs and double-slabs to be associated with each other, and I also learned quite a bit about how the slabs and a lot of other Minecraft code works in the process. (Discovered ItemSlab's this.singleSlab, which I had to indirectly access the values by creating a private variable in my ItemBlockColoreSlab class which I assigned the value of this.singleSlab, and then created setter & getter methods so I could easily-ish convert between a double slab as input in a method to its single slab counterpart.) I also cleaned up and simplified a lot of my code (thanks for adding the getRegistryName() & findBlock() methods, Forge team) and have a much better (but still not yet perfect) understanding of the Minecraft/Forge code.

 

For those who are having the same problem as me, I will update the main post with my new code, which I think would work as a better template for slabs with additional metadata/blockstates than the current 1.8 slabs tutorial on these forums. Note that I have renamed BlockRegistry.java & BlockRenderRegistry.java to ModBlocks.java & BlockRenders respectively, since those are more in line with the standard naming conventions and I think they make more sense than what I had before.

 

I would like to note that I am not fully satisfied with how I handle getting the name of a double slab's single/half slab counterpart. (See my comments in the updated code.) It feels a little indirect & hacky to me, and if anyone has any suggestions for a better way, please let me know. I really want my code to be clean and not use hacky, indirect ways of getting things to work.

Colore - The mod that adds monochrome blocks in every color of the rainbow!

http://www.minecraftforge.net/forum/index.php?topic=35149

 

If you're looking to learn how to make mods for 1.9.4, I wrote a helpful article with links to a lot of useful resources for learning Minecraft 1.9.4 modding!

 

http://supergeniuszeb.com/mods/a-helpful-list-of-minecraft-1-9-4-modding-resources/

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • ---- Informe de fallo de Minecraft ---- // Mi error. Hora: 2024-06-20 22:42:24 Descripción: Superposición de renderizado net.minecraftforge.fml.config.ConfigFileTypeHandler$ConfigLoadingException: Error al cargar el archivo de configuración sofisticadocore-client.toml de tipo CLIENTE para modid sofisticadocore     en net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:47) ~ [fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     en net.minecraftforge.fml.config.ConfigTracker.openConfig(ConfigTracker.java:60) ~[fmlcore-1.20.1-47.3. 1.jar%23213!/:?] {}     en net.minecraftforge.fml.config.ConfigTracker.lambda$loadConfigs$1(ConfigTracker.java:50) ~[fmlcore-1.20.1-47.3.1.jar%23213! /:?] {}     en java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {re:mixin}     en java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131) ~ [?:?] {}     en net.minecraftforge.fml.config.ConfigTracker.loadConfigs(ConfigTracker.java:50) ~[fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     en net .minecraftforge.fml.core.ModStateProvider.lambda$new$1(ModStateProvider.java:67) ~[forge-1.20.1-47.3.1-universal.jar%23217!/?:?] {re:classloading}     en la red. minecraftforge.fml.DistExecutor.unsafeRunWhenOn(DistExecutor.java:111) ~[fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     en net.minecraftforge.fml.core.ModStateProvider.lambda$new $3(ModStateProvider.java:66) ~[forge-1.20.1-47.3.1-universal.jar%23217!/:?] {re:classloading}     en net.minecraftforge.fml.ModLoader.handleInlineTransition(ModLoader.java: 217) ~[fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     en net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$19(ModLoader.java:209) ~[fmlcore-1.20. 1-47.3.1.jar%23213!/:?] {}     en java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {re:mixin}     en net.minecraftforge.fml.ModLoader .dispatchAndHandleError(ModLoader.java:209) ~[fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     en net.minecraftforge.fml.ModLoader.lambda$loadMods$15(ModLoader.java:190 ) ~[fmlcore-1.20.1-47.3.1.jar%23213!/?:?] {}     en java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {re:mixin}     en net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:190) ~[fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     en net.minecraftforge.client.loading.ClientModLoader.lambda $startModLoading$5(ClientModLoader.java:97) ~[forge-1.20.1-47.3.1-universal.jar%23217!/:?] {re:classloading,pl:runtimedistcleaner:A}     en net.minecraftforge.client. cargando.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:89) ~[forge-1.20.1-47.3.1-universal.jar%23217!/:?] {re:classloading,pl:runtimedistcleaner:A}     en la red .minecraftforge.client.loading.ClientModLoader.startModLoading(ClientModLoader.java:97) ~[forge-1.20.1-47.3.1-universal.jar%23217!/?] {re:classloading,pl:runtimedistcleaner:A}     en net.minecraftforge.client.loading.ClientModLoader.lambda$onResourceReload$2(ClientModLoader.java:80) ~[forge-1.20.1-47.3.1-universal.jar%23217!/:?] {re:classloading,pl :runtimedistcleaner:A}     en net.minecraftforge.client.loading.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:89) ~[forge-1.20.1-47.3.1-universal.jar%23217!/:?] { re:classloading,pl:runtimedistcleaner:A}     en java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {}     en java.util.concurrent.CompletableFuture$AsyncRun.exec( CompletableFuture.java:1796) ~[?:?] {}     en java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}     en java.util.concurrent.ForkJoinPool$WorkQueue. topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}     en java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {re:computing_frames}     en java.util.concurrent .ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {re:computing_frames}     en java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {} Causado por: com.electronwill.nightconfig.core.io.ParsingException: No hay suficientes datos disponibles     en com.electronwill.nightconfig.core.io.ParsingException.notEnoughData(ParsingException.java:22) ~[core-3.6.4.jar%2393!/ :?] {}     en com.electronwill.nightconfig.core.io.ReaderInput.directReadChar(ReaderInput.java:36) ~[core-3.6.4.jar%2393!/:?] {}     en com.electronwill.nightconfig .core.io.AbstractInput.readChar(AbstractInput.java:49) ~[core-3.6.4.jar%2393!/:?] {}     en com.electronwill.nightconfig.core.io.AbstractInput.readCharsUntil(AbstractInput. java:123) ~[core-3.6.4.jar%2393!/?] {}     en com.electronwill.nightconfig.toml.TableParser.parseKey(TableParser.java:166) ~[toml-3.6.4.jar %2394!/:?] {}     en com.electronwill.nightconfig.toml.TableParser.parseDottedKey(TableParser.java:145) ~[toml-3.6.4.jar%2394!/:?] {}     en com.electronwill .nightconfig.toml.TableParser.parseNormal(TableParser.java:55) ~[toml-3.6.4.jar%2394!/:?] {}     en com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java: 44) ~[toml-3.6.4.jar%2394!/?] {}     en com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:37) ~[toml-3.6.4.jar%2394 !/:?] {}     en com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:113) ~[core-3.6.4.jar%2393!/:?] {}     en com.electronwill .nightconfig.core.io.ConfigParser.parse(ConfigParser.java:219) ~[core-3.6.4.jar%2393!/:?] {}     en com.electronwill.nightconfig.core.io.ConfigParser.parse( ConfigParser.java:202) ~[core-3.6.4.jar%2393!/:?] {}     en com.electronwill.nightconfig.core.file.WriteSyncFileConfig.load(WriteSyncFileConfig.java:73) ~[core-3.6 .4.jar%2393!/?] {}     en com.electronwill.nightconfig.core.file.AutosaveCommentedFileConfig.load(AutosaveCommentedFileConfig.java:85) ~[core-3.6.4.jar%2393!/:?] {}     en net.minecraftforge.fml.config.ConfigFileTypeHandler. lambda$reader$1(ConfigFileTypeHandler.java:43) ~[fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     ... 27 más Un tutorial detallado del error, su ruta de código y todos los detalles conocidos es el siguiente: -------------------------------- -------------------------------------------------- ----- -- Head -- Hilo: Hilo de procesamiento Modificaciones sospechosas: NINGUNA Stacktrace:     en net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:47) ~[fmlcore-1.20.1-47.3.1.jar %23213!/:?] {}     en net.minecraftforge.fml.config.ConfigTracker.openConfig(ConfigTracker.java:60) ~[fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     en net.minecraftforge.fml.config.ConfigTracker.lambda$loadConfigs$1(ConfigTracker.java:50) ~[fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     en java.lang.Iterable .forEach(Iterable.java:75) ~[?:?] {re:mixin}     en java.util.Collections$SynchronizedCollection.forEach(Collections.java:2131) ~[?:?] {}     en net.minecraftforge. fml.config.ConfigTracker.loadConfigs(ConfigTracker.java:50) ~[fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     en net.minecraftforge.fml.core.ModStateProvider.lambda$new $1(ModStateProvider.java:67) ~[forge-1.20.1-47.3.1-universal.jar%23217!/:?] {re:classloading}     en net.minecraftforge.fml.DistExecutor.unsafeRunWhenOn(DistExecutor.java: 111) ~[fmlcore-1.20.1-47.3.1.jar%23213!/:?] {}     en net.minecraftforge.fml.core.ModStateProvider.lambda$new$3(ModStateProvider.java:66) ~[forge- 1.20.1-47.3.1-universal.jar%23217!/:?] {re:classloading} - Detalles de renderizado de superposición - Detalles:     Nombre de superposición: net.minecraftforge.client.loading.ForgeLoadingOverlay Stacktrace:     en net.minecraft .client.renderer.GameRenderer.m_109093_(GameRenderer.java:1385) ~[client-1.20.1-20230612.114412-srg.jar%23212!/:?] {re:mixin,pl:accesstransformer:B,xf:OptiFine: predeterminado,re:classloading,pl:accesstransformer:B,xf:OptiFine:default,pl:mixin:APP:sanitydim.mixins.json:MixinGameRenderer,pl:mixin:APP:securitycraft.mixins.json:camera.GameRendererMixin,pl: mixin:A}     en net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1146) ~[client-1.20.1-20230612.114412-srg.jar%23212!/:?] {re:mixin,pl:accesstransformer: B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A,pl:runtimedistcleaner:A}     en net.minecraft.client.Minecraft.m_91374_(Minecraft.java:718) ~[cliente -1.20.1-20230612.114412-srg.jar%23212!/?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A, pl:runtimedistcleaner:A}     en net.minecraft.client.main.Main.main(Main.java:218) ~[1.20.1-forge-47.3.1.jar:?] {re:classloading,pl:runtimedistcleaner: A}     en jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}     en jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}     en jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}     en java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}     en net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) ~[fmlloader- 1.20.1-47.3.1.jar:?] {}     en net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99) ~[fmlloader-1.20.1-47.3.1.jar:? ] {}     en net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$makeService$0(CommonClientLaunchHandler.java:25) ~[fmlloader-1.20.1-47.3.1.jar:?] {}     en cpw.mods. modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar:?] {}     en cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9 .jar:?] {}     en cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar:?] {}     en cpw.mods.modlauncher.Launcher.run(Launcher .java:108) ~[modlauncher-10.0.9.jar:?] {}     en cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?] {}     en cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?] {}     en cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[ modlauncher-10.0.9.jar:?] {}     en cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?] {} -- Última recarga -- Detalles:     Número de recarga: 1     Motivo de recarga: inicial     Terminado: No     Paquetes: vanilla, mod_resources -- Detalles del sistema -- Detalles:     Versión de Minecraft: 1.20.1     ID de versión de Minecraft: 1.20.1     Sistema operativo: Windows 10 (amd64) versión 10.0     Versión de Java: 17.0.8,     Versión de VM de Microsoft Java: VM de servidor OpenJDK de 64 bits ( modo mixto), Microsoft     Memoria: 622962864 bytes (594 MiB) / 1107296256 bytes (1056 MiB) hasta 3170893824 bytes (3024 MiB)     CPU: 4     Proveedor del procesador: Genuino     Nombre del procesador Intel: CPU Intel(R) Core(TM) i5-4210U @ 1,70 GHz     Identificador: Intel64 Familia 6 Modelo 69 Paso 1     Microarquitectura: Haswell (Cliente)     Frecuencia (GHz): 2,39     Número de paquetes físicos: 1     Número de CPU físicas: 2     Número de CPU lógicas: 4     Nombre de la tarjeta gráfica n.º 0: Intel( R) Familia de gráficos HD     Tarjeta gráfica #0 Proveedor: Intel Corporation (0x8086)     Tarjeta gráfica #0 VRAM (MB): 1024.00     Tarjeta gráfica #0 ID del dispositivo: 0x0a16     Tarjeta gráfica #0 versionInfo: DriverVersion=20.19.15.4531     Capacidad de la ranura de memoria #0 ( MB): 4096,00     Velocidad de reloj de la ranura de memoria n.° 0 (GHz): 1,60     Tipo de ranura de memoria n.° 0: DDR3     Capacidad de la ranura de memoria n.° 1 (MB): 2048.00     Velocidad de reloj de la ranura de memoria n.° 1 (GHz): 1.60     Tipo de ranura de memoria n.° 1: DDR3     Memoria virtual máx (MB): 12449,39     Memoria virtual utilizada (MB): 7007,55     Memoria de intercambio total (MB): 6413,12     Memoria de intercambio utilizada (MB): 327,89     Banderas JVM: 8 en total; -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M -Xmx3018m -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump     Versión lanzada : 1.20.1-forge-47.3.1     Biblioteca backend: LWJGL versión 3.3.1 build 7     API backend: Intel(R) HD Graphics 4400 GL versión 4.3.0 - Build 20.19.15.4531, Intel     Tamaño de ventana: 1366x768     GL Mayúsculas: Uso framebuffer usando OpenGL 3.2     Mensajes de depuración GL: id=1282, fuente=API, tipo=ERROR, gravedad=ALTA, mensaje='Se ha generado un error. Error de GL GL_INVALID_OPERATION en (nulo): (ID: 173538523) Error genérico x 2     Usando VBO: Sí     Está modificado: Definitivamente; La marca del cliente cambió a 'forge'     Tipo: Cliente (map_client.txt)     Modo de gráficos: sofisticado     Paquetes de recursos:      Idioma actual: es_mx     CPU: 4 CPU Intel(R) Core(TM) i5-4210U a 1,70 GHz     Versión OptiFine: OptiFine_1.20.1 _HD_U_I6     OptiFine Build: 20231221-120401     Fragmentos de distancia de renderizado: 8     Mipmaps: 4     Filtrado anisotrópico: 1     Antialiasing: 0     Multitextura: falso     Sombreadores: nulo     OpenGlVersion: 4.3.0 - Build 20.19.15.4531     OpenGlRenderer: Intel(R) HD Graphics 4400     OpenGlVendor: Intel     CpuCount: 4     ModLauncher: 10.0.9+10.0.9+main. dcd20f30     Destino de lanzamiento de ModLauncher: forgeclient     Nombre de ModLauncher: srg     Servicios de ModLauncher:          mixin-0.8.5.jar mixin PLUGINSERVICE          eventbus-6.0.5.jar eventbus PLUGINSERVICE          fmlloader-1.20.1-47.3.1.jar slf4jfixer PLUGINSERVICE          fmlloader-1.20.1- 47.3.1.jar object_holder_definalize PLUGINSERVICE          fmlloader-1.20.1-47.3.1.jar runtime_enum_extender PLUGINSERVICE          fmlloader-1.20.1-47.3.1.jar capacitity_token_subclass PLUGINSERVICE          accesstransformers-8.0.4.jar accesstransformer PLUGINSERVICE          fmlloader-1.2 0,1-47,3. 1.jar runtimedistcleaner PLUGINSERVICE          modlauncher-10.0.9.jar mixin TRANSFORMATIONERVICE          modlauncher-10.0.9.jar OptiFine TRANSFORMATIONERVICE          modlauncher-10.0.9.jar fml TRANSFORMATIONSERVICE      Proveedores de lenguaje FML:          [email protected]         lowcodefml@null         javafml@null     Lista de mods:          cliente- 1.20.1-20230612.114412-srg.jar |Minecraft |minecraft |1.20.1 |COMMON_SET|Manifiesto: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0: de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f         hijos-de-sins-1.20.1-2.1.6.jar |Hijos de pecados |sons_of_sins |2.1.6 |COMMON_SET|Manifiesto: NOSIGNATURE         TreeChop-1.20.1-forge-0.19.0.jar |HT's TreeChop |treechop |0.18.8 |COMMON_SET|Manifiesto: NOSIGNATURE         geckolib-forge-1.20. 1-4.4.4.jar |GeckoLib 4 |geckolib |4.4.4 |COMMON_SET|Manifiesto: NOSIGNATURE         jei-1.20.1-forge-15.3.0.4.jar |Solo suficientes elementos |jei |15.3.0.4 |COMMON_SET|Manifiesto: NOSIGNATURE         jeiintegration_1.20.1-10.0.0.jar |Integración JEI |jeiintegration |10.0.0 |COMMON_SET|Manifiesto: NOSIGNATURE         sofisticadocore-1.20.1-0.6.22.611.jar |Núcleo sofisticado |núcleo sofisticado |0.6.22.611 |COMMON_SET|Manifiesto: SIN FIRMA         curios-forge-5.9.1+1.20.1.jar |API de Curios |curios |5.9.1+1.20.1 |COMMON_SET|Manifiesto: NOSIGNATURE         waystones-forge-1.20-14.1.3.jar |Waystones |waystones |14.1. 3 |COMMON_SET|Manifiesto: NOSIGNATURE         El-Hombre-De-La-Niebla-1.2.4a-1.20.1.jar |El Hombre De La Niebla |man |1.2.4 |COMMON_SET|Manifiesto: NOSIGNATURE         lápida-1.20.1- 1.0.10.jar |Lápida Mod |lápida |1.20.1-1.0.10 |COMMON_SET|Manifiesto: NOSIGNATURE         [1.20.1] SecurityCraft v1.9.9.jar |SecurityCraft |securitycraft |1.9.9 |COMMON_SET|Manifiesto: NOSIGNATURE         horror_element_mod -1.5.9_1.20.1.jar |Mod elemento de terror |horror_element_mod |1.5.9 |COMMON_SET|Manifiesto: NOSIGNATURE         Apollyon_v1.1.1_Forge_1.20.1.jar |Apollyon |apollyon |1.1.1 |COMMON_SET|Manifiesto: NOSIGNATURE         mixinextras-forge- 0.2.0-beta.6.jar |MixinExtras |mixinextras |0.2.0-beta.6 |COMMON_SET|Manifiesto: NOSIGNATURE         sofisticadasmochilas-1.20.1-3.20.5.1044.jar |Mochilas sofisticadas |mochilas sofisticadas |3.20.5.1044 |COMMON_SET| Manifiesto: NOSIGNATURE         Guide-API-VP-1.20.1-2.2.6.jar |Guide-API VP |guideapi_vp |2.2.6 |COMMON_SET|Manifiesto: NOSIGNATURE         arquitectura-9.2.14-forge.jar |Arquitectura |arquitectura |9.2 .14 |COMMON_SET|Manifiesto: NOSIGNATURE         justhammers-forge-2.0.3+mc1.20.1.jar |Just Hammers                  |justhammers |2.0.3+mc1.20.1 |COMMON_SET|Manifiesto: NOSIGNATURE         Vampirism-1.20.1-1.10.7.jar |Vampirismo |vampirismo |1.10.7 |COMMON_SET|Manifiesto: NOSIGNATURE         vampirism_integrations-1.20.1-1.8.0 .jar |Integraciones de vampirismo |integraciones_vampirismo |1.8.0 |COMMON_SET|Manifiesto: NOSIGNATURE         GodlyVampirism-1.20.1-1.10.0.jar |Vampirismo divino |godly_vampirism |1.10.0 |COMMON_SET|Manifiesto: NOSIGNATURE         balm-forge-1.20.1 -7.2.2.jar |Bálsamo |bálsamo |7.2.2 |COMMON_SET|Manifiesto: NOSIGNATURE         thedragonlib-1.20.1-1.0.0.jar |TheDragonLib |thedragonlib |1.20.1-1.0.0 |COMMON_SET|Manifiesto: NOSIGNATURE         carryon -forge-1.20.1-2.1.2.7.jar |Continuar |carryon |2.1.2.7 |COMMON_SET|Manifiesto: NOSIGNATURE         forge-1.20.1-47.3.1-universal.jar |Forge |forge |47.3.1 |COMMON_SET |Manifiesto: 84:ce:76:e8:45:35:e4:0e:63:86:df:47:59:80:0f:67:6c:c1:5f:6e:5f:4d:b3:54 :47:1a:9f:7f:ed:5e:f2:90         cosmeticarmorreworked-1.20.1-v1a.jar |CosmeticArmorReworked |cosmeticarmorreworked |1.20.1-v1a |COMMON_SET|Manifiesto: 5e:ed:25:99:e4: 44:14:c0:dd:89:c1:a9:4c:10:b5:0d:e4:b1:52:50:45:82:13:d8:d0:32:89:67:56:57: 01:53         Armorplus-1.20.1-20.0.0.jar |ArmorPlus |armorplus |1.20.1-20.0.0 |COMMON_SET|Manifiesto: NOSIGNATURE         THEUNDEADREVAMPED_1.2_1.20.1[Society Monmento Upd|Undead_revamp2 |undead_revamp2 |1.0.0 | COMMON_SET|Manifiesto: NOSIGNATURE         sanitydim-mc1.20-1.1.0.jar |Sanity: Descent Into Madness |sanitydim |1.1.0 |COMMON_SET|Manifiesto: NOSIGNATURE     Informe de fallo UUID: 49e97c25-1f8b-4147-b7cc-4951e2513d6c     FML: 47.3     Forja: net.minecraftforge:47.3.1
    • I created the animations by downloading the existing ones from the Github, and redoing them. I only ever saved the animations, and didnt export because it doesnt know what directory. I'm thinkin i just need a directory and I'd have been done with this, but im not sure.  noticed in blender there was a script thingy on the side, too. so im basically just askin, since i just redid the animations, would I just have to set a directory to the better combat mod somehow? can someone help???
    • Hallo! I'm trying to make a custom modpack for my friends and I to play, but I keep getting this error code whenver I launch it and I can't figure out what's wrong with it. The game crashed whilst rendering overlay Error: java.lang.StackOverflowError: Rendering overlay   Here is the full crash report: Pastebin
  • Topics

×
×
  • Create New...

Important Information

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