use of com.enderio.core.common.util.NNList in project EnderIO by SleepyTrousers.
the class SmartModelAttacher method registerColoredBlocksAndItems.
@SideOnly(Side.CLIENT)
public static void registerColoredBlocksAndItems() {
NNList<Block> blocklist = new NNList<Block>();
NNList<Item> itemlist = new NNList<Item>();
for (RegistrationHolder<?, ?> holder : blocks) {
Block block = holder.block;
Item item = Item.getItemFromBlock(block);
if (block instanceof IPaintable || block instanceof ITintedBlock || block instanceof ITintedItem || item instanceof ITintedItem) {
blocklist.add(block);
if (item != Items.AIR) {
itemlist.add(item);
}
} else {
if (block instanceof IBlockColor) {
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((IBlockColor) block, block);
}
if (item instanceof IItemColor) {
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((IItemColor) item, item);
}
}
}
PaintTintHandler handler = new PaintTintHandler();
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(handler, blocklist.toArray(new Block[0]));
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(handler, itemlist.toArray(new Item[0]));
}
use of com.enderio.core.common.util.NNList in project EnderIO by SleepyTrousers.
the class PoweredTask method readFromNBT.
@Nullable
public static IPoweredTask readFromNBT(@Nonnull NBTTagCompound nbtRoot) {
IMachineRecipe recipe;
float usedEnergy = nbtRoot.getFloat(KEY_USED_ENERGY);
long seed = nbtRoot.getLong(KEY_SEED);
float outputMultiplier = nbtRoot.getFloat(KEY_CHANCE_OUTPUT);
float chanceMultiplier = nbtRoot.getFloat(KEY_CHANCE_MULTI);
NBTTagList inputItems = (NBTTagList) nbtRoot.getTag(KEY_INPUT_STACKS);
NNList<MachineRecipeInput> ins = new NNList<MachineRecipeInput>();
for (int i = 0; i < inputItems.tagCount(); i++) {
NBTTagCompound stackTag = inputItems.getCompoundTagAt(i);
MachineRecipeInput mi = MachineRecipeInput.readFromNBT(stackTag);
ins.add(mi);
}
String uid = nbtRoot.getString(KEY_RECIPE);
recipe = MachineRecipeRegistry.instance.getRecipeForUid(uid);
if (recipe != null) {
return new PoweredTask(recipe, usedEnergy, seed, outputMultiplier, chanceMultiplier, ins);
}
return null;
}
use of com.enderio.core.common.util.NNList in project EnderIO by SleepyTrousers.
the class ExternalConnectionContainer method createGhostSlots.
public void createGhostSlots(@Nonnull List<GhostSlot> ghostSlots) {
if (itemConduit != null) {
ghostSlots.add(new GhostBackgroundItemSlot(ModObject.itemBasicItemFilter.getItemNN(), slotOutputFilter));
ghostSlots.add(new GhostBackgroundItemSlot(ModObject.itemBasicItemFilter.getItemNN(), slotInputFilter));
NNList<ItemStack> ghostSlotIcons = new NNList<>(new ItemStack(ConduitObject.item_extract_speed_upgrade.getItemNN()), new ItemStack(ConduitObject.item_extract_speed_downgrade.getItemNN()));
ghostSlots.add(new GhostBackgroundItemSlot(ghostSlotIcons, slotFunctionUpgrade));
}
}
use of com.enderio.core.common.util.NNList in project EnderIO by SleepyTrousers.
the class ItemDarkSteelAxe method onBlockStartBreak.
@Override
public boolean onBlockStartBreak(@Nonnull ItemStack itemstack, @Nonnull BlockPos pos, @Nonnull EntityPlayer player) {
if (!player.world.isRemote && !player.isSneaking() && EnergyUpgradeManager.itemHasAnyPowerUpgrade(itemstack)) {
IBlockState bs = player.world.getBlockState(pos);
Block block = bs.getBlock();
if (FarmersRegistry.isLog(block)) {
int powerStored = EnergyUpgradeManager.getEnergyStored(itemstack);
HarvestResult res = new HarvestResult();
final IHarvestingTarget target = new AxeHarvestingTarget(bs, pos);
TreeHarvester.harvest(player.world, pos, res, target);
NNList<BlockPos> sortedTargets = new NNList<BlockPos>(res.getHarvestedBlocks());
harvestComparator.refPoint = pos;
Collections.sort(sortedTargets, harvestComparator);
int maxBlocks = powerStored / Config.darkSteelAxePowerUsePerDamagePointMultiHarvest;
int numUsedPower = 0;
for (int i = 0; numUsedPower < maxBlocks && i < sortedTargets.size(); i++) {
if (doMultiHarvest(player, player.world, sortedTargets.get(i), block)) {
numUsedPower++;
}
}
return numUsedPower != 0;
}
}
return false;
}
use of com.enderio.core.common.util.NNList in project EnderIO by SleepyTrousers.
the class InfinityRecipeCategory method setRecipe.
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull InfinityRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, false, 85, 30);
itemStacks.set(ingredients);
this.recipeLayout = recipeLayout;
bsr = new BlockSceneRenderer(new NNList<>(Pair.of(new BlockPos(0, 0, 0), Blocks.BEDROCK.getDefaultState()), Pair.of(new BlockPos(0, 1, 0), Blocks.FIRE.getDefaultState())));
}
Aggregations