@Override public boolean doesItemPassFilter(@Nullable IItemHandler inv, @Nonnull ItemStack item) { if (CapturedMob.containsSoul(item)) { CapturedMob input = CapturedMob.create(item); for (CapturedMob mob : souls) { if (mob.isSameType(input)) { return !blacklist; } } } return blacklist; }
protected boolean isMobInFilter(EntityLivingBase entity) { for (int i = slotDefinition.minInputSlot; i <= slotDefinition.maxInputSlot; i++) { CapturedMob mob = CapturedMob.create(getStackInSlot(i)); if (mob != null && mob.isSameType(entity)) { return true; } } return false; }
@Override public boolean apply(@Nullable Entity entity) { if (entity == null) { return false; } if (!entity.isEntityAlive() || entity.doesEntityNotTriggerPressurePlate() || ((entity instanceof EntityPlayer) && ((EntityPlayer) entity).isSpectator()) || (capturedMob != null && !capturedMob.isSameType(entity))) { return false; } if (searchClass.isInstance(entity) && whiteClasses.isEmpty()) { return true; } for (Class<? extends Entity> clazz : whiteClasses) { if (clazz.isInstance(entity)) { return true; } } return false; }
@Override public void setInventorySlotContents(int slot, @Nonnull ItemStack stack) { CapturedMob input = null; if (CapturedMob.containsSoul(stack)) { input = CapturedMob.create(stack); } if (input != null) { if (slot < souls.size()) { souls.set(slot, input); for (CapturedMob existing : souls) { if (existing != input && existing.isSameType(input)) { souls.remove(slot); return; // CME! } } } else { for (CapturedMob existing : souls) { if (existing.isSameType(input)) { return; } } souls.add(input); } } else if (slot < souls.size()) { souls.remove(slot); } }
List<ItemStack> newOutputs = new ArrayList<>(); for (ItemStack output : ingredients.getOutputs(ItemStack.class).get(1)) { if (output != null && vialMob.isSameType(CapturedMob.create(output))) { newOutputs.add(output); List<ItemStack> newInputs = new ArrayList<>(); for (ItemStack input : ingredients.getInputs(ItemStack.class).get(0)) { if (input != null && resultMob.isSameType(CapturedMob.create(input))) { newInputs.add(input);
@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())); }