mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c1b7927d6 | ||
|
|
bf3ac85d88 | ||
|
|
d09b663ba6 | ||
|
|
3beacb998d | ||
|
|
52e7f95534 | ||
|
|
cc4cc558b8 | ||
|
|
956aaca10c | ||
|
|
23f7c9c7d9 | ||
|
|
3684792a39 | ||
|
|
0e81f373f0 | ||
|
|
59d1d3456b | ||
|
|
15fe11094b | ||
|
|
790e9b9fba | ||
|
|
c7ef2ef807 | ||
|
|
11fa7bbf75 | ||
|
|
4c2cbd77c1 | ||
|
|
f58de9e5cc | ||
|
|
3f0dc9e74f | ||
|
|
9ecab0fecd | ||
|
|
01245f32c5 | ||
|
|
8cc0da5c04 | ||
|
|
6e68768259 | ||
|
|
9ee34b06b6 | ||
|
|
b05c395300 | ||
|
|
48ef020dc9 | ||
|
|
83b7ce00f7 | ||
|
|
6165d80c0c | ||
|
|
31cb40f7b6 | ||
|
|
16e4801d48 | ||
|
|
8fb7d5eb67 | ||
|
|
55866d6a64 | ||
|
|
510cf83670 | ||
|
|
656a6451bf | ||
|
|
69ee5bde65 | ||
|
|
592895cc48 | ||
|
|
7b5febd394 | ||
|
|
71481d5ace | ||
|
|
1d0efd537e | ||
|
|
5052df8844 | ||
|
|
b1d496f24f | ||
|
|
2bfe576f7e | ||
|
|
cc5c8af338 | ||
|
|
19a9c2681c | ||
|
|
f020dcf2e2 |
No files matched your search
@@ -31,7 +31,7 @@ Beware of ugly code.
|
||||
|
||||
Bugfixes are generally welcome. If you want to contribute something which changes game mechanics, please talk to someone with commit privileges first. Nothing is more frustrating than putting a lot of work and effort into a new game mechanic and then having the PR rejected because it doesn’t fit gameplay-wise.
|
||||
|
||||
**If you submit a PR you must accept the [Contributor License Agreement](https://www.clahub.com/agreements/ForestryMC/ForestryMC). There is no way around that, since otherwise changing the license later - even to something more permissive! - , becomes close to impossible.**
|
||||
**If you submit a PR you must accept the [Contributor License Agreement](https://cla-assistant.io/ForestryMC/ForestryMC). There is no way around that, since otherwise changing the license later - even to something more permissive! - , becomes close to impossible.**
|
||||
|
||||
### License & Copyright
|
||||
|
||||
|
||||
+1
-1
Submodule api/forestry updated: cb7a1a6181...1c9fb5e23f.
@@ -2,4 +2,4 @@ mcversion=1.7.10
|
||||
forgeversion=10.13.3.1370-1.7.10
|
||||
version_major=4
|
||||
version_minor=0
|
||||
version_patch=1
|
||||
version_patch=11
|
||||
@@ -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"
|
||||
|
||||
@@ -3,3 +3,4 @@ samtrion;[email protected];2015-01-18
|
||||
GenuineSounds;[email protected];2015-02-26
|
||||
airbreather;[email protected];2015-04-10
|
||||
ganymedes01;[email protected];2015-05-27
|
||||
infinityraider;theoneandonlyraider@gmail;com;2015-10-03
|
||||
+1
-1
Submodule lang updated: 2518a210e7...2843053395.
@@ -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();
|
||||
@@ -73,8 +73,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
public BeekeepingLogic(IBeeHousing housing) {
|
||||
this.housing = housing;
|
||||
this.beeModifier = new BeeHousingModifier(housing);
|
||||
this.beeListener = new BeeHousingListener(housing);
|
||||
this.beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
this.beeListener = BeeManager.beeRoot.createBeeHousingListener(housing);
|
||||
}
|
||||
|
||||
// / SAVING & LOADING
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,25 +34,30 @@ import net.minecraft.tileentity.TileEntityFlowerPot;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
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.apiculture.BeeHousingModifier;
|
||||
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,
|
||||
@@ -66,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();
|
||||
}
|
||||
@@ -91,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);
|
||||
@@ -114,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);
|
||||
@@ -138,11 +156,12 @@ 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 = new BeeHousingModifier(beeHousing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
|
||||
|
||||
Vect area = getArea(bee.getGenome(), beeModifier);
|
||||
Vect housingPos = new Vect(beeHousing.getCoordinates()).add(-area.x / 2, -area.y / 2, -area.z / 2);
|
||||
@@ -152,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);
|
||||
}
|
||||
@@ -166,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;
|
||||
@@ -190,15 +222,21 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
meta = world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
if (PluginManager.Module.AGRICRAFT.isEnabled() && (flowerType.equals(FlowerManager.FlowerTypeWheat) || flowerType.equals(FlowerManager.FlowerTypeNether))) {
|
||||
if (PluginManager.Module.AGRICRAFT.isEnabled()) {
|
||||
Block cropBlock = GameRegistry.findBlock("AgriCraft", "crops");
|
||||
if (block == cropBlock) {
|
||||
ArrayList<ItemStack> drops = block.getDrops(world, x, y, z, 7, 0);
|
||||
if (drops.get(1).getItem() == Items.wheat_seeds && flowerType.equals(FlowerManager.FlowerTypeWheat)) {
|
||||
return true;
|
||||
}
|
||||
if (drops.get(1).getItem() == Items.nether_wart && flowerType.equals(FlowerManager.FlowerTypeNether)) {
|
||||
return true;
|
||||
if(block instanceof IPlantable) {
|
||||
//For agricraft versions which implement IPlantable in the BlockCrop class
|
||||
block = ((IPlantable) block).getPlant(world, x, y, z);
|
||||
} else {
|
||||
//For earlier versions of AgriCraft
|
||||
ArrayList<ItemStack> drops = block.getDrops(world, x, y, z, 7, 0);
|
||||
if (drops.get(1).getItem() == Items.wheat_seeds && flowerType.equals(FlowerManager.FlowerTypeWheat)) {
|
||||
return true;
|
||||
}
|
||||
if (drops.get(1).getItem() == Items.nether_wart && flowerType.equals(FlowerManager.FlowerTypeNether)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,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;
|
||||
}
|
||||
}
|
||||
@@ -224,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
|
||||
@@ -240,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();
|
||||
@@ -266,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);
|
||||
}
|
||||
}
|
||||
+16
-1
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
+12
-2
@@ -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) {
|
||||
+26
-11
@@ -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);
|
||||
+16
-1
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
+7
-1
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
+16
-1
@@ -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;
|
||||
@@ -52,7 +53,6 @@ import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.arboriculture.genetics.pollination.FakePollinatable;
|
||||
import forestry.arboriculture.genetics.pollination.ICheckPollinatable;
|
||||
import forestry.core.config.Config;
|
||||
@@ -251,9 +251,9 @@ 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 = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
// / Rain needs tolerant flyers
|
||||
if (world.isRaining() && !genome.getTolerantFlyer() && BiomeHelper.canRainOrSnow(biome) && !beeModifier.isSealed()) {
|
||||
@@ -316,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);
|
||||
@@ -402,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();
|
||||
@@ -448,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();
|
||||
@@ -458,7 +458,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
setIsNatural(false);
|
||||
}
|
||||
|
||||
IBeeModifier beeHousingModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
IBeeModifier beeModeModifier = mode.getBeeModifier();
|
||||
|
||||
// Bee genetic speed * beehousing * beekeeping mode
|
||||
@@ -518,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);
|
||||
@@ -630,7 +630,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public IIndividual retrievePollen(IBeeHousing housing) {
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int chance = Math.round(genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
@@ -673,7 +673,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public boolean pollinateRandom(IBeeHousing housing, IIndividual pollen) {
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int chance = (int) (genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
@@ -720,7 +720,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public void plantFlowerRandom(IBeeHousing housing) {
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int chance = Math.round(genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
@@ -742,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
@@ -42,6 +44,8 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.apiculture.BeeHousingListener;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.apiculture.BeekeepingLogic;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
@@ -204,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() {
|
||||
@@ -226,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) {
|
||||
@@ -252,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
|
||||
@@ -326,6 +330,16 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
return new BeekeepingLogic(housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeModifier createBeeHousingModifier(IBeeHousing housing) {
|
||||
return new BeeHousingModifier(housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeListener createBeeHousingListener(IBeeHousing housing) {
|
||||
return new BeeHousingListener(housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumBeeChromosome.values();
|
||||
|
||||
@@ -21,7 +21,6 @@ import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.core.genetics.mutations.Mutation;
|
||||
|
||||
public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
@@ -48,7 +47,7 @@ public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
return 0;
|
||||
}
|
||||
|
||||
IBeeModifier beeHousingModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world).getBeeModifier();
|
||||
|
||||
processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
|
||||
@@ -16,13 +16,13 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.DefaultBeeModifier;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
|
||||
public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
return false;
|
||||
}
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
return queen.getGeneration() > 96 + rand.nextInt(6) + rand.nextInt(6) &&
|
||||
rand.nextFloat() < 0.02f * beeModifier.getGeneticDecay(queen.getGenome(), 1f);
|
||||
@@ -92,7 +92,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@Override
|
||||
public boolean isOverworked(IBee queen, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
float productionModifier = beeModifier.getProductionModifier(queen.getGenome(), 1f);
|
||||
if (productionModifier > 16) {
|
||||
@@ -106,7 +106,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@Override
|
||||
public boolean isDegenerating(IBee queen, IBee offspring, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
float mutationModifier = beeModifier.getMutationModifier(queen.getGenome(), queen.getMate(), 1.0f);
|
||||
if (mutationModifier > 10) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -12,12 +12,12 @@ package forestry.apiculture.genetics.alleles;
|
||||
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
import forestry.core.utils.vect.MutableVect;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
@@ -51,7 +51,7 @@ public class AlleleEffectNone extends AlleleCategorized implements IAlleleBeeEff
|
||||
}
|
||||
|
||||
protected Vect getModifiedArea(IBeeGenome genome, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1f);
|
||||
|
||||
MutableVect area = new MutableVect(genome.getTerritory());
|
||||
@@ -71,7 +71,7 @@ public class AlleleEffectNone extends AlleleCategorized implements IAlleleBeeEff
|
||||
}
|
||||
|
||||
protected AxisAlignedBB getBounding(IBeeGenome genome, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1.0f);
|
||||
|
||||
MutableVect area = new MutableVect(genome.getTerritory());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -12,13 +12,12 @@ package forestry.apiculture.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.items.ItemAlyzer;
|
||||
@@ -48,48 +47,11 @@ public class ItemBeealyzer extends ItemAlyzer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSpecimen(ItemStack itemStack) {
|
||||
return BeeManager.beeRoot.isMember(itemStack);
|
||||
protected ISpeciesRoot getSpeciesRoot() {
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotClick(EntityPlayer player) {
|
||||
// Source slot to analyze empty
|
||||
if (getStackInSlot(SLOT_SPECIMEN) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBee bee = BeeManager.beeRoot.getMember(getStackInSlot(SLOT_SPECIMEN));
|
||||
// No bee, abort
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Analyze if necessary
|
||||
if (!bee.isAnalyzed()) {
|
||||
|
||||
// Requires energy
|
||||
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return;
|
||||
}
|
||||
|
||||
bee.analyze();
|
||||
if (player != null) {
|
||||
BeeManager.beeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(bee.getGenome().getPrimary());
|
||||
BeeManager.beeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(bee.getGenome().getSecondary());
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
bee.writeToNBT(nbttagcompound);
|
||||
getStackInSlot(SLOT_SPECIMEN).setTagCompound(nbttagcompound);
|
||||
|
||||
// Decrease energy
|
||||
decrStackSize(SLOT_ENERGY, 1);
|
||||
}
|
||||
|
||||
setInventorySlotContents(SLOT_ANALYZE_1, getStackInSlot(SLOT_SPECIMEN));
|
||||
setInventorySlotContents(SLOT_SPECIMEN, null);
|
||||
}
|
||||
|
||||
// / IHINTSOURCE
|
||||
@Override
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -35,7 +35,6 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IClimateControlled;
|
||||
import forestry.apiculture.BeeHousingInventory;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.core.access.EnumAccess;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.multiblock.CoordTriplet;
|
||||
@@ -60,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;
|
||||
@@ -384,7 +383,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(this);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(this);
|
||||
if (beeModifier.isHellish() && tempChange >= 0) {
|
||||
return EnumTemperature.HELLISH;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.block.BlockFence;
|
||||
import net.minecraft.block.BlockFenceGate;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -41,10 +42,12 @@ import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.render.IconProviderWood;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.render.ParticleHelper;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class BlockArbFence extends BlockFence implements IWoodTyped, ITileEntityProvider {
|
||||
|
||||
private final ParticleHelper.Callback particleCallback;
|
||||
private final boolean fireproof;
|
||||
|
||||
public BlockArbFence(boolean fireproof) {
|
||||
@@ -57,6 +60,8 @@ public class BlockArbFence extends BlockFence implements IWoodTyped, ITileEntity
|
||||
setHarvestLevel("axe", 0);
|
||||
setStepSound(soundTypeWood);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
|
||||
this.particleCallback = new ParticleHelper.DefaultCallback(this);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@@ -138,7 +143,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
|
||||
@@ -174,4 +179,17 @@ public class BlockArbFence extends BlockFence implements IWoodTyped, ITileEntity
|
||||
public boolean isFireproof() {
|
||||
return fireproof;
|
||||
}
|
||||
|
||||
/* Particles */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
|
||||
return ParticleHelper.addHitEffects(worldObj, this, target, effectRenderer, particleCallback);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
|
||||
return ParticleHelper.addDestroyEffects(worldObj, this, x, y, z, meta, effectRenderer, particleCallback);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -37,9 +38,11 @@ import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.render.IconProviderWood;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.render.ParticleHelper;
|
||||
|
||||
public class BlockArbStairs extends BlockStairs implements IWoodTyped, ITileEntityProvider {
|
||||
|
||||
private final ParticleHelper.Callback particleCallback;
|
||||
private final boolean fireproof;
|
||||
|
||||
public BlockArbStairs(Block par2Block, boolean fireproof) {
|
||||
@@ -51,6 +54,8 @@ public class BlockArbStairs extends BlockStairs implements IWoodTyped, ITileEnti
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setHarvestLevel("axe", 0);
|
||||
|
||||
this.particleCallback = new ParticleHelper.DefaultCallback(this);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@@ -75,7 +80,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
|
||||
@@ -126,4 +131,17 @@ public class BlockArbStairs extends BlockStairs implements IWoodTyped, ITileEnti
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileWood();
|
||||
}
|
||||
|
||||
/* Particles */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
|
||||
return ParticleHelper.addHitEffects(worldObj, this, target, effectRenderer, particleCallback);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
|
||||
return ParticleHelper.addDestroyEffects(worldObj, this, x, y, z, meta, effectRenderer, particleCallback);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -41,9 +42,11 @@ import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.render.IconProviderWood;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.render.ParticleHelper;
|
||||
|
||||
public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyped, ITileEntityProvider {
|
||||
|
||||
private final ParticleHelper.Callback particleCallback;
|
||||
private final boolean fireproof;
|
||||
|
||||
public BlockSlab(boolean fireproof) {
|
||||
@@ -57,6 +60,8 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
setResistance(5.0F);
|
||||
setStepSound(soundTypeWood);
|
||||
setHarvestLevel("axe", 0);
|
||||
|
||||
this.particleCallback = new ParticleHelper.DefaultCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,7 +140,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
|
||||
@@ -183,4 +188,17 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
public Item getItem(World world, int x, int y, int z) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
/* Particles */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
|
||||
return ParticleHelper.addHitEffects(worldObj, this, target, effectRenderer, particleCallback);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
|
||||
return ParticleHelper.addDestroyEffects(worldObj, this, x, y, z, meta, effectRenderer, particleCallback);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.util.ArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -35,10 +36,12 @@ import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.render.IconProviderWood;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.render.ParticleHelper;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public abstract class BlockWood extends Block implements ITileEntityProvider, IWoodTyped {
|
||||
|
||||
private final ParticleHelper.Callback particleCallback;
|
||||
private final String blockKind;
|
||||
private final boolean fireproof;
|
||||
|
||||
@@ -49,6 +52,8 @@ public abstract class BlockWood extends Block implements ITileEntityProvider, IW
|
||||
|
||||
setStepSound(soundTypeWood);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
|
||||
particleCallback = new ParticleHelper.DefaultCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,7 +113,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
|
||||
@@ -138,4 +143,16 @@ public abstract class BlockWood extends Block implements ITileEntityProvider, IW
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract IIcon getIcon(IBlockAccess world, int x, int y, int z, int side);
|
||||
|
||||
/* Particles */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
|
||||
return ParticleHelper.addHitEffects(worldObj, this, target, effectRenderer, particleCallback);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
|
||||
return ParticleHelper.addDestroyEffects(worldObj, this, x, y, z, meta, effectRenderer, particleCallback);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -48,10 +48,12 @@ import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.Individual;
|
||||
import forestry.core.genetics.alleles.Allele;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class Tree extends Individual implements ITree, IPlantable {
|
||||
@@ -222,6 +224,10 @@ public class Tree extends Individual implements ITree, IPlantable {
|
||||
@Override
|
||||
public void setLeaves(World world, GameProfile owner, int x, int y, int z) {
|
||||
genome.getPrimary().getGenerator().setLeaves(world, owner, x, y, z, false);
|
||||
TileLeaves leaves = TileUtil.getTile(world, x, y, z, TileLeaves.class);
|
||||
if (leaves != null) {
|
||||
leaves.setTree(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -335,7 +341,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++) {
|
||||
|
||||
@@ -12,13 +12,12 @@ package forestry.arboriculture.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.items.ItemAlyzer;
|
||||
@@ -50,52 +49,32 @@ public class ItemTreealyzer extends ItemAlyzer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSpecimen(ItemStack itemStack) {
|
||||
return GeneticsUtil.getGeneticEquivalent(itemStack) instanceof ITree;
|
||||
protected ISpeciesRoot getSpeciesRoot() {
|
||||
return TreeManager.treeRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (!TreeManager.treeRoot.isMember(itemStack)) {
|
||||
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(itemStack);
|
||||
if (ersatz != null) {
|
||||
return super.canSlotAccept(slotIndex, ersatz);
|
||||
}
|
||||
}
|
||||
return super.canSlotAccept(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotClick(EntityPlayer player) {
|
||||
// Source slot to analyze empty
|
||||
if (getStackInSlot(SLOT_SPECIMEN) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TreeManager.treeRoot.isMember(getStackInSlot(SLOT_SPECIMEN))) {
|
||||
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(getStackInSlot(SLOT_SPECIMEN));
|
||||
ItemStack specimen = getStackInSlot(SLOT_SPECIMEN);
|
||||
if (!TreeManager.treeRoot.isMember(specimen)) {
|
||||
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(specimen);
|
||||
if (ersatz != null) {
|
||||
setInventorySlotContents(SLOT_SPECIMEN, ersatz);
|
||||
}
|
||||
}
|
||||
ITree tree = TreeManager.treeRoot.getMember(getStackInSlot(SLOT_SPECIMEN));
|
||||
// No tree, abort
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Analyze if necessary
|
||||
if (!tree.isAnalyzed()) {
|
||||
|
||||
// Requires energy
|
||||
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return;
|
||||
}
|
||||
|
||||
tree.analyze();
|
||||
if (player != null) {
|
||||
TreeManager.treeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(tree.getGenome().getPrimary());
|
||||
TreeManager.treeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(tree.getGenome().getSecondary());
|
||||
}
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
tree.writeToNBT(nbttagcompound);
|
||||
getStackInSlot(SLOT_SPECIMEN).setTagCompound(nbttagcompound);
|
||||
|
||||
// Decrease energy
|
||||
decrStackSize(SLOT_ENERGY, 1);
|
||||
}
|
||||
|
||||
setInventorySlotContents(SLOT_ANALYZE_1, getStackInSlot(SLOT_SPECIMEN));
|
||||
setInventorySlotContents(SLOT_SPECIMEN, null);
|
||||
super.onSlotClick(player);
|
||||
}
|
||||
|
||||
// / IHINTSOURCE
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
@@ -55,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);
|
||||
@@ -82,11 +83,7 @@ public class CircuitBoard<T> implements ICircuitBoard {
|
||||
ChipsetManager.circuitRegistry.getDefaultLayout();
|
||||
}
|
||||
|
||||
List<ICircuit> readcircuits = new ArrayList<ICircuit>();
|
||||
|
||||
if (circuits != null) {
|
||||
return;
|
||||
}
|
||||
circuits = new ICircuit[4];
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!nbttagcompound.hasKey("CA.I" + i)) {
|
||||
@@ -94,10 +91,9 @@ public class CircuitBoard<T> implements ICircuitBoard {
|
||||
}
|
||||
ICircuit circuit = ChipsetManager.circuitRegistry.getCircuit(nbttagcompound.getString("CA.I" + i));
|
||||
if (circuit != null) {
|
||||
readcircuits.add(circuit);
|
||||
circuits[i] = circuit;
|
||||
}
|
||||
}
|
||||
circuits = readcircuits.toArray(new ICircuit[readcircuits.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,4 +166,9 @@ public class CircuitBoard<T> implements ICircuitBoard {
|
||||
public ICircuit[] getCircuits() {
|
||||
return circuits;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return layout.getSocketType();
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,17 @@
|
||||
package forestry.core.circuits;
|
||||
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class CircuitLayout implements ICircuitLayout {
|
||||
|
||||
private final String uid;
|
||||
private final ICircuitSocketType socketType;
|
||||
|
||||
public CircuitLayout(String uid) {
|
||||
public CircuitLayout(String uid, ICircuitSocketType socketType) {
|
||||
this.uid = uid;
|
||||
this.socketType = socketType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,4 +38,9 @@ public class CircuitLayout implements ICircuitLayout {
|
||||
public String getUsage() {
|
||||
return StringUtil.localize("circuit.layout." + this.uid + ".usage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return socketType;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
@@ -26,10 +27,10 @@ import forestry.core.config.ForestryItem;
|
||||
|
||||
public class CircuitRegistry implements ICircuitRegistry {
|
||||
|
||||
public static final ICircuitLayout DUMMY_LAYOUT = new CircuitLayout("dummy");
|
||||
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>();
|
||||
public static final ICircuitLayout DUMMY_LAYOUT = new CircuitLayout("dummy", CircuitSocketType.NONE);
|
||||
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);
|
||||
|
||||
@@ -10,10 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.circuits;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.core.circuits.ItemSolderingIron.CircuitRecipe;
|
||||
import forestry.core.circuits.ItemSolderingIron.SolderingInventory;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -37,17 +43,32 @@ public class GuiSolderingIron extends GuiForestry<ContainerSolderingIron, Solder
|
||||
String title = layout.getName();
|
||||
fontRendererObj.drawString(title, guiLeft + 8 + getCenteredOffset(title, 138), guiTop + 16, fontColor.get("gui.screen"));
|
||||
|
||||
for (int l = 2; l < inventory.getSizeInventory(); l++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
String description;
|
||||
CircuitRecipe recipe = ItemSolderingIron.SolderManager.getMatchingRecipe(layout, inventory.getStackInSlot(l));
|
||||
ItemStack tube = inventory.getStackInSlot(i + 2);
|
||||
CircuitRecipe recipe = ItemSolderingIron.SolderManager.getMatchingRecipe(layout, tube);
|
||||
if (recipe == null) {
|
||||
description = "(" + StringUtil.localize("gui.noeffect") + ")";
|
||||
} else {
|
||||
description = StringUtil.localize(recipe.circuit.getName()) + " (" + recipe.circuit.getLimit() + ")";
|
||||
}
|
||||
|
||||
int row = (l - 2) * 20;
|
||||
int row = i * 20;
|
||||
fontRendererObj.drawString(description, guiLeft + 32, guiTop + 36 + row, fontColor.get("gui.screen"));
|
||||
|
||||
if (tube == null) {
|
||||
try {
|
||||
ICircuitSocketType socketType = layout.getSocketType();
|
||||
if (CircuitSocketType.FARM.equals(socketType)) {
|
||||
FarmDirection farmDirection = FarmDirection.values()[i];
|
||||
String farmDirectionString = farmDirection.toString().toLowerCase(Locale.ENGLISH);
|
||||
String localizedDirection = StringUtil.localize("gui.solder." + farmDirectionString);
|
||||
fontRendererObj.drawString(localizedDirection, guiLeft + 17, guiTop + 36 + row, fontColor.get("gui.screen"));
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
// older circuit layouts do not have getSocketType()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,14 @@ package forestry.core.circuits;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
|
||||
public interface ISocketable {
|
||||
int getSocketCount();
|
||||
|
||||
ItemStack getSocket(int slot);
|
||||
|
||||
void setSocket(int slot, ItemStack stack);
|
||||
|
||||
ICircuitSocketType getSocketType();
|
||||
}
|
||||
@@ -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;
|
||||
@@ -134,11 +134,11 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
layouts.rotateLeft();
|
||||
}
|
||||
|
||||
private Collection<ICircuit> getCircuits(EnumCircuitBoardType type, boolean doConsume) {
|
||||
private ICircuit[] getCircuits(boolean doConsume) {
|
||||
|
||||
ArrayList<ICircuit> circuits = new ArrayList<ICircuit>();
|
||||
ICircuit[] circuits = new ICircuit[ingredientSlotCount];
|
||||
|
||||
for (short i = 0; i < type.sockets; i++) {
|
||||
for (short i = 0; i < ingredientSlotCount; i++) {
|
||||
ItemStack ingredient = getStackInSlot(ingredientSlot1 + i);
|
||||
if (ingredient == null) {
|
||||
continue;
|
||||
@@ -157,7 +157,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
if (doConsume) {
|
||||
decrStackSize(ingredientSlot1 + i, recipe.resource.stackSize);
|
||||
}
|
||||
circuits.add(recipe.circuit);
|
||||
circuits[i] = recipe.circuit;
|
||||
}
|
||||
|
||||
return circuits;
|
||||
@@ -192,25 +192,33 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
}
|
||||
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.values()[blank.getItemDamage()];
|
||||
Collection<ICircuit> circuits = getCircuits(type, false);
|
||||
|
||||
if (circuits.size() != type.sockets) {
|
||||
if (getCircuitCount() != type.sockets) {
|
||||
return;
|
||||
}
|
||||
|
||||
circuits = getCircuits(type, true);
|
||||
ICircuit[] circuits = getCircuits(true);
|
||||
|
||||
ICircuit[] circuitsArray = circuits.toArray(new ICircuit[circuits.size()]);
|
||||
ItemStack circuitBoard = ItemCircuitBoard.createCircuitboard(type, layouts.getCurrent(), circuitsArray);
|
||||
ItemStack circuitBoard = ItemCircuitBoard.createCircuitboard(type, layouts.getCurrent(), circuits);
|
||||
|
||||
setInventorySlotContents(finishedSlot, circuitBoard);
|
||||
setInventorySlotContents(blankSlot, null);
|
||||
}
|
||||
|
||||
public static int getCount(ICircuit circuit, ArrayList<ICircuit> circuits) {
|
||||
private int getCircuitCount() {
|
||||
ICircuit[] circuits = getCircuits(false);
|
||||
int count = 0;
|
||||
for (ICircuit circuit : circuits) {
|
||||
if (circuit != null) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static int getCount(ICircuit circuit, ICircuit[] circuits) {
|
||||
int count = 0;
|
||||
for (ICircuit other : circuits) {
|
||||
if (other.getUID().equals(circuit.getUID())) {
|
||||
if (other != null && other.getUID().equals(circuit.getUID())) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -242,8 +250,8 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
if (circuitCount != type.sockets) {
|
||||
errorStates.add(EnumErrorCode.CIRCUITMISMATCH);
|
||||
} else {
|
||||
Collection<ICircuit> circuits = getCircuits(type, false);
|
||||
if (circuits.size() != type.sockets) {
|
||||
int count = getCircuitCount();
|
||||
if (count != type.sockets) {
|
||||
errorStates.add(EnumErrorCode.NOCIRCUITLAYOUT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
@@ -152,16 +151,18 @@ public final class FluidHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!hasRoomForDrainedContainer(input, output, drainedItem, inputSlot, outputSlot)) {
|
||||
// consume forestry containers if there is only one slot
|
||||
if (outputSlot == inputSlot && drainedItem != null) {
|
||||
Item item = drainedItem.getItem();
|
||||
// consume forestry containers if there is no room for them
|
||||
if (ForestryItem.canEmpty.isItemEqual(item) || ForestryItem.waxCapsule.isItemEqual(item) || ForestryItem.refractoryEmpty.isItemEqual(item)) {
|
||||
drainedItem = null;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasRoomForDrainedContainer(input, output, drainedItem, inputSlot, outputSlot)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
|
||||
if (drainedItem != null) {
|
||||
@@ -196,23 +197,6 @@ public final class FluidHelper {
|
||||
return output.stackSize + drainedItem.stackSize <= output.getMaxStackSize();
|
||||
}
|
||||
|
||||
public static boolean isFillableContainer(ItemStack stack, FluidStack liquid) {
|
||||
ItemStack empty = ItemStackUtil.createSplitStack(stack, 1);
|
||||
Item item = empty.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
IFluidContainerItem containerItem = (IFluidContainerItem) item;
|
||||
return containerItem.fill(empty, liquid, false) > 0;
|
||||
}
|
||||
|
||||
for (FluidContainerData cont : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
if (cont.fluid.isFluidEqual(liquid) && (cont.emptyContainer != null && cont.emptyContainer.isItemEqual(empty))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEmptyContainer(ItemStack empty) {
|
||||
|
||||
if (FluidContainerRegistry.isEmptyContainer(empty)) {
|
||||
@@ -272,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) {
|
||||
@@ -299,8 +283,7 @@ public final class FluidHelper {
|
||||
|
||||
Item item = empty.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
ItemStack full = empty.copy();
|
||||
full.stackSize = 1;
|
||||
ItemStack full = ItemStackUtil.createSplitStack(empty, 1);
|
||||
IFluidContainerItem containerItem = (IFluidContainerItem) item;
|
||||
containerItem.fill(full, liquid, true);
|
||||
return full;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Loaded 100 of 229 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user