Skip to content

Commit

Permalink
Added a black list for the animal feeder
Browse files Browse the repository at this point in the history
  • Loading branch information
Buuz135 committed Dec 30, 2018
1 parent a6b89f6 commit 537b7e4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
mod_version=1.12.2
mod_version=1.12.3
minecraft_version=1.12.2
teslacorelib_version=1.0.15.+
teslacorelib_mc_version=1.12.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
*/
package com.buuz135.industrial.tile.agriculture;

import com.buuz135.industrial.proxy.BlockRegistry;
import com.buuz135.industrial.tile.CustomColoredItemHandler;
import com.buuz135.industrial.tile.WorkingAreaElectricMachine;
import com.buuz135.industrial.utils.WorkUtils;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityLlama;
Expand Down Expand Up @@ -78,7 +80,7 @@ public float work() {
List<EntityAnimal> animals = this.world.getEntitiesWithinAABB(EntityAnimal.class, area);
if (animals.size() == 0 || animals.size() > 35) return 0;
//Removing from the list animals that can't breed
animals.removeIf(entityAnimal -> entityAnimal.isChild() || entityAnimal.getGrowingAge() != 0 || getFirstBreedingItem(entityAnimal).isEmpty() || entityAnimal.isInLove());
animals.removeIf(entityAnimal -> entityAnimal.isChild() || entityAnimal.getGrowingAge() != 0 || getFirstBreedingItem(entityAnimal).isEmpty() || entityAnimal.isInLove() || BlockRegistry.animalStockIncreaserBlock.entityBlacklist.contains(EntityList.getKey(entityAnimal).toString()));
for (EntityAnimal firstParent : animals) {
for (EntityAnimal secondParent : animals) {
if (!firstParent.equals(secondParent) && firstParent.getClass().equals(secondParent.getClass())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,23 @@
package com.buuz135.industrial.tile.block;

import com.buuz135.industrial.book.BookCategory;
import com.buuz135.industrial.config.CustomConfiguration;
import com.buuz135.industrial.proxy.ItemRegistry;
import com.buuz135.industrial.tile.agriculture.AnimalStockIncreaserTile;
import com.buuz135.industrial.utils.RecipeUtils;
import net.minecraft.block.material.Material;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.config.Configuration;
import net.ndrei.teslacorelib.items.MachineCaseItem;

import java.util.Arrays;
import java.util.List;

public class AnimalStockIncreaserBlock extends CustomAreaOrientedBlock<AnimalStockIncreaserTile> {

public List<String> entityBlacklist;

public AnimalStockIncreaserBlock() {
super("animal_stock_increaser", AnimalStockIncreaserTile.class, Material.ROCK, 400, 20, RangeType.FRONT, 5, 1, true);
}
Expand All @@ -51,4 +58,10 @@ public BookCategory getCategory() {
return BookCategory.ANIMAL_HUSBANDRY;
}

@Override
public void getMachineConfig() {
super.getMachineConfig();
entityBlacklist = Arrays.asList(CustomConfiguration.config.getStringList("entityBlacklist", "machines" + Configuration.CATEGORY_SPLITTER + this.getRegistryName().getPath().toString(),
new String[]{}, "A list of entities blacklist from being fed with the machine"));
}
}

0 comments on commit 537b7e4

Please sign in to comment.