Jump to content

Recommended Posts

Posted

I am trying to use sided configs, if i run the server through eclipse it creates the config but if i run it on obfuscated code it does not, it outputs that it is but it never does.

 

CommonProxy

 

 

/*******************************************************************************
* Copyright (c) 2012 Viper283.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Viper283
******************************************************************************/
package viper283.core;

import net.minecraft.src.EntityPlayer;
import net.minecraft.src.World;
import cpw.mods.fml.common.network.IGuiHandler;

/**
* @author Viper283
*
*/
public class CommonProxy implements IGuiHandler {

/**
 * 
 */
public void registerRenderInformation() {
	// TODO Auto-generated constructor stub
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
		int x, int y, int z) {
	// TODO Auto-generated method stub
	return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
		int x, int y, int z) {
	// TODO Auto-generated method stub
	return null;
}

public String config() {
	System.out.println("fhbdjsf");
	return "/config/Viper283/CvC/Config.cfg";
}

}

 

 

 

ClientProxy

 

 

/*******************************************************************************
* Copyright (c) 2012 Viper283.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Viper283
******************************************************************************/
package viper283.core.client;

import net.minecraft.client.Minecraft;
import net.minecraftforge.client.MinecraftForgeClient;
import viper283.core.CommonProxy;

/**
* @author Viper283
*
*/
public class ClientProxy extends CommonProxy {


@Override
public void registerRenderInformation() {

}

public String config() {
	return Minecraft.getMinecraftDir() + "/config/Viper283/CvC/Config.cfg";
}

}

 

 

 

ViperCore

 

 

/*******************************************************************************
* Copyright (c) 2012 Viper283.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Viper283
******************************************************************************/
package viper283.core;

import java.io.File;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;

import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

/**
* @author Viper283
*
*/
@Mod( modid = "CodeViperCore", name = "CodeViperCore", version = Resources.version )
@NetworkMod( channels = { "CodeViperCore" }, clientSideRequired = true, serverSideRequired = false,  packetHandler = PacketHandler.class)
public class ViperCore {

@SidedProxy(clientSide = "viper283.core.client.ClientProxy", serverSide = "viper283.core.CommonProxy")
public static CommonProxy proxy;
@Instance
public static ViperCore instance;
private static String logger = "[CvC]: ";
public static boolean debugText;
public static final List<Object> MODS = new ArrayList<Object>();


public static void registerMod(Object networkmod, String modName, String version)
    {
        String[] versionNumbers = Resources.version.split("\\.");
        String[] addonVersionNumbers = Resources.version.split("\\.");

        if (Integer.parseInt(addonVersionNumbers[0]) != Integer.parseInt(versionNumbers[0]))
        {
            throw new RuntimeException(logger + "CodeViperCore mod major version mismatch, expecting " + version);
        }
        else if (Integer.parseInt(addonVersionNumbers[1]) > Integer.parseInt(versionNumbers[1]))
        {
         throw new RuntimeException(logger + "CodeViperCore too old, need at least " + version);
        }
        else if (Integer.parseInt(addonVersionNumbers[1]) < Integer.parseInt(versionNumbers[1]))
        {
         throw new RuntimeException(logger + "CodeViperCore mod minor version mismatch, need at least " + version);
        }
        else if (Integer.parseInt(addonVersionNumbers[2]) != Integer.parseInt(versionNumbers[2]))
        {
            System.out.println(logger + "CvC mod minor version " + version + " mismatch with version " + version);
        }

        MODS.add(networkmod);
        System.out.println(logger + "Loaded CodeViperCore Mod: " + modName);
    }


@PreInit
public void initConfig(FMLPreInitializationEvent evt) {
	evt.getModMetadata().version = Resources.version;
	Configuration cfg = new Configuration(new File(proxy.config()));
	try {
		cfg.load();
		debugText = cfg.getOrCreateBooleanProperty("Debug Text", cfg.CATEGORY_GENERAL, true).getBoolean(true);
	} catch(Exception e) {
		System.out.println(logger + "Failed to load config for reason: ");
		e.printStackTrace();
	} finally {
		cfg.save();
	}


}

@Init
public void load(FMLInitializationEvent evt) {

}

}

 

 

 

If i am just being a noob them please treat me so. also it does create the config on the client side

Posted

I know this isn't going to be helpful in the slightest, but I noticed

System.out.println("fhbdjsf");

 

So glad I'm not the only one who does that :P

thats how i know that it's meant to be creating the config. i'm glad i'm not the only to lol

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.