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

View file

@ -1,15 +1,15 @@
# Done to increase the memory available to Gradle.
org.gradle.jvmargs=-Xmx1G
loom.platform = forge
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true
# Mod properties
mod_version = 1192.2.112124.2242
mod_version = 1211.2.112124.2242
maven_group = com.zontreck
archives_name = ariasessentials
# Minecraft properties
minecraft_version = 1.19.2
minecraft_version = 1.21.1
# Dependencies
forge_version = 1.19.2-43.4.0
jei_version = 11.6.0.1024
neoforge_version = 21.1.84
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.ModItems;
import com.zontreck.libzontreck.config.ServerConfig;
import com.zontreck.libzontreck.util.SNbtIo;
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.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
@ -26,6 +32,7 @@ import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.file.Path;
import java.time.Instant;
import java.util.Random;
import java.util.logging.LogManager;
@ -38,7 +45,8 @@ public final class AriasEssentials {
public AriasEssentials() {
// 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.
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
@ -57,8 +65,6 @@ public final class AriasEssentials {
DeprecatedModBlocks.register(bus);
ModBlocks.register(bus);
}
@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,
POST,
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;
@ -9,7 +8,7 @@ public class HTTPRequest
public String body;
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.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class HTTPRequestBuilder
{
public class HTTPRequestBuilder {
private HttpURLConnection connection;
private URL url;
private HTTPRequest request = new HTTPRequest();
public static HTTPRequestBuilder builder()
{
public static HTTPRequestBuilder builder() {
return new HTTPRequestBuilder();
}
protected HTTPRequestBuilder()
{
protected HTTPRequestBuilder() {
}
/**
* Sets the url in this request to the one supplied
*
* @param url The url to connect to
* @return Builder instance
* @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;
this.url = new URL(url);
@ -38,31 +35,31 @@ public class HTTPRequestBuilder
/**
* Sets the HTTP Request method
*
* @param method The method you want to use
* @see HTTPMethod
* @return Builder instance
*/
public HTTPRequestBuilder withMethod(HTTPMethod method)
{
switch(method)
{
case GET:
{
public HTTPRequestBuilder withMethod(HTTPMethod method) {
switch (method) {
case GET: {
request.method = "GET";
break;
}
case 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;
}
case DELETE:{
case DELETE: {
request.method = "DELETE";
break;
}
case PUT:{
case 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;
}
}
@ -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
* @return Builder Instance
*/
public HTTPRequestBuilder withBody(String body)
{
public HTTPRequestBuilder withBody(String body) {
request.body = body;
return this;
}
/**
* 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
* @return
*/
public HTTPRequestBuilder withContentType(String type)
{
public HTTPRequestBuilder withContentType(String type) {
request.contentType = type;
return this;
}
public HTTPResponse build()
{
public HTTPResponse build() {
try {
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod(request.method);
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.setDoInput(true);
connection.setUseCaches(false);
@ -109,7 +107,6 @@ public class HTTPRequestBuilder
dos.flush();
dos.close();
// Get the response body
InputStream inputStream = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
@ -127,7 +124,7 @@ public class HTTPRequestBuilder
return new HTTPResponse(connection.getContentType(), connection.getResponseCode(), responseBody, request);
} catch (IOException e) {
throw new RuntimeException(e);
}finally {
} finally {
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 int ResponseCode;
private String ResponseBody;
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.ResponseCode = code;
this.ResponseBody = body;

View file

@ -1,14 +1,12 @@
package com.zontreck.items;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
import com.zontreck.AriasEssentials;
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)
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)
{
AE_TAB_ITEMS.add(item);
return item;
}
}