Begin 1.20 port (god this is horrible)

This commit is contained in:
Andrew-71 2023-07-29 21:07:20 +03:00
parent 8730ae91a0
commit 987a18c360
105 changed files with 757 additions and 2300 deletions

View file

@ -1,66 +1,34 @@
plugins {
id 'idea'
id 'java'
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
id 'maven-publish'
id 'org.spongepowered.gradle.vanilla'
}
base {
archivesName = "${mod_name}-common-${minecraft_version}"
}
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"))
}
}
}
}
repositories {
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
if(file("src/main/resources/${mod_id}.accesswidener").exists()){
accessWideners(file("src/main/resources/${mod_id}.accesswidener"))
}
}
dependencies {
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
// CC: R and TARDIM
//implementation("curse.maven:cc-restitched-462672:3908334")
//compileOnly("org.squiddev:cc-tweaked-1.19.1:${cc_version}")
//compileOnly("curse.maven:tardim-531315:4453925")
//implementation ("org.squiddev:cc-tweaked-1.19.1:${cc_version}")
}
processResources {
def buildProps = project.properties.clone()
filesMatching(['pack.mcmeta']) {
expand buildProps
}
// ComputerCraft
compileOnly("cc.tweaked:cc-tweaked-$minecraft_version-common-api:$cc_version")
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
artifactId base.archivesName.get()
from components.java
}
}
repositories {
maven {
url "file://" + System.getenv("local_maven")

View file

@ -0,0 +1,11 @@
package su.a71.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);
}

View file

@ -0,0 +1,8 @@
package su.a71.tardim_ic;
public class Registration {
public static void register() {
}
}

View file

@ -0,0 +1,25 @@
package su.a71.tardim_ic.platform;
import com.example.examplemod.Constants;
import su.a71.tardim_ic.platform.services.IPlatformHelper;
import java.util.ServiceLoader;
public class Services {
// Platform helper that lets us do stuff for Forge/Fabric while being in Common
public static final IPlatformHelper PLATFORM = load(IPlatformHelper.class);
// This code is used to load a service for the current environment. Your implementation of the service must be defined
// manually by including a text file in META-INF/services named with the fully qualified class name of the service.
// Inside the file you should write the fully qualified class name of the implementation to load for the platform. For
// example our file on Forge points to ForgePlatformHelper while Fabric points to FabricPlatformHelper.
public static <T> T load(Class<T> clazz) {
final T loadedService = ServiceLoader.load(clazz)
.findFirst()
.orElseThrow(() -> new NullPointerException("Failed to load service for " + clazz.getName()));
Constants.LOG.debug("Loaded {} for service {}", loadedService, clazz);
return loadedService;
}
}

View file

@ -0,0 +1,38 @@
package su.a71.tardim_ic.platform.services;
public interface IPlatformHelper {
/**
* Gets the name of the current platform
*
* @return The name of the current platform.
*/
String getPlatformName();
/**
* Checks if a mod with the given id is loaded.
*
* @param modId The mod to check if it is loaded.
* @return True if the mod is loaded, false otherwise.
*/
boolean isModLoaded(String modId);
/**
* Check if the game is currently in a development environment.
*
* @return True if in a development environment, false otherwise.
*/
boolean isDevelopmentEnvironment();
/**
* Gets the name of the environment type as a string.
*
* @return The name of the environment type.
*/
default String getEnvironmentName() {
return isDevelopmentEnvironment() ? "development" : "production";
}
// TODO: Add registration stuff here?
}

View file

@ -1,19 +0,0 @@
package su.a71.tardim_ic.tardim_ic;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
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;
public static final Gson GSON;
static {
LOG = LoggerFactory.getLogger(MOD_NAME);
GSON = (new GsonBuilder()).setPrettyPrinting().create();
}
}

View file

@ -1,4 +1,4 @@
package su.a71.tardim_ic.tardim_ic.utils;
package su.a71.tardim_ic.utils;
import com.mojang.authlib.GameProfile;
import net.minecraft.core.BlockPos;
@ -7,14 +7,18 @@ import net.minecraft.world.level.Level;
import java.util.UUID;
/**
* This class is used whenever we need a player for a function but cannot get one
* (i.g we are on server side and need to execute TARDIM command)
*/
public class FakePlayer extends Player {
public FakePlayer(Level lvl, BlockPos blockPos) {
super(lvl, blockPos, 0, new GameProfile(UUID.randomUUID(), "FakePlayer_tardimic"), null);
super(lvl, blockPos, 0, new GameProfile(UUID.randomUUID(), "FakePlayer_tardimic"));
}
public FakePlayer(Level lvl, BlockPos blockPos, UUID id) {
super(lvl, blockPos, 0, new GameProfile(id, "FakePlayer_tardimic"), null);
super(lvl, blockPos, 0, new GameProfile(id, "FakePlayer_tardimic"));
}
@ -28,5 +32,3 @@ public class FakePlayer extends Player {
return false;
}
}

View file

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Before After
Before After

View file

@ -3,8 +3,8 @@
"parent": "digital_tardim_interface",
"texture_size": [64, 64],
"textures": {
"1": "tardim_ic:blocks/digital_tardim_interface",
"particle": "tardim_ic:blocks/digital_tardim_interface"
"1": "tardim_ic:block/digital_tardim_interface",
"particle": "tardim_ic:block/digital_tardim_interface"
},
"elements": [
{

View file

@ -2,8 +2,8 @@
"credit": "Made by karoter2 (Feulim)",
"texture_size": [128, 128],
"textures": {
"0": "tardim_ic:blocks/food_machine",
"particle": "tardim_ic:blocks/food_machine"
"0": "tardim_ic:block/food_machine",
"particle": "tardim_ic:block/food_machine"
},
"elements": [
{

View file

@ -3,9 +3,9 @@
"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"
"1": "tardim_ic:block/redstone_input",
"2": "tardim_ic:block/redstone_input",
"particle": "tardim_ic:block/redstone_input"
},
"elements": [
{

View file

@ -2,8 +2,8 @@
"credit": "Made by karoter2 (Feulim)",
"texture_size": [64, 64],
"textures": {
"1": "tardim_ic:blocks/tardim_dock",
"particle": "tardim_ic:blocks/tardim_dock"
"1": "tardim_ic:block/tardim_dock",
"particle": "tardim_ic:block/tardim_dock"
},
"elements": [
{

View file

@ -0,0 +1,7 @@
{
"animation": {
"frametime": 10,
"interpolate": true,
"frames": [0, 1, 2, 3]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

View file

@ -1,6 +1,6 @@
{
"pack": {
"description": "TARDIM: In Control resources",
"pack_format": 6
}
}
"pack": {
"description": "${mod_name}",
"pack_format": 8
}
}

View file

@ -0,0 +1,20 @@
{
"required": true,
"minVersion": "0.8",
"package": "su.a71.tardim_ic.mixin",
"refmap": "${mod_id}.refmap.json",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"client": [
],
"server": [
"BetterFuelMapMixin",
"BetterFuelStorageMixin",
"JammerMixin"
],
"injectors": {
"defaultRequire": 1
}
}