mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-27 23:46:05 +00:00
More work on splitting ExtraBees
This commit is contained in:
1 parent
ac05f9013a
commit
b12d19c9ea
44 files changed
+327
-315
No files matched your search
@@ -12,14 +12,15 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BeeModifierLogic {
|
||||
private Map<EnumBeeModifier, Float[]> modifiers;
|
||||
private List<EnumBeeBooleanModifier> booleanModifiers;
|
||||
|
||||
public BeeModifierLogic() {
|
||||
this.modifiers = new HashMap<>();
|
||||
this.booleanModifiers = new ArrayList<>();
|
||||
}
|
||||
|
||||
private Map<EnumBeeModifier, Float[]> modifiers;
|
||||
private List<EnumBeeBooleanModifier> booleanModifiers;
|
||||
|
||||
public float getModifier(final EnumBeeModifier modifier, final float currentModifier) {
|
||||
if (!this.modifiers.containsKey(modifier)) {
|
||||
return 1.0f;
|
||||
@@ -70,4 +71,5 @@ public class BeeModifierLogic {
|
||||
tooltip.add(modifierName + ": " + valueString);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package binnie.extrabees.utils;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class HiveDrop implements IHiveDrop {
|
||||
|
||||
public HiveDrop(final IAlleleBeeSpecies species, final int chance) {
|
||||
this(Utils.getBeeRoot().getTemplate(species), NonNullList.create(), chance);
|
||||
}
|
||||
|
||||
public HiveDrop(IAllele[] template, final NonNullList<ItemStack> extra, final int chance) {
|
||||
this.extra = extra;
|
||||
this.template = template;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
private IAllele[] template;
|
||||
private NonNullList<ItemStack> extra;
|
||||
private int chance;
|
||||
|
||||
@Override
|
||||
public NonNullList<ItemStack> getExtraItems(IBlockAccess world, BlockPos pos, int fortune) {
|
||||
final NonNullList<ItemStack> ret = NonNullList.create();
|
||||
for (final ItemStack stack : this.extra) {
|
||||
ret.add(stack.copy());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getChance(IBlockAccess world, BlockPos pos, int fortune) {
|
||||
return chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIgnobleChance(IBlockAccess world, BlockPos pos, int fortune) {
|
||||
return 0.5; //TODO implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBee getBeeType(IBlockAccess world, BlockPos pos) {
|
||||
return Utils.getBeeRoot().getBee(Utils.getBeeRoot().templateAsGenome(this.template));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package binnie.extrabees.utils;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 12-5-2017.
|
||||
*/
|
||||
public interface IEBEnumItem {
|
||||
|
||||
boolean isActive();
|
||||
|
||||
String getName(final ItemStack p0);
|
||||
|
||||
int ordinal();
|
||||
|
||||
ItemStack get(final int p0);
|
||||
|
||||
String name();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package binnie.extrabees.utils;
|
||||
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class MaterialBeehive extends Material {
|
||||
|
||||
public MaterialBeehive() {
|
||||
super(MapColor.STONE);
|
||||
this.setRequiresTool();
|
||||
this.setImmovableMobility();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package binnie.extrabees.utils.config;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 12-5-2017.
|
||||
*/
|
||||
public class ConfigHandler {
|
||||
|
||||
public ConfigHandler(File location){
|
||||
config = new Configuration(location);
|
||||
configurables = Sets.newHashSet();
|
||||
}
|
||||
|
||||
public boolean addConfigurable(IConfigurable configurable){
|
||||
return configurables.add(Preconditions.checkNotNull(configurable));
|
||||
}
|
||||
|
||||
public void reload(boolean load){
|
||||
if (load){
|
||||
config.load();
|
||||
}
|
||||
for (IConfigurable configurable : configurables){
|
||||
configurable.configure(config);
|
||||
}
|
||||
if (config.hasChanged()){
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
|
||||
private final Configuration config;
|
||||
private final Set<IConfigurable> configurables;
|
||||
|
||||
public interface IConfigurable {
|
||||
|
||||
public void configure(Configuration config);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package binnie.extrabees.utils.config;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 12-5-2017.
|
||||
*/
|
||||
public class ConfigurationMain implements ConfigHandler.IConfigurable {
|
||||
|
||||
public static boolean canQuarryMineHives = true;
|
||||
|
||||
public static int waterHiveRate = 1;
|
||||
|
||||
public static int rockHiveRate = 2;
|
||||
|
||||
public static int netherHiveRate = 2;
|
||||
|
||||
public static int marbleHiveRate = 2;
|
||||
|
||||
@Override
|
||||
public void configure(Configuration config) {
|
||||
canQuarryMineHives = config.getBoolean("canQuarryMineHives", Configuration.CATEGORY_GENERAL, true, "Sets whether a quarry will be able to mine hives or not.");
|
||||
|
||||
config.addCustomCategoryComment(WORLDGEN, "WorldGen settings for ExtraBees");
|
||||
waterHiveRate = config.getInt("waterHiveRate", WORLDGEN, 2, 0, 10, "Sets the worldgen spawn chance for water hives.");
|
||||
rockHiveRate = config.getInt("rockHiveRate", WORLDGEN, 2, 0, 10, "Sets the worldgen spawn chance for rock hives.");
|
||||
netherHiveRate = config.getInt("netherHiveRate", WORLDGEN, 2, 0, 10, "Sets the worldgen spawn chance for nether hives.");
|
||||
marbleHiveRate = config.getInt("marbleHiveRate", WORLDGEN, 2, 0, 10, "Sets the worldgen spawn chance for marble hives.");
|
||||
}
|
||||
|
||||
private static final String WORLDGEN = "World-Gen";
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user