Performance and information hiding improvements (no unchanged hullhider blocks)
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
e0659c1bb2
Commit
c3bb34ed6b
@ -27,7 +27,10 @@ import net.minecraft.core.SectionPosition;
|
|||||||
import net.minecraft.network.protocol.game.PacketPlayOutBlockChange;
|
import net.minecraft.network.protocol.game.PacketPlayOutBlockChange;
|
||||||
import net.minecraft.network.protocol.game.PacketPlayOutMultiBlockChange;
|
import net.minecraft.network.protocol.game.PacketPlayOutMultiBlockChange;
|
||||||
import net.minecraft.world.level.block.state.IBlockData;
|
import net.minecraft.world.level.block.state.IBlockData;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@ -36,20 +39,23 @@ public class HullHiderWrapper18 implements HullHiderWrapper {
|
|||||||
private static final Reflection.MethodInvoker getState = Reflection.getTypedMethod(Reflection.getClass("{obc}.block.data.CraftBlockData"), "getState", IBlockData.class);
|
private static final Reflection.MethodInvoker getState = Reflection.getTypedMethod(Reflection.getClass("{obc}.block.data.CraftBlockData"), "getState", IBlockData.class);
|
||||||
@Override
|
@Override
|
||||||
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
|
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
|
||||||
Object[] blockdata = new Object[changes.size()];
|
List<Object> blockdata = new ArrayList<>(changes.size());
|
||||||
|
|
||||||
for(int i = 0; i < changes.size(); i++) {
|
changes.removeIf(change -> {
|
||||||
Hull.IntVector change = changes.get(i);
|
//BlockData data = Config.world.getBlockData(change.getX(), change.getY(), change.getZ());
|
||||||
blockdata[i] = getState.invoke(Config.world.getBlockData(change.getX(), change.getY(), change.getZ()));
|
BlockData data = Material.EMERALD_BLOCK.createBlockData();
|
||||||
}
|
boolean unchanged = data.getMaterial() == Config.ObfuscateWith;
|
||||||
|
if(!unchanged)
|
||||||
|
blockdata.add(getState.invoke(data));
|
||||||
|
return unchanged;
|
||||||
|
});
|
||||||
|
|
||||||
return generateBlockChangePacket(changes, blockdata);
|
return generateBlockChangePacket(changes, blockdata.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object generateBlockChangePacket(List<Hull.IntVector> changes, Object[] blockdata) {
|
private Object generateBlockChangePacket(List<Hull.IntVector> changes, Object[] blockdata) {
|
||||||
if(changes.size() > 1) {
|
if(changes.size() > 1) {
|
||||||
Hull.IntVector section = changes.get(0);
|
Hull.IntVector section = changes.get(0);
|
||||||
//section = new Hull.IntVector(ProtocolUtils.posToChunk(section.getX()), ProtocolUtils.posToChunk(section.getY()), ProtocolUtils.posToChunk(section.getZ()));
|
|
||||||
section = new Hull.IntVector(section.getX() >> 4, section.getY() >> 4, section.getZ() >> 4);
|
section = new Hull.IntVector(section.getX() >> 4, section.getY() >> 4, section.getZ() >> 4);
|
||||||
int xOffset = 16*section.getX();
|
int xOffset = 16*section.getX();
|
||||||
int yOffset = 16*section.getY();
|
int yOffset = 16*section.getY();
|
||||||
|
@ -122,7 +122,7 @@ public class Config {
|
|||||||
public static final boolean TechhiderActive;
|
public static final boolean TechhiderActive;
|
||||||
public static final Set<Material> HiddenBlocks;
|
public static final Set<Material> HiddenBlocks;
|
||||||
public static final Set<String> HiddenBlockEntities;
|
public static final Set<String> HiddenBlockEntities;
|
||||||
public static final String ObfuscateWith;
|
public static final Material ObfuscateWith;
|
||||||
|
|
||||||
//event parameter
|
//event parameter
|
||||||
private static final int EventKampfID;
|
private static final int EventKampfID;
|
||||||
@ -213,7 +213,7 @@ public class Config {
|
|||||||
ForbiddenItems = Collections.unmodifiableSet(config.getStringList("Kits.ForbiddenItems").stream().map(Material::valueOf).collect(Collectors.toSet()));
|
ForbiddenItems = Collections.unmodifiableSet(config.getStringList("Kits.ForbiddenItems").stream().map(Material::valueOf).collect(Collectors.toSet()));
|
||||||
|
|
||||||
TechhiderActive = config.getBoolean("Techhider.Active", false);
|
TechhiderActive = config.getBoolean("Techhider.Active", false);
|
||||||
ObfuscateWith = config.getString("Techhider.ObfuscateWith", "end_stone").toUpperCase();
|
ObfuscateWith = Material.getMaterial(config.getString("Techhider.ObfuscateWith", "end_stone").toUpperCase());
|
||||||
HiddenBlocks = config.getStringList("Techhider.HiddenBlocks").stream().map(String::toUpperCase).map(Material::getMaterial).collect(Collectors.toSet());
|
HiddenBlocks = config.getStringList("Techhider.HiddenBlocks").stream().map(String::toUpperCase).map(Material::getMaterial).collect(Collectors.toSet());
|
||||||
HiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities")));
|
HiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities")));
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public class PacketProcessor implements Listener {
|
|||||||
private final BukkitTask task;
|
private final BukkitTask task;
|
||||||
private final LinkedList<Runnable> syncList = new LinkedList<>();
|
private final LinkedList<Runnable> syncList = new LinkedList<>();
|
||||||
private final Set<Integer> hiddenBlockIds = Config.HiddenBlocks.stream().flatMap(m -> BlockIds.impl.materialToAllIds(m).stream()).collect(Collectors.toSet());
|
private final Set<Integer> hiddenBlockIds = Config.HiddenBlocks.stream().flatMap(m -> BlockIds.impl.materialToAllIds(m).stream()).collect(Collectors.toSet());
|
||||||
private final int obfuscateWith = BlockIds.impl.materialToId(Material.getMaterial(Config.ObfuscateWith.toUpperCase()));
|
private final int obfuscateWith = BlockIds.impl.materialToId(Config.ObfuscateWith);
|
||||||
private final FreezeWorld freezer = new FreezeWorld();
|
private final FreezeWorld freezer = new FreezeWorld();
|
||||||
private final REntityServer entityServer = new REntityServer();
|
private final REntityServer entityServer = new REntityServer();
|
||||||
private final Map<Integer, REntity> entities = new HashMap<>();
|
private final Map<Integer, REntity> entities = new HashMap<>();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren