use of crazypants.enderio.api.upgrades.IDarkSteelItem in project EnderIO by SleepyTrousers.
the class DarkSteelRecipeManager method getRecipes.
public static NNList<ItemStack> getRecipes(@Nonnull Set<UpgradePath> list, @Nonnull NNList<ItemStack> input) {
NNList<ItemStack> output = new NNList<ItemStack>();
NNIterator<ItemStack> iterator = input.iterator();
while (iterator.hasNext()) {
ItemStack inputStack = iterator.next();
if (inputStack.getItem() instanceof IDarkSteelItem) {
for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
if (upgrade.canAddToItem(inputStack, (IDarkSteelItem) inputStack.getItem())) {
ItemStack outputStack = inputStack.copy();
upgrade.addToItem(outputStack, (IDarkSteelItem) outputStack.getItem());
final UpgradePath path = new UpgradePath(inputStack, upgrade.getUpgradeItem(), outputStack);
if (!list.contains(path)) {
list.add(path);
output.add(outputStack);
}
}
}
}
}
return output;
}
use of crazypants.enderio.api.upgrades.IDarkSteelItem in project EnderIO by SleepyTrousers.
the class DarkSteelRecipeManager method addAdvancedTooltipEntries.
public static void addAdvancedTooltipEntries(@Nonnull ItemStack itemstack, EntityPlayer entityplayer, @Nonnull List<String> list, boolean flag) {
if (itemstack.getItem() instanceof IDarkSteelItem) {
List<IDarkSteelUpgrade> applyableUpgrades = new ArrayList<IDarkSteelUpgrade>();
for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
if (upgrade instanceof IAdvancedTooltipProvider && upgrade.hasUpgrade(itemstack, (IDarkSteelItem) itemstack.getItem())) {
((IAdvancedTooltipProvider) upgrade).addDetailedEntries(itemstack, entityplayer, list, flag);
} else if (upgrade.canAddToItem(itemstack, (IDarkSteelItem) itemstack.getItem())) {
applyableUpgrades.add(upgrade);
}
}
if (!applyableUpgrades.isEmpty()) {
list.add(TextFormatting.YELLOW + EnderIO.lang.localize("tooltip.anvilupgrades") + " ");
for (IDarkSteelUpgrade up : applyableUpgrades) {
list.add(Lang.DARK_STEEL_LEVELS1.get(TextFormatting.DARK_AQUA, EnderIO.lang.localizeExact(up.getUnlocalizedName() + ".name")));
list.add(Lang.DARK_STEEL_LEVELS2.get(TextFormatting.DARK_AQUA, TextFormatting.ITALIC, up.getUpgradeItemName(), up.getLevelCost()));
}
}
}
}
use of crazypants.enderio.api.upgrades.IDarkSteelItem in project EnderIO by SleepyTrousers.
the class ItemDarkSteelPickaxe method doRightClickItemPlace.
@SideOnly(Side.CLIENT)
@Nonnull
static EnumActionResult doRightClickItemPlace(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, @Nonnull EnumHand hand, float par8, float par9, float par10) {
if (hand != EnumHand.MAIN_HAND) {
return EnumActionResult.PASS;
}
int current = player.inventory.currentItem;
int slot = current == 0 && Config.slotZeroPlacesEight ? 8 : current + 1;
if (slot < InventoryPlayer.getHotbarSize() && !(player.inventory.mainInventory.get(slot).getItem() instanceof IDarkSteelItem)) {
/*
* this will not work with buckets unless we don't switch back to the current item (the pick); there's probably some client <-> server event thing going
* on with buckets, so our item-switch within the same tick would be a problem.
*/
player.inventory.currentItem = slot;
Minecraft mc = Minecraft.getMinecraft();
EnumActionResult result = mc.playerController.processRightClickBlock(mc.player, mc.world, pos, side, new Vec3d(par8, par9, par10), hand);
player.inventory.currentItem = current;
return result;
}
return EnumActionResult.PASS;
}
Aggregations