Skip to content

Commit

Permalink
Update to Minecraft 1.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
b3spectacled committed Dec 29, 2022
1 parent 2ef6f8a commit 227217d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 46 deletions.
43 changes: 19 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -42,42 +42,37 @@ processResources {
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}

jar {
from "LICENSE"
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
from components.java
}
}

// select the repositories you want to publish to
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// uncomment to publish to the local maven
// mavenLocal()
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
15 changes: 8 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19
yarn_mappings=1.19+build.4
loader_version=0.14.8
# check these on https://fabricmc.net/develop/
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.5
loader_version=0.14.12

# Mod Properties
mod_version = 0.7
maven_group = com.bespectacled
archives_base_name = custom-spawns

# Dependencies
fabric_version=0.56.1+1.19
fabric_version=0.70.0+1.19.3

cloth_config_version = 7.0.67
mod_menu_version = 4.0.0
cloth_config_version = 9.0.94
mod_menu_version = 5.0.2
17 changes: 12 additions & 5 deletions src/main/java/com/bespectacled/customspawn/CustomSpawn.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.bespectacled.customspawn;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;

import com.bespectacled.customspawn.config.CustomSpawnConfig;

Expand All @@ -17,10 +17,17 @@ public class CustomSpawn implements ModInitializer {

public static final CustomSpawnConfig SPAWNS_CONFIG = AutoConfig.register(CustomSpawnConfig.class, GsonConfigSerializer::new).getConfig();

private static final Logger LOGGER = LogManager.getLogger("CustomSpawns");
private static final Logger LOGGER = LoggerFactory.getLogger("CustomSpawns");

public static void log(Level level, String message) {
LOGGER.log(level, "[" + MOD_NAME + "] {}", message);
message = String.format("[%s] %s", MOD_NAME, message);

switch(level) {
case DEBUG: LOGGER.debug(message);
case ERROR: LOGGER.error(message);
case WARN: LOGGER.warn(message);
default: LOGGER.info(message);
}
}

public static Identifier createId(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package com.bespectacled.customspawn;

import org.apache.logging.log4j.Level;
import org.slf4j.event.Level;

import com.bespectacled.customspawn.config.CustomSpawnConfig;

import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.biome.v1.ModificationPhase;
import net.minecraft.entity.EntityType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.SpawnSettings;

Expand Down Expand Up @@ -38,7 +39,7 @@ public static void modifySpawns() {
context.getSpawnSettings().addSpawn(
addition.spawnGroup,
new SpawnSettings.SpawnEntry(
Registry.ENTITY_TYPE.get(entityKey(addition.mobId)),
Registries.ENTITY_TYPE.get(entityKey(addition.mobId)),
addition.weight,
addition.minCount,
addition.maxCount
Expand All @@ -62,7 +63,7 @@ public static void modifySpawns() {
));

context.getSpawnSettings().removeSpawnsOfEntityType(
Registry.ENTITY_TYPE.get(entityKey(removal.mobId))
Registries.ENTITY_TYPE.get(entityKey(removal.mobId))
);
}
);
Expand All @@ -87,13 +88,13 @@ public static void modifySpawns() {
));

context.getSpawnSettings().removeSpawnsOfEntityType(
Registry.ENTITY_TYPE.get(entityKey(replacement.originalMobId))
Registries.ENTITY_TYPE.get(entityKey(replacement.originalMobId))
);

context.getSpawnSettings().addSpawn(
replacement.replacementSpawnGroup,
new SpawnSettings.SpawnEntry(
Registry.ENTITY_TYPE.get(entityKey(replacement.replacementMobId)),
Registries.ENTITY_TYPE.get(entityKey(replacement.replacementMobId)),
replacement.replacementWeight,
replacement.replacementMinCount,
replacement.replacementMaxCount
Expand All @@ -105,10 +106,10 @@ public static void modifySpawns() {
}

private static RegistryKey<Biome> biomeKey(String id) {
return RegistryKey.of(Registry.BIOME_KEY, new Identifier(id));
return RegistryKey.of(RegistryKeys.BIOME, new Identifier(id));
}

private static RegistryKey<EntityType<?>> entityKey(String id) {
return RegistryKey.of(Registry.ENTITY_TYPE_KEY, new Identifier(id));
return RegistryKey.of(RegistryKeys.ENTITY_TYPE, new Identifier(id));
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"depends": {
"fabricloader": ">=0.11.3",
"fabric": "*",
"minecraft": "1.19.x",
"minecraft": "1.19.3",
"java": ">=17",
"cloth-config2": "*"
}
Expand Down

0 comments on commit 227217d

Please sign in to comment.