Skip to content

Commit

Permalink
Fix bug of unable to generating world when sepals with c2me.
Browse files Browse the repository at this point in the history
Upgrade dependencies versions.
  • Loading branch information
cao-awa committed Nov 16, 2024
1 parent bed20e1 commit 0fee077
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 28 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ dependencies {

shadow 'com.alibaba.fastjson2:fastjson2:2.0.50'

shadow 'com.github.cao.awa:catheter:1.0.41'
shadow 'com.github.cao.awa:sinuatum:1.0.10'
shadow 'com.github.cao.awa:catheter:1.0.42'
shadow 'com.github.cao.awa:sinuatum:1.0.11'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.16.7

# Mod Properties
mod_version = 1.0.4
mod_version = 1.0.5
maven_group = com.github.cao.awa.sepals
archives_base_name = sepals

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.cao.awa.apricot.annotations.Stable;
import com.github.cao.awa.sinuatum.manipulate.Manipulate;
import com.github.cao.awa.sinuatum.manipulate.QuickManipulate;

import java.util.Random;

Expand All @@ -15,7 +16,7 @@ public static String create() {
}

public static String create(int size) {
return new String(Manipulate.operation(
return new String(QuickManipulate.operation(
new char[size],
result -> {
for (int i = 0; i < size; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.cao.awa.apricot.annotations.Stable;
import com.github.cao.awa.sinuatum.manipulate.Manipulate;
import com.github.cao.awa.sinuatum.manipulate.QuickManipulate;

import java.util.Random;

Expand All @@ -15,7 +16,7 @@ public static String create() {
}

public static String create(int size) {
return new String(Manipulate.operation(
return new String(QuickManipulate.operation(
new char[size],
result -> {
for (int i = 0; i < size; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.github.cao.awa.apricot.annotations.Stable;
import com.github.cao.awa.lilium.mathematic.Mathematics;
import com.github.cao.awa.sinuatum.manipulate.Manipulate;
import com.github.cao.awa.sinuatum.manipulate.ManipulateBuilder;

import java.io.File;
import java.io.RandomAccessFile;
Expand Down Expand Up @@ -33,7 +33,7 @@ public static String digest(String message, DigestAlgorithm sha) {
}

public static byte[] digestBytes(byte[] message, DigestAlgorithm algorithm) {
MessageDigest digest = Manipulate.supply(() -> MessageDigest.getInstance(algorithm.instanceName())).get();
MessageDigest digest = ManipulateBuilder.supply(() -> MessageDigest.getInstance(algorithm.instanceName())).get();
if (digest == null) {
return null;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ public enum Sha1 implements Sha {

Sha1(String instance) {
this.instance = instance;
this.digestInstance = Manipulate.supply(() -> MessageDigest.getInstance(instance)).get();
this.digestInstance = ManipulateBuilder.supply(() -> MessageDigest.getInstance(instance)).get();
}

@Override
Expand All @@ -142,7 +142,7 @@ public enum Sha3 implements Sha {

Sha3(String instance) {
this.instance = instance;
this.digestInstance = Manipulate.supply(() -> MessageDigest.getInstance(instance)).get();
this.digestInstance = ManipulateBuilder.supply(() -> MessageDigest.getInstance(instance)).get();
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/github/cao/awa/sepals/Sepals.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
import com.github.cao.awa.sepals.command.SepalsDebugCommand;
import com.github.cao.awa.sepals.config.SepalsConfig;
import com.github.cao.awa.sepals.transform.mixin.handler.SepalsMixinHandler;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Sepals implements DedicatedServerModInitializer {
public class Sepals implements ModInitializer {
public static final Logger LOGGER = LogManager.getLogger("Sepals");
public static final String VERSION = "1.0.4";
public static final String VERSION = "1.0.5";
public static final SepalsConfig CONFIG = new SepalsConfig();
public static final SepalsConfig PERSISTENT_CONFIG = new SepalsConfig();

@Override
public void onInitializeServer() {
public void onInitialize() {
SepalsMixinHandler.startPostProcess();

LOGGER.info("Sepals {} loading", VERSION);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.github.cao.awa.sepals.collection.listener;

import com.github.cao.awa.sinuatum.manipulate.QuickManipulate;
import com.github.cao.awa.sinuatum.util.collection.CollectionFactor;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.LongSet;
import it.unimi.dsi.fastutil.objects.ObjectCollection;
Expand All @@ -11,42 +13,47 @@

@SuppressWarnings("unchecked")
public class ActivableLong2ObjectMap<V> implements Long2ObjectMap<V> {
private final ActiveTrigger<V>[] triggers = new ActiveTrigger[ActivableLong2ObjectMap.ActiveTriggerType.values().length];
private final Map<ActiveTriggerType, ActiveTrigger<V>> triggers = QuickManipulate.operation(CollectionFactor.hashMap(), map -> {
map.put(ActiveTriggerType.PUT, (m, k, v) -> {});
map.put(ActiveTriggerType.REMOVE, (m, k, v) -> {});
map.put(ActiveTriggerType.REMOVED, (m, k, v) -> {});
map.put(ActiveTriggerType.CLEAR, (m, k, v) -> {});
});
private final Long2ObjectMap<V> delegate;

public ActivableLong2ObjectMap(Long2ObjectMap<V> delegate) {
this.delegate = delegate;
}

public ActivableLong2ObjectMap<V> triggerPut(MapPutTrigger<V> putTrigger) {
this.triggers[ActiveTriggerType.PUT.ordinal()] = putTrigger;
this.triggers.put(ActiveTriggerType.PUT, putTrigger);
return this;
}

public ActivableLong2ObjectMap<V> triggerRemove(MapRemoveTrigger<V> removeTrigger) {
this.triggers[ActiveTriggerType.REMOVE.ordinal()] = removeTrigger;
this.triggers.put(ActiveTriggerType.REMOVE, removeTrigger);
return this;
}

public ActivableLong2ObjectMap<V> triggerPutAndRemoved(MapRemovedTrigger<V> removeTrigger) {
this.triggers[ActiveTriggerType.REMOVED.ordinal()] = removeTrigger;
public ActivableLong2ObjectMap<V> triggerPutAndRemoved(MapRemovedTrigger<V> removedTrigger) {
this.triggers.put(ActiveTriggerType.REMOVED, removedTrigger);
return this;
}

public ActivableLong2ObjectMap<V> triggerPutAndRemove(MapPutTrigger<V> putTrigger, MapRemoveTrigger<V> removeTrigger) {
this.triggers[ActiveTriggerType.PUT.ordinal()] = putTrigger;
this.triggers[ActiveTriggerType.REMOVE.ordinal()] = removeTrigger;
this.triggers.put(ActiveTriggerType.PUT, putTrigger);
this.triggers.put(ActiveTriggerType.REMOVE, removeTrigger);
return this;
}

public ActivableLong2ObjectMap<V> triggerPutAndRemoved(MapPutTrigger<V> putTrigger, MapRemovedTrigger<V> removeTrigger) {
this.triggers[ActiveTriggerType.PUT.ordinal()] = putTrigger;
this.triggers[ActiveTriggerType.REMOVED.ordinal()] = removeTrigger;
this.triggers.put(ActiveTriggerType.PUT, putTrigger);
this.triggers.put(ActiveTriggerType.REMOVED, putTrigger);
return this;
}

public ActivableLong2ObjectMap<V> triggerClear(MapClearTrigger<V> clearTrigger) {
this.triggers[ActiveTriggerType.CLEAR.ordinal()] = clearTrigger;
this.triggers.put(ActiveTriggerType.CLEAR, clearTrigger);
return this;
}

Expand Down Expand Up @@ -145,7 +152,7 @@ public ObjectSet<Map.Entry<Long, V>> entrySet() {
}

public ActiveTrigger<V> trigger(ActiveTriggerType type) {
return this.triggers[type.ordinal()];
return this.triggers.get(type);
}

public enum ActiveTriggerType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import com.github.cao.awa.apricot.util.collection.ApricotCollectionFactor;
import com.github.cao.awa.apricot.util.io.IOUtil;
import com.github.cao.awa.sepals.transform.mixin.config.SepalsMixinConfig;
import com.github.cao.awa.sepals.transform.mixin.config.handler.SepalsMixinHandlerConfig;
import com.github.cao.awa.sepals.transform.mixin.handler.SepalsMixinHandler;
import com.github.cao.awa.sinuatum.manipulate.Manipulate;
import com.github.cao.awa.sinuatum.manipulate.ManipulateBuilder;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import org.objectweb.asm.tree.ClassNode;
Expand Down Expand Up @@ -34,7 +33,7 @@ public class SepalsMixinPlugin implements IMixinConfigPlugin {
public void onLoad(String mixinPackage) {
if (config == null) {
SepalsMixinHandler.registerDefaultHandlers();
config = Manipulate.make((x) -> {
config = ManipulateBuilder.make((x) -> {
IMixinService service = MixinService.getService();
InputStream resource = service.getResourceAsStream("sepals.mixin-handlers.json");
if (resource == null) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
"icon": "assets/sepals/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"com.github.cao.awa.sepals.Sepals"
],
"client": [
],
"server": [
"com.github.cao.awa.sepals.Sepals"
]
},
"mixins": [
Expand Down

0 comments on commit 0fee077

Please sign in to comment.