Begin update process to 1.21.1

This commit is contained in:
zontreck 2025-02-22 23:38:42 -07:00
parent 1c63a59566
commit 922f89d14c
8 changed files with 68 additions and 62 deletions

View file

@ -1,5 +1,5 @@
plugins { plugins {
id 'dev.architectury.loom' version '1.6-SNAPSHOT' id 'dev.architectury.loom' version '1.7-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }
@ -13,12 +13,16 @@ base {
loom { loom {
silentMojangMappingsLicense() silentMojangMappingsLicense()
forge { neoforge {
mixinConfig 'ariasessentials.mixins.json' mixinConfig 'ariasessentials.mixins.json'
} }
} }
repositories { repositories {
maven {
name = 'NeoForged'
url = 'https://maven.neoforged.net/releases'
}
// Add repositories to retrieve artifacts from in here. // Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because // You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically. // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
@ -45,7 +49,7 @@ repositories {
dependencies { dependencies {
minecraft "net.minecraft:minecraft:$project.minecraft_version" minecraft "net.minecraft:minecraft:$project.minecraft_version"
mappings loom.officialMojangMappings() mappings loom.officialMojangMappings()
forge "net.minecraftforge:forge:$project.forge_version" neoForge "net.neoforged:neoforge:$project.neoforge_version"
// compile against the JEI API but do not include it at runtime // compile against the JEI API but do not include it at runtime
@ -68,12 +72,12 @@ java {
// If you remove this line, sources will not be generated. // If you remove this line, sources will not be generated.
withSourcesJar() withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_21
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
it.options.release = 17 it.options.release = 21
} }
// Configure Maven publishing. // Configure Maven publishing.

View file

@ -1,15 +1,15 @@
# Done to increase the memory available to Gradle. # Done to increase the memory available to Gradle.
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx2G
loom.platform = forge org.gradle.parallel=true
# Mod properties # Mod properties
mod_version = 1192.2.112124.2242 mod_version = 1211.2.112124.2242
maven_group = com.zontreck maven_group = com.zontreck
archives_name = ariasessentials archives_name = ariasessentials
# Minecraft properties # Minecraft properties
minecraft_version = 1.19.2 minecraft_version = 1.21.1
# Dependencies # Dependencies
forge_version = 1.19.2-43.4.0 neoforge_version = 21.1.84
jei_version = 11.6.0.1024 yarn_mappings_patch_version = 1.21+build.4

View file

@ -13,7 +13,13 @@ import com.zontreck.entities.ModEntities;
import com.zontreck.items.DeprecatedModItems; import com.zontreck.items.DeprecatedModItems;
import com.zontreck.items.ModItems; import com.zontreck.items.ModItems;
import com.zontreck.libzontreck.config.ServerConfig; import com.zontreck.libzontreck.config.ServerConfig;
import com.zontreck.libzontreck.util.SNbtIo;
import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraft.data.structures.NbtToSnbt;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.StringTag;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
@ -26,6 +32,7 @@ import org.slf4j.ILoggerFactory;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.nio.file.Path;
import java.time.Instant; import java.time.Instant;
import java.util.Random; import java.util.Random;
import java.util.logging.LogManager; import java.util.logging.LogManager;
@ -38,7 +45,8 @@ public final class AriasEssentials {
public AriasEssentials() { public AriasEssentials() {
// This code runs as soon as Minecraft is in a mod-load-ready state. // This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like registries and resources) may still be uninitialized. // However, some things (like registries and resources) may still be
// uninitialized.
// Proceed with mild caution. // Proceed with mild caution.
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
@ -57,8 +65,6 @@ public final class AriasEssentials {
DeprecatedModBlocks.register(bus); DeprecatedModBlocks.register(bus);
ModBlocks.register(bus); ModBlocks.register(bus);
} }
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)

View file

@ -1,7 +1,6 @@
package dev.zontreck.ariaslib.http; package com.zontreck.ariaslib.http;
public enum HTTPMethod public enum HTTPMethod {
{
GET, GET,
POST, POST,
PUT, PUT,

View file

@ -1,7 +1,6 @@
package dev.zontreck.ariaslib.http; package com.zontreck.ariaslib.http;
public class HTTPRequest public class HTTPRequest {
{
public String url; public String url;
@ -9,7 +8,7 @@ public class HTTPRequest
public String body; public String body;
public String contentType; public String contentType;
protected HTTPRequest(){ protected HTTPRequest() {
} }
} }

View file

@ -1,35 +1,32 @@
package dev.zontreck.ariaslib.http; package com.zontreck.ariaslib.http;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
public class HTTPRequestBuilder public class HTTPRequestBuilder {
{
private HttpURLConnection connection; private HttpURLConnection connection;
private URL url; private URL url;
private HTTPRequest request = new HTTPRequest(); private HTTPRequest request = new HTTPRequest();
public static HTTPRequestBuilder builder() public static HTTPRequestBuilder builder() {
{
return new HTTPRequestBuilder(); return new HTTPRequestBuilder();
} }
protected HTTPRequestBuilder() protected HTTPRequestBuilder() {
{
} }
/** /**
* Sets the url in this request to the one supplied * Sets the url in this request to the one supplied
*
* @param url The url to connect to * @param url The url to connect to
* @return Builder instance * @return Builder instance
* @throws MalformedURLException If the URL supplied was invalid * @throws MalformedURLException If the URL supplied was invalid
*/ */
public HTTPRequestBuilder withURL( String url) throws MalformedURLException { public HTTPRequestBuilder withURL(String url) throws MalformedURLException {
request.url = url; request.url = url;
this.url = new URL(url); this.url = new URL(url);
@ -38,31 +35,31 @@ public class HTTPRequestBuilder
/** /**
* Sets the HTTP Request method * Sets the HTTP Request method
*
* @param method The method you want to use * @param method The method you want to use
* @see HTTPMethod * @see HTTPMethod
* @return Builder instance * @return Builder instance
*/ */
public HTTPRequestBuilder withMethod(HTTPMethod method) public HTTPRequestBuilder withMethod(HTTPMethod method) {
{ switch (method) {
switch(method) case GET: {
{
case GET:
{
request.method = "GET"; request.method = "GET";
break; break;
} }
case POST: { case POST: {
request.method = "POST"; request.method = "POST";
if(request.contentType.isEmpty()) request.contentType = "application/x-www-form-urlencoded"; if (request.contentType.isEmpty())
request.contentType = "application/x-www-form-urlencoded";
break; break;
} }
case DELETE:{ case DELETE: {
request.method = "DELETE"; request.method = "DELETE";
break; break;
} }
case PUT:{ case PUT: {
request.method = "PUT"; request.method = "PUT";
if(request.contentType.isEmpty()) request.contentType = "application/x-www-form-urlencoded"; if (request.contentType.isEmpty())
request.contentType = "application/x-www-form-urlencoded";
break; break;
} }
} }
@ -71,35 +68,36 @@ public class HTTPRequestBuilder
} }
/** /**
* Sets the request body. This may only be processed by the server when using POST or PUT, depending on the server's setup * Sets the request body. This may only be processed by the server when using
* POST or PUT, depending on the server's setup
*
* @param body The body to upload * @param body The body to upload
* @return Builder Instance * @return Builder Instance
*/ */
public HTTPRequestBuilder withBody(String body) public HTTPRequestBuilder withBody(String body) {
{
request.body = body; request.body = body;
return this; return this;
} }
/** /**
* Sets the content type header * Sets the content type header
* Default: application/x-www-form-urlencoded for POST/PUT, and null/not present for GET * Default: application/x-www-form-urlencoded for POST/PUT, and null/not present
* for GET
*
* @param type * @param type
* @return * @return
*/ */
public HTTPRequestBuilder withContentType(String type) public HTTPRequestBuilder withContentType(String type) {
{
request.contentType = type; request.contentType = type;
return this; return this;
} }
public HTTPResponse build() public HTTPResponse build() {
{
try { try {
connection = (HttpURLConnection) url.openConnection(); connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod(request.method); connection.setRequestMethod(request.method);
byte[] array = request.body.getBytes("UTF-8"); byte[] array = request.body.getBytes("UTF-8");
connection.setRequestProperty("Content-Length" , "" + array.length); connection.setRequestProperty("Content-Length", "" + array.length);
connection.setRequestProperty("Content-Type", request.contentType); connection.setRequestProperty("Content-Type", request.contentType);
connection.setDoInput(true); connection.setDoInput(true);
connection.setUseCaches(false); connection.setUseCaches(false);
@ -109,7 +107,6 @@ public class HTTPRequestBuilder
dos.flush(); dos.flush();
dos.close(); dos.close();
// Get the response body // Get the response body
InputStream inputStream = connection.getInputStream(); InputStream inputStream = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
@ -127,7 +124,7 @@ public class HTTPRequestBuilder
return new HTTPResponse(connection.getContentType(), connection.getResponseCode(), responseBody, request); return new HTTPResponse(connection.getContentType(), connection.getResponseCode(), responseBody, request);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
}finally { } finally {
connection.disconnect(); connection.disconnect();
} }
} }

View file

@ -1,13 +1,12 @@
package dev.zontreck.ariaslib.http; package com.zontreck.ariaslib.http;
public class HTTPResponse public class HTTPResponse {
{
private String ContentType; private String ContentType;
private int ResponseCode; private int ResponseCode;
private String ResponseBody; private String ResponseBody;
private HTTPRequest OriginalRequest; private HTTPRequest OriginalRequest;
protected HTTPResponse(String contentType, int code, String body, HTTPRequest request){ protected HTTPResponse(String contentType, int code, String body, HTTPRequest request) {
this.ContentType = contentType; this.ContentType = contentType;
this.ResponseCode = code; this.ResponseCode = code;
this.ResponseBody = body; this.ResponseBody = body;

View file

@ -1,14 +1,12 @@
package com.zontreck.items; package com.zontreck.items;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
import com.zontreck.AriasEssentials; import com.zontreck.AriasEssentials;
import com.zontreck.block.ModBlocks; import com.zontreck.block.ModBlocks;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.RegistryObject;
@Mod.EventBusSubscriber(modid = AriasEssentials.MOD_ID, value = Dist.CLIENT) @Mod.EventBusSubscriber(modid = AriasEssentials.MOD_ID, value = Dist.CLIENT)
public class CreativeModeTabs { public class CreativeModeTabs {
@ -19,9 +17,13 @@ public class CreativeModeTabs {
} }
}; };
public static final List<Supplier<? extends ItemLike>> AE_TAB_ITEMS = new ArrayList<Supplier<? extends ItemLike>>();
public static <T extends Item> RegistryObject<T> addToAETab(RegistryObject<T> item) public static <T extends Item> RegistryObject<T> addToAETab(RegistryObject<T> item)
{ {
AE_TAB_ITEMS.add(item);
return item; return item;
} }
} }