use of crazypants.enderio.api.upgrades.IDarkSteelUpgrade in project EnderIO by SleepyTrousers.
the class ItemDarkSteelArmor method getSubItems.
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> par3List) {
if (isInCreativeTab(tab)) {
@Nonnull ItemStack is = new ItemStack(this);
par3List.add(is);
is = new ItemStack(this);
EnergyUpgrade.EMPOWERED_FOUR.addToItem(is, this);
EnergyUpgradeManager.setPowerFull(is, this);
Iterator<IDarkSteelUpgrade> iter = DarkSteelRecipeManager.recipeIterator();
while (iter.hasNext()) {
IDarkSteelUpgrade upgrade = iter.next();
if (!(upgrade instanceof EnergyUpgrade || upgrade instanceof GliderUpgrade || upgrade instanceof ElytraUpgrade) && upgrade.canAddToItem(is, this)) {
upgrade.addToItem(is, this);
}
}
if (GliderUpgrade.INSTANCE.canAddToItem(is, this)) {
ItemStack is2 = is.copy();
GliderUpgrade.INSTANCE.addToItem(is2, this);
par3List.add(is2);
if (ElytraUpgrade.INSTANCE.canAddToItem(is, this)) {
ItemStack is3 = is.copy();
ElytraUpgrade.INSTANCE.addToItem(is3, this);
par3List.add(is3);
}
return;
}
par3List.add(is);
}
}
use of crazypants.enderio.api.upgrades.IDarkSteelUpgrade in project EnderIO by SleepyTrousers.
the class UpgradeRenderDispatcher method doRenderLayer.
@Override
public void doRenderLayer(@Nonnull AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
NNList.of(EntityEquipmentSlot.class).apply(new Callback<EntityEquipmentSlot>() {
@Override
public void apply(@Nonnull EntityEquipmentSlot slot) {
ItemStack item = player.getItemStackFromSlot(slot);
if (item.getItem() instanceof IDarkSteelItem) {
for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
if (upgrade instanceof IHasPlayerRenderer && upgrade.hasUpgrade(item)) {
((IHasPlayerRenderer) upgrade).getRender().doRenderLayer(renderPlayer, slot, item, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
}
}
}
if (item.getItem() instanceof IHasPlayerRenderer) {
((IHasPlayerRenderer) item.getItem()).getRender().doRenderLayer(renderPlayer, slot, item, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
}
}
});
IInventory baubles = BaublesUtil.instance().getBaubles(player);
if (baubles != null) {
for (int i = 0; i < baubles.getSizeInventory(); i++) {
ItemStack piece = baubles.getStackInSlot(i);
if (piece.getItem() instanceof IHasPlayerRenderer) {
((IHasPlayerRenderer) piece.getItem()).getRender().doRenderLayer(renderPlayer, null, piece, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
}
}
}
}
use of crazypants.enderio.api.upgrades.IDarkSteelUpgrade in project EnderIO by SleepyTrousers.
the class DarkSteelController method onPlayerTick.
@SubscribeEvent
public static void onPlayerTick(TickEvent.PlayerTickEvent event) {
EntityPlayer player = event.player;
if (event.phase == Phase.START && !player.isSpectator()) {
// boots
updateStepHeightAndFallDistance(player);
// leggings
SpeedController.updateSpeed(player);
NNList.of(EntityEquipmentSlot.class).apply(new Callback<EntityEquipmentSlot>() {
@Override
public void apply(@Nonnull EntityEquipmentSlot slot) {
ItemStack item = player.getItemStackFromSlot(slot);
if (item.getItem() instanceof IDarkSteelItem) {
for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
if (upgrade.hasUpgrade(item)) {
upgrade.onPlayerTick(item, (IDarkSteelItem) item.getItem(), player);
}
}
}
}
});
}
}
use of crazypants.enderio.api.upgrades.IDarkSteelUpgrade 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.IDarkSteelUpgrade 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()));
}
}
}
}
Aggregations