mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-27 23:46:05 +00:00
Some reformat code for 1.11.2 source (#84)
* Optimized imports * Some code reformat * Some refactoring and code reformat * Some code reformat
This commit is contained in:
1 parent
886c36a308
commit
c3809fbc27
508 files changed
+6677
-6238
No files matched your search
@@ -13,9 +13,6 @@ import java.util.List;
|
||||
|
||||
import static org.apache.commons.lang3.ObjectUtils.firstNonNull;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class AlvearyMutationHandler {
|
||||
|
||||
private static final List<Pair<ItemStack, Float>> MUTATIONS = new ArrayList<>();
|
||||
@@ -36,7 +33,7 @@ public class AlvearyMutationHandler {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public static void addMutationItem(@Nullable Item item, float chance){
|
||||
public static void addMutationItem(@Nullable Item item, float chance) {
|
||||
addMutationItem(new ItemStack(firstNonNull(item, Item.getItemFromBlock(Blocks.AIR))), chance);
|
||||
}
|
||||
|
||||
@@ -51,5 +48,4 @@ public class AlvearyMutationHandler {
|
||||
public static List<Pair<ItemStack, Float>> getMutagens() {
|
||||
return Collections.unmodifiableList(MUTATIONS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,14 +13,14 @@ 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;
|
||||
@@ -71,5 +71,4 @@ public class BeeModifierLogic {
|
||||
tooltip.add(modifierName + ": " + valueString);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,13 +3,9 @@ package binnie.extrabees.utils;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 12-5-2017.
|
||||
*/
|
||||
public class ExtraBeesResourceLocation extends ResourceLocation {
|
||||
|
||||
public ExtraBeesResourceLocation(String resourceName) {
|
||||
super(ExtraBees.MODID, resourceName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,9 +6,6 @@ import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 14-5-2017.
|
||||
*/
|
||||
@Nonnull
|
||||
@TypeQualifierDefault(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
@@ -11,6 +11,10 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class HiveDrop implements IHiveDrop {
|
||||
|
||||
private IAllele[] template;
|
||||
private NonNullList<ItemStack> extra;
|
||||
private int chance;
|
||||
|
||||
public HiveDrop(final IAlleleBeeSpecies species, final int chance) {
|
||||
this(Utils.getBeeRoot().getTemplate(species), NonNullList.create(), chance);
|
||||
}
|
||||
@@ -21,10 +25,6 @@ public class HiveDrop implements IHiveDrop {
|
||||
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();
|
||||
@@ -48,5 +48,4 @@ public class HiveDrop implements IHiveDrop {
|
||||
public IBee getBeeType(IBlockAccess world, BlockPos pos) {
|
||||
return Utils.getBeeRoot().getBee(Utils.getBeeRoot().templateAsGenome(this.template));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,5 +15,4 @@ public class MaterialBeehive extends Material {
|
||||
public boolean isOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,36 +19,33 @@ import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 12-5-2017.
|
||||
*/
|
||||
public class Utils {
|
||||
|
||||
public static IBeeRoot getBeeRoot() {
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
|
||||
public static IAlleleBeeSpecies getSpecies(BeeDefinition species){
|
||||
public static IAlleleBeeSpecies getSpecies(BeeDefinition species) {
|
||||
return species.getGenome().getPrimary();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Item getIC2Item(String name){
|
||||
public static Item getIC2Item(String name) {
|
||||
return getModItem("ic2", name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Item getBotaniaItem(String name){
|
||||
public static Item getBotaniaItem(String name) {
|
||||
return getModItem("botania", name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Block getBotaniaBlock(String name){
|
||||
public static Block getBotaniaBlock(String name) {
|
||||
ResourceLocation key = new ResourceLocation("botania", name);
|
||||
return ForgeRegistries.BLOCKS.containsKey(key) ? ForgeRegistries.BLOCKS.getValue(key) : null;
|
||||
}
|
||||
|
||||
private static Item getModItem(String mod, String name){
|
||||
private static Item getModItem(String mod, String name) {
|
||||
ResourceLocation key = new ResourceLocation(mod, name);
|
||||
return ForgeRegistries.ITEMS.containsKey(key) ? ForgeRegistries.ITEMS.getValue(key) : null;
|
||||
}
|
||||
@@ -72,8 +69,7 @@ public class Utils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FluidStack getFluidFromName(String name, int amount){
|
||||
public static FluidStack getFluidFromName(String name, int amount) {
|
||||
return FluidRegistry.getFluidStack(name.toLowerCase(), amount);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,33 +7,29 @@ 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 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,19 +2,13 @@ package binnie.extrabees.utils.config;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 12-5-2017.
|
||||
*/
|
||||
public class ConfigurationMain implements IConfigurable {
|
||||
|
||||
private static final String WORLDGEN = "World-Gen";
|
||||
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
|
||||
@@ -27,7 +21,4 @@ public class ConfigurationMain implements IConfigurable {
|
||||
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";
|
||||
|
||||
}
|
||||
@@ -2,11 +2,7 @@ package binnie.extrabees.utils.config;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 12-5-2017.
|
||||
*/
|
||||
public interface IConfigurable {
|
||||
|
||||
public void configure(Configuration config);
|
||||
|
||||
void configure(Configuration config);
|
||||
}
|
||||
Reference in new issue
Block a user