Compare commits

..
11 Commits
194 changed files with 609 additions and 456 deletions

No files matched your search

+1 -1
View File
@@ -2,4 +2,4 @@ mcversion=1.7.10
forgeversion=10.13.3.1370-1.7.10
version_major=4
version_minor=0
version_patch=6
version_patch=9
+4
View File
@@ -36,6 +36,10 @@ ext.dirLang = "./lang"
ext.apiForestry = "./api/forestry"
ext.apiRedstoneFlux = "./api/redstoneflux"
// java version
sourceCompatibility = 1.7
targetCompatibility = 1.7
minecraft {
version = mcversion + "-" + forgeversion
runDir = "run"
+7 -7
View File
@@ -70,7 +70,7 @@ public class Forestry {
public static Forestry instance;
private File configFolder;
private static final Map<String, ForestryItem> mappedItems = new HashMap<String, ForestryItem>();
private static final Map<String, ForestryItem> mappedItems = new HashMap<>();
static {
mappedItems.put("Forestry:builderBackpack", ForestryItem.builderBackpack);
@@ -87,12 +87,12 @@ public class Forestry {
}
public Forestry() {
FuelManager.fermenterFuel = new ItemStackMap<FermenterFuel>();
FuelManager.moistenerResource = new ItemStackMap<MoistenerFuel>();
FuelManager.rainSubstrate = new ItemStackMap<RainSubstrate>();
FuelManager.bronzeEngineFuel = new FluidMap<EngineBronzeFuel>();
FuelManager.copperEngineFuel = new ItemStackMap<EngineCopperFuel>();
FuelManager.generatorFuel = new FluidMap<GeneratorFuel>();
FuelManager.fermenterFuel = new ItemStackMap<>();
FuelManager.moistenerResource = new ItemStackMap<>();
FuelManager.rainSubstrate = new ItemStackMap<>();
FuelManager.bronzeEngineFuel = new FluidMap<>();
FuelManager.copperEngineFuel = new ItemStackMap<>();
FuelManager.generatorFuel = new FluidMap<>();
}
@SidedProxy(clientSide = "forestry.core.ForestryClient", serverSide = "forestry.core.ForestryCore")
@@ -60,7 +60,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
private int queenWorkCycleThrottle;
private IEffectData effectData[] = new IEffectData[2];
private final Stack<ItemStack> spawn = new Stack<ItemStack>();
private final Stack<ItemStack> spawn = new Stack<>();
private final HasFlowersCache hasFlowersCache = new HasFlowersCache();
private final QueenCanWorkCache queenCanWorkCache = new QueenCanWorkCache();
@@ -112,7 +112,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
hasFlowersCache.writeToNBT(nbttagcompound);
Stack<ItemStack> spawnCopy = new Stack<ItemStack>();
Stack<ItemStack> spawnCopy = new Stack<>();
spawnCopy.addAll(spawn);
NBTTagList nbttaglist = new NBTTagList();
while (!spawnCopy.isEmpty()) {
@@ -373,7 +373,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
World world = beeHousing.getWorld();
Stack<ItemStack> offspring = new Stack<ItemStack>();
Stack<ItemStack> offspring = new Stack<>();
IApiaristTracker breedingTracker = BeeManager.beeRoot.getBreedingTracker(world, beeHousing.getOwner());
// Princess
@@ -399,7 +399,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
IBeeHousingInventory beeInventory = beeHousing.getBeeInventory();
Collection<ItemStack> spawn = new ArrayList<ItemStack>();
Collection<ItemStack> spawn = new ArrayList<>();
while (!offspring.isEmpty()) {
ItemStack spawned = offspring.pop();
@@ -72,7 +72,7 @@ public class BlockAlveary extends BlockStructure {
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> drop = new ArrayList<ItemStack>();
ArrayList<ItemStack> drop = new ArrayList<>();
drop.add(new ItemStack(this, 1, metadata != 1 ? metadata : 0));
return drop;
}
@@ -83,7 +83,7 @@ public class BlockBeehives extends BlockContainer {
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ArrayList<ItemStack> ret = new ArrayList<>();
// Handle legacy block
if (metadata == 0) {
@@ -75,7 +75,7 @@ public class BlockCandle extends BlockTorch {
.put("dyeBlack", new Color(20, 20, 20).getRGB())
.build();
lightingItems = new HashSet<Item>(Arrays.asList(
lightingItems = new HashSet<>(Arrays.asList(
Items.flint_and_steel,
Items.flint,
Item.getItemFromBlock(Blocks.torch)
@@ -233,7 +233,7 @@ public class BlockCandle extends BlockTorch {
/* DROP HANDLING */
// Hack: When harvesting we need to get the drops in onBlockHarvested,
// because Mojang destroys the block and tile before calling getDrops.
private final ThreadLocal<ItemStack> drop = new ThreadLocal<ItemStack>();
private final ThreadLocal<ItemStack> drop = new ThreadLocal<>();
@Override
public void onBlockHarvested(World world, int x, int y, int z, int metadata, EntityPlayer player) {
@@ -253,7 +253,7 @@ public class BlockCandle extends BlockTorch {
dropStack = getCandleDrop(world, x, y, z);
}
ArrayList<ItemStack> drops = new ArrayList<ItemStack>(1);
ArrayList<ItemStack> drops = new ArrayList<>(1);
drops.add(dropStack);
return drops;
@@ -25,7 +25,7 @@ public class BeeModeHelper implements ICommandModeHelper {
public String[] getModeNames() {
ArrayList<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getBeekeepingModes();
int modeStringCount = beekeepingModes.size();
List<String> modeStrings = new ArrayList<String>(modeStringCount);
List<String> modeStrings = new ArrayList<>(modeStringCount);
for (IBeekeepingMode mode : beekeepingModes) {
modeStrings.add(mode.getName());
}
@@ -53,7 +53,7 @@ public class BeeStatsSaveHelper implements IStatsSaveHelper {
@Override
public Collection<IAlleleSpecies> getSpecies() {
Collection<IAlleleSpecies> species = new ArrayList<IAlleleSpecies>();
Collection<IAlleleSpecies> species = new ArrayList<>();
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
if (allele instanceof IAlleleBeeSpecies) {
species.add((IAlleleBeeSpecies) allele);
@@ -39,7 +39,7 @@ public class CommandBeeGive extends SubCommand {
super("give");
setPermLevel(PermLevel.ADMIN);
List<String> beeTypeStrings = new ArrayList<String>();
List<String> beeTypeStrings = new ArrayList<>();
for (EnumBeeType type : EnumBeeType.values()) {
if (type == EnumBeeType.NONE) {
continue;
@@ -151,7 +151,7 @@ public class CommandBeeGive extends SubCommand {
}
private static String[] getSpecies() {
List<String> species = new ArrayList<String>();
List<String> species = new ArrayList<>();
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
if (allele instanceof IAlleleBeeSpecies) {
@@ -12,6 +12,8 @@ package forestry.apiculture.flowers;
import com.google.common.base.Objects;
import javax.annotation.Nonnull;
import net.minecraft.block.Block;
import net.minecraftforge.oredict.OreDictionary;
@@ -46,7 +48,7 @@ final class Flower implements IFlower {
}
@Override
public int compareTo(IFlower other) {
public int compareTo(@Nonnull IFlower other) {
return this.weight.compareTo(other.getWeight());
}
@@ -45,12 +45,13 @@ public class FlowerProvider implements IFlowerProvider {
EnumSet<EnumPlantType> plantTypes = pollinatable.getPlantType();
if (flowerType.equals(FlowerManager.FlowerTypeNether)) {
return plantTypes.contains(EnumPlantType.Nether);
} else if (flowerType.equals(FlowerManager.FlowerTypeCacti)) {
return plantTypes.contains(EnumPlantType.Desert);
} else {
return plantTypes.size() > 1 || !plantTypes.contains(EnumPlantType.Nether);
switch (flowerType) {
case FlowerManager.FlowerTypeNether:
return plantTypes.contains(EnumPlantType.Nether);
case FlowerManager.FlowerTypeCacti:
return plantTypes.contains(EnumPlantType.Desert);
default:
return plantTypes.size() > 1 || !plantTypes.contains(EnumPlantType.Nether);
}
}
@@ -46,14 +46,18 @@ import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerAcceptableRule;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.core.config.Constants;
import forestry.core.utils.Log;
import forestry.core.utils.vect.MutableVect;
import forestry.core.utils.vect.Vect;
import forestry.plugins.PluginManager;
public final class FlowerRegistry implements IFlowerRegistry {
public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelper {
private final Set<String> defaultFlowerTypes = ImmutableSet.of(
FlowerManager.FlowerTypeVanilla,
@@ -67,17 +71,19 @@ public final class FlowerRegistry implements IFlowerRegistry {
FlowerManager.FlowerTypeGourd
);
private final HashMultimap<String, IFlowerAcceptableRule> registeredRules; // custom check
private final HashMultimap<String, Block> registeredBlocks; // quick first check
private final HashMultimap<String, IFlower> registeredFlowers; // full check
private final HashMultimap<String, Flower> registeredFlowers; // full check
private final ArrayListMultimap<String, IFlowerGrowthRule> growthRules;
private final Map<String, TreeMap<Double, IFlower>> chances;
private final Map<String, TreeMap<Double, Flower>> chances;
public FlowerRegistry() {
this.registeredRules = HashMultimap.create();
this.registeredBlocks = HashMultimap.create();
this.registeredFlowers = HashMultimap.create();
this.growthRules = ArrayListMultimap.create();
this.chances = new HashMap<String, TreeMap<Double, IFlower>>();
this.chances = new HashMap<>();
registerVanillaGrowthRules();
}
@@ -92,6 +98,17 @@ public final class FlowerRegistry implements IFlowerRegistry {
registerFlower(block, meta, 0.0, flowerTypes);
}
@Override
public void registerAcceptableFlowerRule(IFlowerAcceptableRule acceptableFlower, String... flowerTypes) {
for (String flowerType : flowerTypes) {
if (defaultFlowerTypes.contains(flowerType)) {
Log.severe("IFlowerAcceptableRules are too slow to be applied to Forestry's built-in flower type: " + flowerType + ".");
} else {
registeredRules.put(flowerType, acceptableFlower);
}
}
}
@Override
public void registerPlantableFlower(Block block, int meta, double weight, String... flowerTypes) {
registerFlower(block, meta, weight, flowerTypes);
@@ -115,7 +132,7 @@ public final class FlowerRegistry implements IFlowerRegistry {
throw new NullPointerException("Tried to register flower with null type. " + block);
}
Set<IFlower> flowers = this.registeredFlowers.get(flowerType);
Set<Flower> flowers = this.registeredFlowers.get(flowerType);
flowers.add(newFlower);
Set<Block> blocks = this.registeredBlocks.get(flowerType);
@@ -139,8 +156,9 @@ public final class FlowerRegistry implements IFlowerRegistry {
return null;
}
Set<IFlowerAcceptableRule> acceptableRules = this.registeredRules.get(flowerType);
Set<Block> acceptedBlocks = this.registeredBlocks.get(flowerType);
Set<IFlower> acceptedFlowers = this.registeredFlowers.get(flowerType);
Set<Flower> acceptedFlowers = this.registeredFlowers.get(flowerType);
World world = beeHousing.getWorld();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
@@ -153,6 +171,12 @@ public final class FlowerRegistry implements IFlowerRegistry {
Vect posBlock = Vect.add(housingPos, posCurrent);
for (IFlowerAcceptableRule acceptableRule : acceptableRules) {
if (acceptableRule.isAcceptableFlower(flowerType, world, posBlock.x, posBlock.y, posBlock.z)) {
return new ChunkCoordinates(posBlock.x, posBlock.y, posBlock.z);
}
}
if (isAcceptedFlower(flowerType, acceptedBlocks, acceptedFlowers, world, posBlock.x, posBlock.y, posBlock.z)) {
return new ChunkCoordinates(posBlock.x, posBlock.y, posBlock.z);
}
@@ -167,13 +191,20 @@ public final class FlowerRegistry implements IFlowerRegistry {
return false;
}
Set<IFlowerAcceptableRule> acceptedCustom = this.registeredRules.get(flowerType);
for (IFlowerAcceptableRule acceptableFlower : acceptedCustom) {
if (acceptableFlower.isAcceptableFlower(flowerType, world, x, y, z)) {
return true;
}
}
Set<Block> acceptedBlocks = this.registeredBlocks.get(flowerType);
Set<IFlower> acceptedFlowers = this.registeredFlowers.get(flowerType);
Set<Flower> acceptedFlowers = this.registeredFlowers.get(flowerType);
return isAcceptedFlower(flowerType, acceptedBlocks, acceptedFlowers, world, x, y, z);
}
private static boolean isAcceptedFlower(String flowerType, Set<Block> acceptedBlocks, Set<IFlower> acceptedFlowers, World world, int x, int y, int z) {
private static boolean isAcceptedFlower(String flowerType, Set<Block> acceptedBlocks, Set<Flower> acceptedFlowers, World world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
final int meta;
@@ -221,7 +252,15 @@ public final class FlowerRegistry implements IFlowerRegistry {
}
for (IFlowerGrowthRule rule : this.growthRules.get(flowerType)) {
if (rule.growFlower(this, flowerType, world, individual, x, y, z)) {
boolean success;
try {
success = rule.growFlower(this, flowerType, world, x, y, z);
} catch (Throwable ignored) {
// legacy method
success = rule.growFlower(this, flowerType, world, individual, x, y, z);
}
if (success) {
return true;
}
}
@@ -231,7 +270,7 @@ public final class FlowerRegistry implements IFlowerRegistry {
@Override
public Set<IFlower> getAcceptableFlowers(String flowerType) {
return this.registeredFlowers.get(flowerType);
return ImmutableSet.<IFlower>copyOf(this.registeredFlowers.get(flowerType));
}
@Override
@@ -247,21 +286,21 @@ public final class FlowerRegistry implements IFlowerRegistry {
@Override
public IFlower getRandomPlantableFlower(String flowerType, Random rand) {
TreeMap<Double, IFlower> chancesMap = getChancesMap(flowerType);
TreeMap<Double, Flower> chancesMap = getChancesMap(flowerType);
double maxKey = chancesMap.lastKey() + 1.0;
return chancesMap.get(chancesMap.lowerKey(rand.nextDouble() * maxKey));
}
@Override
public Collection<String> getFlowerTypes() {
return new ArrayList<String>(Sets.union(defaultFlowerTypes, registeredFlowers.keySet()));
return new ArrayList<>(Sets.union(defaultFlowerTypes, registeredFlowers.keySet()));
}
private TreeMap<Double, IFlower> getChancesMap(String flowerType) {
private TreeMap<Double, Flower> getChancesMap(String flowerType) {
if (!this.chances.containsKey(flowerType)) {
TreeMap<Double, IFlower> flowerChances = new TreeMap<Double, IFlower>();
TreeMap<Double, Flower> flowerChances = new TreeMap<>();
double count = 0.0;
for (IFlower flower : this.registeredFlowers.get(flowerType)) {
for (Flower flower : this.registeredFlowers.get(flowerType)) {
if (flower.isPlantable()) {
flowerChances.put(count, flower);
count += flower.getWeight();
@@ -273,13 +312,19 @@ public final class FlowerRegistry implements IFlowerRegistry {
}
private void registerVanillaGrowthRules() {
registerGrowthRule(new VanillaDirtGrassGrowthRule(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
registerGrowthRule(new VanillaSnowGrowthRule(), FlowerManager.FlowerTypeSnow);
registerGrowthRule(new VanillaFlowerPotGrowthRule(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeMushrooms, FlowerManager.FlowerTypeCacti,
registerGrowthRule(new GrowthRuleDirtGrass(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
registerGrowthRule(new GrowthRuleSnow(), FlowerManager.FlowerTypeSnow);
registerGrowthRule(new GrowthRuleFlowerPot(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeMushrooms, FlowerManager.FlowerTypeCacti,
FlowerManager.FlowerTypeJungle);
registerGrowthRule(new VanillaMyceliumGrowthRule(), FlowerManager.FlowerTypeMushrooms);
registerGrowthRule(new VanillaDefaultGrowthRule(), FlowerManager.FlowerTypeEnd);
registerGrowthRule(new VanillaFertilizeGrowthRule(Blocks.melon_stem, Blocks.pumpkin_stem), FlowerManager.FlowerTypeGourd);
registerGrowthRule(new VanillaFertilizeGrowthRule(Blocks.wheat), FlowerManager.FlowerTypeWheat);
registerGrowthRule(new GrowthRuleMycelium(), FlowerManager.FlowerTypeMushrooms);
registerGrowthRule(new GrowthRuleNone(), FlowerManager.FlowerTypeEnd);
registerGrowthRule(new GrowthRuleFertilize(Blocks.melon_stem, Blocks.pumpkin_stem), FlowerManager.FlowerTypeGourd);
registerGrowthRule(new GrowthRuleFertilize(Blocks.wheat), FlowerManager.FlowerTypeWheat);
}
@Override
public boolean plantRandomFlower(String flowerType, World world, int x, int y, int z) {
IFlower flower = getRandomPlantableFlower(flowerType, world.rand);
return world.setBlock(x, y, z, flower.getBlock(), flower.getMeta(), Constants.FLAG_BLOCK_SYNCH);
}
}
@@ -15,12 +15,13 @@ import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.core.config.Constants;
public class VanillaDirtGrassGrowthRule implements IFlowerGrowthRule {
public class GrowthRuleDirtGrass implements IFlowerGrowthRule {
@Override
public boolean growFlower(IFlowerRegistry flowerRegistry, String flowerType, World world, IIndividual individual, int x, int y, int z) {
@@ -37,4 +38,18 @@ public class VanillaDirtGrassGrowthRule implements IFlowerGrowthRule {
return world.setBlock(x, y, z, flower.getBlock(), flower.getMeta(), Constants.FLAG_BLOCK_SYNCH);
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
if (!world.isAirBlock(x, y, z)) {
return false;
}
Block ground = world.getBlock(x, y - 1, z);
if (ground != Blocks.dirt && ground != Blocks.grass) {
return false;
}
return helper.plantRandomFlower(flowerType, world, x, y, z);
}
}
@@ -16,20 +16,30 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
public class VanillaFertilizeGrowthRule implements IFlowerGrowthRule {
public class GrowthRuleFertilize implements IFlowerGrowthRule {
private final List<Block> allowedItems;
public VanillaFertilizeGrowthRule(Block... allowedItems) {
public GrowthRuleFertilize(Block... allowedItems) {
this.allowedItems = Arrays.asList(allowedItems);
}
@Override
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(world, x, y, z);
}
private boolean growFlower(World world, int x, int y, int z) {
Block ground = world.getBlock(x, y, z);
int groundMeta;
for (Block b : this.allowedItems) {
@@ -17,15 +17,24 @@ import net.minecraft.tileentity.TileEntityFlowerPot;
import net.minecraft.world.World;
import forestry.api.apiculture.FlowerManager;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
public class VanillaFlowerPotGrowthRule implements IFlowerGrowthRule {
public class GrowthRuleFlowerPot implements IFlowerGrowthRule {
@Override
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
return growFlower(flowerType, world, x, y, z);
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(flowerType, world, x, y, z);
}
private static boolean growFlower(String flowerType, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileEntityFlowerPot)) {
return false;
@@ -44,16 +53,22 @@ public class VanillaFlowerPotGrowthRule implements IFlowerGrowthRule {
BlockFlowerPot flowerPot = (BlockFlowerPot) block;
int flower;
if (flowerType.equals(FlowerManager.FlowerTypeVanilla) || flowerType.equals(FlowerManager.FlowerTypeSnow)) {
flower = world.rand.nextInt(2) + 1;
} else if (flowerType.equals(FlowerManager.FlowerTypeJungle)) {
flower = 6;
} else if (flowerType.equals(FlowerManager.FlowerTypeCacti)) {
flower = world.rand.nextInt(2) + 9;
} else if (flowerType.equals(FlowerManager.FlowerTypeMushrooms)) {
flower = world.rand.nextInt(2) + 7;
} else {
return false;
switch (flowerType) {
case FlowerManager.FlowerTypeVanilla:
case FlowerManager.FlowerTypeSnow:
flower = world.rand.nextInt(2) + 1;
break;
case FlowerManager.FlowerTypeJungle:
flower = 6;
break;
case FlowerManager.FlowerTypeCacti:
flower = world.rand.nextInt(2) + 9;
break;
case FlowerManager.FlowerTypeMushrooms:
flower = world.rand.nextInt(2) + 7;
break;
default:
return false;
}
TileEntityFlowerPot newTile = (TileEntityFlowerPot) flowerPot.createNewTileEntity(world, flower);
@@ -15,12 +15,13 @@ import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.core.config.Constants;
public class VanillaMyceliumGrowthRule implements IFlowerGrowthRule {
public class GrowthRuleMycelium implements IFlowerGrowthRule {
@Override
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
@@ -37,4 +38,18 @@ public class VanillaMyceliumGrowthRule implements IFlowerGrowthRule {
return world.setBlock(x, y, z, flower.getBlock(), flower.getMeta(), Constants.FLAG_BLOCK_SYNCH);
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
if (!world.isAirBlock(x, y, z)) {
return false;
}
Block ground = world.getBlock(x, y - 1, z);
if (ground != Blocks.mycelium) {
return false;
}
return helper.plantRandomFlower(flowerType, world, x, y, z);
}
}
@@ -12,15 +12,21 @@ package forestry.apiculture.flowers;
import net.minecraft.world.World;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
public class VanillaDefaultGrowthRule implements IFlowerGrowthRule {
public class GrowthRuleNone implements IFlowerGrowthRule {
@Override
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
return true;
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return true;
}
}
@@ -15,12 +15,13 @@ import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.core.config.Constants;
public class VanillaSnowGrowthRule implements IFlowerGrowthRule {
public class GrowthRuleSnow implements IFlowerGrowthRule {
@Override
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
@@ -37,4 +38,18 @@ public class VanillaSnowGrowthRule implements IFlowerGrowthRule {
return world.setBlock(x, y, z, flower.getBlock(), flower.getMeta(), Constants.FLAG_BLOCK_SYNCH);
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
if (world.getBlock(x, y, z) != Blocks.snow) {
return false;
}
Block ground = world.getBlock(x, y - 1, z);
if (ground != Blocks.dirt && ground != Blocks.grass) {
return false;
}
return helper.plantRandomFlower(flowerType, world, x, y, z);
}
}
@@ -30,6 +30,7 @@ import com.mojang.authlib.GameProfile;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.FlowerManager;
import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IApiaristTracker;
@@ -250,7 +251,7 @@ public class Bee extends IndividualLiving implements IBee {
World world = housing.getWorld();
BiomeGenBase biome = housing.getBiome();
Set<IErrorState> errorStates = new HashSet<IErrorState>();
Set<IErrorState> errorStates = new HashSet<>();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
@@ -315,7 +316,7 @@ public class Bee extends IndividualLiving implements IBee {
@Override
public ArrayList<BiomeGenBase> getSuitableBiomes() {
ArrayList<BiomeGenBase> suitableBiomes = new ArrayList<BiomeGenBase>();
ArrayList<BiomeGenBase> suitableBiomes = new ArrayList<>();
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
if (isSuitableBiome(biome)) {
suitableBiomes.add(biome);
@@ -401,7 +402,7 @@ public class Bee extends IndividualLiving implements IBee {
// / PRODUCTION
@Override
public ItemStack[] getProduceList() {
ArrayList<ItemStack> products = new ArrayList<ItemStack>();
ArrayList<ItemStack> products = new ArrayList<>();
IAlleleBeeSpecies primary = genome.getPrimary();
IAlleleBeeSpecies secondary = genome.getSecondary();
@@ -447,7 +448,7 @@ public class Bee extends IndividualLiving implements IBee {
return null;
}
List<ItemStack> products = new ArrayList<ItemStack>();
List<ItemStack> products = new ArrayList<>();
IAlleleBeeSpecies primary = genome.getPrimary();
IAlleleBeeSpecies secondary = genome.getSecondary();
@@ -517,7 +518,7 @@ public class Bee extends IndividualLiving implements IBee {
return null;
}
List<IBee> bees = new ArrayList<IBee>();
List<IBee> bees = new ArrayList<>();
ChunkCoordinates housingCoordinates = housing.getCoordinates();
int toCreate = BeeManager.beeRoot.getBeekeepingMode(world).getFinalFertility(this, world, housingCoordinates.posX, housingCoordinates.posY, housingCoordinates.posZ);
@@ -741,7 +742,7 @@ public class Bee extends IndividualLiving implements IBee {
Vect randomPos = Vect.getRandomPositionInArea(random, area);
Vect posBlock = Vect.add(housingPos, randomPos, offset);
if (provider.growFlower(world, this, posBlock.x, posBlock.y, posBlock.z)) {
if (FlowerManager.flowerRegistry.growFlower(provider.getFlowerType(), world, this, posBlock.x, posBlock.y, posBlock.z)) {
break;
}
}
@@ -208,7 +208,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
}
/* TEMPLATES */
private static final ArrayList<IBee> beeTemplates = new ArrayList<IBee>();
private static final ArrayList<IBee> beeTemplates = new ArrayList<>();
@Override
public ArrayList<IBee> getIndividualTemplates() {
@@ -230,7 +230,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
/**
* List of possible mutations on species alleles.
*/
private static final ArrayList<IBeeMutation> beeMutations = new ArrayList<IBeeMutation>();
private static final ArrayList<IBeeMutation> beeMutations = new ArrayList<>();
@Override
public Collection<IBeeMutation> getMutations(boolean shuffle) {
@@ -256,7 +256,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
}
/* BREEDING MODES */
private final ArrayList<IBeekeepingMode> beekeepingModes = new ArrayList<IBeekeepingMode>();
private final ArrayList<IBeekeepingMode> beekeepingModes = new ArrayList<>();
private static IBeekeepingMode activeBeekeepingMode;
@Override
@@ -53,7 +53,7 @@ public class BeekeepingMode implements IBeekeepingMode {
@Override
public ArrayList<String> getDescription() {
ArrayList<String> ret = new ArrayList<String>();
ArrayList<String> ret = new ArrayList<>();
ret.add("beemode." + name.toLowerCase(Locale.ENGLISH) + ".desc");
return ret;
}
@@ -25,7 +25,7 @@ import forestry.api.apiculture.IHiveDrop;
public class HiveDrop implements IHiveDrop {
private final IBeeDefinition beeTemplate;
private final ArrayList<ItemStack> additional = new ArrayList<ItemStack>();
private final ArrayList<ItemStack> additional = new ArrayList<>();
private final int chance;
private float ignobleShare = 0.0f;
@@ -59,7 +59,7 @@ public class HiveDrop implements IHiveDrop {
@Override
public ArrayList<ItemStack> getAdditional(World world, int x, int y, int z, int fortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ArrayList<ItemStack> ret = new ArrayList<>();
for (ItemStack stack : additional) {
ret.add(stack.copy());
}
@@ -45,8 +45,8 @@ import forestry.core.utils.GeneticsUtil;
import forestry.core.utils.ItemStackUtil;
public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpeciesCustom {
private final Map<ItemStack, Float> productChances = new HashMap<ItemStack, Float>();
private final Map<ItemStack, Float> specialtyChances = new HashMap<ItemStack, Float>();
private final Map<ItemStack, Float> productChances = new HashMap<>();
private final Map<ItemStack, Float> specialtyChances = new HashMap<>();
private final int primaryColour;
private final int secondaryColour;
@@ -137,7 +137,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
@Override
public ItemStack[] getResearchBounty(World world, GameProfile researcher, IIndividual individual, int bountyLevel) {
ArrayList<ItemStack> bounty = new ArrayList<ItemStack>();
ArrayList<ItemStack> bounty = new ArrayList<>();
Collections.addAll(bounty, super.getResearchBounty(world, researcher, individual, bountyLevel));
if (bountyLevel > 10) {
@@ -49,7 +49,7 @@ public class AlleleEffectResurrection extends AlleleEffectThrottled {
}
public static List<Resurrectable> getReanimationList() {
ArrayList<Resurrectable> list = new ArrayList<Resurrectable>();
ArrayList<Resurrectable> list = new ArrayList<>();
list.add(new Resurrectable(new ItemStack(Items.bone), EntitySkeleton.class));
list.add(new Resurrectable(new ItemStack(Items.arrow), EntitySkeleton.class));
list.add(new Resurrectable(new ItemStack(Items.rotten_flesh), EntityZombie.class));
@@ -58,7 +58,7 @@ public class AlleleEffectResurrection extends AlleleEffectThrottled {
}
public static List<Resurrectable> getResurrectionList() {
ArrayList<Resurrectable> list = new ArrayList<Resurrectable>();
ArrayList<Resurrectable> list = new ArrayList<>();
list.add(new Resurrectable(new ItemStack(Items.gunpowder), EntityCreeper.class));
list.add(new Resurrectable(new ItemStack(Items.ender_pearl), EntityEnderman.class));
list.add(new Resurrectable(new ItemStack(Items.string), EntitySpider.class));
@@ -39,7 +39,7 @@ public class GuiBeealyzer extends GuiAlyzer {
public GuiBeealyzer(EntityPlayer player, BeealyzerInventory inventory) {
super("rootBees", player, new ContainerAlyzer(inventory, player), inventory, "gui.beealyzer");
ArrayList<ItemStack> beeList = new ArrayList<ItemStack>();
ArrayList<ItemStack> beeList = new ArrayList<>();
((ItemBeeGE) ForestryItem.beeDroneGE.item()).addCreativeItems(beeList, false);
for (ItemStack beeStack : beeList) {
IAlleleBeeSpecies species = BeeGenome.getSpecies(beeStack);
@@ -49,7 +49,7 @@ public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator, Habi
new HabitatSlot(9, "Mushroom"),
new HabitatSlot(10, "Nether"),
new HabitatSlot(11, "End")};
private final Map<BiomeDictionary.Type, HabitatSlot> biomeToHabitat = new EnumMap<BiomeDictionary.Type, HabitatSlot>(BiomeDictionary.Type.class);
private final Map<BiomeDictionary.Type, HabitatSlot> biomeToHabitat = new EnumMap<>(BiomeDictionary.Type.class);
private int startX;
private int startY;
@@ -34,7 +34,7 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter, ImprinterInven
private int startX;
private int startY;
private final Map<String, ItemStack> iconStacks = new HashMap<String, ItemStack>();
private final Map<String, ItemStack> iconStacks = new HashMap<>();
public GuiImprinter(InventoryPlayer inventoryplayer, ImprinterInventory inventory) {
super(Constants.TEXTURE_PATH_GUI + "/imprinter.png", new ContainerImprinter(inventoryplayer, inventory), inventory);
@@ -42,7 +42,7 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter, ImprinterInven
xSize = 176;
ySize = 185;
List<ItemStack> beeList = new ArrayList<ItemStack>();
List<ItemStack> beeList = new ArrayList<>();
((ItemBeeGE) ForestryItem.beeDroneGE.item()).addCreativeItems(beeList, false);
for (ItemStack beeStack : beeList) {
IAlleleBeeSpecies species = BeeGenome.getSpecies(beeStack);
@@ -59,7 +59,7 @@ public class ItemHabitatLocator extends ItemInventoried {
private static final String iconName = "forestry:biomefinder";
private Set<BiomeGenBase> targetBiomes = new HashSet<BiomeGenBase>();
private Set<BiomeGenBase> targetBiomes = new HashSet<>();
private boolean biomeFound = false;
private int searchRadiusIteration = 0;
private int searchAngleIteration = 0;
@@ -108,7 +108,7 @@ public class ItemHabitatLocator extends ItemInventoried {
private void startBiomeSearch(IBee bee, EntityPlayer player) {
this.targetBiomes = new HashSet<BiomeGenBase>(bee.getSuitableBiomes());
this.targetBiomes = new HashSet<>(bee.getSuitableBiomes());
this.searchAngleIteration = 0;
this.searchRadiusIteration = 0;
this.biomeFound = false;
@@ -237,9 +237,9 @@ public class ItemHabitatLocator extends ItemInventoried {
return new ChunkCoordinates(pos.x, pos.y, pos.z);
}
private static final Set<BiomeGenBase> waterBiomes = new HashSet<BiomeGenBase>();
private static final Set<BiomeGenBase> netherBiomes = new HashSet<BiomeGenBase>();
private static final Set<BiomeGenBase> endBiomes = new HashSet<BiomeGenBase>();
private static final Set<BiomeGenBase> waterBiomes = new HashSet<>();
private static final Set<BiomeGenBase> netherBiomes = new HashSet<>();
private static final Set<BiomeGenBase> endBiomes = new HashSet<>();
static {
Collections.addAll(waterBiomes, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.BEACH));
@@ -107,7 +107,7 @@ public class ItemHoneycomb extends ItemForestryMultiPass {
}
private int getRandomCombType(Random random, boolean includeSecret) {
List<Integer> validCombs = new ArrayList<Integer>(combs.length);
List<Integer> validCombs = new ArrayList<>(combs.length);
for (int i = 0; i < combs.length; i++) {
if (!combs[i].isSecret || includeSecret) {
validCombs.add(i);
@@ -59,11 +59,11 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
private float humidChange = 0.0f;
// PARTS
private final Set<IBeeModifier> beeModifiers = new HashSet<IBeeModifier>();
private final Set<IBeeListener> beeListeners = new HashSet<IBeeListener>();
private final Set<IAlvearyComponent.Climatiser> climatisers = new HashSet<IAlvearyComponent.Climatiser>();
private final Set<IAlvearyComponent.Active> activeComponents = new HashSet<IAlvearyComponent.Active>();
private final Set<IAlvearyComponent> allComponents = new HashSet<IAlvearyComponent>();
private final Set<IBeeModifier> beeModifiers = new HashSet<>();
private final Set<IBeeListener> beeListeners = new HashSet<>();
private final Set<IAlvearyComponent.Climatiser> climatisers = new HashSet<>();
private final Set<IAlvearyComponent.Active> activeComponents = new HashSet<>();
private final Set<IAlvearyComponent> allComponents = new HashSet<>();
// CLIENT
private int breedingProgressPercent = 0;
@@ -133,7 +133,7 @@ public class TileAlvearyPlain extends TileAlveary implements IBeeHousing, IClima
@Optional.Method(modid = "BuildCraftAPI|statements")
@Override
public Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile) {
Collection<ITriggerExternal> res = new ArrayList<ITriggerExternal>();
Collection<ITriggerExternal> res = new ArrayList<>();
res.add(ApicultureTriggers.missingQueen);
res.add(ApicultureTriggers.missingDrone);
return res;
@@ -40,7 +40,7 @@ import forestry.core.utils.ItemStackUtil;
public class TileAlvearySwarmer extends TileAlvearyWithGui implements ISidedInventory, IActivatable, IAlvearyComponent.Active {
private final SwarmerInventory inventory;
private final Stack<ItemStack> pendingSpawns = new Stack<ItemStack>();
private final Stack<ItemStack> pendingSpawns = new Stack<>();
private boolean active;
public TileAlvearySwarmer() {
@@ -159,6 +159,6 @@ public class ParticleRenderer {
}
private boolean lazyAdd = false;
private final List<EntityFX> particles = new ArrayList<EntityFX>();
private final List<EntityFX> newParticles = new ArrayList<EntityFX>();
private final List<EntityFX> particles = new ArrayList<>();
private final List<EntityFX> newParticles = new ArrayList<>();
}
@@ -40,6 +40,7 @@ public class TileApiaristChest extends TileNaturalistChest {
checkedForLegacyBlock = true;
}
super.updateServerSide();
}
private void migrateFromLegacyBlock() {
@@ -70,7 +70,7 @@ public class TileApiary extends TileAbstractBeeHousing {
@Override
public Collection<IBeeModifier> getBeeModifiers() {
List<IBeeModifier> beeModifiers = new ArrayList<IBeeModifier>();
List<IBeeModifier> beeModifiers = new ArrayList<>();
beeModifiers.add(beeModifier);
@@ -159,7 +159,7 @@ public class TileApiary extends TileAbstractBeeHousing {
}
public Collection<IHiveFrame> getFrames() {
Collection<IHiveFrame> hiveFrames = new ArrayList<IHiveFrame>(SLOT_FRAMES_COUNT);
Collection<IHiveFrame> hiveFrames = new ArrayList<>(SLOT_FRAMES_COUNT);
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
ItemStack stackInSlot = getStackInSlot(i);
@@ -181,7 +181,7 @@ public class TileApiary extends TileAbstractBeeHousing {
@Optional.Method(modid = "BuildCraftAPI|statements")
@Override
public Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile) {
LinkedList<ITriggerExternal> res = new LinkedList<ITriggerExternal>();
LinkedList<ITriggerExternal> res = new LinkedList<>();
res.add(ApicultureTriggers.missingQueen);
res.add(ApicultureTriggers.missingDrone);
res.add(ApicultureTriggers.noFrames);
@@ -343,7 +343,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
EnumHumidity biomeHumidity = EnumHumidity.getFromValue(biome.rainfall);
// Add bees that can live in this environment
List<IBeeGenome> valid = new ArrayList<IBeeGenome>();
List<IBeeGenome> valid = new ArrayList<>();
for (IBeeGenome genome : candidates) {
if (checkBiomeHazard(genome, biomeTemperature, biomeHumidity)) {
valid.add(genome);
@@ -25,7 +25,7 @@ import forestry.api.core.EnumTemperature;
public final class Hive {
private final IHiveDescription hiveDescription;
private final List<IHiveDrop> drops = new ArrayList<IHiveDrop>();
private final List<IHiveDrop> drops = new ArrayList<>();
public Hive(IHiveDescription hiveDescription) {
if (hiveDescription == null) {
@@ -19,7 +19,7 @@ import net.minecraft.world.World;
public class HiveGenGround extends HiveGen {
private final Set<Material> groundMaterials = new HashSet<Material>();
private final Set<Material> groundMaterials = new HashSet<>();
public HiveGenGround(Block... groundBlocks) {
for (Block block : groundBlocks) {
@@ -22,7 +22,7 @@ import forestry.api.apiculture.hives.IHiveRegistry;
public class HiveRegistry implements IHiveRegistry {
private final Map<String, Hive> hives = new HashMap<String, Hive>();
private final Map<String, Hive> hives = new HashMap<>();
@Override
public void registerHive(String hiveName, IHiveDescription hiveDescription) {
@@ -50,7 +50,7 @@ public class HiveRegistry implements IHiveRegistry {
}
public List<Hive> getHives() {
return new ArrayList<Hive>(hives.values());
return new ArrayList<>(hives.values());
}
public List<IHiveDrop> getDrops(String hiveName) {
@@ -37,7 +37,7 @@ public class FruitProviderNone implements IFruitProvider {
}
}
private static final HashMap<String, OverlayType> overlayTypes = new HashMap<String, OverlayType>();
private static final HashMap<String, OverlayType> overlayTypes = new HashMap<>();
static {
overlayTypes.put("berries", new OverlayType("berries", (short) 1000));
@@ -28,7 +28,7 @@ import forestry.api.genetics.IFruitFamily;
*/
public class FruitProviderRandom extends FruitProviderNone {
private final Map<ItemStack, Float> products = new HashMap<ItemStack, Float>();
private final Map<ItemStack, Float> products = new HashMap<>();
private int colour = 0xffffff;
public FruitProviderRandom(String key, IFruitFamily family, ItemStack product, float modifier) {
@@ -48,7 +48,7 @@ public class FruitProviderRandom extends FruitProviderNone {
@Override
public ItemStack[] getFruits(ITreeGenome genome, World world, int x, int y, int z, int ripeningTime) {
ArrayList<ItemStack> product = new ArrayList<ItemStack>();
ArrayList<ItemStack> product = new ArrayList<>();
float modeYieldMod = TreeManager.treeRoot.getTreekeepingMode(world).getYieldModifier(genome, 1f);
@@ -25,7 +25,7 @@ import forestry.api.genetics.IFruitFamily;
public class FruitProviderRipening extends FruitProviderNone {
private final Map<ItemStack, Float> products = new HashMap<ItemStack, Float>();
private final Map<ItemStack, Float> products = new HashMap<>();
private int colourCallow = 0xffffff;
@@ -63,7 +63,7 @@ public class FruitProviderRipening extends FruitProviderNone {
@Override
public ItemStack[] getFruits(ITreeGenome genome, World world, int x, int y, int z, int ripeningTime) {
ArrayList<ItemStack> product = new ArrayList<ItemStack>();
ArrayList<ItemStack> product = new ArrayList<>();
float stage = getRipeningStage(ripeningTime);
if (stage < 0.5f) {
@@ -20,16 +20,16 @@ import forestry.api.arboriculture.EnumWoodType;
import forestry.api.arboriculture.IWoodItemAccess;
public class WoodItemAccess implements IWoodItemAccess {
private static final EnumMap<EnumWoodType, ItemStack> logs = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> logsFireproof = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> planks = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> planksFireproof = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> slabs = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> slabsFireproof = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> fences = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> fencesFireproof = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> stairs = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> stairsFireproof = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> logs = new EnumMap<>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> logsFireproof = new EnumMap<>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> planks = new EnumMap<>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> planksFireproof = new EnumMap<>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> slabs = new EnumMap<>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> slabsFireproof = new EnumMap<>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> fences = new EnumMap<>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> fencesFireproof = new EnumMap<>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> stairs = new EnumMap<>(EnumWoodType.class);
private static final EnumMap<EnumWoodType, ItemStack> stairsFireproof = new EnumMap<>(EnumWoodType.class);
private static ItemStack getStack(EnumWoodType woodType, Block block) {
NBTTagCompound woodNBT = new NBTTagCompound();
@@ -138,7 +138,7 @@ public class BlockArbFence extends BlockFence implements IWoodTyped, ITileEntity
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return new ArrayList<ItemStack>();
return new ArrayList<>();
}
@Override
@@ -75,7 +75,7 @@ public class BlockArbStairs extends BlockStairs implements IWoodTyped, ITileEnti
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return new ArrayList<ItemStack>();
return new ArrayList<>();
}
@Override
@@ -103,7 +103,7 @@ public class BlockForestryLeaves extends BlockNewLeaf implements ITileEntityProv
/* DROP HANDLING */
// Hack: When harvesting leaves we need to get the drops in onBlockHarvested,
// because Mojang destroys the block and tile before calling getDrops.
private final ThreadLocal<ArrayList<ItemStack>> drops = new ThreadLocal<ArrayList<ItemStack>>();
private final ThreadLocal<ArrayList<ItemStack>> drops = new ThreadLocal<>();
@Override
public void onBlockHarvested(World world, int x, int y, int z, int metadata, EntityPlayer player) {
@@ -144,7 +144,7 @@ public class BlockForestryLeaves extends BlockNewLeaf implements ITileEntityProv
}
private static ArrayList<ItemStack> getLeafDrop(World world, @Nullable GameProfile playerProfile, int x, int y, int z, float saplingModifier, int fortune) {
ArrayList<ItemStack> prod = new ArrayList<ItemStack>();
ArrayList<ItemStack> prod = new ArrayList<>();
TileLeaves tile = getLeafTile(world, x, y, z);
if (tile == null || tile.getTree() == null || tile.isDecorative()) {
@@ -80,7 +80,7 @@ public class BlockFruitPod extends BlockCocoa {
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return new ArrayList<ItemStack>();
return new ArrayList<>();
}
@Override
@@ -150,7 +150,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable {
/* REMOVING */
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return new ArrayList<ItemStack>();
return new ArrayList<>();
}
@Override
@@ -135,7 +135,7 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return new ArrayList<ItemStack>();
return new ArrayList<>();
}
@Override
@@ -108,7 +108,7 @@ public abstract class BlockWood extends Block implements ITileEntityProvider, IW
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return new ArrayList<ItemStack>();
return new ArrayList<>();
}
@Override
@@ -73,7 +73,7 @@ public final class CommandTreeSpawn extends SubCommand {
}
private static String[] getSpecies() {
List<String> species = new ArrayList<String>();
List<String> species = new ArrayList<>();
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
if (allele instanceof IAlleleTreeSpecies) {
@@ -25,7 +25,7 @@ public class TreeModeHelper implements ICommandModeHelper {
public String[] getModeNames() {
ArrayList<ITreekeepingMode> treekeepingModes = TreeManager.treeRoot.getTreekeepingModes();
int modeStringCount = treekeepingModes.size();
List<String> modeStrings = new ArrayList<String>(modeStringCount);
List<String> modeStrings = new ArrayList<>(modeStringCount);
for (ITreekeepingMode mode : treekeepingModes) {
modeStrings.add(mode.getName());
}
@@ -38,7 +38,7 @@ public class TreeStatsSaveHelper implements IStatsSaveHelper {
@Override
public Collection<IAlleleSpecies> getSpecies() {
Collection<IAlleleSpecies> species = new ArrayList<IAlleleSpecies>();
Collection<IAlleleSpecies> species = new ArrayList<>();
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
if (allele instanceof IAlleleTreeSpecies) {
species.add((IAlleleTreeSpecies) allele);
@@ -335,7 +335,7 @@ public class Tree extends Individual implements ITree, IPlantable {
/* REPRODUCTION */
@Override
public ITree[] getSaplings(World world, GameProfile playerProfile, int x, int y, int z, float modifier) {
ArrayList<ITree> prod = new ArrayList<ITree>();
ArrayList<ITree> prod = new ArrayList<>();
float chance = genome.getFertility() * modifier;
@@ -63,9 +63,9 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
public static final String UID = "rootTrees";
private static int treeSpeciesCount = -1;
private static ITreekeepingMode activeTreekeepingMode;
public static final ArrayList<ITree> treeTemplates = new ArrayList<ITree>();
public static final ArrayList<ITree> treeTemplates = new ArrayList<>();
private final ArrayList<ITreekeepingMode> treekeepingModes = new ArrayList<ITreekeepingMode>();
private final ArrayList<ITreekeepingMode> treekeepingModes = new ArrayList<>();
public TreeHelper() {
setResearchSuitability(new ItemStack(Blocks.sapling, 1, OreDictionary.WILDCARD_VALUE), 1.0f);
@@ -343,7 +343,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
}
/* MUTATIONS */
private static final List<ITreeMutation> treeMutations = new ArrayList<ITreeMutation>();
private static final List<ITreeMutation> treeMutations = new ArrayList<>();
@Override
public List<ITreeMutation> getMutations(boolean shuffle) {
@@ -369,7 +369,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
}
/* ILEAFTICKHANDLER */
private final LinkedList<ILeafTickHandler> leafTickHandlers = new LinkedList<ILeafTickHandler>();
private final LinkedList<ILeafTickHandler> leafTickHandlers = new LinkedList<>();
@Override
public void registerLeafTickHandler(ILeafTickHandler handler) {
@@ -45,7 +45,7 @@ public class TreekeepingMode implements ITreekeepingMode {
@Override
public ArrayList<String> getDescription() {
ArrayList<String> ret = new ArrayList<String>();
ArrayList<String> ret = new ArrayList<>();
ret.add("treemode." + name.toLowerCase(Locale.ENGLISH) + ".desc");
return ret;
}
@@ -41,7 +41,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
private final ITreeGenerator generator;
private final IGermlingIconProvider germlingIconProvider;
private final ILeafIconProvider leafIconProvider;
private final List<IFruitFamily> fruits = new ArrayList<IFruitFamily>();
private final List<IFruitFamily> fruits = new ArrayList<>();
private EnumPlantType nativeType = EnumPlantType.Plains;
@@ -47,7 +47,7 @@ public class GuiTreealyzer extends GuiAlyzer {
public GuiTreealyzer(EntityPlayer player, TreealyzerInventory inventory) {
super("rootTrees", player, new ContainerAlyzer(inventory, player), inventory, "gui.treealyzer");
ArrayList<ItemStack> treeList = new ArrayList<ItemStack>();
ArrayList<ItemStack> treeList = new ArrayList<>();
((ItemGermlingGE) ForestryItem.sapling.item()).addCreativeItems(treeList, false);
for (ItemStack treeStack : treeList) {
IAlleleTreeSpecies species = TreeGenome.getSpecies(treeStack);
@@ -189,12 +189,12 @@ public class GuiTreealyzer extends GuiAlyzer {
drawLine(StringUtil.localize("gui.tolerated"), COLUMN_0);
List<EnumPlantType> activeTolerated = new ArrayList<EnumPlantType>(tree.getGenome().getPlantTypes());
List<EnumPlantType> activeTolerated = new ArrayList<>(tree.getGenome().getPlantTypes());
List<EnumPlantType> inactiveTolerated = Collections.emptyList();
IAllele inactiveAllelePlant = tree.getGenome().getInactiveAllele(EnumTreeChromosome.PLANT);
if (inactiveAllelePlant instanceof AllelePlantType) {
inactiveTolerated = new ArrayList<EnumPlantType>(((AllelePlantType) inactiveAllelePlant).getPlantTypes());
inactiveTolerated = new ArrayList<>(((AllelePlantType) inactiveAllelePlant).getPlantTypes());
}
int max = Math.max(activeTolerated.size(), inactiveTolerated.size());
@@ -213,8 +213,8 @@ public class GuiTreealyzer extends GuiAlyzer {
// FRUITS
drawLine(StringUtil.localize("gui.supports"), COLUMN_0);
List<IFruitFamily> families0 = new ArrayList<IFruitFamily>(tree.getGenome().getPrimary().getSuitableFruit());
List<IFruitFamily> families1 = new ArrayList<IFruitFamily>(tree.getGenome().getSecondary().getSuitableFruit());
List<IFruitFamily> families0 = new ArrayList<>(tree.getGenome().getPrimary().getSuitableFruit());
List<IFruitFamily> families1 = new ArrayList<>(tree.getGenome().getSecondary().getSuitableFruit());
max = Math.max(families0.size(), families1.size());
for (int i = 0; i < max; i++) {
@@ -21,7 +21,7 @@ import forestry.api.arboriculture.EnumLeafType;
import forestry.core.render.TextureManager;
public class TextureLeaves {
private static final Map<EnumLeafType, TextureLeaves> leafTextures = new EnumMap<EnumLeafType, TextureLeaves>(EnumLeafType.class);
private static final Map<EnumLeafType, TextureLeaves> leafTextures = new EnumMap<>(EnumLeafType.class);
static {
for (EnumLeafType leafType : EnumLeafType.values()) {
@@ -163,7 +163,7 @@ public class TileFruitPod extends TileEntity implements IFruitBearer, IStreamabl
@Override
public Collection<ItemStack> pickFruit(ItemStack tool) {
if (allele == null) {
return new ArrayList<ItemStack>();
return new ArrayList<>();
}
Collection<ItemStack> fruits = Arrays.asList(getDrop());
@@ -50,7 +50,7 @@ import forestry.core.utils.PlayerUtil;
public class BlockBase extends BlockForestry {
private final List<MachineDefinition> definitions = new ArrayList<MachineDefinition>();
private final List<MachineDefinition> definitions = new ArrayList<>();
private final boolean hasTESR;
public BlockBase(Material material) {
@@ -49,7 +49,7 @@ public class BlockResourceOre extends Block {
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
ArrayList<ItemStack> drops = new ArrayList<>();
if (metadata == 0) {
int fortuneModifier = world.rand.nextInt(fortune + 2) - 1;
@@ -64,7 +64,7 @@ public class BlockSoil extends Block implements IItemTyped {
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ArrayList<ItemStack> ret = new ArrayList<>();
SoilType type = getTypeFromMeta(metadata);
@@ -56,7 +56,7 @@ public class CircuitBoard<T> implements ICircuitBoard {
list.add(EnumChatFormatting.GOLD + layout.getUsage() + ":");
}
List<String> extendedTooltip = new ArrayList<String>();
List<String> extendedTooltip = new ArrayList<>();
for (ICircuit circuit : circuits) {
if (circuit != null) {
circuit.addTooltip(extendedTooltip);
@@ -28,9 +28,9 @@ import forestry.core.config.ForestryItem;
public class CircuitRegistry implements ICircuitRegistry {
public static final ICircuitLayout DUMMY_LAYOUT = new CircuitLayout("dummy", CircuitSocketType.NONE);
private static final Map<String, ICircuitLayout> DUMMY_MAP = new LinkedHashMap<String, ICircuitLayout>();
private final Map<String, ICircuitLayout> layoutMap = new LinkedHashMap<String, ICircuitLayout>();
private final Map<String, ICircuit> circuitMap = new LinkedHashMap<String, ICircuit>();
private static final Map<String, ICircuitLayout> DUMMY_MAP = new LinkedHashMap<>();
private final Map<String, ICircuitLayout> layoutMap = new LinkedHashMap<>();
private final Map<String, ICircuit> circuitMap = new LinkedHashMap<>();
static {
DUMMY_MAP.put("dummy", DUMMY_LAYOUT);
@@ -58,7 +58,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
public static class SolderManager implements ISolderManager {
public static final ArrayList<CircuitRecipe> recipes = new ArrayList<CircuitRecipe>();
public static final ArrayList<CircuitRecipe> recipes = new ArrayList<>();
@Override
public void addRecipe(ICircuitLayout layout, ItemStack resource, ICircuit circuit) {
@@ -100,7 +100,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
// / INVENTORY MANAGMENT
public static class SolderingInventory extends ItemInventory implements IErrorSource {
private final RevolvingList<ICircuitLayout> layouts = new RevolvingList<ICircuitLayout>(ChipsetManager.circuitRegistry.getRegisteredLayouts().values());
private final RevolvingList<ICircuitLayout> layouts = new RevolvingList<>(ChipsetManager.circuitRegistry.getRegisteredLayouts().values());
private static final short blankSlot = 0;
private static final short finishedSlot = 1;
@@ -170,7 +170,7 @@ public class CommandHelpers {
}
}
List<String> commandNames = new ArrayList<String>();
List<String> commandNames = new ArrayList<>();
for (SubCommand child : command.getChildren()) {
commandNames.add(child.getCommandName());
}
@@ -78,7 +78,7 @@ public final class CommandSaveStats extends SubCommand {
player = CommandHelpers.getPlayer(sender, sender.getCommandSenderName());
}
Collection<String> statistics = new ArrayList<String>();
Collection<String> statistics = new ArrayList<>();
String date = DateFormat.getInstance().format(new Date());
statistics.add(StatCollector.translateToLocalFormatted(saveHelper.getUnlocalizedSaveStatsString(), player.getDisplayName(), date));
@@ -27,7 +27,7 @@ public class RootCommand extends CommandBase implements IForestryCommand {
public static final String ROOT_COMMAND_NAME = "forestry";
public static final String ROOT_COMMAND_ALIAS = "for";
private final SortedSet<SubCommand> children = new TreeSet<SubCommand>(new Comparator<SubCommand>() {
private final SortedSet<SubCommand> children = new TreeSet<>(new Comparator<SubCommand>() {
@Override
public int compare(SubCommand o1, SubCommand o2) {
@@ -70,7 +70,7 @@ public class RootCommand extends CommandBase implements IForestryCommand {
@Override
public List<String> getCommandAliases() {
List<String> aliases = new ArrayList<String>();
List<String> aliases = new ArrayList<>();
aliases.add(ROOT_COMMAND_ALIAS);
return aliases;
}
@@ -37,10 +37,10 @@ public abstract class SubCommand implements IForestryCommand {
}
private final String name;
private final List<String> aliases = new ArrayList<String>();
private final List<String> aliases = new ArrayList<>();
private PermLevel permLevel = PermLevel.EVERYONE;
private IForestryCommand parent;
private final SortedSet<SubCommand> children = new TreeSet<SubCommand>(new Comparator<SubCommand>() {
private final SortedSet<SubCommand> children = new TreeSet<>(new Comparator<SubCommand>() {
@Override
public int compare(SubCommand o1, SubCommand o2) {
@@ -44,9 +44,9 @@ public class Config {
public static String gameMode;
private static final Set<String> disabledStructures = new HashSet<String>();
private static final Set<String> disabledFluids = new HashSet<String>();
private static final Set<String> disabledBlocks = new HashSet<String>();
private static final Set<String> disabledStructures = new HashSet<>();
private static final Set<String> disabledFluids = new HashSet<>();
private static final Set<String> disabledBlocks = new HashSet<>();
public static boolean isDebug = false;
@@ -83,7 +83,7 @@ public class Config {
private static boolean craftingBronzeEnabled = true;
public static boolean craftingStampsEnabled = true;
public static final ArrayList<String> collectorStamps = new ArrayList<String>();
public static final ArrayList<String> collectorStamps = new ArrayList<>();
public static int farmSize = 2;
public static boolean squareFarms = false;
@@ -98,7 +98,7 @@ public class Config {
// Hints
public static boolean enableHints = true;
public static final Map<String, String[]> hints = new HashMap<String, String[]>();
public static final Map<String, String[]> hints = new HashMap<>();
public static boolean enableEnergyStat = true;
public static boolean isStructureEnabled(String uid) {
@@ -29,7 +29,7 @@ public class ForestryGuiConfig extends GuiConfig {
}
private static List<IConfigElement> getConfigCategories() {
List<IConfigElement> configElements = new ArrayList<IConfigElement>();
List<IConfigElement> configElements = new ArrayList<>();
List<String> commonCategoryNames = Arrays.asList("crafting", "difficulty", "genetics", "performance", "structures", "tweaks", "world");
for (String categoryName : commonCategoryNames) {
@@ -37,10 +37,10 @@ public class GameMode implements IGameMode {
private String identifier = "EASY";
private final String category;
private final Map<String, Boolean> booleanSettings = new HashMap<String, Boolean>();
private final Map<String, Integer> integerSettings = new HashMap<String, Integer>();
private final Map<String, Float> floatSettings = new HashMap<String, Float>();
private final Map<String, ItemStack> stackSettings = new HashMap<String, ItemStack>();
private final Map<String, Boolean> booleanSettings = new HashMap<>();
private final Map<String, Integer> integerSettings = new HashMap<>();
private final Map<String, Float> floatSettings = new HashMap<>();
private final Map<String, ItemStack> stackSettings = new HashMap<>();
private static final float ENERGY_DEMAND_MODIFIER = 1.0f;
private static final float FUEL_MODIFIER = 1.0f;
@@ -14,7 +14,7 @@ import java.util.HashMap;
public class SessionVars {
private static final HashMap<String, String> stringVars = new HashMap<String, String>();
private static final HashMap<String, String> stringVars = new HashMap<>();
private static Class<?> openedLedger;
@@ -156,7 +156,7 @@ public class Version {
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
ArrayList<String> changelog = new ArrayList<String>();
ArrayList<String> changelog = new ArrayList<>();
while ((line = reader.readLine()) != null) {
if (line.startsWith("#")) {
continue;
@@ -25,7 +25,7 @@ import forestry.core.proxy.Proxies;
@Deprecated
public class Configuration {
private final TreeMap<String, ArrayList<Property>> categorized = new TreeMap<String, ArrayList<Property>>();
private final TreeMap<String, ArrayList<Property>> categorized = new TreeMap<>();
public Property get(String key, String category, boolean defaultVal) {
@@ -23,7 +23,7 @@ import forestry.api.core.IErrorLogic;
import forestry.api.core.IErrorState;
public class ErrorLogic implements IErrorLogic {
private final Set<IErrorState> errorStates = new HashSet<IErrorState>();
private final Set<IErrorState> errorStates = new HashSet<>();
@Override
public final boolean setCondition(boolean condition, IErrorState errorState) {
@@ -34,7 +34,7 @@ import forestry.api.core.IErrorStateRegistry;
public class ErrorStateRegistry implements IErrorStateRegistry {
private static final BiMap<Short, IErrorState> states = HashBiMap.create();
private static final Map<String, IErrorState> stateNames = new HashMap<String, IErrorState>();
private static final Map<String, IErrorState> stateNames = new HashMap<>();
private static final Set<IErrorState> stateView = Collections.unmodifiableSet(states.inverse().keySet());
@Override
@@ -92,7 +92,7 @@ public class BlockForestryFluid extends BlockFluidClassic {
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.icons = new ArrayList<IIcon>(2);
this.icons = new ArrayList<>(2);
String still = "liquid/" + fluidName + "_still";
this.icons.add(TextureManager.getInstance().registerTex(iconRegister, still));
@@ -256,7 +256,7 @@ public final class FluidHelper {
}
public static List<ItemStack> getAllFilledContainers(ItemStack empty) {
List<ItemStack> filledContainers = new ArrayList<ItemStack>();
List<ItemStack> filledContainers = new ArrayList<>();
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
ItemStack filledContainer = getFilledContainer(fluid, empty);
if (filledContainer != null) {
@@ -30,7 +30,7 @@ import static forestry.core.items.ItemLiquidContainer.EnumContainerType;
public class LiquidRegistryHelper {
private static final EnumMap<EnumContainerType, ForestryItem> emptyContainers = new EnumMap<EnumContainerType, ForestryItem>(EnumContainerType.class);
private static final EnumMap<EnumContainerType, ForestryItem> emptyContainers = new EnumMap<>(EnumContainerType.class);
static {
emptyContainers.put(EnumContainerType.CAN, ForestryItem.canEmpty);
@@ -49,9 +49,9 @@ import forestry.core.utils.NBTUtil.NBTList;
public class TankManager extends ForwardingList<StandardTank> implements ITankManager, List<StandardTank> {
private static final byte NETWORK_DATA = 3;
private final List<StandardTank> tanks = new ArrayList<StandardTank>();
private final List<FluidStack> prevFluidStacks = new ArrayList<FluidStack>();
private final List<Integer> prevColor = new ArrayList<Integer>();
private final List<StandardTank> tanks = new ArrayList<>();
private final List<FluidStack> prevFluidStacks = new ArrayList<>();
private final List<Integer> prevColor = new ArrayList<>();
public TankManager() {
}
@@ -43,7 +43,7 @@ public class FilteredTank extends StandardTank {
public FilteredTank(int capacity, Collection<Fluid> filters, TileEntity tile) {
super(capacity, tile);
this.filters = new HashSet<Fluid>(filters);
this.filters = new HashSet<>(filters);
}
public void addFilter(Fluid filter) {
@@ -47,9 +47,9 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
public static final String TYPE_KEY = "TYPE";
private final Set<String> discoveredSpecies = new HashSet<String>();
private final Set<String> discoveredMutations = new HashSet<String>();
private final Set<String> researchedMutations = new HashSet<String>();
private final Set<String> discoveredSpecies = new HashSet<>();
private final Set<String> discoveredMutations = new HashSet<>();
private final Set<String> researchedMutations = new HashSet<>();
private String modeName;
private final GameProfile username;
@@ -26,8 +26,8 @@ public class Classification implements IClassification {
private IClassification parent;
private final ArrayList<IAlleleSpecies> members = new ArrayList<IAlleleSpecies>();
private final ArrayList<IClassification> groups = new ArrayList<IClassification>();
private final ArrayList<IAlleleSpecies> members = new ArrayList<>();
private final ArrayList<IClassification> groups = new ArrayList<>();
public Classification(EnumClassLevel level, String uid, String scientific) {
this.level = level;
@@ -76,7 +76,7 @@ public class ItemResearchNote extends ItemForestry {
}
public ArrayList<String> getTooltip(NBTTagCompound compound) {
ArrayList<String> tooltips = new ArrayList<String>();
ArrayList<String> tooltips = new ArrayList<>();
if (compound == null || this == NONE) {
return tooltips;
@@ -32,7 +32,7 @@ import forestry.api.genetics.ISpeciesRoot;
public abstract class SpeciesRoot implements ISpeciesRoot {
/* RESEARCH */
private final LinkedHashMap<ItemStack, Float> researchCatalysts = new LinkedHashMap<ItemStack, Float>();
private final LinkedHashMap<ItemStack, Float> researchCatalysts = new LinkedHashMap<>();
@Override
public Map<ItemStack, Float> getResearchCatalysts() {
@@ -45,7 +45,7 @@ public abstract class SpeciesRoot implements ISpeciesRoot {
}
/* TEMPLATES */
protected final HashMap<String, IAllele[]> speciesTemplates = new HashMap<String, IAllele[]>();
protected final HashMap<String, IAllele[]> speciesTemplates = new HashMap<>();
@Override
public Map<String, IAllele[]> getGenomeTemplates() {
@@ -74,7 +74,7 @@ public abstract class SpeciesRoot implements ISpeciesRoot {
/* MUTATIONS */
@Override
public Collection<? extends IMutation> getCombinations(IAllele other) {
ArrayList<IMutation> combinations = new ArrayList<IMutation>();
ArrayList<IMutation> combinations = new ArrayList<>();
for (IMutation mutation : getMutations(false)) {
if (mutation.isPartner(other)) {
combinations.add(mutation);
@@ -86,7 +86,7 @@ public abstract class SpeciesRoot implements ISpeciesRoot {
@Override
public List<IMutation> getCombinations(IAlleleSpecies parentSpecies0, IAlleleSpecies parentSpecies1, boolean shuffle) {
List<IMutation> combinations = new ArrayList<IMutation>();
List<IMutation> combinations = new ArrayList<>();
String parentSpecies1UID = parentSpecies1.getUID();
for (IMutation mutation : getMutations(shuffle)) {
@@ -103,7 +103,7 @@ public abstract class SpeciesRoot implements ISpeciesRoot {
@Override
public Collection<? extends IMutation> getPaths(IAllele result, IChromosomeType chromosomeType) {
ArrayList<IMutation> paths = new ArrayList<IMutation>();
ArrayList<IMutation> paths = new ArrayList<>();
for (IMutation mutation : getMutations(false)) {
if (mutation.getTemplate()[chromosomeType.ordinal()] == result) {
paths.add(mutation);
@@ -29,7 +29,7 @@ public class AlleleHelper implements IAlleleHelper {
private static final String modId = "forestry";
private final Map<Class, Map<?, ? extends IAllele>> alleleMaps = new HashMap<Class, Map<?, ? extends IAllele>>();
private final Map<Class, Map<?, ? extends IAllele>> alleleMaps = new HashMap<>();
public void init() {
if (PluginManager.Module.APICULTURE.isEnabled()) {
@@ -78,14 +78,14 @@ public class AlleleHelper implements IAlleleHelper {
createAlleles(EnumAllele.Size.class);
}
Map<Integer, IAlleleInteger> integers = new HashMap<Integer, IAlleleInteger>();
Map<Integer, IAlleleInteger> integers = new HashMap<>();
for (int i = 1; i <= 10; i++) {
IAlleleInteger alleleInteger = new AlleleInteger(modId, "i", i + "d", i, true);
integers.put(i, alleleInteger);
}
alleleMaps.put(Integer.class, integers);
Map<Boolean, IAlleleBoolean> booleans = new HashMap<Boolean, IAlleleBoolean>();
Map<Boolean, IAlleleBoolean> booleans = new HashMap<>();
booleans.put(true, new AlleleBoolean(modId, "bool", true, false));
booleans.put(false, new AlleleBoolean(modId, "bool", false, false));
alleleMaps.put(Boolean.class, booleans);
@@ -133,7 +133,7 @@ public class AlleleHelper implements IAlleleHelper {
private <K extends Enum<K> & IAlleleValue<V>, V> void createAlleles(Class<K> enumClass) {
String category = enumClass.getSimpleName().toLowerCase(Locale.ENGLISH);
EnumMap<K, IAllele> map = new EnumMap<K, IAllele>(enumClass);
EnumMap<K, IAllele> map = new EnumMap<>(enumClass);
for (K enumValue : enumClass.getEnumConstants()) {
IAllele allele = createAllele(category, enumValue);
map.put(enumValue, allele);
@@ -40,7 +40,7 @@ public class AlleleRegistry implements IAlleleRegistry {
private static final int ALLELE_ARRAY_SIZE = 2048;
/* SPECIES ROOT */
private final LinkedHashMap<String, ISpeciesRoot> rootMap = new LinkedHashMap<String, ISpeciesRoot>(16);
private final LinkedHashMap<String, ISpeciesRoot> rootMap = new LinkedHashMap<>(16);
@Override
public void registerSpeciesRoot(ISpeciesRoot root) {
@@ -97,15 +97,15 @@ public class AlleleRegistry implements IAlleleRegistry {
}
/* ALLELES */
private final LinkedHashMap<String, IAllele> alleleMap = new LinkedHashMap<String, IAllele>(ALLELE_ARRAY_SIZE);
private final LinkedHashMap<String, IAllele> deprecatedAlleleMap = new LinkedHashMap<String, IAllele>(32);
private final LinkedHashMap<String, IClassification> classificationMap = new LinkedHashMap<String, IClassification>(128);
private final LinkedHashMap<String, IFruitFamily> fruitMap = new LinkedHashMap<String, IFruitFamily>(64);
private final LinkedHashMap<String, IAllele> alleleMap = new LinkedHashMap<>(ALLELE_ARRAY_SIZE);
private final LinkedHashMap<String, IAllele> deprecatedAlleleMap = new LinkedHashMap<>(32);
private final LinkedHashMap<String, IClassification> classificationMap = new LinkedHashMap<>(128);
private final LinkedHashMap<String, IFruitFamily> fruitMap = new LinkedHashMap<>(64);
/*
* Internal HashSet of all alleleHandlers, which trigger when an allele or branch is registered
*/
private final HashSet<IAlleleHandler> alleleHandlers = new HashSet<IAlleleHandler>();
private final HashSet<IAlleleHandler> alleleHandlers = new HashSet<>();
public void initialize() {
@@ -234,7 +234,7 @@ public class AlleleRegistry implements IAlleleRegistry {
}
/* BLACKLIST */
private final ArrayList<String> blacklist = new ArrayList<String>();
private final ArrayList<String> blacklist = new ArrayList<>();
@Override
public void blacklistAllele(String uid) {
@@ -36,8 +36,8 @@ public abstract class Mutation implements IMutationCustom {
private final IAllele[] template;
private final List<IMutationCondition> mutationConditions = new ArrayList<IMutationCondition>();
private final List<String> specialConditions = new ArrayList<String>();
private final List<IMutationCondition> mutationConditions = new ArrayList<>();
private final List<String> specialConditions = new ArrayList<>();
private boolean isSecret = false;
@@ -26,7 +26,7 @@ public abstract class ContainerLiquidTanks<T extends TileEntity & ILiquidTankTil
protected ContainerLiquidTanks(T tile, InventoryPlayer playerInventory, int xInv, int yInv) {
super(tile, playerInventory, xInv, yInv);
this.helper = new ContainerLiquidTanksHelper<T>(tile);
this.helper = new ContainerLiquidTanksHelper<>(tile);
}
@Override
@@ -29,8 +29,8 @@ public abstract class ContainerLiquidTanksSocketed<T extends TileEntity & ILiqui
protected ContainerLiquidTanksSocketed(T tile, InventoryPlayer playerInventory, int xInv, int yInv) {
super(tile, playerInventory, xInv, yInv);
this.socketedHelper = new ContainerSocketedHelper<T>(tile);
this.tanksHelper = new ContainerLiquidTanksHelper<T>(tile);
this.socketedHelper = new ContainerSocketedHelper<>(tile);
this.tanksHelper = new ContainerLiquidTanksHelper<>(tile);
}
/* IContainerLiquidTanks */
@@ -23,7 +23,7 @@ public abstract class ContainerSocketed<T extends TileEntity & ISocketable> exte
protected ContainerSocketed(T tile, InventoryPlayer playerInventory, int xInv, int yInv) {
super(tile, playerInventory, xInv, yInv);
this.helper = new ContainerSocketedHelper<T>(tile);
this.helper = new ContainerSocketedHelper<>(tile);
}
@Override
@@ -54,7 +54,7 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
private final String guiName;
protected final Map<String, ItemStack> iconStacks = new HashMap<String, ItemStack>();
protected final Map<String, ItemStack> iconStacks = new HashMap<>();
protected GuiAlyzer(String speciesRoot, EntityPlayer player, ContainerAlyzer container, IInventory inventory, String guiName) {
super(Constants.TEXTURE_PATH_GUI + "/beealyzer2.png", container, inventory);
@@ -182,7 +182,7 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
drawLine(StringUtil.localize("gui.alyzer.classification") + ":", 12);
newLine();
Stack<IClassification> hierarchy = new Stack<IClassification>();
Stack<IClassification> hierarchy = new Stack<>();
IClassification classification = individual.getGenome().getPrimary().getBranch();
while (classification != null) {
@@ -251,7 +251,7 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
RenderHelper.enableGUIStandardItemLighting();
HashMap<IMutation, IAllele> combinations = new HashMap<IMutation, IAllele>();
HashMap<IMutation, IAllele> combinations = new HashMap<>();
for (IMutation mutation : speciesRoot.getCombinations(individual.getGenome().getPrimary())) {
combinations.put(mutation, individual.getGenome().getPrimary());
@@ -39,7 +39,7 @@ import forestry.core.utils.StringUtil;
public class GuiNaturalistInventory extends GuiForestry<Container, IPagedInventory> {
private final ISpeciesRoot speciesRoot;
private final IBreedingTracker breedingTracker;
private final HashMap<String, ItemStack> iconStacks = new HashMap<String, ItemStack>();
private final HashMap<String, ItemStack> iconStacks = new HashMap<>();
private final int pageCurrent, pageMax;
public GuiNaturalistInventory(ISpeciesRoot speciesRoot, EntityPlayer player, Container container, IPagedInventory inventory, int page, int maxPages) {
@@ -28,8 +28,8 @@ import forestry.core.proxy.Proxies;
public class LedgerManager {
private final List<Ledger> ledgers = new ArrayList<Ledger>();
private final List<ErrorLedger> errorLedgers = new ArrayList<ErrorLedger>();
private final List<Ledger> ledgers = new ArrayList<>();
private final List<ErrorLedger> errorLedgers = new ArrayList<>();
private IErrorSource errorSource;
@@ -20,7 +20,7 @@ import java.util.List;
*/
public class ToolTip extends ForwardingList<ToolTipLine> {
private final List<ToolTipLine> delegate = new ArrayList<ToolTipLine>();
private final List<ToolTipLine> delegate = new ArrayList<>();
private final long delay;
private long mouseOverStart;
@@ -24,7 +24,7 @@ public class WidgetManager {
public final GuiForestry gui;
public final Minecraft minecraft;
protected final List<Widget> widgets = new ArrayList<Widget>();
protected final List<Widget> widgets = new ArrayList<>();
public WidgetManager(GuiForestry gui) {
this.gui = gui;
Loaded 100 of 194 files, more files were not shown because too many files have changed in this diff. Show more