0.11.1.110-Java-Port. Refactored proxy stuff a bit.
This commit is contained in:
parent
b67c9b1e4b
commit
6f927ddbfe
|
@ -27,41 +27,15 @@ public class BlockLuxCapacitor extends Block {
|
|||
|
||||
public BlockLuxCapacitor() {
|
||||
super(Material.circuits);
|
||||
|
||||
// Block's creative tab
|
||||
setCreativeTab(Config.getCreativeTab());
|
||||
|
||||
// Block's hardness (base time to harvest it with the correct tool).
|
||||
// Sand = 0.5, Stone = 1.5, Ore = 3.0 Obsidian = 20
|
||||
setHardness(0.05F);
|
||||
|
||||
// Block's resistance to explosions. Stone = 10, obsidian = 2000
|
||||
setResistance(10.0F);
|
||||
|
||||
// Sound to play when player steps on the block
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
|
||||
// How much light is stopped by this block; 0 for air, 255 for fully
|
||||
// opaque.
|
||||
setLightOpacity(0);
|
||||
|
||||
// Light level, 0-1. Gets multiplied by 15 and truncated to find the
|
||||
// actual light level for the block.
|
||||
setLightLevel(1.0f);
|
||||
|
||||
// Whether to receive random ticks e.g. plants
|
||||
setTickRandomly(false);
|
||||
|
||||
// Harvest level for this block. par2 can be pickaxe, axe, or shovel, or
|
||||
// a different toolclass. par3 is the minimum level of item required to
|
||||
// break it:
|
||||
// 0=bare hands, 1=wood, 2=stone, 3=iron, 4=diamond
|
||||
// MinecraftForge.setBlockHarvestLevel(this, "pickaxe", 0);
|
||||
|
||||
GameRegistry.registerTileEntity(TileEntityLuxCapacitor.class, "luxCapacitor");
|
||||
|
||||
setBlockName("luxCapacitor");
|
||||
|
||||
}
|
||||
|
||||
private static float bbMin(double offset) {
|
||||
|
@ -169,5 +143,4 @@ public class BlockLuxCapacitor extends Block {
|
|||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -59,7 +59,6 @@ public class Config {
|
|||
static File configFolder = null;
|
||||
private static MPSCreativeTab mpsCreativeTab;
|
||||
|
||||
|
||||
private static Configuration config = null;
|
||||
public static boolean canUseShaders = false;
|
||||
|
||||
|
|
|
@ -51,52 +51,18 @@ public final class ModularPowersuits {
|
|||
@SidedProxy(clientSide = "net.machinemuse.powersuits.common.proxy.ClientProxy", serverSide = "net.machinemuse.powersuits.common.proxy.ServerProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static Configuration config = null;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
File newConfig = new File(event.getModConfigurationDirectory() + "/machinemuse/powersuits.cfg");
|
||||
Config.init(new Configuration(newConfig));
|
||||
Config.setConfigFolderBase(event.getModConfigurationDirectory());
|
||||
MinecraftForge.EVENT_BUS.register(new HarvestEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new MovementManager());
|
||||
proxy.registerEvents();
|
||||
proxy.preInit(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void load(FMLInitializationEvent event) {
|
||||
Config.loadPowerModules();
|
||||
Config.getMaximumArmorPerPiece();
|
||||
Config.getMaximumFlyingSpeedmps();
|
||||
Config.useMouseWheel();
|
||||
Config.useGraphicalMeters();
|
||||
Config.getSalvageChance();
|
||||
Config.baseMaxHeat();
|
||||
Config.allowConflictingKeybinds();
|
||||
Config.fontAntiAliasing();
|
||||
Config.useCustomFonts();
|
||||
Config.glowMultiplier();
|
||||
Config.useShaders();
|
||||
Config.getWeightCapacity();
|
||||
Config.keybindHUDon();
|
||||
Config.keybindHUDx();
|
||||
Config.toggleModuleSpam();
|
||||
EntityRegistry.registerModEntity(EntityPlasmaBolt.class, "entityPlasmaBolt", 2477, this, 64, 20, true);
|
||||
EntityRegistry.registerModEntity(EntitySpinningBlade.class, "entitySpinningBlade", 2478, this, 64, 20, true);
|
||||
EntityRegistry.registerModEntity(EntityLuxCapacitor.class, "entityLuxCapacitor", 2479, this, 64, 20, true);
|
||||
proxy.registerHandlers();
|
||||
proxy.registerRenderers();
|
||||
MPSPacketList.registerPackets();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, MPSGuiHandler.getInstance());
|
||||
TerminalHandler.registerHandler();
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit();
|
||||
ModCompatibility.registerModSpecificModules();
|
||||
Config.extractRecipes();
|
||||
Config.addCustomInstallCosts();
|
||||
Config.getConfig().save();
|
||||
proxy.postInit(event);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package net.machinemuse.powersuits.common.proxy;
|
|||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.machinemuse.general.sound.SoundDictionary;
|
||||
import net.machinemuse.numina.network.MusePacket;
|
||||
import net.machinemuse.numina.network.MusePacketModeChangeRequest;
|
||||
|
@ -41,10 +42,12 @@ import java.net.URL;
|
|||
*
|
||||
* Ported to Java by lehjr on 11/14/16.
|
||||
*/
|
||||
public class ClientProxy implements CommonProxy {
|
||||
public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void registerEvents() {
|
||||
MinecraftForge.EVENT_BUS.register(new SoundDictionary());
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new PlayerUpdateHandler());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +69,6 @@ public class ClientProxy implements CommonProxy {
|
|||
RenderingRegistry.registerEntityRenderingHandler(EntityPlasmaBolt.class, new RenderPlasmaBolt());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySpinningBlade.class, new RenderSpinningBlade());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityLuxCapacitor.class, new RenderLuxCapacitorEntity());
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEventHandler());
|
||||
URL resource = ClientProxy.class.getResource("/assets/powersuits/models/modelspec.xml");
|
||||
ModelSpecXMLReader.getINSTANCE().parseFile(resource);
|
||||
URL otherResource = ClientProxy.class.getResource("/assets/powersuits/models/armor2.xml");
|
||||
|
@ -80,12 +82,12 @@ public class ClientProxy implements CommonProxy {
|
|||
@Override
|
||||
public void registerHandlers() {
|
||||
FMLCommonHandler.instance().bus().register(new KeybindKeyHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new PlayerUpdateHandler());
|
||||
FMLCommonHandler.instance().bus().register(new ClientTickHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
super.postInit(event);
|
||||
KeybindManager.readInKeybinds();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
package net.machinemuse.powersuits.common.proxy;
|
||||
|
||||
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.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.machinemuse.powersuits.common.MPSGuiHandler;
|
||||
import net.machinemuse.powersuits.common.ModCompatibility;
|
||||
import net.machinemuse.powersuits.common.ModularPowersuits;
|
||||
import net.machinemuse.powersuits.entity.EntityLuxCapacitor;
|
||||
import net.machinemuse.powersuits.entity.EntityPlasmaBolt;
|
||||
import net.machinemuse.powersuits.entity.EntitySpinningBlade;
|
||||
import net.machinemuse.powersuits.event.HarvestEventHandler;
|
||||
import net.machinemuse.powersuits.event.MovementManager;
|
||||
import net.machinemuse.powersuits.network.packets.MPSPacketList;
|
||||
import net.machinemuse.powersuits.powermodule.tool.TerminalHandler;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Common side of the proxy. Provides functions which
|
||||
* the ClientProxy and ServerProxy will override if the behaviour is different for client and
|
||||
|
@ -9,14 +30,56 @@ package net.machinemuse.powersuits.common.proxy;
|
|||
*
|
||||
* Ported to Java by lehjr on 11/14/16.
|
||||
*/
|
||||
public interface CommonProxy {
|
||||
void registerEvents();
|
||||
public abstract class CommonProxy {
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
File newConfig = new File(event.getModConfigurationDirectory() + "/machinemuse/powersuits.cfg");
|
||||
Config.init(new Configuration(newConfig));
|
||||
Config.setConfigFolderBase(event.getModConfigurationDirectory());
|
||||
registerEvents();
|
||||
}
|
||||
|
||||
void registerRenderers();
|
||||
public void init(FMLInitializationEvent event) {
|
||||
Config.loadPowerModules();
|
||||
Config.getMaximumArmorPerPiece();
|
||||
Config.getMaximumFlyingSpeedmps();
|
||||
Config.useMouseWheel();
|
||||
Config.useGraphicalMeters();
|
||||
Config.getSalvageChance();
|
||||
Config.baseMaxHeat();
|
||||
Config.allowConflictingKeybinds();
|
||||
Config.fontAntiAliasing();
|
||||
Config.useCustomFonts();
|
||||
Config.glowMultiplier();
|
||||
Config.useShaders();
|
||||
Config.getWeightCapacity();
|
||||
Config.keybindHUDon();
|
||||
Config.keybindHUDx();
|
||||
Config.toggleModuleSpam();
|
||||
EntityRegistry.registerModEntity(EntityPlasmaBolt.class, "entityPlasmaBolt", 2477, ModularPowersuits.getInstance(), 64, 20, true);
|
||||
EntityRegistry.registerModEntity(EntitySpinningBlade.class, "entitySpinningBlade", 2478, ModularPowersuits.getInstance(), 64, 20, true);
|
||||
EntityRegistry.registerModEntity(EntityLuxCapacitor.class, "entityLuxCapacitor", 2479, ModularPowersuits.getInstance(), 64, 20, true);
|
||||
registerHandlers();
|
||||
registerRenderers();
|
||||
MPSPacketList.registerPackets();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(ModularPowersuits.getInstance(), MPSGuiHandler.getInstance());
|
||||
TerminalHandler.registerHandler();
|
||||
}
|
||||
|
||||
void registerHandlers();
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
ModCompatibility.registerModSpecificModules();
|
||||
Config.extractRecipes();
|
||||
Config.addCustomInstallCosts();
|
||||
Config.getConfig().save();
|
||||
}
|
||||
|
||||
void postInit();
|
||||
public void registerEvents() {
|
||||
MinecraftForge.EVENT_BUS.register(new HarvestEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new MovementManager());
|
||||
}
|
||||
|
||||
void sendModeChange(int dMode, String newMode);
|
||||
public abstract void registerHandlers();
|
||||
|
||||
public abstract void registerRenderers();
|
||||
|
||||
public abstract void sendModeChange(int dMode, String newMode);
|
||||
}
|
|
@ -12,10 +12,17 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
*
|
||||
* Ported to Java by lehjr on 11/14/16.
|
||||
*/
|
||||
public class ServerProxy implements CommonProxy{
|
||||
public class ServerProxy extends CommonProxy{
|
||||
@Override
|
||||
public void registerEvents() {
|
||||
super.registerEvents();
|
||||
FMLCommonHandler.instance().bus().register(new PlayerLoginHandlerThingy());
|
||||
MinecraftForge.EVENT_BUS.register(new PlayerUpdateHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerHandlers() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,16 +30,6 @@ public class ServerProxy implements CommonProxy{
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerHandlers() {
|
||||
MinecraftForge.EVENT_BUS.register(new PlayerUpdateHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendModeChange(int dMode, String newMode) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue