Twice Upon a Loader
This commit is contained in:
commit
86367a3863
50 changed files with 2388 additions and 0 deletions
15
.gitattributes
vendored
Normal file
15
.gitattributes
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
* text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.patch text eol=lf
|
||||
*.java text eol=lf
|
||||
*.gradle text eol=crlf
|
||||
*.png binary
|
||||
*.gif binary
|
||||
*.exe binary
|
||||
*.dll binary
|
||||
*.jar binary
|
||||
*.lzma binary
|
||||
*.zip binary
|
||||
*.pyd binary
|
||||
*.cfg text eol=lf
|
||||
*.jks binary
|
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
# eclipse
|
||||
bin
|
||||
*.launch
|
||||
.settings
|
||||
.metadata
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# idea
|
||||
out
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iml
|
||||
.idea/*
|
||||
!.idea/scopes
|
||||
|
||||
# gradle
|
||||
build
|
||||
.gradle
|
||||
|
||||
# other
|
||||
eclipse
|
||||
run
|
3
.idea/scopes/Fabric_sources.xml
generated
Normal file
3
.idea/scopes/Fabric_sources.xml
generated
Normal file
|
@ -0,0 +1,3 @@
|
|||
<component name="DependencyValidationManager">
|
||||
<scope name="Fabric sources" pattern="!ext[Gradle: cpw.mods:*:*]:*/&&!ext[Gradle: mezz.jei:*:*:*]:*/&&!ext[Gradle: net.jodah:typetools:*]:*/&&!ext[Gradle: net.minecraft:client:extra:*]:*/&&!ext[Gradle: net.minecraft:joined*:*]:*/&&!ext[Gradle: net.minecraft:mappings_official:zip:*]:*/&&!ext[Gradle: net.minecraftforge:*:*]:*/" />
|
||||
</component>
|
3
.idea/scopes/Forge_sources.xml
generated
Normal file
3
.idea/scopes/Forge_sources.xml
generated
Normal file
|
@ -0,0 +1,3 @@
|
|||
<component name="DependencyValidationManager">
|
||||
<scope name="Forge sources" pattern="!ext[Gradle: loom_mappings_*:*:*]:*/&&!ext[Gradle: net.fabricmc:*:*]:*/&&!ext[Gradle: net.minecraft:joined*:*]:*/&&!ext[Gradle: net.minecraft:mappings_official:zip:*]:*/&&!ext[Gradle: net.minecraft:minecraft-project-*:*]:*/" />
|
||||
</component>
|
54
Common/build.gradle
Normal file
54
Common/build.gradle
Normal file
|
@ -0,0 +1,54 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
archivesBaseName = "${mod_name}-common-${minecraft_version}"
|
||||
|
||||
minecraft {
|
||||
version(minecraft_version)
|
||||
runs {
|
||||
if (project.hasProperty('common_runs_enabled') ? project.findProperty('common_runs_enabled').toBoolean() : true) {
|
||||
|
||||
server(project.hasProperty('common_server_run_name') ? project.findProperty('common_server_run_name') : 'vanilla_server') {
|
||||
workingDirectory(this.file("run"))
|
||||
}
|
||||
client(project.hasProperty('common_client_run_name') ? project.findProperty('common_client_run_name') : 'vanilla_client') {
|
||||
workingDirectory(this.file("run"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
|
||||
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
||||
def buildProps = project.properties.clone()
|
||||
|
||||
filesMatching(['pack.mcmeta']) {
|
||||
|
||||
expand buildProps
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
groupId project.group
|
||||
artifactId project.archivesBaseName
|
||||
version project.version
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url "file://" + System.getenv("local_maven")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package su.a71.tardim_ic.tardim_ic;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static final String MOD_ID = "tardim_ic";
|
||||
public static final String MOD_NAME = "TARDIM: In Control";
|
||||
public static final Logger LOG = LoggerFactory.getLogger(MOD_NAME);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "tardim_ic:block/digital_tardim_interface"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "tardim_ic:block/redstone_tardim_input"
|
||||
}
|
||||
}
|
||||
}
|
BIN
Common/src/main/resources/assets/tardim_ic/icon.png
Normal file
BIN
Common/src/main/resources/assets/tardim_ic/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"block.tardim_ic.digital_tardim_interface": "Digital TARDIM Interface",
|
||||
"block.tardim_ic.redstone_tardim_input": "Redstone TARDIM Input",
|
||||
"itemGroup.tardim_ic": "TARDIM: In Control"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"block.tardim_ic.digital_tardim_interface": "Digital TARDIM Interface",
|
||||
"block.tardim_ic.redstone_tardim_input": "Redstone TARDIM Input",
|
||||
"itemGroup.tardim_ic": "TARDIM: In Control"
|
||||
}
|
5
Common/src/main/resources/assets/tardim_ic/lang/rpr.json
Normal file
5
Common/src/main/resources/assets/tardim_ic/lang/rpr.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"block.tardim_ic.digital_tardim_interface": "Циферный Интерфейсъ Хронобудки",
|
||||
"block.tardim_ic.redstone_tardim_input": "Краснокаменный Инпутъ Хронобудки",
|
||||
"itemGroup.tardim_ic": "ТАРДИМЪ: Подъ Контрольемъ"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"block.tardim_ic.digital_tardim_interface": "Цифровой интерфейс TARDIM",
|
||||
"block.tardim_ic.redstone_tardim_input": "Редстоуновый ввод TARDIM",
|
||||
"itemGroup.tardim_ic": "TARDIM: In Control"
|
||||
}
|
|
@ -0,0 +1,213 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "digital_tardim_interface",
|
||||
"texture_size": [64, 64],
|
||||
"textures": {
|
||||
"1": "tardim_ic:blocks/digital_tardim_interface",
|
||||
"particle": "tardim_ic:blocks/digital_tardim_interface"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 14, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [4, 4, 8, 7.5], "texture": "#1"},
|
||||
"east": {"uv": [0, 4, 4, 7.5], "texture": "#1"},
|
||||
"south": {"uv": [12, 4, 16, 7.5], "texture": "#1"},
|
||||
"west": {"uv": [8, 4, 12, 7.5], "texture": "#1"},
|
||||
"up": {"uv": [8, 4, 4, 0], "texture": "#1"},
|
||||
"down": {"uv": [12, 0, 8, 4], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5, 14, 5],
|
||||
"to": [11, 16, 11],
|
||||
"faces": {
|
||||
"north": {"uv": [1.5, 9, 3, 9.5], "texture": "#1"},
|
||||
"east": {"uv": [0, 9, 1.5, 9.5], "texture": "#1"},
|
||||
"south": {"uv": [4.5, 9, 6, 9.5], "texture": "#1"},
|
||||
"west": {"uv": [3, 9, 4.5, 9.5], "texture": "#1"},
|
||||
"up": {"uv": [3, 9, 1.5, 7.5], "texture": "#1"},
|
||||
"down": {"uv": [4.5, 7.5, 3, 9], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [11, 14, 7],
|
||||
"to": [14, 16, 9],
|
||||
"faces": {
|
||||
"north": {"uv": [12.5, 0.5, 13.25, 1], "texture": "#1"},
|
||||
"east": {"uv": [12, 0.5, 12.5, 1], "texture": "#1"},
|
||||
"south": {"uv": [13.75, 0.5, 14.5, 1], "texture": "#1"},
|
||||
"west": {"uv": [13.25, 0.5, 13.75, 1], "texture": "#1"},
|
||||
"up": {"uv": [13.25, 0.5, 12.5, 0], "texture": "#1"},
|
||||
"down": {"uv": [14, 0, 13.25, 0.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [12.5, 14, 3.5],
|
||||
"to": [12.5, 15, 12.5],
|
||||
"faces": {
|
||||
"north": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"east": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"south": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"west": {"uv": [13, 3.75, 15.25, 4], "texture": "#1"},
|
||||
"up": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"down": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [3.5, 14, 12.5],
|
||||
"to": [12.5, 15, 12.5],
|
||||
"faces": {
|
||||
"north": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"east": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"south": {"uv": [12.5, 3.75, 14.75, 4], "texture": "#1"},
|
||||
"west": {"uv": [13.5, 3.75, 15.75, 4], "texture": "#1"},
|
||||
"up": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"down": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [3.5, 14, 3.5],
|
||||
"to": [12.5, 15, 3.5],
|
||||
"faces": {
|
||||
"north": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"east": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"south": {"uv": [12.5, 3.75, 14.75, 4], "texture": "#1"},
|
||||
"west": {"uv": [13.5, 3.75, 15.75, 4], "texture": "#1"},
|
||||
"up": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"down": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [3.5, 14, 3.5],
|
||||
"to": [3.5, 15, 12.5],
|
||||
"faces": {
|
||||
"north": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"east": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"south": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"west": {"uv": [13, 3.75, 15.25, 4], "texture": "#1"},
|
||||
"up": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"},
|
||||
"down": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [2, 14, 7],
|
||||
"to": [5, 16, 9],
|
||||
"faces": {
|
||||
"north": {"uv": [5, 8, 5.75, 8.5], "texture": "#1"},
|
||||
"east": {"uv": [4.5, 8, 5, 8.5], "texture": "#1"},
|
||||
"south": {"uv": [6.25, 8, 7, 8.5], "texture": "#1"},
|
||||
"west": {"uv": [5.75, 8, 6.25, 8.5], "texture": "#1"},
|
||||
"up": {"uv": [5.75, 8, 5, 7.5], "texture": "#1"},
|
||||
"down": {"uv": [6.5, 7.5, 5.75, 8], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [7, 14, 2],
|
||||
"to": [9, 16, 5],
|
||||
"faces": {
|
||||
"north": {"uv": [3.25, 12.5, 3.75, 13], "texture": "#1"},
|
||||
"east": {"uv": [2.5, 12.5, 3.25, 13], "texture": "#1"},
|
||||
"south": {"uv": [4.5, 12.5, 5, 13], "texture": "#1"},
|
||||
"west": {"uv": [3.75, 12.5, 4.5, 13], "texture": "#1"},
|
||||
"up": {"uv": [3.75, 12.5, 3.25, 11.75], "texture": "#1"},
|
||||
"down": {"uv": [4.25, 11.75, 3.75, 12.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [7, 14, 11],
|
||||
"to": [9, 16, 14],
|
||||
"faces": {
|
||||
"north": {"uv": [0.75, 12.5, 1.25, 13], "texture": "#1"},
|
||||
"east": {"uv": [0, 12.5, 0.75, 13], "texture": "#1"},
|
||||
"south": {"uv": [2, 12.5, 2.5, 13], "texture": "#1"},
|
||||
"west": {"uv": [1.25, 12.5, 2, 13], "texture": "#1"},
|
||||
"up": {"uv": [1.25, 12.5, 0.75, 11.75], "texture": "#1"},
|
||||
"down": {"uv": [1.75, 11.75, 1.25, 12.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 13, -2],
|
||||
"to": [10, 17, 2],
|
||||
"faces": {
|
||||
"north": {"uv": [10, 9.5, 11, 10.5], "texture": "#1"},
|
||||
"east": {"uv": [9, 9.5, 10, 10.5], "texture": "#1"},
|
||||
"south": {"uv": [12, 9.5, 13, 10.5], "texture": "#1"},
|
||||
"west": {"uv": [11, 9.5, 12, 10.5], "texture": "#1"},
|
||||
"up": {"uv": [11, 9.5, 10, 8.5], "texture": "#1"},
|
||||
"down": {"uv": [12, 8.5, 11, 9.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 13, 14],
|
||||
"to": [10, 17, 18],
|
||||
"faces": {
|
||||
"north": {"uv": [7, 8.5, 8, 9.5], "texture": "#1"},
|
||||
"east": {"uv": [6, 8.5, 7, 9.5], "texture": "#1"},
|
||||
"south": {"uv": [9, 8.5, 10, 9.5], "texture": "#1"},
|
||||
"west": {"uv": [8, 8.5, 9, 9.5], "texture": "#1"},
|
||||
"up": {"uv": [8, 8.5, 7, 7.5], "texture": "#1"},
|
||||
"down": {"uv": [9, 7.5, 8, 8.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [-2, 13, 6],
|
||||
"to": [2, 17, 10],
|
||||
"faces": {
|
||||
"north": {"uv": [1, 3, 2, 4], "texture": "#1"},
|
||||
"east": {"uv": [0, 3, 1, 4], "texture": "#1"},
|
||||
"south": {"uv": [3, 3, 4, 4], "texture": "#1"},
|
||||
"west": {"uv": [2, 3, 3, 4], "texture": "#1"},
|
||||
"up": {"uv": [2, 3, 1, 2], "texture": "#1"},
|
||||
"down": {"uv": [3, 2, 2, 3], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [14, 13, 6],
|
||||
"to": [18, 17, 10],
|
||||
"faces": {
|
||||
"north": {"uv": [1, 1, 2, 2], "texture": "#1"},
|
||||
"east": {"uv": [0, 1, 1, 2], "texture": "#1"},
|
||||
"south": {"uv": [3, 1, 4, 2], "texture": "#1"},
|
||||
"west": {"uv": [2, 1, 3, 2], "texture": "#1"},
|
||||
"up": {"uv": [2, 1, 1, 0], "texture": "#1"},
|
||||
"down": {"uv": [3, 0, 2, 1], "texture": "#1"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"translation": [0, -1.5, 0],
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"thirdperson_lefthand": {
|
||||
"translation": [0, -1.5, 0],
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"translation": [-1.25, 0, 0],
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"translation": [3.75, -1.5, 0],
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"ground": {
|
||||
"translation": [0, -0.5, 0],
|
||||
"scale": [0.35, 0.35, 0.35]
|
||||
},
|
||||
"gui": {
|
||||
"rotation": [33, 45, 0],
|
||||
"scale": [0.6, 0.6, 0.6]
|
||||
},
|
||||
"head": {
|
||||
"translation": [0, 0.75, 0],
|
||||
"scale": [1.1, 1.1, 1.1]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [-90, 0, 0],
|
||||
"translation": [0, 0, 4.25]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/cube_all",
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"1": "tardim_ic:blocks/red_contr",
|
||||
"2": "tardim_ic:blocks/red_contr2",
|
||||
"particle": "tardim_ic:blocks/red_contr"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#2"},
|
||||
"east": {"uv": [0, 0, 16, 16], "texture": "#2"},
|
||||
"south": {"uv": [0, 0, 16, 16], "texture": "#2"},
|
||||
"west": {"uv": [0, 0, 16, 16], "texture": "#2"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#2"},
|
||||
"down": {"uv": [0, 0, 16, 16], "texture": "#2"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [-0.325, -0.35, -0.35],
|
||||
"to": [16.35, 16.525, 16.275],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 16, 16], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 16, 16], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 16, 16], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
|
||||
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"parent": "tardim_ic:block/digital_tardim_interface",
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [ 75, 45, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ],
|
||||
"translation": [ 0, 1, 0 ]
|
||||
},
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [ 75, 45, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ],
|
||||
"translation": [ 0, 1, 0 ]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 45, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [ 0, 45, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"parent": "tardim_ic:block/redstone_tardim_input",
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [ 75, 45, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ],
|
||||
"translation": [ 0, 1, 0 ]
|
||||
},
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [ 75, 45, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ],
|
||||
"translation": [ 0, 1, 0 ]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 45, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [ 0, 45, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ]
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 927 B |
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 10,
|
||||
"interpolate": true,
|
||||
"frames": [0, 1, 2, 3]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"bonus_rolls": 0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "tardim_ic:digital_tardim_interface",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"bonus_rolls": 0,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "tardim_ic:redstone_tardim_input",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"DDD",
|
||||
"R0R",
|
||||
"GRG"
|
||||
],
|
||||
"key": {
|
||||
"G": {
|
||||
"item": "minecraft:gold_ingot",
|
||||
"count": 1
|
||||
},
|
||||
"R": {
|
||||
"item": "minecraft:redstone",
|
||||
"count": 1
|
||||
},
|
||||
"0": {
|
||||
"item": "minecraft:ender_eye",
|
||||
"count": 1
|
||||
},
|
||||
"D": {
|
||||
"item": "minecraft:polished_deepslate",
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "tardim_ic:digital_tardim_interface",
|
||||
"count": 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"GRG",
|
||||
"RBR",
|
||||
"GRG"
|
||||
],
|
||||
"key": {
|
||||
"G": {
|
||||
"item": "minecraft:gold_ingot",
|
||||
"count": 1
|
||||
},
|
||||
"R": {
|
||||
"item": "minecraft:redstone",
|
||||
"count": 1
|
||||
},
|
||||
"B": {
|
||||
"item": "minecraft:redstone_block",
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "tardim_ic:redstone_tardim_input",
|
||||
"count": 1
|
||||
}
|
||||
}
|
7
Common/src/main/resources/pack.mcmeta
Normal file
7
Common/src/main/resources/pack.mcmeta
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"pack": {
|
||||
"description": "TARDIM: In Control resources",
|
||||
"pack_format": 6,
|
||||
"_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
|
||||
}
|
||||
}
|
64
Fabric/build.gradle
Normal file
64
Fabric/build.gradle
Normal file
|
@ -0,0 +1,64 @@
|
|||
plugins {
|
||||
id 'fabric-loom' version '0.12-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
id 'idea'
|
||||
}
|
||||
|
||||
archivesBaseName = "${mod_name}-fabric-${minecraft_version}"
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${minecraft_version}"
|
||||
mappings loom.officialMojangMappings()
|
||||
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
||||
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
|
||||
implementation project(":Common")
|
||||
}
|
||||
|
||||
loom {
|
||||
runs {
|
||||
client {
|
||||
client()
|
||||
setConfigName("Fabric Client")
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
}
|
||||
server {
|
||||
server()
|
||||
setConfigName("Fabric Server")
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
processResources {
|
||||
from project(":Common").sourceSets.main.resources
|
||||
inputs.property "version", project.version
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
source(project(":Common").sourceSets.main.allSource)
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
groupId project.group
|
||||
artifactId project.archivesBaseName
|
||||
version project.version
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url "file://" + System.getenv("local_maven")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package su.a71.tardim_ic.tardim_ic;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
|
||||
public class TardimInControl implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
}
|
||||
}
|
39
Fabric/src/main/resources/fabric.mod.json
Normal file
39
Fabric/src/main/resources/fabric.mod.json
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "modid",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "Example Mod",
|
||||
"description": "This is an example description! Tell everyone what your mod is about!",
|
||||
"authors": [
|
||||
"Me!"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://fabricmc.net/",
|
||||
"sources": "https://github.com/FabricMC/fabric-example-mod"
|
||||
},
|
||||
|
||||
"license": "CC0-1.0",
|
||||
"icon": "assets/modid/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"com.example.examplemod.ExampleMod"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"modid.mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.19.x",
|
||||
"java": ">=17"
|
||||
},
|
||||
"suggests": {
|
||||
"another-mod": "*"
|
||||
}
|
||||
}
|
||||
|
15
Fabric/src/main/resources/modid.mixins.json
Normal file
15
Fabric/src/main/resources/modid.mixins.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"ExampleMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
|
108
Forge/build.gradle
Normal file
108
Forge/build.gradle
Normal file
|
@ -0,0 +1,108 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://maven.minecraftforge.net' }
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
||||
}
|
||||
}
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
archivesBaseName = "${mod_name}-forge-${minecraft_version}"
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'official', version: minecraft_version
|
||||
|
||||
if (project.hasProperty('forge_ats_enabled') && project.findProperty('forge_ats_enabled').toBoolean()) {
|
||||
// This location is hardcoded in Forge and can not be changed.
|
||||
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
project.logger.debug('Forge Access Transformers are enabled for this project.')
|
||||
}
|
||||
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
taskName 'Client'
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
mods {
|
||||
modClientRun {
|
||||
source sourceSets.main
|
||||
source project(":Common").sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
workingDirectory project.file('run')
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
taskName 'Server'
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
mods {
|
||||
modServerRun {
|
||||
source sourceSets.main
|
||||
source project(":Common").sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
taskName 'Data'
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
mods {
|
||||
modDataRun {
|
||||
source sourceSets.main
|
||||
source project(":Common").sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main.resources.srcDir 'src/generated/resources'
|
||||
|
||||
dependencies {
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
compileOnly project(":Common")
|
||||
|
||||
implementation fg.deobf("curse.maven:tardim-531315:3983700")
|
||||
implementation fg.deobf("org.squiddev:cc-tweaked-1.19.1:${cc_version}")
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
source(project(":Common").sourceSets.main.allSource)
|
||||
}
|
||||
|
||||
processResources {
|
||||
from project(":Common").sourceSets.main.resources
|
||||
}
|
||||
|
||||
|
||||
jar.finalizedBy('reobfJar')
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
groupId project.group
|
||||
artifactId project.archivesBaseName
|
||||
version project.version
|
||||
artifact jar
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "file://" + System.getenv("local_maven")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package su.a71.tardim_ic.tardim_ic;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import su.a71.tardim_ic.tardim_ic.digital_interface.DigitalInterfaceBlock;
|
||||
import su.a71.tardim_ic.tardim_ic.digital_interface.DigitalInterfaceTileEntity;
|
||||
import su.a71.tardim_ic.tardim_ic.redsone_input.RedstoneInputBlock;
|
||||
import su.a71.tardim_ic.tardim_ic.redsone_input.RedstoneInputTileEntity;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class Registration {
|
||||
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, TardimInControl.MODID);
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, TardimInControl.MODID);
|
||||
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, TardimInControl.MODID);
|
||||
|
||||
public static final CreativeModeTab TARDIM_IC_TAB = new CreativeModeTab("tardim_ic") {
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return new ItemStack(Registration.DIGITAL_TARDIM_INTERFACE.get());
|
||||
}
|
||||
};
|
||||
|
||||
// Blocks
|
||||
private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> block) {
|
||||
RegistryObject<T> registryObject = BLOCKS.register(name, block);
|
||||
ITEMS.register(name, () -> new BlockItem(registryObject.get(), new Item.Properties().tab(TARDIM_IC_TAB)));
|
||||
return registryObject;
|
||||
}
|
||||
public static final RegistryObject<Block> DIGITAL_TARDIM_INTERFACE = register("digital_tardim_interface", DigitalInterfaceBlock::new);
|
||||
public static final RegistryObject<Block> REDSTONE_TARDIM_INPUT = register("redstone_tardim_input", RedstoneInputBlock::new);
|
||||
|
||||
// Tile Entities
|
||||
public static final RegistryObject<BlockEntityType<DigitalInterfaceTileEntity>> DIGITAL_TARDIM_INTERFACE_TILEENTITY = Registration.BLOCK_ENTITIES.register("digital_tardim_interface", () -> new BlockEntityType<>(DigitalInterfaceTileEntity::new, Sets.newHashSet(DIGITAL_TARDIM_INTERFACE.get()), null));
|
||||
public static final RegistryObject<BlockEntityType<RedstoneInputTileEntity>> REDSTONE_TARDIM_INPUT_TILEENTITY = Registration.BLOCK_ENTITIES.register("redstone_tardim_input", () -> new BlockEntityType<>(RedstoneInputTileEntity::new, Sets.newHashSet(REDSTONE_TARDIM_INPUT.get()), null));
|
||||
|
||||
// Register our stuff
|
||||
public static void register() {
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
BLOCKS.register(modEventBus);
|
||||
ITEMS.register(modEventBus);
|
||||
BLOCK_ENTITIES.register(modEventBus);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package su.a71.tardim_ic.tardim_ic;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import su.a71.tardim_ic.tardim_ic.Constants;
|
||||
|
||||
// The value here should match an entry in the META-INF/mods.toml file
|
||||
@Mod(Constants.MOD_ID)
|
||||
public class TardimInControl {
|
||||
|
||||
// Our mod id
|
||||
public static final String MODID = "tardim_ic";
|
||||
|
||||
public TardimInControl() {
|
||||
Registration.register();
|
||||
// Register ourselves for server and other game events we are interested in. Currently, we do not use any events
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package su.a71.tardim_ic.tardim_ic.command;
|
||||
|
||||
// This will be added whenever I manage to convince TARDIM devs to make CommandManager.register public
|
||||
|
||||
import com.mojang.brigadier.Command;
|
||||
import com.swdteam.common.command.tardim.CommandTardimBase;
|
||||
import com.swdteam.common.command.tardim.ICommand;
|
||||
import com.swdteam.tardim.TardimData;
|
||||
import com.swdteam.tardim.TardimManager;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
import dan200.computercraft.api.network.Packet;
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
|
||||
import static com.swdteam.common.command.tardim.CommandTardimBase.sendResponse;
|
||||
|
||||
public class CommandModemTransmit implements ICommand {
|
||||
@Override
|
||||
public void execute(String[] args, Player player, BlockPos pos, CommandTardimBase.CommandSource source) {
|
||||
if (args.length == 3) {
|
||||
TardimData data = TardimManager.getFromPos(pos);
|
||||
if (data != null) {
|
||||
if (data.hasPermission(player)) {
|
||||
try {
|
||||
int sendChannel = Integer.parseInt(args[0]);
|
||||
int replyChannel = Integer.parseInt(args[1]);
|
||||
String message = args[2];
|
||||
boolean allDimensions = Boolean.parseBoolean(args[3]) || args[3].equals("true");
|
||||
|
||||
if (data.getTravelLocation() == null) {
|
||||
data.setTravelLocation(new TardimData.Location(data.getCurrentLocation()));
|
||||
}
|
||||
|
||||
if (allDimensions)
|
||||
{
|
||||
ComputerCraftAPI.getWirelessNetwork().transmitInterdimensional(new Packet(sendChannel, replyChannel, message, new CommandSender(player, data.getTravelLocation().getPos())));
|
||||
}
|
||||
else {
|
||||
ComputerCraftAPI.getWirelessNetwork().transmitSameDimension(new Packet(sendChannel, replyChannel, message,
|
||||
new CommandSender(player, data.getTravelLocation().getPos())), 300);
|
||||
}
|
||||
sendResponse(player, "Sent modem message", CommandTardimBase.ResponseType.COMPLETE, source);
|
||||
} catch (Exception var9) {
|
||||
sendResponse(player, "Invalid coordinates", CommandTardimBase.ResponseType.FAIL, source);
|
||||
}
|
||||
} else {
|
||||
sendResponse(player, "You do not have permission", CommandTardimBase.ResponseType.FAIL, source);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sendResponse(player, this.getUsage(), CommandTardimBase.ResponseType.FAIL, source);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "ccModemTransmit";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return "ccModemTransmit <channel: int> <replyChannel: int> <message: string> <all_dimension: true/false>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandTardimBase.CommandSource allowedSource() {
|
||||
return CommandTardimBase.CommandSource.BOTH;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package su.a71.tardim_ic.tardim_ic.command;
|
||||
|
||||
import dan200.computercraft.api.network.IPacketSender;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CommandSender implements IPacketSender {
|
||||
|
||||
private final Player player;
|
||||
private final Level level;
|
||||
private final BlockPos pos;
|
||||
|
||||
CommandSender(Player player, BlockPos pos) {
|
||||
this.player = player;
|
||||
this.level = player.level;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Level getLevel() {
|
||||
return this.level;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Vec3 getPosition() {
|
||||
return new Vec3(this.pos.getX(), this.pos.getY(), this.pos.getZ());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getSenderID() {
|
||||
return this.player.getName().getString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package su.a71.tardim_ic.tardim_ic.digital_interface;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.EntityBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.a71.tardim_ic.tardim_ic.Registration;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
public class DigitalInterfaceBlock extends Block implements EntityBlock {
|
||||
|
||||
public DigitalInterfaceBlock() {
|
||||
super(Properties.of(Material.METAL).strength(2, 4).noOcclusion());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) {
|
||||
return Registration.DIGITAL_TARDIM_INTERFACE_TILEENTITY.get().create(pos, state);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,727 @@
|
|||
package su.a71.tardim_ic.tardim_ic.digital_interface;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
|
||||
import dan200.computercraft.api.lua.LuaFunction;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dan200.computercraft.api.lua.ObjectLuaTable;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
|
||||
// TODO: Fabric and Forge diffirence? (Bottom: Fabric)
|
||||
import com.swdteam.tardim.TardimData;
|
||||
import com.swdteam.tardim.TardimManager;
|
||||
import com.swdteam.tardim.TardimData.Location;
|
||||
//import com.swdteam.tardim.tardim.TardimManager;
|
||||
//import com.swdteam.tardim.tardim.TardimData;
|
||||
|
||||
import com.swdteam.common.command.tardim.CommandTravel;
|
||||
import com.swdteam.common.data.DimensionMapReloadListener;
|
||||
import com.swdteam.common.init.TRDSounds;
|
||||
import com.swdteam.common.item.ItemTardim;
|
||||
import com.swdteam.main.Tardim;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class DigitalInterfacePeripheral implements IPeripheral {
|
||||
|
||||
private final List<IComputerAccess> connectedComputers = new ArrayList<>(); // List of computers connected to the peripheral
|
||||
private final DigitalInterfaceTileEntity tileEntity; // Peripheral's BlockEntity, used for accessing coordinates
|
||||
|
||||
/**
|
||||
* @param tileEntity the tile entity of this peripheral
|
||||
* @hidden
|
||||
*/
|
||||
public DigitalInterfacePeripheral(DigitalInterfaceTileEntity tileEntity) {
|
||||
this.tileEntity = tileEntity;
|
||||
}
|
||||
|
||||
/** Setting name for the peripheral. A computer will see it as "digital_tardim_interface_n"
|
||||
* @hidden
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getType() { return "digital_tardim_interface"; }
|
||||
|
||||
/** Apparently CC uses this to check if the peripheral in front of a modem is this one
|
||||
* @hidden
|
||||
* @param iPeripheral The peripheral to compare against. This may be {@code null}.
|
||||
* @return {@code true} if the peripheral is the same as this one.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(@Nullable IPeripheral iPeripheral) { return this == iPeripheral; }
|
||||
|
||||
/** Called when a computer disconnects from the peripheral
|
||||
* @hidden
|
||||
* @param computer The interface to the computer that is being detached. Remember that multiple computers can be
|
||||
* attached to a peripheral at once.
|
||||
*/
|
||||
@Override
|
||||
public void detach(@Nonnull IComputerAccess computer) { connectedComputers.remove(computer); }
|
||||
|
||||
/** Called when a computer connects to the peripheral
|
||||
* @hidden
|
||||
* @param computer The interface to the computer that is being attached. Remember that multiple computers can be
|
||||
* attached to a peripheral at once.
|
||||
*/
|
||||
@Override
|
||||
public void attach(@Nonnull IComputerAccess computer) { connectedComputers.add(computer); }
|
||||
|
||||
/**
|
||||
* I *think* I use this to get peripheral's world position
|
||||
* @hidden
|
||||
* @return
|
||||
*/
|
||||
public DigitalInterfaceTileEntity getTileEntity() {
|
||||
return tileEntity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get TARDIM's data, which we need for *every* function
|
||||
* <p>
|
||||
* We can't do a simple
|
||||
* <code>TardimManager.getFromPos(getTileEntity().getPos())</code>
|
||||
* <p>
|
||||
* because if someone attempts to call a method outside a TARDIM, this would create a new TARDIM/Point to the one with ID of 0 (Due to the way TardimSaveHandler.loadTardisData works).
|
||||
* Which is obviously not what we want.
|
||||
* <p>
|
||||
* So instead we use this, and get the ability to give user a LuaException if they think that fiddling with time is funny
|
||||
* This is mostly a copy of getIDForXZ function with some added checks
|
||||
*
|
||||
* @return TardimData of the TARDIM that the peripheral is in
|
||||
* @throws LuaException if the peripheral is not in a TARDIM
|
||||
* @hidden
|
||||
*/
|
||||
public TardimData getTardimData() throws LuaException {
|
||||
int X = getTileEntity().getPos().getX(), Z = getTileEntity().getPos().getZ();
|
||||
|
||||
int index = 0;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int dx = 0;
|
||||
int dy = 1;
|
||||
int segment_length = 1;
|
||||
int segment_passed = 0;
|
||||
boolean found = false;
|
||||
long timecheck = System.currentTimeMillis();
|
||||
|
||||
while(true) {
|
||||
if (System.currentTimeMillis() - timecheck > 10000L) {
|
||||
System.out.println("Finding ID from XZ Coordinates is taking too long!");
|
||||
break;
|
||||
}
|
||||
|
||||
if (X >= x * TardimManager.INTERIOR_BOUNDS
|
||||
&& X <= TardimManager.INTERIOR_BOUNDS + x * TardimManager.INTERIOR_BOUNDS
|
||||
&& Z >= y * TardimManager.INTERIOR_BOUNDS
|
||||
&& Z <= TardimManager.INTERIOR_BOUNDS + y * TardimManager.INTERIOR_BOUNDS) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
x += dx;
|
||||
y += dy;
|
||||
if (++segment_passed == segment_length) {
|
||||
segment_passed = 0;
|
||||
int buffer = dy;
|
||||
dy = -dx;
|
||||
dx = buffer;
|
||||
if (buffer == 0) {
|
||||
++segment_length;
|
||||
}
|
||||
}
|
||||
|
||||
++index;
|
||||
}
|
||||
|
||||
// We really don't want to access a ghost TARDIM, do we?
|
||||
if (!found) {
|
||||
throw new LuaException("Peripheral is not inside a TARDIM");
|
||||
}
|
||||
TardimData T = TardimManager.getTardim(index);
|
||||
if (T.getCurrentLocation() == null || T.getOwnerName() == null) {
|
||||
throw new LuaException("Peripheral is not inside a TARDIM");
|
||||
}
|
||||
|
||||
return T;
|
||||
}
|
||||
|
||||
// Peripheral methods ===============================================================
|
||||
|
||||
/**
|
||||
* Return how much fuel is left in the TARDIM
|
||||
*
|
||||
* @return Fuel left (Out of 100)
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final double getFuel() throws LuaException {
|
||||
return getTardimData().getFuel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get how much fuel it would take to travel to the destination
|
||||
* @return Amount of fuel needed (Out of 100)
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final double calculateFuelForJourney() throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
|
||||
if (data.getTravelLocation() == null) return 0;
|
||||
|
||||
Location curr = data.getCurrentLocation();
|
||||
Location dest = data.getTravelLocation();
|
||||
|
||||
double fuel = 0.0;
|
||||
|
||||
if (curr.getLevel() != dest.getLevel())
|
||||
{
|
||||
fuel = 10.0;
|
||||
}
|
||||
|
||||
Vec3 posA = new Vec3(curr.getPos().getX(), curr.getPos().getY(), curr.getPos().getZ());
|
||||
Vec3 posB = new Vec3(dest.getPos().getX(), dest.getPos().getY(), dest.getPos().getZ());
|
||||
fuel += posA.distanceTo(posB) / 100.0;
|
||||
if (fuel > 100.0) fuel = 100.0;
|
||||
|
||||
return fuel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the TARDIM is locked
|
||||
* @return true if locked, false if not
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final boolean isLocked() throws LuaException {
|
||||
return getTardimData().isLocked();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the TARDIM is in flight
|
||||
* @return true if in flight, false if not
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final boolean isInFlight() throws LuaException { return getTardimData().isInFlight(); }
|
||||
|
||||
/**
|
||||
* Supposedly gets UNIX timestamp of when we entered flight
|
||||
* @return UNIX timestamp if in flight, -1 if not
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final long getTimeEnteredFlight() throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
if (!data.isInFlight()) {
|
||||
return -1;
|
||||
}
|
||||
return data.getTimeEnteredFlight();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get username of the TARDIM's owner
|
||||
* @return String of the owner's username
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final String getOwnerName() throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
return data.getOwnerName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock/unlock the TARDIM
|
||||
* @param locked true to lock, false to unlock
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void setLocked(boolean locked) throws LuaException {
|
||||
getTardimData().setLocked(locked);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current location of the TARDIM
|
||||
* @return ObjectLuaTable of the current location with the following keys:
|
||||
* <ul>
|
||||
* <li>dimension - String of the dimension</li>
|
||||
* <li>pos - table with the keys x, y, z that hold numbers</li>
|
||||
* <li>facing - String of the facing</li>
|
||||
* </ul>
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final ObjectLuaTable getCurrentLocation() throws LuaException {
|
||||
Location loc = getTardimData().getCurrentLocation();
|
||||
return new ObjectLuaTable(Map.of(
|
||||
"dimension", loc.getLevel().location().toString(),
|
||||
"pos", new ObjectLuaTable(Map.of(
|
||||
"x", loc.getPos().getX(),
|
||||
"y", loc.getPos().getY(),
|
||||
"z", loc.getPos().getZ()
|
||||
)),
|
||||
"facing", loc.getFacing().toString()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current location of the TARDIM
|
||||
* @return if there is no destination returns null.
|
||||
* <p>
|
||||
* Otherwise, ObjectLuaTable of the current location with the following keys:
|
||||
* <ul>
|
||||
* <li>dimension - String of the dimension</li>
|
||||
* <li>pos - table with the keys x, y, z that hold numbers</li>
|
||||
* <li>facing - String of the facing</li>
|
||||
* </ul>
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final ObjectLuaTable getTravelLocation() throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
if (data.getTravelLocation() == null) {
|
||||
data.setTravelLocation(data.getCurrentLocation());
|
||||
}
|
||||
Location loc = data.getTravelLocation();
|
||||
return new ObjectLuaTable(Map.of(
|
||||
"dimension", loc.getLevel().location().toString(),
|
||||
"pos", new ObjectLuaTable(Map.of(
|
||||
"x", loc.getPos().getX(),
|
||||
"y", loc.getPos().getY(),
|
||||
"z", loc.getPos().getZ()
|
||||
)),
|
||||
"facing", loc.getFacing().toString()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of the TARDIM owner's companions
|
||||
* @return ObjectLuaTable containing the usernames of the companions
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final ObjectLuaTable getCompanions() throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
Map<Integer, String> companions = new HashMap<>();
|
||||
for (int i = 0; i < data.getCompanions().size(); i++) {
|
||||
companions.put(i + 1, data.getCompanions().get(i).getUsername());
|
||||
}
|
||||
return new ObjectLuaTable(companions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set dimension for the TARDIM to travel to
|
||||
* <p>
|
||||
* This is a serious hazard right now due to the fact that I am unable to check if the dimension is valid.
|
||||
* <p>
|
||||
* TODO: If invalid dimension is given, the TARDIM is unable to land until the dimension is changed. Add proper checks.
|
||||
* @param dimension String of the dimension e.g. "minecraft:overworld"
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void setDimension(String dimension) throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
|
||||
String key = dimension;
|
||||
dimension = DimensionMapReloadListener.toTitleCase(dimension);
|
||||
if (TardimManager.DIMENSION_MAP.containsKey(dimension)) {
|
||||
key = (String)TardimManager.DIMENSION_MAP.get(dimension);
|
||||
} else {
|
||||
dimension = dimension.toLowerCase();
|
||||
}
|
||||
|
||||
if (!CommandTravel.isValidPath(key)) {
|
||||
throw new LuaException("Invalid dimension");
|
||||
} else {
|
||||
ResourceKey<Level> dim = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(dimension));
|
||||
if (data.getTravelLocation() == null) {
|
||||
data.setTravelLocation(new Location(data.getCurrentLocation()));
|
||||
}
|
||||
|
||||
data.getTravelLocation().setLocation(dim);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the destination's coordinates
|
||||
* @param x X coordinate
|
||||
* @param y Y coordinate
|
||||
* @param z Z coordinate
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void setTravelLocation(int x, int y, int z) throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
if (data.getTravelLocation() == null) {
|
||||
data.setTravelLocation(new Location(data.getCurrentLocation()));
|
||||
}
|
||||
|
||||
data.getTravelLocation().setPosition(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set destination to the TARDIM's owner's home (Must be online)
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void home() throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
|
||||
UUID uuid = data.getOwner();
|
||||
String username = data.getOwnerName();
|
||||
if (uuid == null || username == null) {
|
||||
throw new LuaException("TARDIM has no owner");
|
||||
}
|
||||
|
||||
PlayerList playerList = ServerLifecycleHooks.getCurrentServer().getPlayerList();
|
||||
ServerPlayer player = playerList.getPlayer(uuid);
|
||||
if (player == null) {
|
||||
throw new LuaException("TARDIM owner is not online");
|
||||
}
|
||||
|
||||
ResourceKey<Level> dim = player.getRespawnDimension();
|
||||
BlockPos pos = player.getRespawnPosition();
|
||||
if (pos == null) {
|
||||
throw new LuaException("TARDIM owner has no home");
|
||||
}
|
||||
|
||||
setDimension(dim.location().toString());
|
||||
setTravelLocation(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set destination for a player's location (Player must be online)
|
||||
* @param username - String of the username of the player
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void locatePlayer(String username) throws LuaException {
|
||||
PlayerList playerList = ServerLifecycleHooks.getCurrentServer().getPlayerList();
|
||||
ServerPlayer player = playerList.getPlayerByName(username);
|
||||
if (player == null) {
|
||||
throw new LuaException("Player not found");
|
||||
}
|
||||
|
||||
ResourceKey<Level> dim = player.getCommandSenderWorld().dimension();
|
||||
BlockPos pos = player.blockPosition();
|
||||
|
||||
setDimension(dim.location().toString());
|
||||
setTravelLocation(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get online players. Useful for making a GUI for the locate function or just a nice dashboard.
|
||||
*
|
||||
* @return ObjectLuaTable of the online players
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final ObjectLuaTable getOnlinePlayers() throws LuaException {
|
||||
PlayerList playerList = ServerLifecycleHooks.getCurrentServer().getPlayerList();
|
||||
Map<Integer, String> players = new HashMap<>();
|
||||
for (int i = 0; i < playerList.getPlayers().size(); i++) {
|
||||
players.put(i + 1, playerList.getPlayers().get(i).getGameProfile().getName());
|
||||
}
|
||||
|
||||
return new ObjectLuaTable(players);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rotation of the TARDIM's door
|
||||
* @return String of the door rotation ("north", "south", "east", "west")
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final String getDoorRotation() throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
Direction rotation = data.getTravelLocation().getFacing();
|
||||
switch (rotation) {
|
||||
case NORTH -> {
|
||||
return "north";
|
||||
}
|
||||
case EAST -> {
|
||||
return "east";
|
||||
}
|
||||
case SOUTH -> {
|
||||
return "south";
|
||||
}
|
||||
case WEST -> {
|
||||
return "west";
|
||||
}
|
||||
default -> {
|
||||
throw new LuaException("Invalid door rotation");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the rotation of the TARDIM's door
|
||||
* @param rotation String of the door rotation ("north", "south", "east", "west")
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void setDoorRotation(String rotation) throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
switch (rotation) {
|
||||
case "north" -> data.getTravelLocation().setFacing(Direction.NORTH);
|
||||
case "east" -> data.getTravelLocation().setFacing(Direction.EAST);
|
||||
case "south" -> data.getTravelLocation().setFacing(Direction.SOUTH);
|
||||
case "west" -> data.getTravelLocation().setFacing(Direction.WEST);
|
||||
default -> throw new LuaException("Invalid door rotation");
|
||||
}
|
||||
|
||||
data.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the rotation of the TARDIM's door (north -> east -> south -> west -> north)
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void toggleDoorRotation() throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
if (data.getTravelLocation() == null) {
|
||||
data.setTravelLocation(new Location(data.getCurrentLocation()));
|
||||
}
|
||||
|
||||
if (data.getTravelLocation().getFacing() == null) {
|
||||
data.getTravelLocation().setFacing(Direction.NORTH);
|
||||
}
|
||||
|
||||
switch (data.getTravelLocation().getFacing()) {
|
||||
case NORTH -> data.getTravelLocation().setFacing(Direction.EAST);
|
||||
case EAST -> data.getTravelLocation().setFacing(Direction.SOUTH);
|
||||
case SOUTH -> data.getTravelLocation().setFacing(Direction.WEST);
|
||||
case WEST -> data.getTravelLocation().setFacing(Direction.NORTH);
|
||||
default -> data.getTravelLocation().setFacing(Direction.NORTH);
|
||||
}
|
||||
|
||||
data.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a number to the destination's coordinates
|
||||
* @param axis String of the axis ("x", "y", "z")
|
||||
* @param amount Number to add to the axis
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void coordAdd(String axis, int amount) throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
if (data.getTravelLocation() == null) {
|
||||
data.setTravelLocation(new Location(data.getCurrentLocation()));
|
||||
}
|
||||
|
||||
Location location = data.getTravelLocation();
|
||||
switch (axis) {
|
||||
case "x" -> location.addPosition(amount, 0, 0);
|
||||
case "y" -> location.addPosition(0, amount, 0);
|
||||
case "z" -> location.addPosition(0, 0, amount);
|
||||
default -> throw new LuaException("Invalid axis");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dematerialize the TARDIM
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void demat() throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
|
||||
if (data.isInFlight()) {
|
||||
throw new LuaException("TARDIM is already in flight");
|
||||
}
|
||||
Location loc = data.getCurrentLocation();
|
||||
ServerLevel level = ServerLifecycleHooks.getCurrentServer().getLevel(loc.getLevel());
|
||||
ItemTardim.destroyTardim(level, loc.getPos(), Direction.NORTH);
|
||||
data.setInFlight(true);
|
||||
if (data.getTravelLocation() == null) {
|
||||
data.setTravelLocation(new Location(data.getCurrentLocation()));
|
||||
}
|
||||
|
||||
// TODO: This is a horrendous way of doing this. Please fix.
|
||||
String level_str = "tardim:tardis_dimension";
|
||||
ServerLifecycleHooks.getCurrentServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(level_str))).playSound(null, this.tileEntity.getPos(), (SoundEvent) TRDSounds.TARDIM_TAKEOFF.get(), SoundSource.AMBIENT, 1.0F, 1.0F);
|
||||
|
||||
data.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Materialize the TARDIM at the destination
|
||||
* <p>
|
||||
* Has a LOT of checks to make sure the TARDIM can materialize, so please implement error handling if you use this.
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void remat() throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
|
||||
if (data.isInFlight()) {
|
||||
if (data.getTimeEnteredFlight() < System.currentTimeMillis() / 1000L - 10L) {
|
||||
Location loc = data.getTravelLocation();
|
||||
ServerLevel level = ServerLifecycleHooks.getCurrentServer().getLevel(loc.getLevel());
|
||||
double fuel = data.calculateFuelForJourney(
|
||||
ServerLifecycleHooks.getCurrentServer().getLevel(data.getCurrentLocation().getLevel()), level, data.getCurrentLocation().getPos(), loc.getPos()
|
||||
);
|
||||
if (data.getFuel() >= fuel) {
|
||||
level.getChunk(loc.getPos());
|
||||
BlockPos landingPosButBetter = CommandTravel.getLandingPosition(level, loc.getPos());
|
||||
boolean recalc = false;
|
||||
|
||||
for(int jj = 0; jj < 32; ++jj) {
|
||||
if (!Block.canSupportRigidBlock(level, landingPosButBetter.below())) {
|
||||
BlockPos pos2 = landingPosButBetter.offset(
|
||||
level.random.nextInt(10) * (level.random.nextBoolean() ? 1 : -1),
|
||||
0,
|
||||
level.random.nextInt(10) * (level.random.nextBoolean() ? 1 : -1)
|
||||
);
|
||||
landingPosButBetter = CommandTravel.getLandingPosition(level, pos2);
|
||||
if (Block.canSupportRigidBlock(level, landingPosButBetter.below())) {
|
||||
recalc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!recalc) {
|
||||
for(int jj = 0; jj < 32; ++jj) {
|
||||
if (!Block.canSupportRigidBlock(level, landingPosButBetter.below())) {
|
||||
BlockPos pos2 = landingPosButBetter.offset(
|
||||
level.random.nextInt(30) * (level.random.nextBoolean() ? 1 : -1),
|
||||
0,
|
||||
level.random.nextInt(30) * (level.random.nextBoolean() ? 1 : -1)
|
||||
);
|
||||
landingPosButBetter = CommandTravel.getLandingPosition(level, pos2);
|
||||
if (Block.canSupportRigidBlock(level, landingPosButBetter.below())) {
|
||||
recalc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!recalc) {
|
||||
for(int jj = 0; jj < 32; ++jj) {
|
||||
if (!Block.canSupportRigidBlock(level, landingPosButBetter.below())) {
|
||||
BlockPos pos2 = landingPosButBetter.offset(
|
||||
level.random.nextInt(50) * (level.random.nextBoolean() ? 1 : -1),
|
||||
0,
|
||||
level.random.nextInt(50) * (level.random.nextBoolean() ? 1 : -1)
|
||||
);
|
||||
landingPosButBetter = CommandTravel.getLandingPosition(level, pos2);
|
||||
if (Block.canSupportRigidBlock(level, landingPosButBetter.below())) {
|
||||
recalc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Block.canSupportRigidBlock(level, landingPosButBetter.below())) {
|
||||
loc.setPosition(landingPosButBetter.getX(), landingPosButBetter.getY(), landingPosButBetter.getZ());
|
||||
if (Tardim.isPosValid(level, loc.getPos())) {
|
||||
ItemTardim.buildTardim(level, loc.getPos(), data.getTravelLocation().getFacing(), data.getId());
|
||||
data.setCurrentLocation(data.getTravelLocation());
|
||||
data.setTravelLocation(null);
|
||||
data.setInFlight(false);
|
||||
data.addFuel(-fuel);
|
||||
data.save();
|
||||
|
||||
// if (!recalc) {
|
||||
// sendResponse(player, "TARDIM is landing", CommandTardimBase.ResponseType.COMPLETE, source);
|
||||
// } else {
|
||||
// sendResponse(player, "Landing recalculated due to obstruction", CommandTardimBase.ResponseType.INFO, source);
|
||||
// sendResponse(player, "TARDIM is landing", CommandTardimBase.ResponseType.COMPLETE, source);
|
||||
// }
|
||||
|
||||
String level_str = "tardim:tardis_dimension";
|
||||
ServerLifecycleHooks.getCurrentServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(level_str))).playSound(null, this.tileEntity.getPos(), (SoundEvent) TRDSounds.TARDIM_LANDING.get(), SoundSource.AMBIENT, 1.0F, 1.0F);
|
||||
|
||||
} else {
|
||||
throw new LuaException("TARDIM landing obstructed. Aborting...");
|
||||
}
|
||||
} else {
|
||||
throw new LuaException("TARDIM landing obstructed. Aborting...");
|
||||
}
|
||||
} else {
|
||||
throw new LuaException("Not enough fuel for journey");
|
||||
}
|
||||
} else {
|
||||
throw new LuaException("TARDIM is still taking off");
|
||||
}
|
||||
} else {
|
||||
throw new LuaException("TARDIM has already landed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate a biome
|
||||
* @param biome_str String of the biome e.g. "minecraft:plains"
|
||||
*/
|
||||
@LuaFunction(mainThread = true)
|
||||
public final void locateBiome(String biome_str) throws LuaException {
|
||||
TardimData data = getTardimData();
|
||||
if (data.getTravelLocation() == null) {
|
||||
data.setTravelLocation(new Location(data.getCurrentLocation()));
|
||||
}
|
||||
|
||||
Optional<Biome> biome = ServerLifecycleHooks.getCurrentServer()
|
||||
.registryAccess()
|
||||
.registryOrThrow(Registry.BIOME_REGISTRY)
|
||||
.getOptional(new ResourceLocation(biome_str));
|
||||
if (biome != null && biome.isPresent()) {
|
||||
if (data.getTravelLocation() == null) {
|
||||
data.setTravelLocation(new Location(data.getCurrentLocation()));
|
||||
}
|
||||
|
||||
ServerLevel level = ServerLifecycleHooks.getCurrentServer().getLevel(data.getTravelLocation().getLevel());
|
||||
BlockPos blockpos = new BlockPos(
|
||||
data.getTravelLocation().getPos().getX(),
|
||||
level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, data.getTravelLocation().getPos()).getY(),
|
||||
data.getTravelLocation().getPos().getZ()
|
||||
);
|
||||
BlockPos blockpos1 = this.findNearestBiome(level, (Biome)biome.get(), blockpos, 6400, 8);
|
||||
if (blockpos1 != null) {
|
||||
data.getTravelLocation().setPosition(blockpos1.getX(), blockpos1.getY(), blockpos1.getZ());
|
||||
data.save();
|
||||
} else {
|
||||
throw new LuaException("Biome not found");
|
||||
}
|
||||
} else {
|
||||
throw new LuaException("Unknown biome");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to find a biome
|
||||
* @param level ServerLevel to search
|
||||
* @param biome Biome to find
|
||||
* @param pos BlockPos to start from
|
||||
* @param i Idk what this is, likely a radius
|
||||
* @param j No idea about this either
|
||||
* @return BlockPos of the biome
|
||||
* @hidden
|
||||
*/
|
||||
public BlockPos findNearestBiome(ServerLevel level, Biome biome, BlockPos pos, int i, int j) {
|
||||
Pair<BlockPos, Holder<Biome>> bb = level.getChunkSource()
|
||||
.getGenerator()
|
||||
.getBiomeSource()
|
||||
.findBiomeHorizontal(
|
||||
pos.getX(),
|
||||
pos.getY(),
|
||||
pos.getZ(),
|
||||
i,
|
||||
j,
|
||||
b_val -> b_val.value() == biome,
|
||||
level.random,
|
||||
true,
|
||||
level.getChunkSource().randomState().sampler()
|
||||
);
|
||||
return bb != null && bb.getFirst() != null ? (BlockPos)bb.getFirst() : null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package su.a71.tardim_ic.tardim_ic.digital_interface;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.a71.tardim_ic.tardim_ic.Registration;
|
||||
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import static dan200.computercraft.shared.Capabilities.CAPABILITY_PERIPHERAL;
|
||||
|
||||
public class DigitalInterfaceTileEntity extends BlockEntity {
|
||||
|
||||
public DigitalInterfaceTileEntity(BlockPos pos, BlockState state) {
|
||||
super(Registration.DIGITAL_TARDIM_INTERFACE_TILEENTITY.get(), pos, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Our peripheral, we create a new peripheral for each new tile entity
|
||||
*/
|
||||
protected DigitalInterfacePeripheral peripheral = new DigitalInterfacePeripheral(this);
|
||||
private LazyOptional<IPeripheral> peripheralCap;
|
||||
public BlockPos getPos() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* When a computer modem tries to wrap our block, the modem will call getCapability to receive our peripheral.
|
||||
* Then we just simply return a {@link LazyOptional} with our Peripheral
|
||||
*/
|
||||
@Override
|
||||
@NotNull
|
||||
public <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, Direction direction) {
|
||||
if (cap == CAPABILITY_PERIPHERAL) {
|
||||
if (peripheralCap == null) {
|
||||
peripheralCap = LazyOptional.of(() -> peripheral);
|
||||
}
|
||||
return peripheralCap.cast();
|
||||
}
|
||||
return super.getCapability(cap, direction);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package su.a71.tardim_ic.tardim_ic.redsone_input;
|
||||
|
||||
import com.swdteam.common.block.BlockBaseTardimPanel;
|
||||
|
||||
import com.swdteam.common.init.TRDDimensions;
|
||||
import com.swdteam.common.init.TRDSounds;
|
||||
import com.swdteam.network.NetworkHandler;
|
||||
import com.swdteam.network.packets.PacketOpenEditGui;
|
||||
import com.swdteam.tardim.TardimData;
|
||||
import com.swdteam.tardim.TardimManager;
|
||||
import com.swdteam.tileentity.TileEntityBaseTardimPanel;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.EntityBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import su.a71.tardim_ic.tardim_ic.Registration;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RedstoneInputBlock extends BlockBaseTardimPanel implements EntityBlock {
|
||||
private boolean isPowered = false;
|
||||
public RedstoneInputBlock() {
|
||||
super(Properties.of(Material.METAL).strength(2, 4).noOcclusion());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) {
|
||||
return Registration.REDSTONE_TARDIM_INPUT_TILEENTITY.get().create(pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult use(BlockState blockState, Level w, BlockPos blockPos, Player player, InteractionHand hand, BlockHitResult p_60508_) {
|
||||
if (!w.isClientSide) {
|
||||
|
||||
w.playSound((Player)null, blockPos, (SoundEvent) TRDSounds.TARDIM_BEEP.get(), SoundSource.BLOCKS, 0.3F, 0.5F);
|
||||
|
||||
BlockEntity be = w.getBlockEntity(blockPos);
|
||||
if (be instanceof TileEntityBaseTardimPanel && w.dimension() == TRDDimensions.TARDIS) {
|
||||
TardimData data = TardimManager.getFromPos(blockPos);
|
||||
if (data != null && data.hasPermission(player)) {
|
||||
NetworkHandler.sendTo((ServerPlayer)player, new PacketOpenEditGui(1, blockPos));
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
player.displayClientMessage(
|
||||
Component.literal("You do not have permission").withStyle(ChatFormatting.DARK_RED).withStyle(ChatFormatting.BOLD), true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
public boolean canSurvive(BlockState blockState, LevelReader levelReader, BlockPos blockPos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, BlockPos fromPos, boolean isMoving) {
|
||||
DebugPackets.sendNeighborsUpdatePacket(level, blockPos);
|
||||
|
||||
// get redstone signal
|
||||
Direction direction = blockState.getValue(FACING);
|
||||
int redstoneSignal = level.getSignal(blockPos, direction);
|
||||
if (redstoneSignal > 0 && !isPowered) {
|
||||
isPowered = true;
|
||||
BlockEntity be = level.getBlockEntity(blockPos);
|
||||
if (be instanceof TileEntityBaseTardimPanel && level.dimension() == TRDDimensions.TARDIS) {
|
||||
TardimData data = TardimManager.getFromPos(blockPos);
|
||||
if (data != null) {
|
||||
if (((TileEntityBaseTardimPanel)be).hasCommand()) {
|
||||
((TileEntityBaseTardimPanel)be).execute(FakePlayerFactory.getMinecraft(ServerLifecycleHooks.getCurrentServer().getLevel(level.dimension())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (redstoneSignal == 0 && isPowered)
|
||||
isPowered = false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package su.a71.tardim_ic.tardim_ic.redsone_input;
|
||||
|
||||
import com.swdteam.tileentity.TileEntityBaseTardimPanel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.swdteam.common.init.TRDTiles;
|
||||
|
||||
import su.a71.tardim_ic.tardim_ic.Registration;
|
||||
import com.swdteam.tileentity.TileEntityTardimScanner;
|
||||
import com.swdteam.common.block.BlockTardimScanner;
|
||||
|
||||
|
||||
public class RedstoneInputTileEntity extends TileEntityBaseTardimPanel {
|
||||
public RedstoneInputTileEntity(BlockPos pos, BlockState state) {
|
||||
super(Registration.REDSTONE_TARDIM_INPUT_TILEENTITY.get(), pos, state);
|
||||
}
|
||||
|
||||
|
||||
public BlockPos getPos() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package su.a71.tardim_ic.tardim_ic.sonic;
|
||||
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
import com.swdteam.tardim.TardimData;
|
||||
import com.swdteam.tardim.TardimManager;
|
||||
|
||||
import com.swdteam.client.gui.GuiCommandScreen;
|
||||
|
||||
public class SonicProbe extends Item {
|
||||
private TardimData tardim;
|
||||
public SonicProbe(Properties properties) {
|
||||
super(properties.stacksTo(1));
|
||||
}
|
||||
|
||||
public void setTardim(TardimData tardim) {
|
||||
this.tardim = tardim;
|
||||
}
|
||||
|
||||
// Add tile entity
|
||||
|
||||
}
|
46
Forge/src/main/resources/META-INF/mods.toml
Normal file
46
Forge/src/main/resources/META-INF/mods.toml
Normal file
|
@ -0,0 +1,46 @@
|
|||
|
||||
modLoader = "javafml" #mandatory
|
||||
loaderVersion="[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
license = "All rights reserved"
|
||||
[[mods]] #mandatory
|
||||
# The modid of the mod
|
||||
modId = "tardim_ic" #mandatory
|
||||
version = "0.9" #mandatory
|
||||
# A display name for the mod
|
||||
displayName = "TARDIM: In Control" #mandatory
|
||||
# The description text for the mod (multi line!) (#mandatory)
|
||||
description = '''
|
||||
All of time and space, now automated. Control your TARDIM using ComputerCraft: Tweaked.
|
||||
'''
|
||||
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||
[[dependencies.tardim_ic]] #optional
|
||||
# the modid of the dependency
|
||||
modId = "forge" #mandatory
|
||||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory = true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange="[43,)" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||
ordering = "NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||
side = "BOTH"
|
||||
# Here's another dependency
|
||||
[[dependencies.tardim_ic]]
|
||||
modId = "computercraft"
|
||||
mandatory = true
|
||||
versionRange = "1.95.3"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
[[dependencies.tardim_ic]]
|
||||
modId = "tardim"
|
||||
mandatory = true
|
||||
versionRange = "1.1.3"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
[[dependencies.tardim_ic]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange = "1.19.2"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
25
README.md
Normal file
25
README.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# MultiLoader Template
|
||||
|
||||
This project provides a Gradle project template that can compile mods for both Forge and Fabric using a common sourceset. This project does not require any third party libraries or dependencies.
|
||||
|
||||
## Getting Started
|
||||
|
||||
## IntelliJ IDEA
|
||||
This guide will show how to import the MultiLoader Template into IntelliJ IDEA. The setup process is roughly equivalent to setting up Forge and Fabric independently and should be very familiar to anyone who has worked with their MDKs.
|
||||
|
||||
1. Clone or download this repository to your computer.
|
||||
2. Configure the project by editing the `group`, `mod_name`, `mod_author`, and `mod_id` properties in the `gradle.properties` file. You will also need to change the `rootProject.name` property in `settings.gradle`.
|
||||
3. Open the template's root folder as a new project in IDEA. This is the folder that contains this README file and the gradlew executable.
|
||||
4. If your default JVM/JDK is not Java 17 you will encounter an error when opening the project. This error is fixed by going to `File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JVM`and changing the value to a valid Java 17 JVM. You will also need to set the Project SDK to Java 17. This can be done by going to `File > Project Structure > Project SDK`. Once both have been set open the Gradle tab in IDEA and click the refresh button to reload the project.
|
||||
5. Open the Gradle tab in IDEA if it has not already been opened. Navigate to `Your Project > Common > Tasks > vanilla gradle > decompile`. Run this task to decompile Minecraft.
|
||||
6. Open the Gradle tab in IDEA if it has not already been opened. Navigate to `Your Project > Forge > Tasks > forgegradle runs > genIntellijRuns`. Run this task to set up run configurations for Forge.
|
||||
7. Open your Run/Debug Configurations. Under the Application category there should now be options to run Forge and Fabric projects. Select one of the client options and try to run it.
|
||||
8. Assuming you were able to run the game in step 7 your workspace should now be set up.
|
||||
|
||||
### Eclipse
|
||||
While it is possible to use this template in Eclipse it is not recommended. During the development of this template multiple critical bugs and quirks related to Eclipse were found at nearly every level of the required build tools. While we continue to work with these tools to report and resolve issues support for projects like these are not there yet. For now Eclipse is considered unsupported by this project. The development cycle for build tools is notoriously slow so there are no ETAs available.
|
||||
|
||||
## Development Guide
|
||||
When using this template the majority of your mod is developed in the Common project. The Common project is compiled against the vanilla game and is used to hold code that is shared between the different loader-specific versions of your mod. The Common project has no knowledge or access to ModLoader specific code, apis, or concepts. Code that requires something from a specific loader must be done through the project that is specific to that loader, such as the Forge or Fabric project.
|
||||
|
||||
Loader specific projects such as the Forge and Fabric project are used to load the Common project into the game. These projects also define code that is specific to that loader. Loader specific projects can access all of the code in the Common project. It is important to remember that the Common project can not access code from loader specific projects.
|
66
build.gradle
Normal file
66
build.gradle
Normal file
|
@ -0,0 +1,66 @@
|
|||
subprojects {
|
||||
|
||||
apply plugin: 'java'
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
java.withSourcesJar()
|
||||
java.withJavadocJar()
|
||||
|
||||
jar {
|
||||
from(rootProject.file("LICENSE")) {
|
||||
rename { "${it}_${mod_name}" }
|
||||
}
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_name,
|
||||
'Specification-Vendor' : mod_author,
|
||||
'Specification-Version' : project.jar.archiveVersion,
|
||||
'Implementation-Title' : project.name,
|
||||
'Implementation-Version' : project.jar.archiveVersion,
|
||||
'Implementation-Vendor' : mod_author,
|
||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
'Timestamp' : System.currentTimeMillis(),
|
||||
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
|
||||
'Built-On-Minecraft' : minecraft_version
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
from(rootProject.file("LICENSE")) {
|
||||
rename { "${it}_${mod_name}" }
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
name = 'Sponge / Mixin'
|
||||
url = 'https://repo.spongepowered.org/repository/maven-public/'
|
||||
}
|
||||
|
||||
maven {
|
||||
name = 'BlameJared Maven (CrT / Bookshelf)'
|
||||
url = 'https://maven.blamejared.com'
|
||||
}
|
||||
|
||||
maven { url 'https://squiddev.cc/maven/' }
|
||||
maven { url "https://cursemaven.com"}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
|
||||
it.options.encoding = 'UTF-8'
|
||||
it.options.release = 17
|
||||
}
|
||||
|
||||
// Disables Gradle's custom module metadata from being published to maven. The
|
||||
// metadata includes mapped dependencies which are not reasonably consumable by
|
||||
// other mod developers.
|
||||
tasks.withType(GenerateModuleMetadata) {
|
||||
|
||||
enabled = false
|
||||
}
|
||||
}
|
28
gradle.properties
Normal file
28
gradle.properties
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Project
|
||||
version=0.9
|
||||
group=su.a71.tardim_ic
|
||||
|
||||
# Common
|
||||
minecraft_version=1.19.2
|
||||
common_runs_enabled=false
|
||||
common_client_run_name=Common Client
|
||||
common_server_run_name=Common Server
|
||||
|
||||
# Forge
|
||||
forge_version=43.1.30
|
||||
//forge_ats_enabled=true
|
||||
|
||||
# Fabric
|
||||
fabric_version=0.62.0+1.19.2
|
||||
fabric_loader_version=0.14.9
|
||||
|
||||
# Mod options
|
||||
mod_name="TARDIM: In Control"
|
||||
mod_author=Andrew_7_1
|
||||
mod_id=tardim_ic
|
||||
|
||||
# Gradle
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
cc_version=1.100.9
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
183
gradlew
vendored
Executable file
183
gradlew
vendored
Executable file
|
@ -0,0 +1,183 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MSYS* | MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
ARGV=("$@")
|
||||
eval set -- $DEFAULT_JVM_OPTS
|
||||
|
||||
IFS=$'
|
||||
' read -rd '' -a JAVA_OPTS_ARR <<< "$(echo $JAVA_OPTS | xargs -n1)"
|
||||
IFS=$'
|
||||
' read -rd '' -a GRADLE_OPTS_ARR <<< "$(echo $GRADLE_OPTS | xargs -n1)"
|
||||
|
||||
exec "$JAVACMD" "$@" "${JAVA_OPTS_ARR[@]}" "${GRADLE_OPTS_ARR[@]}" "-Dorg.gradle.appname=$APP_BASE_NAME" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "${ARGV[@]}"
|
89
gradlew.bat
vendored
Normal file
89
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
12
scripts/basicTest.lua
Normal file
12
scripts/basicTest.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
-- This is a very basic test script
|
||||
-- This basically just verifies the mod works
|
||||
|
||||
local int = peripheral.find("digital_tardim_interface")
|
||||
if int == nil then
|
||||
error("No interface found")
|
||||
end
|
||||
|
||||
print(int.getOwnerName() .. "'s TARDIM")
|
||||
print("FUEL: " .. int.getFuel() .. "/100")
|
||||
print("IN FLIGHT? " .. int.isInFlight())
|
||||
print("IS LOCKED? " .. int.isLocked())
|
16
settings.gradle
Normal file
16
settings.gradle
Normal file
|
@ -0,0 +1,16 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
maven {
|
||||
name = 'Sponge Snapshots'
|
||||
url = 'https://repo.spongepowered.org/repository/maven-public/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = 'tardim_ic'
|
||||
include("Common", "Fabric", "Forge")
|
Loading…
Add table
Reference in a new issue