@Override public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> list) { if (tab == getCreativeTab()) { super.getSubItems(tab, list); } else if (tab == EnderIOTab.tabEnderIOMobs) { for (CapturedMob capturedMob : CapturedMob.getAllSouls()) { list.add(capturedMob.toStack(this, 1, 1)); } } }
@SuppressWarnings("null") @Override public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> list) { if (tab == getCreativeTab()) { list.add(CapturedMob.create(new ResourceLocation("minecraft", "chicken")).toStack(this, 0, 1)); } else if (tab == EnderIOTab.tabEnderIOMobs) { for (CapturedMob capturedMob : CapturedMob.getAllSouls()) { list.add(capturedMob.toStack(this, 0, 1)); } } }
@Override public void enforceValidity() throws InvalidRecipeConfigException { if (!isValid()) { Log.warn("Could not find an entity for '" + name + "'"); Log.warn("Available entities are:"); for (CapturedMob possible : CapturedMob.getAllSouls()) { Log.warn(" -> " + possible.getEntityName() + " (" + possible.getDisplayName() + ")"); // Log.warn(" <entity name=\"" + possible.getEntityName() + "\" costMultiplier=\"1\" disabled=\"false\"/> <!-- " + possible.getDisplayName() + " -->"); } throw new InvalidRecipeConfigException("Could not find an entity for '" + name + "'"); } }
@Override public void enforceValidity() throws InvalidRecipeConfigException { if (!isValid()) { Log.warn("Could not find an entity for '" + name + "'"); Log.warn("Available entities are:"); for (CapturedMob possible : CapturedMob.getAllSouls()) { Log.warn(" -> " + possible.getEntityName() + " (" + possible.getDisplayName() + ")"); } throw new InvalidRecipeConfigException("Could not find an entity for '" + name + "'"); } }
@Override public void getIngredients(@Nonnull IIngredients ingredients) { final ItemStack outputStack = recipe.getOutputStack(); final List<ResourceLocation> supportedSouls = recipe.getSupportedSouls(); final ItemStack inputStack = recipe.getInputStack(); final List<ItemStack> inputItemList = new NNList<>(); if (Prep.isValid(inputStack)) { inputItemList.add(inputStack); if (itemBrokenSpawner.getItem() == inputStack.getItem()) { // a Broken Spawner on the input side always means "any kind of", so put any kind of broken spawner into the input list. Skip the same type as the // output, that would be a wasteful NOP recipe CapturedMob resultMob = CapturedMob.create(outputStack); for (CapturedMob soul : CapturedMob.getAllSouls()) { if (resultMob == null || !resultMob.isSameType(soul)) { inputItemList.add(soul.toStack(itemBrokenSpawner.getItemNN(), 0, 1)); } } } } NNList<CapturedMob> souls = CapturedMob.getSouls(supportedSouls); final List<ItemStack> soulStacks = new ArrayList<ItemStack>(); final List<ItemStack> outputs = new ArrayList<ItemStack>(); for (CapturedMob soul : souls) { soulStacks.add(soul.toStack(itemSoulVial.getItemNN(), 1, 1)); outputs.add(recipe.getOutputStack(inputStack, soul)); } ingredients.setInputLists(ItemStack.class, new NNList<List<ItemStack>>(soulStacks, inputItemList)); ingredients.setOutputLists(ItemStack.class, new NNList<List<ItemStack>>(Collections.singletonList(new ItemStack(itemSoulVial.getItemNN())), outputs)); ingredients.setInput(EnergyIngredient.class, new EnergyIngredient(recipe.getEnergyRequired())); }
@SuppressWarnings("null") @Override @SideOnly(Side.CLIENT) public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> list) { super.getSubBlocks(tab, list); if (SpawnerConfig.poweredSpawnerAddAllMobsCreative.get()) { CapturedMob.getAllSouls().apply(new Callback<CapturedMob>() { @Override public void apply(@Nonnull CapturedMob mob) { list.add(mob.toStack(BlockPoweredSpawner.this, 0, 1)); } }); } else { list.add(CapturedMob.create(new ResourceLocation("enderman")).toStack(this, 0, 1)); list.add(CapturedMob.create(new ResourceLocation("chicken")).toStack(this, 0, 1)); list.add(CapturedMob.create(new ResourceLocation("skeleton")).toStack(this, 0, 1)); list.add(CapturedMob.create(new ResourceLocation("wither_skeleton")).toStack(this, 0, 1)); list.add(CapturedMob.create(new ResourceLocation("stray")).toStack(this, 0, 1)); } }