Default config correctness ward
-Added a boolean to the config class, that shows the player a message upon joining the world, if it is false and the mod version is not alpha. Meant to assure that config defaults are set correctly (in code) upon beta- or release- distribution of the mod.
This commit is contained in:
parent
5903cf69f0
commit
3e4c4afa0f
4 changed files with 38 additions and 2 deletions
|
@ -10,7 +10,6 @@ buildscript {
|
|||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.
|
||||
|
||||
|
||||
ext.modversion = "3.0.0-a1"
|
||||
ext.mcversion = "1.10.2"
|
||||
ext.forgeversion = "12.18.3.2221"
|
||||
|
|
|
@ -19,6 +19,8 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|||
*/
|
||||
public class DDConfig {
|
||||
|
||||
public static final boolean haveConfigDefaultsBeenCheckedForCorrectness = false; //@todo check this at each non-alpha release. This field does not have a use in the mod itself, but should ensure that the developers of this mod, don't forget to reset the config defaults to the right values before releasing a non-alpha release
|
||||
|
||||
public static File configurationFolder;
|
||||
private static int pocketGridSize = 8;
|
||||
private static int maxPocketSize = 4;
|
||||
|
@ -101,7 +103,7 @@ public class DDConfig {
|
|||
}
|
||||
return dungeonSchematicNamesArrayList;
|
||||
}
|
||||
|
||||
|
||||
public static int getBaseDimID() {
|
||||
return baseDimID;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.zixiken.dimdoors.shared;
|
||||
|
||||
import com.zixiken.dimdoors.DimDoors;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author s101426
|
||||
*/
|
||||
public class DDEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerJoinWorld(EntityJoinWorldEvent event) { //@todo, probably move this to another class
|
||||
//check if config default values have been checked
|
||||
if (!DDConfig.haveConfigDefaultsBeenCheckedForCorrectness) {
|
||||
if (!DimDoors.VERSION.contains("a")) { //if it is not an alpha version
|
||||
Entity entity = event.getEntity();
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
DimDoors.chat(player, "The default values for the config files fo this non-alpha version of DimDoors have not been sufficiently checked on correctness. Please notify the developer about this IF no newer version of this mod is available.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
@ -21,6 +22,7 @@ public abstract class DDProxyCommon implements IDDProxy {
|
|||
|
||||
@Override
|
||||
public void onPreInitialization(FMLPreInitializationEvent event) {
|
||||
MinecraftForge.EVENT_BUS.register(new DDEventHandler());
|
||||
DimDoorDimensions.init();
|
||||
ModBlocks.registerBlocks();
|
||||
ModItems.registerItems();
|
||||
|
|
Loading…
Reference in a new issue