Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Fix some FAWE bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Dec 1, 2023
1 parent ea1bfad commit aff82b2
Show file tree
Hide file tree
Showing 54 changed files with 315 additions and 218 deletions.
20 changes: 20 additions & 0 deletions patches/minecraft/net/minecraft/world/chunk/NibbleArray.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/net/minecraft/world/chunk/NibbleArray.java
+++ b/net/minecraft/world/chunk/NibbleArray.java
@@ -33,7 +_,7 @@
return p_177483_2_ << 8 | p_177483_3_ << 4 | p_177483_1_;
}

- private int func_177480_a(int p_177480_1_) {
+ public int func_177480_a(int p_177480_1_) {
if (this.field_76585_a == null) {
return 0;
} else {
@@ -42,7 +_,7 @@
}
}

- private void func_177482_a(int p_177482_1_, int p_177482_2_) {
+ public void func_177482_a(int p_177482_1_, int p_177482_2_) {
if (this.field_76585_a == null) {
this.field_76585_a = new byte[2048];
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void run() {
lib.getParentFile().mkdirs();

String u = url + "libraries/" + lib.getAbsolutePath().replaceAll("\\\\", "/").split("/libraries/")[1];
System.out.println(i18n.get("libraries.global.percentage", Math.round((float) (currentSize.get() * 100) / allSize.get()) + "%")); //Global percentage
System.out.println(i18n.get("libraries.global.percentage", Math.min(Math.round((float) (currentSize.get() * 100) / allSize.get()), 100) + "%")); //Global percentage
try {
UpdateUtils.downloadFile(u, lib, libs.get(lib));
if (lib.getName().endsWith(".jar") && !lib.getName().contains("asm-tree-6.1.1.jar"))
Expand Down
19 changes: 9 additions & 10 deletions src/main/java/com/mohistmc/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@

import com.mohistmc.api.ServerAPI;
import com.mohistmc.common.async.MohistThreadBox;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
import org.bukkit.plugin.Plugin;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.spigotmc.SpigotConfig;

import javax.net.ssl.HttpsURLConnection;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
Expand All @@ -46,6 +36,15 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import javax.net.ssl.HttpsURLConnection;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
import org.bukkit.plugin.Plugin;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.spigotmc.SpigotConfig;

/**
* bStats collects some data for plugin authors.
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/mohistmc/MohistConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
import com.mohistmc.command.UpdateMohistCommand;
import com.mohistmc.command.WhitelistModsCommand;
import com.mohistmc.plugins.WorldCommand;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
Expand All @@ -28,6 +22,11 @@
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;

public class MohistConfig {

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/mohistmc/MohistProxySelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@

import com.mohistmc.api.event.MohistNetworkEvent;
import com.mohistmc.util.IOUtil;
import org.bukkit.Bukkit;

import java.io.IOException;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.SocketAddress;
import java.net.URI;
import java.util.List;
import org.bukkit.Bukkit;

public class MohistProxySelector extends ProxySelector {

Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/mohistmc/api/ItemAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@

package com.mohistmc.api;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.util.ResourceLocation;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ItemAPI {

public static Map<String, String> MODNAME_MAP = new ConcurrentHashMap();
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/mohistmc/api/PlayerAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@
package com.mohistmc.api;

import com.mojang.authlib.GameProfile;
import java.net.SocketAddress;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.server.MinecraftServer;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;

import java.net.SocketAddress;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class PlayerAPI {

public static Map<SocketAddress, Integer> mods = new ConcurrentHashMap<>();
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/mohistmc/api/ServerAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
package com.mohistmc.api;

import io.netty.util.internal.ConcurrentSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
Expand All @@ -28,12 +33,6 @@
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public class ServerAPI {

public static Map<String, Integer> mods = new ConcurrentHashMap();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/mohistmc/api/event/MohistNetworkEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@

package com.mohistmc.api.event;

import java.net.URI;
import org.bukkit.Bukkit;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

import java.net.URI;

public class MohistNetworkEvent extends Event implements Cancellable {

private static HandlerList handlers = new HandlerList();
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/mohistmc/api/mc/ChunkMcAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@
package com.mohistmc.api.mc;

import com.mojang.datafixers.util.Either;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.server.ChunkHolder;
import net.minecraft.world.server.ChunkHolder.IChunkLoadingError;
import net.minecraft.world.server.ChunkHolder.LocationType;
import net.minecraft.world.server.ServerWorld;

import java.util.Optional;
import java.util.concurrent.CompletableFuture;

/**
* Mohist API for Minecraft chunks.
* @author KR33PY
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/mohistmc/bukkit/ServerListPingEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

package com.mohistmc.bukkit;

import java.net.InetSocketAddress;
import java.util.Iterator;
import java.util.NoSuchElementException;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.NetworkManager;
import net.minecraft.server.MinecraftServer;
Expand All @@ -26,10 +29,6 @@
import org.bukkit.craftbukkit.v1_16_R3.util.CraftIconCache;
import org.bukkit.entity.Player;

import java.net.InetSocketAddress;
import java.util.Iterator;
import java.util.NoSuchElementException;

public class ServerListPingEvent extends org.bukkit.event.server.ServerListPingEvent {

public CraftIconCache icon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;

import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
package com.mohistmc.bukkit.nms.proxy;

import com.mohistmc.bukkit.nms.utils.RemapUtils;
import net.md_5.specialsource.repo.RuntimeRepo;

import java.security.ProtectionDomain;
import net.md_5.specialsource.repo.RuntimeRepo;

public class DelegateClassLoder extends ClassLoader{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@

import com.mohistmc.bukkit.nms.utils.RemapUtils;
import com.mohistmc.util.MohistJDK9EnumHelper;
import net.md_5.specialsource.repo.RuntimeRepo;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;

import java.io.InputStream;
import java.net.JarURLConnection;
import java.net.URL;
Expand All @@ -38,6 +34,9 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import net.md_5.specialsource.repo.RuntimeRepo;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.mohistmc.bukkit.nms.utils.ASMUtils;
import com.mohistmc.bukkit.nms.utils.ReflectionUtils;
import com.mohistmc.bukkit.nms.utils.RemapUtils;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

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

import com.mohistmc.bukkit.nms.remappers.ReflectMethodRemapper;
import com.mohistmc.bukkit.nms.utils.RemapUtils;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@

package com.mohistmc.bukkit.nms.proxy;

import org.bukkit.configuration.file.YamlConfiguration;
import org.yaml.snakeyaml.reader.ReaderException;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.bukkit.configuration.file.YamlConfiguration;
import org.yaml.snakeyaml.reader.ReaderException;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
package com.mohistmc.bukkit.nms.remappers;

import com.mohistmc.bukkit.nms.ClassLoaderContext;
import java.io.IOException;
import java.io.InputStream;
import net.md_5.specialsource.repo.CachingRepo;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.tree.ClassNode;

import java.io.IOException;
import java.io.InputStream;

/**
*
* @author pyz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
package com.mohistmc.bukkit.nms.remappers;

import com.mohistmc.bukkit.nms.utils.RemapUtils;
import net.md_5.specialsource.provider.InheritanceProvider;
import org.objectweb.asm.tree.ClassNode;

import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import net.md_5.specialsource.provider.InheritanceProvider;
import org.objectweb.asm.tree.ClassNode;

public class MohistInheritanceProvider implements InheritanceProvider {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@

import com.google.common.collect.BiMap;
import com.mohistmc.bukkit.nms.model.ClassMapping;
import net.md_5.specialsource.InheritanceMap;
import net.md_5.specialsource.NodeType;
import net.md_5.specialsource.provider.InheritanceProvider;
import net.md_5.specialsource.transformer.MappingTransformer;
import net.md_5.specialsource.transformer.MavenShade;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.Remapper;

import java.io.BufferedReader;
import java.io.IOException;
import java.lang.reflect.Modifier;
Expand All @@ -38,6 +30,13 @@
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
import net.md_5.specialsource.InheritanceMap;
import net.md_5.specialsource.NodeType;
import net.md_5.specialsource.provider.InheritanceProvider;
import net.md_5.specialsource.transformer.MappingTransformer;
import net.md_5.specialsource.transformer.MavenShade;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.Remapper;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
package com.mohistmc.bukkit.nms.remappers;

import com.mohistmc.bukkit.nms.model.ClassMapping;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import net.md_5.specialsource.CustomRemapper;
import net.md_5.specialsource.NodeType;
import net.md_5.specialsource.RemapperProcessor;
Expand All @@ -27,13 +30,8 @@
import net.md_5.specialsource.repo.ClassRepo;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;

import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS;
import org.objectweb.asm.tree.ClassNode;

/**
*
Expand Down
Loading

0 comments on commit aff82b2

Please sign in to comment.