2731
This commit is contained in:
parent
fa9cd98b5a
commit
abb9b5102f
65 changed files with 0 additions and 0 deletions
4
ToAddBack/compat/ee3/CommandCustomLoad.java
Normal file
4
ToAddBack/compat/ee3/CommandCustomLoad.java
Normal file
|
@ -0,0 +1,4 @@
|
|||
package techreborn.compat.ee3;
|
||||
|
||||
public class CommandCustomLoad {
|
||||
}
|
59
ToAddBack/compat/ee3/CommandRegen.java
Normal file
59
ToAddBack/compat/ee3/CommandRegen.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
package techreborn.compat.ee3;
|
||||
|
||||
import com.pahimar.ee3.command.CommandSyncEnergyValues;
|
||||
import com.pahimar.ee3.exchange.DynamicEnergyValueInitThread;
|
||||
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||
import com.pahimar.ee3.reference.Reference;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class CommandRegen extends CommandBase {
|
||||
|
||||
public static final String EE3_ENERGYVALUES_DIR =
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld().getSaveHandler().getWorldDirectory()
|
||||
+ File.separator + "data" + File.separator
|
||||
+ Reference.LOWERCASE_MOD_ID + File.separator
|
||||
+ "energyvalues";
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "eeregen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender commandSender) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender commandSender, String[] args) {
|
||||
commandSender.addChatMessage(new ChatComponentText("Regening EMC Values..."));
|
||||
File energyValuesDirectory = new File(EE3_ENERGYVALUES_DIR);
|
||||
|
||||
if (energyValuesDirectory.exists() && energyValuesDirectory.isDirectory()) {
|
||||
File[] files = energyValuesDirectory.listFiles();
|
||||
for (File f : files) {
|
||||
if (f.getName().toLowerCase().contains(".gz")) {
|
||||
f.delete();
|
||||
commandSender.addChatMessage(new ChatComponentText("Deleted " + f.getName()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
commandSender.addChatMessage(new ChatComponentText("Regening EMC Values"));
|
||||
DynamicEnergyValueInitThread.initEnergyValueRegistry();
|
||||
EnergyValueRegistry.getInstance().setShouldRegenNextRestart(false);
|
||||
EnergyValueRegistry.getInstance().save();
|
||||
commandSender.addChatMessage(new ChatComponentText("Syncing all EMC Values"));
|
||||
new CommandSyncEnergyValues().processCommand(commandSender, args);
|
||||
}
|
||||
}
|
54
ToAddBack/compat/ee3/CommandReload.java
Normal file
54
ToAddBack/compat/ee3/CommandReload.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package techreborn.compat.ee3;
|
||||
|
||||
import com.pahimar.ee3.exchange.DynamicEnergyValueInitThread;
|
||||
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||
import com.pahimar.ee3.reference.Files;
|
||||
import com.pahimar.ee3.reference.Reference;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class CommandReload extends CommandBase {
|
||||
|
||||
public static final String EE3_ENERGYVALUES_DIR =
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld().getSaveHandler().getWorldDirectory()
|
||||
+ File.separator + "data" + File.separator
|
||||
+ Reference.LOWERCASE_MOD_ID + File.separator
|
||||
+ "energyvalues";
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "eerelaod";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender commandSender) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender commandSender, String[] args) {
|
||||
commandSender.addChatMessage(new ChatComponentText("Reloading EMC Values..."));
|
||||
File energyValuesDirectory = new File(EE3_ENERGYVALUES_DIR);
|
||||
|
||||
if (energyValuesDirectory.exists() && energyValuesDirectory.isDirectory()) {
|
||||
File staticValues = new File(energyValuesDirectory, Files.STATIC_ENERGY_VALUES_JSON);
|
||||
commandSender.addChatMessage(new ChatComponentText("Looking for " + staticValues.getName()));
|
||||
if (staticValues.exists()) {
|
||||
commandSender.addChatMessage(new ChatComponentText("Found static values, reloading from disk!"));
|
||||
} else {
|
||||
commandSender.addChatMessage(new ChatComponentText("Will now recompute all values!!"));
|
||||
}
|
||||
}
|
||||
DynamicEnergyValueInitThread.initEnergyValueRegistry();
|
||||
EnergyValueRegistry.getInstance().setShouldRegenNextRestart(false);
|
||||
}
|
||||
}
|
94
ToAddBack/compat/ee3/EmcValues.java
Normal file
94
ToAddBack/compat/ee3/EmcValues.java
Normal file
|
@ -0,0 +1,94 @@
|
|||
package techreborn.compat.ee3;
|
||||
|
||||
import com.pahimar.ee3.api.exchange.EnergyValue;
|
||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
|
||||
import com.pahimar.ee3.api.exchange.RecipeRegistryProxy;
|
||||
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||
import com.pahimar.ee3.exchange.OreStack;
|
||||
import com.pahimar.ee3.exchange.WrappedStack;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import techreborn.api.recipe.IBaseRecipeType;
|
||||
import techreborn.api.recipe.RecipeHandler;
|
||||
import techreborn.compat.ICompatModule;
|
||||
import techreborn.items.ItemParts;
|
||||
import techreborn.items.ItemPlates;
|
||||
|
||||
public class EmcValues implements ICompatModule {
|
||||
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
for (IBaseRecipeType recipeType : RecipeHandler.recipeList) {
|
||||
if (recipeType.getOutputsSize() == 1) {
|
||||
RecipeRegistryProxy.addRecipe(recipeType.getOutput(0), recipeType.getInputs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if (!Loader.isModLoaded("EE3Compatibility")) {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
addOre("ingotCopper", 128);
|
||||
addOre("ingotSilver", 1024);
|
||||
addOre("ingotTin", 256);
|
||||
addOre("ingotLead", 256);
|
||||
addOre("dustSteel", 512);
|
||||
addOre("ingotRefinedIron", 512);
|
||||
addOre("dustCoal", 32);
|
||||
addOre("dustDiamond", 8192);
|
||||
addOre("dustSulfur", 32);
|
||||
addOre("dustLead", 256);
|
||||
addOre("ingotBronze", 256);
|
||||
addOre("ingotElectrum", 2052);
|
||||
addOre("dustLapis", 864);
|
||||
addOre("dustSilver", 1024);
|
||||
addOre("dustTin", 256);
|
||||
}
|
||||
|
||||
addStack(ItemPlates.getPlateByName("steel"), 512);
|
||||
addStack(ItemParts.getPartByName("lazuriteChunk"), 7776);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
event.registerServerCommand(new CommandRegen());
|
||||
event.registerServerCommand(new CommandReload());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverTick(TickEvent.ServerTickEvent event) {
|
||||
//This should be a fix for the things not saving
|
||||
EnergyValueRegistry.getInstance().setShouldRegenNextRestart(false);
|
||||
}
|
||||
|
||||
private void addOre(String name, float value) {
|
||||
WrappedStack stack = WrappedStack.wrap(new OreStack(name));
|
||||
EnergyValue energyValue = new EnergyValue(value);
|
||||
|
||||
EnergyValueRegistryProxy.addPreAssignedEnergyValue(stack, energyValue);
|
||||
}
|
||||
|
||||
|
||||
private void addStack(ItemStack itemStack, float value) {
|
||||
WrappedStack stack = WrappedStack.wrap(itemStack);
|
||||
EnergyValue energyValue = new EnergyValue(value);
|
||||
|
||||
EnergyValueRegistryProxy.addPreAssignedEnergyValue(stack, energyValue);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue