update 1.20.1

This commit is contained in:
mlus-Asuka 2023-09-22 12:07:58 +08:00
parent 45e13f1199
commit 5de0fdcff6
4 changed files with 13 additions and 17 deletions

View File

@ -2,6 +2,7 @@
This is a Minecraft forge mod using Mysql backend to make player data synchronization between different servers. This is a Minecraft forge mod using Mysql backend to make player data synchronization between different servers.
Such as equipment,inventory,effects,experience,food level.Any other mods support is also possible. Such as equipment,inventory,effects,experience,food level.Any other mods support is also possible.
Support version now: Support version now:
1.20.1
1.19-1.19.3 1.19-1.19.3
1.18.2 1.18.2
1.16.5 1.16.5

View File

@ -13,7 +13,7 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft { minecraft {
mappings channel: 'official', version: '1.19.2' mappings channel: 'official', version: '1.20.1'
//accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. //accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
@ -116,18 +116,14 @@ repositories {
} }
dependencies { dependencies {
minecraft 'net.minecraftforge:forge:1.19.2-43.1.1' minecraft 'net.minecraftforge:forge:1.20.1-47.1.0'
jarJar("curse.maven:MySQL-561280:3685108") { jarJar("curse.maven:MySQL-561280:3685108") {
jarJar.ranged(it, '[1.0,)') jarJar.ranged(it, '[1.0,)')
} }
jarJar("com.zaxxer:HikariCP:3.4.5") { runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:5.3.2+1.20.1")
jarJar.ranged(it, '[3.4.5,)') compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:5.3.2+1.20.1:api")
}
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.19.2-5.1.1.0")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.19.2-5.1.1.0:api")
implementation fg.deobf("curse.maven:MySQL-561280:3685108") implementation fg.deobf("curse.maven:MySQL-561280:3685108")
implementation group: 'com.zaxxer', name: 'HikariCP', version: '3.4.5' implementation group: 'com.zaxxer', name: 'HikariCP', version: '3.4.5'
} }

View File

@ -6,7 +6,6 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModList;
import net.minecraftforge.items.IItemHandlerModifiable;
import vip.fubuki.playersync.util.JDBCsetUp; import vip.fubuki.playersync.util.JDBCsetUp;
import vip.fubuki.playersync.util.LocalJsonUtil; import vip.fubuki.playersync.util.LocalJsonUtil;
@ -23,7 +22,7 @@ public class ModsSupport {
/* /*
Curios Support Curios Support
*/ */
LazyOptional<IItemHandlerModifiable> itemHandler = top.theillusivec4.curios.api.CuriosApi.getCuriosHelper().getEquippedCurios(player); LazyOptional<top.theillusivec4.curios.api.type.capability.ICuriosItemHandler> itemHandler = top.theillusivec4.curios.api.CuriosApi.getCuriosInventory(player);
JDBCsetUp.QueryResult queryResult=JDBCsetUp.executeQuery("SELECT curios_item FROM curios WHERE uuid = '"+player.getUUID()+"'"); JDBCsetUp.QueryResult queryResult=JDBCsetUp.executeQuery("SELECT curios_item FROM curios WHERE uuid = '"+player.getUUID()+"'");
ResultSet resultSet = queryResult.getResultSet(); ResultSet resultSet = queryResult.getResultSet();
if(resultSet.next()) { if(resultSet.next()) {
@ -34,7 +33,7 @@ public class ModsSupport {
for (int i = 0; i < handler.getSlots(); i++) { for (int i = 0; i < handler.getSlots(); i++) {
try { try {
if (curios.get(i) == null) continue; if (curios.get(i) == null) continue;
handler.setStackInSlot(i, ItemStack.of(NbtUtils.snbtToStructure(curios.get(i).replace("|", ",")))); handler.getEquippedCurios().setStackInSlot(i, ItemStack.of(NbtUtils.snbtToStructure(curios.get(i).replace("|", ","))));
} catch (CommandSyntaxException e) { } catch (CommandSyntaxException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -56,12 +55,12 @@ public class ModsSupport {
} }
public void StoreCurios(Player player,boolean init) throws SQLException { public void StoreCurios(Player player,boolean init) throws SQLException {
LazyOptional<IItemHandlerModifiable> itemHandler = top.theillusivec4.curios.api.CuriosApi.getCuriosHelper().getEquippedCurios(player); LazyOptional<top.theillusivec4.curios.api.type.capability.ICuriosItemHandler> itemHandler = top.theillusivec4.curios.api.CuriosApi.getCuriosInventory(player);
Map<Integer, String> curios = new HashMap<>(); Map<Integer, String> curios = new HashMap<>();
itemHandler.ifPresent(handler -> { itemHandler.ifPresent(handler -> {
for (int i = 0; i < handler.getSlots(); i++) { for (int i = 0; i < handler.getSlots(); i++) {
if (!handler.getStackInSlot(i).isEmpty()) { if (!handler.getEquippedCurios().getStackInSlot(i).isEmpty()) {
String sNBT= handler.getStackInSlot(i).serializeNBT().toString().replace(",", "|"); String sNBT= handler.getEquippedCurios().getStackInSlot(i).serializeNBT().toString().replace(",", "|");
curios.put(i, sNBT); curios.put(i, sNBT);
} }
} }

View File

@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version # A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. loaderVersion="[47,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="GPL-3.0 license" license="GPL-3.0 license"
@ -51,7 +51,7 @@ make multiserver players' data sync
# Does this dependency have to exist - if not, ordering below must be specified # Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory mandatory=true #mandatory
# The version range of the dependency # The version range of the dependency
versionRange="[43,)" #mandatory versionRange="[47,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE" ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER # Side this dependency is applied on - BOTH, CLIENT or SERVER
@ -61,6 +61,6 @@ make multiserver players' data sync
modId="minecraft" modId="minecraft"
mandatory=true mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version # This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.19.2,1.20)" versionRange="[1.20,1.21)"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"