Skip to content

Commit

Permalink
Merge pull request #9 from Reider745/NukkitMot
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
Reider745 authored Dec 10, 2024
2 parents 0c25151 + c1a3dce commit b56cd5a
Show file tree
Hide file tree
Showing 103 changed files with 2,610 additions and 1,361 deletions.
17 changes: 12 additions & 5 deletions README-RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ stop-on-critical-ticking-error: false
# Если количесвто пакетов привышает это, то игрок кикается с сервера
max-packet-sending: 200

# Дополнительные потоки Updatable
threading_additional_thread_count: 8

# uuid игрока, отправляемый клиентом
override-player-uuid: on

# Дополнительная информация в лог
# debug-logger: on
# info-logger: on
Expand All @@ -105,6 +111,7 @@ max-packet-sending: 200
+ state — выводит стейты блока по рантайм идентификатору
+ profilecallback [enabled] [showParameters] — отладка и профайлинг калбеков
+ dimensions_list - выводит список измерений
+ tps - отображает нагрузку на tick inner core

> Все команды предназначены для операторов и не могут быть вызваны игроками.
Expand All @@ -114,9 +121,9 @@ max-packet-sending: 200

## Техническая информация

| Ключ | Значение |
|---|---|
| Версия протокола | 422 (1.16.200) |
| Коммит Apparatus | `73194cfd` |
| Ключ | Значение |
|-------------------------|---|
| Версия протокола | 422 (1.16.200) |
| Коммит InnerCore-1.16 | `96197c3b3426c6fa022332b7825cd018370d2a7c` |
| Коммит Instant Referrer | `a264591` |
| Коммит Nukkit-MOT | `191f6ea2b29c083d41470125fd6cd1fb3d698399` |
| Коммит Nukkit-MOT | `e85deb189b829c9e23908a6443dd06d67f340a90` |
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ pack-version-code: 159
# Maximum number of packets sent to the client
# max-packet-sending: 150

# Additional updatable threads
threading_additional_thread_count: 8

# Override player UUID
override-player-uuid: on

# Additional information in the log
# debug-logger: on
# info-logger: on
Expand All @@ -103,14 +109,15 @@ pack-version-code: 159
+ state — outputs block statuses by the runtime ID
+ profilecallback [enabled] [showParameters] — debugging and profiling of callbacks
+ dimensions_list - displays a list of dimensions
+ tps - displays the load on the tick inner core

> All commands are for operators and cannot be called by players.
## Technical information

| Ключ | Значение |
|---|---|
| Protocol version | 422 (1.16.200) |
| Commit Apparatus | `73194cfd` |
| Ключ | Значение |
|-------------------------|---|
| Protocol version | 422 (1.16.200) |
| Commit InnerCore-1.16 | `96197c3b3426c6fa022332b7825cd018370d2a7c` |
| Commit Instant Referrer | `a264591` |
| Commit Nukkit-MOT | `191f6ea2b29c083d41470125fd6cd1fb3d698399` |
| Commit Nukkit-MOT | `e85deb189b829c9e23908a6443dd06d67f340a90` |
Binary file modified iclibs/Nukkit-MOT-SNAPSHOT.jar
Binary file not shown.
55 changes: 40 additions & 15 deletions src/main/java/com/reider745/InnerCoreServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
import com.reider745.commands.CommandsHelper;
import com.reider745.event.EventListener;
import com.reider745.event.InnerCorePlugin;
import com.reider745.hooks.GlobalBlockPalette;
import com.reider745.hooks.RuntimeItemsHooks;
import com.reider745.hooks.block.BlockPalette;
import com.reider745.hooks.item.RuntimeItemsHooks;
import com.reider745.hooks.SnowfallEverywhere;
import com.reider745.hooks.bugfix.DimensionsFix;
import com.reider745.item.CustomItem;

import com.reider745.item.ItemMethod;
import com.reider745.item.NukkitIdConvertor;
import com.reider745.item.NukkitIdConverter;
import com.reider745.world.FakeDimensions;
import com.reider745.world.dimensions.DimensionsMethods;
import com.zhekasmirnov.apparatus.mcpe.NativeWorkbench;
import com.zhekasmirnov.apparatus.multiplayer.Network;
import com.zhekasmirnov.horizon.runtime.logger.Logger;
import com.zhekasmirnov.innercore.api.NativeCallback;
import com.zhekasmirnov.innercore.api.NativeFurnaceRegistry;
import com.zhekasmirnov.innercore.api.log.ICLog;
import com.zhekasmirnov.innercore.api.runtime.LoadingStage;
import com.zhekasmirnov.innercore.api.runtime.saver.world.WorldDataSaverHandler;
import com.zhekasmirnov.innercore.mod.build.ExtractionHelper;
Expand Down Expand Up @@ -205,7 +205,7 @@ public void preload(Server server) throws Exception {
final File dataFolderFile = new File(dataPath);

CallbackHelper.init();
NukkitIdConvertor.init();
NukkitIdConverter.init();
DimensionsMethods.init();
FakeDimensions.init();

Expand Down Expand Up @@ -309,8 +309,7 @@ public void afterload() {
pluginManager.registerEvents(new SnowfallEverywhere(), plugin);
}

DimensionsFix.init();
GlobalBlockPalette.init();
BlockPalette.init();
RuntimeItemsHooks.register();
CustomBlock.init();
CustomItem.init();
Expand All @@ -327,6 +326,9 @@ public void afterload() {
endLoad = true;

NativeCallback.onLevelCreated();

if(isEnableSockets())
Logger.warning("Socket connections are enabled, it is possible that the connection is not stable");
}

public void reload() {
Expand All @@ -341,10 +343,12 @@ public void reload() {
}

public void start() {
for(File file : Objects.requireNonNull(new File(InnerCoreServer.dataPath, "behavior_packs").listFiles())) {
BehaviorPack pack = new BehaviorPack(file.getAbsolutePath());
pack.load();
}
try{
for(File file : Objects.requireNonNull(new File(InnerCoreServer.dataPath, "behavior_packs").listFiles())) {
BehaviorPack pack = new BehaviorPack(file.getAbsolutePath());
pack.load();
}
}catch (Exception e){}
}

public static Object getProperty(String variable) {
Expand Down Expand Up @@ -425,6 +429,7 @@ private ModPack getModpack() {
StringBuilder builder = new StringBuilder();
builder.append("Available modpacks: ");
for (ModPack modpack : modpacks) {
builder.append(',');
builder.append(modpack.getRootDirectory().getName());
}
builder.append('.');
Expand Down Expand Up @@ -472,6 +477,10 @@ public static int getMaxPacketSending(){
return getPropertyInt("max-packet-sending", 200);
}

public static int getAdditionalThreadCount() {
return getPropertyInt("threading_additional_thread_count", 0);
}

public static boolean isUnsupportedOptionsAllowed() {
return getPropertyBoolean("allow-unsupported-options", false);
}
Expand All @@ -493,23 +502,31 @@ public static boolean shouldPlayersReceiveExceptionForms() {
return getPropertyBoolean("display-ticking-errors-to-players", true);
}

public static boolean canOverridePlayerUUID(){
return getPropertyBoolean("override-player-uuid", true);
}

public static String getName() {
return getPropertyString("pack", "Inner Core Test");
return getPropertyString("pack", "Inner Core");
}

public static String getVersionName() {
return getPropertyString("pack-version", "2.3.1b115 test");
return getPropertyString("pack-version", "2.3.1b122");
}

public static boolean isEnableSockets() {
return InnerCoreServer.getPropertyBoolean("socket-server-enable", true);
}

public static int getVersionCode() {
List<Integer> versions = getVersionsCode();
if(versions.isEmpty())
return 159;
return 160;
return versions.get(0);
}

public static List<Integer> getVersionsCode() {
final String args = getPropertyString("pack-version-code", "159");
final String args = getPropertyString("pack-version-code", "162");
final String[] versions_s = args.split(",");
final List<Integer> versions = new ArrayList<>();

Expand Down Expand Up @@ -549,4 +566,12 @@ public static void useIncomprehensibleMethod(String name) {
handleUnsupportedMethod("I don't really understand what this method does (" + name
+ "), which is why you're reading this right now");
}

public static void printStackTrace(){
try {
throw new RuntimeException("Aboba");
}catch (Exception e){
System.out.println(ICLog.getStackTrace(e));
}
}
}
25 changes: 25 additions & 0 deletions src/main/java/com/reider745/InstrumentHook.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.reider745;

import java.lang.instrument.Instrumentation;
import java.util.UUID;

public class InstrumentHook {
public static void premain(String agentArgs, Instrumentation inst) {
if (agentArgs != null) {
System.getProperties().put(AGENT_ARGS_KEY, agentArgs);
}
System.getProperties().put(INSTRUMENTATION_KEY, inst);
}

public static Instrumentation getInstrumentation() {
return (Instrumentation) System.getProperties().get(INSTRUMENTATION_KEY);
}

// Needn't be a UUID - can be a String or any other object that
// implements equals().
private static final Object AGENT_ARGS_KEY =
UUID.fromString("887b43f3-c742-4b87-978d-70d2db74e40e");

private static final Object INSTRUMENTATION_KEY =
UUID.fromString("214ac54a-60a5-417e-b3b8-772e80a16667");
}
Loading

0 comments on commit b56cd5a

Please sign in to comment.