SteamWar/FightSystem
Archiviert
13
1

Merge branch 'master' into soundOnSchemChoosing
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
YoyoNow 2022-04-09 21:40:53 +02:00
Commit bfd4c9e9ca
3 geänderte Dateien mit 10 neuen und 33 gelöschten Zeilen

Datei anzeigen

@ -26,12 +26,12 @@ import io.netty.buffer.UnpooledByteBufAllocator;
import net.minecraft.core.IRegistry;
import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData;
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
import net.minecraft.util.SimpleBitStorage;
import net.minecraft.world.level.block.entity.TileEntityTypes;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.nio.ByteBuffer;
import java.nio.LongBuffer;
import java.util.List;
import java.util.Set;
import java.util.function.IntFunction;
@ -93,15 +93,17 @@ public class TechHider18 implements TechHider.ChunkHider {
buffer.writeBytes(data, curI, dataArrayLength * 8);
} else {
ByteBuffer source = ByteBuffer.wrap(data, curI, dataArrayLength * 8);
VariableValueArray values = new VariableValueArray(bitsPerBlock, dataArrayLength, source.asLongBuffer());
long[] array = new long[dataArrayLength];
source.asLongBuffer().get(array);
SimpleBitStorage values = new SimpleBitStorage(bitsPerBlock, 4096, array);
for (int pos = 0; pos < 4096; pos++) {
if (hiddenBlockIds.contains(values.get(pos))) {
values.set(pos, obfuscateWith);
if (hiddenBlockIds.contains(values.a(pos))) {
values.b(pos, obfuscateWith);
}
}
for (long l : values.backing)
for (long l : values.a())
buffer.writeLong(l);
}
});
@ -145,30 +147,4 @@ public class TechHider18 implements TechHider.ChunkHider {
return i;
}
private static final class VariableValueArray {
private final long[] backing;
private final int bitsPerValue;
private final long valueMask;
private final int valuesPerLong;
public VariableValueArray(int bitsPerEntry, int dataArrayLength, LongBuffer buffer) {
this.bitsPerValue = bitsPerEntry;
this.backing = new long[dataArrayLength];
buffer.get(backing);
this.valueMask = (1L << this.bitsPerValue) - 1;
this.valuesPerLong = 64 / bitsPerEntry;
}
public int get(int index) {
return (int)((backing[index / valuesPerLong] >> ((index % valuesPerLong) * bitsPerValue)) & valueMask);
}
public void set(int index, int value) {
int i0 = index / valuesPerLong;
int i1 = index % valuesPerLong;
backing[i0] = backing[i0] & ~(this.valueMask << i1) | (value & valueMask) << i1;
}
}
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.fightsystem.commands;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.record.PacketProcessor;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
@ -42,7 +43,7 @@ public class SkipCommand implements CommandExecutor {
}
Player player = (Player) sender;
if(PacketProcessor.isReplaying()) {
if(PacketProcessor.isReplaying() && Fight.getBlueTeam().getDesignatedLeader() == player.getUniqueId()) {
PacketProcessor.currentReplay().skipToSubtitle();
} else {
Commands.toggleSkip(player);

Datei anzeigen

@ -232,7 +232,7 @@ public class FightUI {
}
Message message = queue.poll();
Bukkit.getOnlinePlayers().forEach(p -> WorldOfColorWrapper.impl.sendTitle(p, "", FightSystem.getMessage().parse(message.getMsg(), p, message.getParams()), 5, 40, 5));
Bukkit.getOnlinePlayers().forEach(p -> WorldOfColorWrapper.impl.sendTitle(p, " ", FightSystem.getMessage().parse(message.getMsg(), p, message.getParams()), 5, 40, 5));
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), FightUI::printSubtitle, 50);
subtitleScheduled = true;
}