Skip to content

Commit d04e829

Browse files
committed
💾 Ajout du code historique pour MC1.12.2
0 parents  commit d04e829

File tree

9 files changed

+335
-0
lines changed

9 files changed

+335
-0
lines changed

.gitignore

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# User-specific stuff
2+
.idea/
3+
4+
*.iml
5+
*.ipr
6+
*.iws
7+
8+
# IntelliJ
9+
out/
10+
# mpeltonen/sbt-idea plugin
11+
.idea_modules/
12+
13+
# JIRA plugin
14+
atlassian-ide-plugin.xml
15+
16+
# Compiled class file
17+
*.class
18+
19+
# Log file
20+
*.log
21+
22+
# BlueJ files
23+
*.ctxt
24+
25+
# Package Files #
26+
*.jar
27+
*.war
28+
*.nar
29+
*.ear
30+
*.zip
31+
*.tar.gz
32+
*.rar
33+
34+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
35+
hs_err_pid*
36+
37+
*~
38+
39+
# temporary files which can be created if a process still has a handle open of a deleted file
40+
.fuse_hidden*
41+
42+
# KDE directory preferences
43+
.directory
44+
45+
# Linux trash folder which might appear on any partition or disk
46+
.Trash-*
47+
48+
# .nfs files are created when an open file is removed but is still being accessed
49+
.nfs*
50+
51+
# General
52+
.DS_Store
53+
.AppleDouble
54+
.LSOverride
55+
56+
# Icon must end with two \r
57+
Icon
58+
59+
# Thumbnails
60+
._*
61+
62+
# Files that might appear in the root of a volume
63+
.DocumentRevisions-V100
64+
.fseventsd
65+
.Spotlight-V100
66+
.TemporaryItems
67+
.Trashes
68+
.VolumeIcon.icns
69+
.com.apple.timemachine.donotpresent
70+
71+
# Directories potentially created on remote AFP share
72+
.AppleDB
73+
.AppleDesktop
74+
Network Trash Folder
75+
Temporary Items
76+
.apdisk
77+
78+
# Windows thumbnail cache files
79+
Thumbs.db
80+
Thumbs.db:encryptable
81+
ehthumbs.db
82+
ehthumbs_vista.db
83+
84+
# Dump file
85+
*.stackdump
86+
87+
# Folder config file
88+
[Dd]esktop.ini
89+
90+
# Recycle Bin used on file shares
91+
$RECYCLE.BIN/
92+
93+
# Windows Installer files
94+
*.cab
95+
*.msi
96+
*.msix
97+
*.msm
98+
*.msp
99+
100+
# Windows shortcuts
101+
*.lnk
102+
103+
.gradle
104+
build/
105+
106+
# Ignore Gradle GUI config
107+
gradle-app.setting
108+
109+
# Cache of project
110+
.gradletasknamecache
111+
112+
**/build/
113+
114+
# Common working directory
115+
run/
116+
117+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
118+
!gradle-wrapper.jar

build.gradle

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
buildscript {
2+
repositories {
3+
maven { url = 'https://maven.minecraftforge.net' }
4+
mavenCentral()
5+
}
6+
dependencies {
7+
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
8+
}
9+
}
10+
11+
apply plugin: 'net.minecraftforge.gradle'
12+
13+
group = 'com.gml'
14+
version = '1.0-SNAPSHOT'
15+
16+
java {
17+
archivesBaseName = 'openeeprom'
18+
toolchain.languageVersion = JavaLanguageVersion.of(8)
19+
}
20+
21+
minecraft {
22+
mappings channel: 'stable', version: '39-1.12'
23+
24+
runs {
25+
client {
26+
workingDirectory project.file('run')
27+
28+
property 'forge.logging.markers', 'REGISTRIES'
29+
property 'forge.logging.console.level', 'debug'
30+
31+
32+
mods {
33+
openeeprom {
34+
source sourceSets.main
35+
}
36+
}
37+
}
38+
39+
server {
40+
workingDirectory project.file('run')
41+
42+
property 'forge.logging.markers', 'REGISTRIES'
43+
property 'forge.logging.console.level', 'debug'
44+
45+
46+
mods {
47+
openeeprom {
48+
source sourceSets.main
49+
}
50+
}
51+
}
52+
}
53+
}
54+
55+
sourceSets.main.resources { srcDir 'src/generated/resources' }
56+
57+
repositories {
58+
maven {
59+
name = "OC repo"
60+
url = "https://maven.cil.li/"
61+
}
62+
}
63+
64+
dependencies {
65+
minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860'
66+
implementation fg.deobf("li.cil.oc:OpenComputers:MC1.12.1-1.7.+")
67+
}
68+
69+
jar {
70+
manifest {
71+
attributes([
72+
"Specification-Title": "openeeprom",
73+
"Specification-Vendor": "Grahmindol",
74+
"Specification-Version": "1",
75+
"Implementation-Title": project.name,
76+
"Implementation-Version": project.jar.archiveVersion,
77+
"Implementation-Vendor": "Grahmindol",
78+
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
79+
])
80+
}
81+
}
82+
83+
jar.finalizedBy('reobfJar')

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.gradle.jvmargs=-Xmx3G
2+
org.gradle.daemon=false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'openeeprom'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.gml.openeeprom;
2+
3+
import net.minecraft.client.Minecraft;
4+
5+
import java.io.IOException;
6+
import java.nio.file.Path;
7+
8+
public class ClientProxy extends CommonProxy{
9+
@Override
10+
public Path getBaseFolder() throws IOException {
11+
return Minecraft.getMinecraft().gameDir.toPath();
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.gml.openeeprom;
2+
3+
import net.minecraftforge.fml.server.FMLServerHandler;
4+
5+
import java.io.IOException;
6+
import java.nio.file.Path;
7+
8+
public class CommonProxy {
9+
public Path getBaseFolder() throws IOException {
10+
Path universeFolder = FMLServerHandler.instance().getSavesDirectory().toPath();
11+
return universeFolder;
12+
}
13+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package com.gml.openeeprom;
2+
3+
import net.minecraft.item.ItemStack;
4+
import net.minecraftforge.fml.common.Mod;
5+
import net.minecraftforge.fml.common.SidedProxy;
6+
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
7+
8+
import java.io.File;
9+
import java.io.FileInputStream;
10+
import java.io.IOException;
11+
import java.util.Properties;
12+
13+
@Mod(
14+
modid = OpenEEPROM.MODID,
15+
name = "OpenEEPROM",
16+
version = "1.0-SNAPSHOT",
17+
dependencies = "after:OpenComputers"
18+
)
19+
public class OpenEEPROM {
20+
21+
public static final String MODID = "openeeprom";
22+
23+
@Mod.Instance(MODID)
24+
public static OpenEEPROM INSTANCE;
25+
26+
public static Config cfg = null;
27+
28+
@SidedProxy(clientSide = "com.gml.openeeprom.ClientProxy", serverSide = "com.gml.openeeprom.CommonProxy")
29+
public static CommonProxy proxy;
30+
31+
@Mod.EventHandler
32+
public void preinit(FMLPreInitializationEvent event) {
33+
try {
34+
listFilesForFolder(new File(proxy.getBaseFolder().toString() + "\\mods\\openeeprom\\lua\\"));
35+
} catch (IOException e) {
36+
e.printStackTrace();
37+
}
38+
}
39+
40+
public void listFilesForFolder(final File folder) throws IOException {
41+
File[] files = folder.listFiles();
42+
if (files != null) {
43+
for (final File fileEntry : files) {
44+
if (fileEntry.isDirectory()) {
45+
if (new File(fileEntry+"/.eeprom.cfg").isFile()) {
46+
cfg = new Config(fileEntry + "\\.eeprom.cfg");
47+
String name = cfg.getString("name", fileEntry.getName());
48+
Boolean isReadOnly = cfg.getBool("isReadOnly", "true");
49+
if (new File(fileEntry+"/code.lua").isFile()) {
50+
FileInputStream fl = new FileInputStream(new File(fileEntry+"/code.lua"));
51+
byte[] code = new byte[(int)new File(fileEntry+"/code.lua").length()];
52+
fl.read(code);
53+
fl.close();
54+
ItemStack eeprom = li.cil.oc.api.Items.registerEEPROM(name, code, new byte[255], isReadOnly);
55+
eeprom.setStackDisplayName(name);
56+
57+
System.out.println("Registering a eeprom with name " + name);
58+
}
59+
} else {
60+
System.out.println("Not an eeprom");
61+
}
62+
}
63+
}
64+
}
65+
}
66+
67+
class Config
68+
{
69+
Properties configFile;
70+
public Config(String path)
71+
{
72+
configFile = new java.util.Properties();
73+
try {
74+
configFile.load(new FileInputStream(path));
75+
}catch(Exception eta){
76+
eta.printStackTrace();
77+
}
78+
}
79+
public String getString(String key, String defultVal) {
80+
String value = this.configFile.getProperty(key, defultVal);
81+
return value;
82+
}
83+
public Boolean getBool(String key, String defultVal) {
84+
String value = this.configFile.getProperty(key, defultVal);
85+
return Boolean.parseBoolean(value);
86+
}
87+
}
88+
}

src/main/resources/mcmod.info

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[
2+
{
3+
"modid": "openeeprom",
4+
"name": "OpenEEPROM",
5+
"description": "add customized eeprom",
6+
"version": "${version}",
7+
"mcversion": "${mcversion}",
8+
"url": "",
9+
"updateUrl": "",
10+
"authorList": ["Grahmindol"],
11+
"credits": "",
12+
"logoFile": "",
13+
"screenshots": [],
14+
"dependencies": []
15+
}
16+
]

0 commit comments

Comments
 (0)