Skip to content

Commit

Permalink
Cleaning part 5
Browse files Browse the repository at this point in the history
Change to correct version I'm working on
  • Loading branch information
robmart committed Nov 13, 2018
1 parent 7fd5b70 commit cc015c5
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mappings_version=snapshot_20171003
org.gradle.jvmargs=-Xmx3G
mc_version=1.12.2
forge_version=14.23.5.2768
mod_version=0.0.2
mod_version=0.0.3
build_number=3
mod_name=RPGMode
author=Robmart
4 changes: 3 additions & 1 deletion src/main/java/robmart/rpgmode/api/block/RPGBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@

import net.minecraft.block.BlockBush;

import static robmart.rpgmode.api.util.InjectionUtil.Null;

/**
* @author Robmart
* Created on 11/9/2018
*/
public class RPGBlocks {
public static BlockBush hellFlower;
public static final BlockBush HELL_FLOWER = Null();

private RPGBlocks() {
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/robmart/rpgmode/client/gui/RPGGuiConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class RPGGuiConfig extends DefaultGuiFactory {

public RPGGuiConfig() {
super(Reference.MOD_ID, GuiConfig.getAbridgedConfigPath(ConfigurationHandler.config.toString()));
super(Reference.MOD_ID, GuiConfig.getAbridgedConfigPath(ConfigurationHandler.getConfig().toString()));
}


Expand All @@ -49,11 +49,11 @@ public GuiScreen createConfigGui(GuiScreen parent) {
private static List<IConfigElement> getConfigElements() {
List<IConfigElement> list = new ArrayList<>();

list.addAll(new ConfigElement(ConfigurationHandler.config
.getCategory(Configuration.CATEGORY_GENERAL))
list.addAll(new ConfigElement(ConfigurationHandler.getConfig()
.getCategory(Configuration.CATEGORY_GENERAL))
.getChildElements());
list.addAll(new ConfigElement(ConfigurationHandler.config
.getCategory(Configuration.CATEGORY_CLIENT))
list.addAll(new ConfigElement(ConfigurationHandler.getConfig()
.getCategory(Configuration.CATEGORY_CLIENT))
.getChildElements());

return list;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/robmart/rpgmode/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void preInit(FMLPreInitializationEvent event) {
} catch (Exception e) {
RPGMode.logger.error("Problem loading configuration");
} finally {
if (ConfigurationHandler.config != null) ConfigurationHandler.save();
if (ConfigurationHandler.getConfig() != null) ConfigurationHandler.save();
}

InitItems.init();
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/robmart/rpgmode/common/block/BlockRPGBush.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
public class BlockRPGBush extends BlockBush implements IRPGBlock {
protected static final AxisAlignedBB FLOWER_AABB = new AxisAlignedBB(
0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 1.0D, 0.699999988079071D);
protected EnumPlantType plantType;
private final String[] variants;
private final String bareName;

private final String[] variants;
private final String bareName;
protected EnumPlantType plantType;

public BlockRPGBush(String name, EnumPlantType plantType) {
super(Material.PLANTS);
Expand Down Expand Up @@ -131,7 +132,7 @@ public EnumRarity getBlockRarity(ItemStack stack) {

@Override
public String[] getVariants() {
return variants;
return variants.clone();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
public class ConfigurationHandler {

public static Configuration config;
private static Configuration config;

private static boolean debug = false;
private static boolean displayManaValue = false;
Expand Down Expand Up @@ -85,6 +85,9 @@ private static void load() {
config.save();
}

public static Configuration getConfig() {
return config;
}

public static void save() {
config.save();
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/robmart/rpgmode/common/init/InitBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
import net.minecraftforge.common.EnumPlantType;
import robmart.rpgmode.api.block.RPGBlocks;
import robmart.rpgmode.api.reference.RefBlockNames;
import robmart.rpgmode.common.RPGMode;
import robmart.rpgmode.common.block.BlockRPGBush;
import robmart.rpgmode.common.util.ReflectionUtil;

/**
* @author Robmart
Expand All @@ -33,6 +35,11 @@ private InitBlocks() {
}

public static void init() {
RPGBlocks.hellFlower = new BlockRPGBush(RefBlockNames.HELL_FLOWER, EnumPlantType.Nether);
try {
ReflectionUtil.setField(RPGBlocks.class, "HELL_FLOWER",
new BlockRPGBush(RefBlockNames.HELL_FLOWER, EnumPlantType.Nether));
} catch (NoSuchFieldException | IllegalAccessException e) {
RPGMode.logger.error(e);
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/robmart/rpgmode/common/init/InitRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void generateBrewing() {

//Foolishness
addBrewingRecipe(new BrewRecipe(PotionTypes.AWKWARD,
new ItemStack(RPGBlocks.hellFlower), RPGPotionTypes.FOOLISHNESS));
new ItemStack(RPGBlocks.HELL_FLOWER), RPGPotionTypes.FOOLISHNESS));

//Automatically makes recipes for long and strong potions
for (Field field : RPGPotionTypes.class.getDeclaredFields()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public void decorate(World worldIn, Random random, Biome biome, BlockPos pos) {
int z1 = z + random.nextInt(dist * 2) - dist;
BlockPos pos2 = new BlockPos(x1, y, z1);

if (worldIn.isAirBlock(pos2) && RPGBlocks.hellFlower.canPlaceBlockAt(worldIn, pos2)) {
worldIn.setBlockState(pos2, RPGBlocks.hellFlower.getDefaultState());
if (worldIn.isAirBlock(pos2) && RPGBlocks.HELL_FLOWER.canPlaceBlockAt(worldIn, pos2)) {
worldIn.setBlockState(pos2, RPGBlocks.HELL_FLOWER.getDefaultState());
}
}
}
Expand Down

0 comments on commit cc015c5

Please sign in to comment.