Jump to content

Recommended Posts

Posted

Hello.

 

I'm currently using Minecraft 1.6.4 with Forge 1.6.4-9.11.1.964 (don't tell me that's out of date...) and now I'm having a problem by using Schematics....

 

Here is the error:

 

---- Minecraft Crash Report ----
// Sorry 

Time: 27.07.14 14:54
Description: Exception in server tick loop

java.lang.ExceptionInInitializerError
at com.github.lunatrius.schematica.world.SchematicWorld.generateBlockList(SchematicWorld.java:221)
at com.github.lunatrius.schematica.world.SchematicWorld.<init>(SchematicWorld.java:131)
at com.github.lunatrius.schematica.world.schematic.SchematicAlpha.readFromNBT(SchematicAlpha.java:104)
at com.github.lunatrius.schematica.world.schematic.SchematicFormat.readFromStream(SchematicFormat.java:76)
at com.minecolonies.util.Schematic.loadSchematic(Schematic.java:76)
at com.minecolonies.util.Schematic.loadSchematic(Schematic.java:67)
at com.minecolonies.util.Schematic.loadAndPlaceSchematicWithRotation(Schematic.java:141)
at com.minecolonies.items.ItemSupplyChestDeployer.placeSupplyShip(ItemSupplyChestDeployer.java:199)
at com.minecolonies.items.ItemSupplyChestDeployer.spawnShip(ItemSupplyChestDeployer.java:182)
at com.minecolonies.items.ItemSupplyChestDeployer.onItemUse(ItemSupplyChestDeployer.java:51)
at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:153)
at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:434)
at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:58)
at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:583)
Caused by: java.lang.NullPointerException
at com.github.lunatrius.schematica.config.BlockInfo.addBlockItemMapping(BlockInfo.java:190)
at com.github.lunatrius.schematica.config.BlockInfo.populateBlockItemMap(BlockInfo.java:153)
at com.github.lunatrius.schematica.config.BlockInfo.<clinit>(BlockInfo.java:277)
... 23 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.6.4
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_65, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 738820512 bytes (704 MB) / 1468530688 bytes (1400 MB) up to 3810525184 bytes (3634 MB)
JVM Flags: 0 total; 
AABB Pool Size: 5901 (330456 bytes; 0 MB) allocated, 3734 (209104 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 3, tallocated: 63
FML: MCP v8.11 FML v6.99.19.964 Minecraft Forge 9.11.1.964 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
FML{6.99.19.964} [Forge Mod Loader] (forge-1.6.4-9.11.1.964-mcp.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
Forge{9.11.1.964} [Minecraft Forge] (forge-1.6.4-9.11.1.964-mcp.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
minecolonies{@VERSION@} [MineColonies] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 1469 (82264 bytes; 0 MB) allocated, 1424 (79744 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Gamer_ABC'/26889, l='New Worldw2', x=165,30, y=64,25, z=288,69]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'

 

 

And here is the code:

 

package com.github.lunatrius.schematica.config;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;

import com.github.lunatrius.schematica.config.PlacementData.PlacementType;
import com.minecolonies.MineColonies;

import net.minecraft.block.Block;
import net.minecraft.block.BlockButton;
import net.minecraft.block.BlockChest;
import net.minecraft.block.BlockDispenser;
import net.minecraft.block.BlockEnderChest;
import net.minecraft.block.BlockFurnace;
import net.minecraft.block.BlockHopper;
import net.minecraft.block.BlockLog;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.BlockPumpkin;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.BlockTorch;
import net.minecraft.item.Item;

public class BlockInfo 
{

public static final List<Integer> BLOCK_LIST_IGNORE_BLOCK = new ArrayList<Integer>();
public static final List<Integer> BLOCK_LIST_IGNORE_METADATA = new ArrayList<Integer>();
public static final Map<Integer, Integer> BLOCK_ITEM_MAP = new HashMap<Integer, Integer>();
@SuppressWarnings("rawtypes")
public static final Map<Class, PlacementData> CLASS_PLACEMENT_MAP = new HashMap<Class, PlacementData>();
public static final Map<Integer, PlacementData> ITEM_PLACEMENT_MAP = new HashMap<Integer, PlacementData>();

private static final Map<String, Integer> ALIAS = new HashMap<String, Integer>();
private static final Map<Integer, Integer> FLIP = new HashMap<Integer, Integer>();
private static final Map<Integer, Integer> ROTATION = new HashMap<Integer, Integer>(); 

public static void populateIgnoredBlock()
{
	BLOCK_LIST_IGNORE_BLOCK.clear();

	/**
	 * minecraft
	 */
	addIgnoredBlock(Block.pistonMoving.blockID);
	addIgnoredBlock(Block.pistonExtension.blockID);
	addIgnoredBlock(Block.portal.blockID);
	addIgnoredBlock(Block.endPortal.blockID);
}

private static boolean addIgnoredBlock(Integer block)
{
	if(block == null)
		return false;

	return BLOCK_LIST_IGNORE_BLOCK.add(block);
} 

public static void populateIgnoredBlockMetadata()
{
	BLOCK_LIST_IGNORE_METADATA.clear();

        /**
         * minecraft
         */
        addIgnoredBlockMetadata(Block.waterMoving.blockID);
        addIgnoredBlockMetadata(Block.waterStill.blockID);
        addIgnoredBlockMetadata(Block.lavaMoving.blockID);
        addIgnoredBlockMetadata(Block.lavaStill.blockID);
        addIgnoredBlockMetadata(Block.dispenser.blockID);
        addIgnoredBlockMetadata(Block.bed.blockID);
        addIgnoredBlockMetadata(Block.railPowered.blockID);
        addIgnoredBlockMetadata(Block.railDetector.blockID);
        addIgnoredBlockMetadata(Block.pistonStickyBase.blockID);
        addIgnoredBlockMetadata(Block.pistonBase.blockID);
        addIgnoredBlockMetadata(Block.torchWood.blockID);
        addIgnoredBlockMetadata(Block.stairsWoodOak.blockID);
        addIgnoredBlockMetadata(Block.chest.blockID);
        addIgnoredBlockMetadata(Block.chestTrapped.blockID);
        addIgnoredBlockMetadata(Block.redstoneWire.blockID);
        addIgnoredBlockMetadata(Block.crops.blockID);
        addIgnoredBlockMetadata(Block.tilledField.blockID);
        addIgnoredBlockMetadata(Block.furnaceIdle.blockID);
        addIgnoredBlockMetadata(Block.furnaceBurning.blockID);
        addIgnoredBlockMetadata(Block.signPost.blockID);
        addIgnoredBlockMetadata(Block.doorWood.blockID);
        addIgnoredBlockMetadata(Block.ladder.blockID);
        addIgnoredBlockMetadata(Block.rail.blockID);
        addIgnoredBlockMetadata(Block.stairsCobblestone.blockID);
        addIgnoredBlockMetadata(Block.signWall.blockID);
        addIgnoredBlockMetadata(Block.lever.blockID);
        addIgnoredBlockMetadata(Block.pressurePlateStone.blockID);
        addIgnoredBlockMetadata(Block.doorIron.blockID);
        addIgnoredBlockMetadata(Block.pressurePlatePlanks.blockID);
        addIgnoredBlockMetadata(Block.torchRedstoneActive.blockID);
        addIgnoredBlockMetadata(Block.torchRedstoneIdle.blockID);
        addIgnoredBlockMetadata(Block.stoneButton.blockID);
        addIgnoredBlockMetadata(Block.cactus.blockID);
        addIgnoredBlockMetadata(Block.reed.blockID);
        addIgnoredBlockMetadata(Block.pumpkin.blockID);
        addIgnoredBlockMetadata(Block.portal.blockID);
        addIgnoredBlockMetadata(Block.pumpkinStem.blockID);
        addIgnoredBlockMetadata(Block.cake.blockID);
        addIgnoredBlockMetadata(Block.redstoneRepeaterActive.blockID);
        addIgnoredBlockMetadata(Block.redstoneRepeaterIdle.blockID);
        addIgnoredBlockMetadata(Block.trapdoor.blockID);
        addIgnoredBlockMetadata(Block.vine.blockID);
        addIgnoredBlockMetadata(Block.fenceGate.blockID);
        addIgnoredBlockMetadata(Block.stairsWoodSpruce.blockID);
        addIgnoredBlockMetadata(Block.stairsBrick.blockID);
        addIgnoredBlockMetadata(Block.waterlily.blockID);
        addIgnoredBlockMetadata(Block.stairsNetherBrick.blockID);
        addIgnoredBlockMetadata(Block.netherStalk.blockID);
        addIgnoredBlockMetadata(Block.endPortalFrame.blockID);
        addIgnoredBlockMetadata(Block.redstoneLampActive.blockID);
        addIgnoredBlockMetadata(Block.redstoneLampIdle.blockID);
        addIgnoredBlockMetadata(Block.stairsSandStone.blockID);
        addIgnoredBlockMetadata(Block.enderChest.blockID);
        addIgnoredBlockMetadata(Block.tripWireSource.blockID);
        addIgnoredBlockMetadata(Block.tripWire.blockID);
        addIgnoredBlockMetadata(Block.stairsWoodBirch.blockID);
        addIgnoredBlockMetadata(Block.stairsWoodJungle.blockID);
        addIgnoredBlockMetadata(Block.stairsWoodOak.blockID);
        addIgnoredBlockMetadata(Block.commandBlock.blockID);
        addIgnoredBlockMetadata(Block.flowerPot.blockID);
        addIgnoredBlockMetadata(Block.carrot.blockID);
        addIgnoredBlockMetadata(Block.potato.blockID);
        addIgnoredBlockMetadata(Block.woodenButton.blockID);
        addIgnoredBlockMetadata(Block.anvil.blockID);
        addIgnoredBlockMetadata(Block.trapdoor.blockID);
        addIgnoredBlockMetadata(Block.hopperBlock.blockID);
        addIgnoredBlockMetadata(Block.stairsNetherQuartz.blockID);
        addIgnoredBlockMetadata(Block.dropper.blockID);
}

private static boolean addIgnoredBlockMetadata(Integer block)
{
	if(block == null)
		return false;

	return BLOCK_LIST_IGNORE_METADATA.add(block);
}

public static void populateBlockItemMap()
{
	BLOCK_ITEM_MAP.clear();

	/**
	 * minecraft
	 */
    	addBlockItemMapping(Block.waterMoving.blockID, Item.bucketWater.itemID);
    	addBlockItemMapping(Block.waterStill.blockID, Item.bucketWater.itemID);
    	addBlockItemMapping(Block.lavaMoving.blockID, Item.bucketLava.itemID);
    	addBlockItemMapping(Block.lavaStill.blockID, Item.bucketLava.itemID);
    	addBlockItemMapping(Block.bed.blockID, Item.bed.itemID);
    	addBlockItemMapping(Block.redstoneWire.blockID, Item.redstone.itemID);
    	addBlockItemMapping(Block.crops.blockID, Item.seeds.itemID);
    	addBlockItemMapping(Block.furnaceBurning.blockID, Block.furnaceIdle.blockID);
    	addBlockItemMapping(Block.signPost.blockID, Item.sign.itemID);
    	addBlockItemMapping(Block.doorWood.blockID, Item.doorWood.itemID);
    	addBlockItemMapping(Block.doorIron.blockID, Item.doorIron.itemID);
    	addBlockItemMapping(Block.signWall.blockID, Item.sign.itemID);
    	addBlockItemMapping(Block.torchRedstoneIdle.blockID, Block.torchRedstoneActive.blockID);
    	addBlockItemMapping(Block.reed.blockID, Item.reed.itemID);
    	addBlockItemMapping(Block.redstoneRepeaterIdle.blockID, Item.redstoneRepeater.itemID);
    	addBlockItemMapping(Block.redstoneRepeaterActive.blockID, Item.redstoneRepeater.itemID);
    	addBlockItemMapping(Block.pumpkinStem.blockID, Item.pumpkinSeeds.itemID);
    	addBlockItemMapping(Block.melonStem.blockID, Item.melonSeeds.itemID);
    	addBlockItemMapping(Block.netherStalk.blockID, Item.netherStalkSeeds.itemID);
    	addBlockItemMapping(Block.brewingStand.blockID, Item.brewingStand.itemID);
    	addBlockItemMapping(Block.cauldron.blockID, Item.cauldron.itemID);
    	addBlockItemMapping(Block.redstoneLampActive.blockID, Block.redstoneLampIdle.blockID);
    	addBlockItemMapping(Block.cocoaPlant.blockID, Item.dyePowder.itemID);
    	addBlockItemMapping(Block.tripWire.blockID, Item.silk.itemID);
    	addBlockItemMapping(Block.flowerPot.blockID, Item.flowerPot.itemID);
    	addBlockItemMapping(Block.carrot.blockID, Item.carrot.itemID);
    	addBlockItemMapping(Block.potato.blockID, Item.potato.itemID);
    	addBlockItemMapping(Block.skull.blockID, Item.skull.itemID);
}

    private static int addBlockItemMapping(Integer block, Integer item)
    {
        if(block == null || item == null)
        {
            return 0;
        }

        return BLOCK_ITEM_MAP.put(block, item);
    }
    
    public static void populatePlacementMaps()
    {
    	ITEM_PLACEMENT_MAP.clear();
    	
    	/**
    	 * minecraft
    	 */
        addPlacementMapping(BlockButton.class, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 4, 1, 2).setMaskMeta(0x7));
        addPlacementMapping(BlockChest.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4));
        addPlacementMapping(BlockDispenser.class, new PlacementData(PlacementType.PISTON, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7));
        addPlacementMapping(BlockEnderChest.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4));
        addPlacementMapping(BlockFurnace.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4));
        addPlacementMapping(BlockHopper.class, new PlacementData(PlacementType.BLOCK, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7));
        addPlacementMapping(BlockLog.class, new PlacementData(PlacementType.BLOCK, 0, 0, 8, 8, 4, 4).setMaskMeta(0xC));
        addPlacementMapping(BlockPistonBase.class, new PlacementData(PlacementType.PISTON, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7));
        addPlacementMapping(BlockPumpkin.class, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0xF));
        addPlacementMapping(BlockStairs.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 1, 0).setOffset(0x4, 0.0f, 1.0f).setMaskMeta(0x3));
        addPlacementMapping(BlockTorch.class, new PlacementData(PlacementType.BLOCK, 5, -1, 3, 4, 1, 2).setMaskMeta(0xF));

        addPlacementMapping(Block.dirt, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF));
        addPlacementMapping(Block.planks, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF));
        addPlacementMapping(Block.sandStone, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF));
        //addPlacementMapping(Block.wool, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF));
        addPlacementMapping(Block.stoneSingleSlab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7));
        addPlacementMapping(Block.glass, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF));
        addPlacementMapping(Block.trapdoor, new PlacementData(PlacementType.BLOCK, -1, -1, 1, 0, 3, 2).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x3));
        addPlacementMapping(Block.mobSpawner, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF));
        addPlacementMapping(Block.stoneBrick, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF));
        addPlacementMapping(Block.fenceGate, new PlacementData(PlacementType.PLAYER, -1, -1, 2, 0, 1, 3).setMaskMeta(0x3));
        addPlacementMapping(Block.woodSingleSlab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7));
        addPlacementMapping(Block.anvil, new PlacementData(PlacementType.PLAYER, -1, -1, 1, 3, 0, 2).setMaskMeta(0x3).setMaskMetaInHand(0xC).setBitShiftMetaInHand(2));
        addPlacementMapping(Item.redstoneRepeater, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3));
    }
    
    @SuppressWarnings("rawtypes")
public static PlacementData addPlacementMapping(Class clazz, PlacementData data)
    {
        if(clazz == null || data == null)
        {
            return null;
        }

        return CLASS_PLACEMENT_MAP.put(clazz, data);
    }
    
    public static PlacementData addPlacementMapping(Item item, PlacementData data)
    {
        if(item == null || data == null)
        {
            return null;
        }

        return ITEM_PLACEMENT_MAP.put(item.itemID, data);
    }
    
    public static PlacementData addPlacementMapping(Block block, PlacementData data)
    {
        return addPlacementMapping(block, data);
    }
    
    public static PlacementData addPlacementMapping(Object itemObj, PlacementData data)
    {
    	if(itemObj == null || data == null)
    	{
    		return null;
    	}
    	
    	Item item = null;
    	
    	if(itemObj instanceof Item)
    	{
    		item = (Item) itemObj;
    	}
    	else
    		return null;
    	// TODO?
    	
    	return addPlacementMapping(item, data);
    }
    
    static
    {
        populateIgnoredBlock();
        populateIgnoredBlockMetadata();
        populateBlockItemMap();
        populatePlacementMaps();
    }
    
    public static boolean addMappingAlias(String key, String value)
    {
    	String k = key;
    	int v = parseNumber(value);
    	
    	if(v > 0)
    	{
    		ALIAS.put(k, v);
    		return true;
    	}
    	
    	return false;
    }
    
    public static boolean addMappingRotation(String key, String value)
    {
    	return addMapping(key, value, ROTATION);
    }
    
    public static boolean addMappingFlip(String key, String value)
    {
    	return addMapping(key, value, FLIP);
    }
    
    private static boolean addMapping(String key, String value, Map<Integer, Integer> map)
    {
    	int k = parseInfo(key);
    	int v = parseInfo(value);
    	
    	if (k > 0 && v > 0) 
    	{
    		map.put(k, v);
    		return true;
    	}

    	return false;
    }
    
    private static int parseInfo(String str)
    {
    	String[] parts = str.split("-");
    	
    	int blockId = getBlockId(parts[0]) << 8;
    	if(blockId > 0)
    	{
    		if(parts.length == 1)
    		{
    			return blockId;
    		}
    		
    		if(parts.length == 2)
    		{
    			return blockId | (parseNumber(parts[1]) & 0xF); 
    		}
    	}
    	
    	return 0;
    }
    
    private static int getBlockId(String str)
    {
    	if(ALIAS.containsKey(str))
    		return ALIAS.get(str);
    	
    	return parseNumber(str);
    }
    
    private static int parseNumber(String str)
    {
    	try
    	{
    		return Integer.valueOf(str, 10);
    	}
    	catch(NumberFormatException e)
    	{
    		MineColonies.logger.log(Level.SEVERE, "Could not parse the given number!", e);
    	}
    	return 0;
    }
    
public static int getTransformedMetadataRotation(int blockId, int metadata)
{
	return getTransformedMetadata(blockId, metadata, ROTATION);
}

public static int getTransformedMetadataFlip(int blockId, int metadata) 
{
	return getTransformedMetadata(blockId, metadata, FLIP);
}

private static int getTransformedMetadata(int blockId, int metadata, Map<Integer, Integer> map) 
{
	int key = (blockId <<  | metadata;
	if (map.containsKey(key)) {
		return map.get(key) & 0xF;
	}
	return metadata;
}
}

 

 

For the Schematics I'm using an edited version of Schematica.

If more code is needed: https://bitbucket.org/MinecraftPlaye/mcolonies/src/d63de09c34c27c665d87265c2d014ae797fd355e/src/main/java/com/?at=Backup

 

I hope that someone could help me.

Bektor

Developer of Primeval Forest.

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.

Announcements



×
×
  • Create New...

Important Information

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