use of minechem.item.blueprint.MinechemBlueprint in project Minechem by iopleke.
the class BlueprintProjectorTileEntity method setInventorySlotContents.
@Override
public void setInventorySlotContents(int slot, ItemStack itemstack) {
super.setInventorySlotContents(slot, itemstack);
if (itemstack != null) {
MinechemBlueprint blueprint = MinechemItemsRegistration.blueprint.getBlueprint(itemstack);
setBlueprint(blueprint);
}
}
use of minechem.item.blueprint.MinechemBlueprint in project Minechem by iopleke.
the class BlueprintProjectorGui method getBlockCount.
private HashMap<Integer, Integer> getBlockCount(MinechemBlueprint blueprint) {
HashMap<Integer, Integer> blockCount = new HashMap<Integer, Integer>();
for (int x = 0; x < blueprint.xSize; x++) {
for (int y = 0; y < blueprint.ySize; y++) {
for (int z = 0; z < blueprint.zSize; z++) {
int structureID = blueprint.getStructure()[y][x][z];
int count = 0;
if (blockCount.get(structureID) != null) {
count = blockCount.get(structureID);
}
count++;
blockCount.put(structureID, count);
}
}
}
return blockCount;
}
use of minechem.item.blueprint.MinechemBlueprint in project Minechem by iopleke.
the class BlueprintProjectorTileEntity method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound nbtTagCompound) {
super.readFromNBT(nbtTagCompound);
this.inventory = new ItemStack[getSizeInventory()];
this.isComplete = false;
NBTTagCompound blueprintNBT = (NBTTagCompound) nbtTagCompound.getTag("blueprint");
if (blueprintNBT != null) {
ItemStack blueprintStack = ItemStack.loadItemStackFromNBT(blueprintNBT);
MinechemBlueprint blueprint = MinechemItemsRegistration.blueprint.getBlueprint(blueprintStack);
setBlueprint(blueprint);
this.inventory[0] = blueprintStack;
}
}
use of minechem.item.blueprint.MinechemBlueprint in project Minechem by iopleke.
the class BlueprintProjectorTileEntity method takeBlueprint.
public MinechemBlueprint takeBlueprint() {
MinechemBlueprint blueprint = this.blueprint;
setBlueprint(null);
return blueprint;
}
use of minechem.item.blueprint.MinechemBlueprint in project Minechem by iopleke.
the class BlueprintProjectorGui method drawBlueprintInfo.
private void drawBlueprintInfo(ItemStack blueprintStack) {
MinechemBlueprint blueprint = MinechemItemsRegistration.blueprint.getBlueprint(blueprintStack);
if (blueprint == null) {
return;
}
String name = blueprintStack.getDisplayName().replace("Blueprint", "");
this.fontRendererObj.drawStringWithShadow(name, 64, 12, 0xFFFFFF);
HashMap<Integer, Integer> blockCount = getBlockCount(blueprint);
HashMap<Integer, BlueprintBlock> blockLookup = blueprint.getBlockLookup();
int y = 23;
Iterator<Entry<Integer, Integer>> it = blockCount.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Integer, Integer> entry = it.next();
BlueprintBlock block = blockLookup.get(entry.getKey());
if (block != null) {
ItemStack itemstack = new ItemStack(block.block, 1, block.metadata);
String info = String.format("%dx%s", entry.getValue(), itemstack.getDisplayName());
this.fontRendererObj.drawString(info, 64, y, 0xDDDDDD);
y += 10;
}
}
}
Aggregations