2014-09-26 04:45:55 +02:00
|
|
|
—MAPPINGS NOW IN MCPBOT—
|
2014-09-25 12:08:22 +02:00
|
|
|
|
2014-09-25 02:27:36 +02:00
|
|
|
——————————
|
|
|
|
FIXES
|
|
|
|
——————————
|
|
|
|
—GameData—
|
|
|
|
|
2014-09-25 03:54:30 +02:00
|
|
|
private int registerBlock(Block block, String name, int idHint)
|
|
|
|
{
|
|
|
|
// handle ItemBlock-before-Block registrations
|
|
|
|
ItemBlock itemBlock = null;
|
|
|
|
|
|
|
|
for (Item item : iItemRegistry.typeSafeIterable()) // find matching ItemBlock
|
|
|
|
{
|
|
|
|
if (item instanceof ItemBlock && ((ItemBlock) item).blockInstance == block)
|
|
|
|
{
|
|
|
|
itemBlock = (ItemBlock) item;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (itemBlock != null) // has ItemBlock, adjust id and clear the slot already occupied by the corresponding item
|
|
|
|
{
|
|
|
|
idHint = iItemRegistry.getId(itemBlock);
|
|
|
|
FMLLog.fine("Found matching ItemBlock %s for Block %s at id %d", itemBlock, block, idHint);
|
|
|
|
freeSlot(idHint, block); // temporarily free the slot occupied by the Item for the block registration
|
|
|
|
}
|
|
|
|
|
|
|
|
// add
|
|
|
|
int blockId = iBlockRegistry.add(idHint, name, block, availabilityMap);
|
|
|
|
|
|
|
|
if (itemBlock != null) // verify
|
|
|
|
{
|
|
|
|
if (blockId != idHint) throw new IllegalStateException(String.format("Block at itemblock id %d insertion failed, got id %d.", idHint, blockId));
|
|
|
|
verifyItemBlockName(itemBlock);
|
|
|
|
}
|
|
|
|
|
|
|
|
//Hackery added by me which probably shouldn't be done
|
|
|
|
Iterator iterator1 = block.getBlockState().getValidStates().iterator();
|
|
|
|
|
|
|
|
while (iterator1.hasNext())
|
|
|
|
{
|
|
|
|
IBlockState iblockstate = (IBlockState)iterator1.next();
|
|
|
|
int i = blockRegistry.getIDForObject(block) << 4 | block.getMetaFromBlockState(iblockstate);
|
|
|
|
Block.field_176229_d.func_148746_a(iblockstate, i);
|
|
|
|
}
|
|
|
|
//End hackery
|
|
|
|
|
|
|
|
useSlot(blockId);
|
|
|
|
((RegistryDelegate.Delegate<Block>) block.delegate).setName(name);
|
|
|
|
return blockId;
|
2014-09-25 02:27:36 +02:00
|
|
|
}
|