Compare commits
104
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3059f21ce6 | ||
|
|
b48f898c77 | ||
|
|
6f63743bd8 | ||
|
|
21e15f9b8a | ||
|
|
e505d2b2cd | ||
|
|
c83b374830 | ||
|
|
1bdca2dae5 | ||
|
|
91241dec7d | ||
|
|
651b0bd83e | ||
|
|
7f71f809c0 | ||
|
|
05444e6f56 | ||
|
|
e9e84f5548 | ||
|
|
62cb82de6a | ||
|
|
d10f7619e4 | ||
|
|
16e464719b | ||
|
|
21f22a8446 | ||
|
|
f02d1383c8 | ||
|
|
28be03b978 | ||
|
|
e3ccbe2449 | ||
|
|
5782d356fb | ||
|
|
999d7c7016 | ||
|
|
270db6995c | ||
|
|
bafb169b76 | ||
|
|
5bc0f06500 | ||
|
|
1e244ed37b | ||
|
|
8b8a9b5ce7 | ||
|
|
129549bf2d | ||
|
|
ed7f9d80f8 | ||
|
|
c1054142e0 | ||
|
|
9ee0b82eab | ||
|
|
76f5f81f6a | ||
|
|
0c51152477 | ||
|
|
9b8a0b4969 | ||
|
|
a2528beaf9 | ||
|
|
a3de70d498 | ||
|
|
ea85282f52 | ||
|
|
d723dec820 | ||
|
|
de03945f42 | ||
|
|
bb08c78e8a | ||
|
|
4da8ddbd12 | ||
|
|
8f89d3615b | ||
|
|
03ea36ad28 | ||
|
|
b27678c753 | ||
|
|
6eb99263a2 | ||
|
|
bde44f5136 | ||
|
|
8a09be435e | ||
|
|
7af6cfbb3b | ||
|
|
ce8aee5b8c | ||
|
|
d5927578a9 | ||
|
|
cc9273d05d | ||
|
|
c354b4481d | ||
|
|
ba8c411ed4 | ||
|
|
da1468e858 | ||
|
|
9708ebc821 | ||
|
|
fad39af575 | ||
|
|
4e4492e417 | ||
|
|
5374ee3c0d | ||
|
|
936662db2d | ||
|
|
16bb09aee0 | ||
|
|
7ac2319c07 | ||
|
|
89a795a7e6 | ||
|
|
510247f3b4 | ||
|
|
a61b710e81 | ||
|
|
049c30f8b1 | ||
|
|
21a7bdd395 | ||
|
|
598caa9259 | ||
|
|
0d28fa3a9d | ||
|
|
87c5c1d6c7 | ||
|
|
dde9cea757 | ||
|
|
1fe77a1dd6 | ||
|
|
72a2dfdde4 | ||
|
|
4c039e612b | ||
|
|
b0cd32622e | ||
|
|
3445a0220f | ||
|
|
f1a1e46edc | ||
|
|
343e9ef16d | ||
|
|
c4c063418a | ||
|
|
95955b81f6 | ||
|
|
f4cb19c113 | ||
|
|
f313d0897d | ||
|
|
0293606dc9 | ||
|
|
705f223a70 | ||
|
|
409b1ae646 | ||
|
|
13bd66de7b | ||
|
|
b3d59788b3 | ||
|
|
c58ae74a41 | ||
|
|
aa6d07f893 | ||
|
|
cef044c4fe | ||
|
|
e8c7b9066f | ||
|
|
7f0dbdbc28 | ||
|
|
3890d12105 | ||
|
|
d62755bc01 | ||
|
|
dfc8c988d1 | ||
|
|
508daaa472 | ||
|
|
a765065f98 | ||
|
|
7add2b6658 | ||
|
|
b3d780b52b | ||
|
|
1e46837fec | ||
|
|
ac516060c0 | ||
|
|
a5c34a0829 | ||
|
|
06fa4bab17 | ||
|
|
aabead19ec | ||
|
|
af60e07327 | ||
|
|
0c78830524 |
No files matched your search
+26
-20
@@ -9,11 +9,15 @@ plugins {
|
||||
}
|
||||
|
||||
group = "ac.grim.grimac"
|
||||
version = "2.3.67"
|
||||
version = "2.3.68"
|
||||
description = "Libre simulation anticheat designed for 1.21 with 1.8-1.21 support, powered by PacketEvents 2.0."
|
||||
java.sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
java.targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
// Set to false for debug builds
|
||||
// You cannot live reload classes if the jar relocates dependencies
|
||||
var relocate = true;
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") // Spigot
|
||||
@@ -34,7 +38,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.github.retrooper:packetevents-spigot:2.5.0-SNAPSHOT")
|
||||
implementation("com.github.retrooper:packetevents-spigot:2.5.1-SNAPSHOT")
|
||||
implementation("co.aikar:acf-paper:0.5.1-SNAPSHOT")
|
||||
implementation("club.minnced:discord-webhooks:0.8.0") // Newer versions include kotlin-stdlib, which leads to incompatibility with plugins that use Kotlin
|
||||
implementation("it.unimi.dsi:fastutil:8.5.13")
|
||||
@@ -133,21 +137,23 @@ publishing.publications.create<MavenPublication>("maven") {
|
||||
tasks.shadowJar {
|
||||
minimize()
|
||||
archiveFileName.set("${project.name}-${project.version}.jar")
|
||||
relocate("io.github.retrooper.packetevents", "ac.grim.grimac.shaded.io.github.retrooper.packetevents")
|
||||
relocate("com.github.retrooper.packetevents", "ac.grim.grimac.shaded.com.github.retrooper.packetevents")
|
||||
relocate("co.aikar.commands", "ac.grim.grimac.shaded.acf")
|
||||
relocate("co.aikar.locale", "ac.grim.grimac.shaded.locale")
|
||||
relocate("club.minnced", "ac.grim.grimac.shaded.discord-webhooks")
|
||||
relocate("github.scarsz.configuralize", "ac.grim.grimac.shaded.configuralize")
|
||||
relocate("com.github.puregero", "ac.grim.grimac.shaded.com.github.puregero")
|
||||
relocate("com.google.code.gson", "ac.grim.grimac.shaded.gson")
|
||||
relocate("alexh", "ac.grim.grimac.shaded.maps")
|
||||
relocate("it.unimi.dsi.fastutil", "ac.grim.grimac.shaded.fastutil")
|
||||
relocate("net.kyori", "ac.grim.grimac.shaded.kyori")
|
||||
relocate("okhttp3", "ac.grim.grimac.shaded.okhttp3")
|
||||
relocate("okio", "ac.grim.grimac.shaded.okio")
|
||||
relocate("org.yaml.snakeyaml", "ac.grim.grimac.shaded.snakeyaml")
|
||||
relocate("org.json", "ac.grim.grimac.shaded.json")
|
||||
relocate("org.intellij", "ac.grim.grimac.shaded.intellij")
|
||||
relocate("org.jetbrains", "ac.grim.grimac.shaded.jetbrains")
|
||||
}
|
||||
if (relocate) {
|
||||
relocate("io.github.retrooper.packetevents", "ac.grim.grimac.shaded.io.github.retrooper.packetevents")
|
||||
relocate("com.github.retrooper.packetevents", "ac.grim.grimac.shaded.com.github.retrooper.packetevents")
|
||||
relocate("co.aikar.commands", "ac.grim.grimac.shaded.acf")
|
||||
relocate("co.aikar.locale", "ac.grim.grimac.shaded.locale")
|
||||
relocate("club.minnced", "ac.grim.grimac.shaded.discord-webhooks")
|
||||
relocate("github.scarsz.configuralize", "ac.grim.grimac.shaded.configuralize")
|
||||
relocate("com.github.puregero", "ac.grim.grimac.shaded.com.github.puregero")
|
||||
relocate("com.google.code.gson", "ac.grim.grimac.shaded.gson")
|
||||
relocate("alexh", "ac.grim.grimac.shaded.maps")
|
||||
relocate("it.unimi.dsi.fastutil", "ac.grim.grimac.shaded.fastutil")
|
||||
relocate("net.kyori", "ac.grim.grimac.shaded.kyori")
|
||||
relocate("okhttp3", "ac.grim.grimac.shaded.okhttp3")
|
||||
relocate("okio", "ac.grim.grimac.shaded.okio")
|
||||
relocate("org.yaml.snakeyaml", "ac.grim.grimac.shaded.snakeyaml")
|
||||
relocate("org.json", "ac.grim.grimac.shaded.json")
|
||||
relocate("org.intellij", "ac.grim.grimac.shaded.intellij")
|
||||
relocate("org.jetbrains", "ac.grim.grimac.shaded.jetbrains")
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import ac.grim.grimac.player.GrimPlayer;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import github.scarsz.configuralize.DynamicConfig;
|
||||
import io.github.retrooper.packetevents.util.folia.FoliaScheduler;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -28,6 +29,7 @@ public class Check implements AbstractCheck {
|
||||
private boolean experimental;
|
||||
@Setter
|
||||
private boolean isEnabled;
|
||||
private boolean exempted;
|
||||
|
||||
@Override
|
||||
public boolean isExperimental() {
|
||||
@@ -56,7 +58,14 @@ public class Check implements AbstractCheck {
|
||||
}
|
||||
|
||||
public boolean shouldModifyPackets() {
|
||||
return isEnabled && !player.disableGrim && !player.noModifyPacketPermission;
|
||||
return isEnabled && !player.disableGrim && !player.noModifyPacketPermission && !exempted;
|
||||
}
|
||||
|
||||
public void updateExempted() {
|
||||
if (player.bukkitPlayer == null || checkName == null) return;
|
||||
FoliaScheduler.getEntityScheduler().run(player.bukkitPlayer, GrimAPI.INSTANCE.getPlugin(),
|
||||
t -> exempted = player.bukkitPlayer.hasPermission("grim.exempt." + checkName.toLowerCase()),
|
||||
() -> {});
|
||||
}
|
||||
|
||||
public final boolean flagAndAlert(String verbose) {
|
||||
@@ -72,7 +81,7 @@ public class Check implements AbstractCheck {
|
||||
}
|
||||
|
||||
public final boolean flag() {
|
||||
if (player.disableGrim || (experimental && !GrimAPI.INSTANCE.getConfigManager().isExperimentalChecks()))
|
||||
if (player.disableGrim || (experimental && !GrimAPI.INSTANCE.getConfigManager().isExperimentalChecks()) || exempted)
|
||||
return false; // Avoid calling event if disabled
|
||||
|
||||
FlagEvent event = new FlagEvent(player, this);
|
||||
@@ -103,6 +112,8 @@ public class Check implements AbstractCheck {
|
||||
setbackVL = getConfig().getDoubleElse(configName + ".setbackvl", setbackVL);
|
||||
|
||||
if (setbackVL == -1) setbackVL = Double.MAX_VALUE;
|
||||
|
||||
updateExempted();
|
||||
}
|
||||
|
||||
public boolean alert(String verbose) {
|
||||
|
||||
@@ -25,17 +25,16 @@ public class BadPacketsX extends Check implements PacketCheck {
|
||||
if (dig.getAction() != DiggingAction.START_DIGGING && dig.getAction() != DiggingAction.FINISHED_DIGGING)
|
||||
return;
|
||||
|
||||
final boolean invalid;
|
||||
|
||||
if (dig.getAction() == DiggingAction.FINISHED_DIGGING) {
|
||||
invalid = BlockBreakSpeed.getBlockDamage(player, dig.getBlockPosition()) >= 1 || block.getHardness() == -1.0f;
|
||||
} else invalid = (block == StateTypes.LIGHT && !(player.getInventory().getHeldItem().is(ItemTypes.LIGHT) || player.getInventory().getOffHand().is(ItemTypes.LIGHT)))
|
||||
// the block does not have a hitbox
|
||||
boolean invalid = (block == StateTypes.LIGHT && !(player.getInventory().getHeldItem().is(ItemTypes.LIGHT) || player.getInventory().getOffHand().is(ItemTypes.LIGHT)))
|
||||
|| block.isAir()
|
||||
|| block == StateTypes.WATER
|
||||
|| block == StateTypes.LAVA
|
||||
|| block == StateTypes.BUBBLE_COLUMN
|
||||
|| block == StateTypes.MOVING_PISTON
|
||||
|| (block == StateTypes.FIRE && noFireHitbox);
|
||||
|| (block == StateTypes.FIRE && noFireHitbox)
|
||||
// or the client claims to have broken an unbreakable block
|
||||
|| block.getHardness() == -1.0f && dig.getAction() == DiggingAction.FINISHED_DIGGING;
|
||||
|
||||
if (invalid && flagAndAlert("block=" + block.getName() + ", type=" + dig.getAction()) && shouldModifyPackets()) {
|
||||
event.setCancelled(true);
|
||||
|
||||
@@ -4,7 +4,9 @@ import ac.grim.grimac.checks.Check;
|
||||
import ac.grim.grimac.checks.CheckData;
|
||||
import ac.grim.grimac.checks.type.PacketCheck;
|
||||
import ac.grim.grimac.player.GrimPlayer;
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.DiggingAction;
|
||||
import com.github.retrooper.packetevents.util.Vector3i;
|
||||
@@ -21,7 +23,7 @@ public class BadPacketsZ extends Check implements PacketCheck {
|
||||
|
||||
private boolean lastBlockWasInstantBreak = false;
|
||||
private Vector3i lastBlock, lastCancelledBlock, lastLastBlock = null;
|
||||
private final int exemptedY = player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8) ? 4095 : 255;
|
||||
private final int exemptedY = player.getClientVersion().isOlderThan(ClientVersion.V_1_8) ? 255 : (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_14) ? -1 : 4095);
|
||||
|
||||
// The client sometimes sends a wierd cancel packet
|
||||
private boolean shouldExempt(final Vector3i pos) {
|
||||
@@ -33,10 +35,6 @@ public class BadPacketsZ extends Check implements PacketCheck {
|
||||
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14_4) && pos.y != exemptedY)
|
||||
return false;
|
||||
|
||||
// the client only sends this packet if the last block was an instant break
|
||||
if (getBlockDamage(player, lastBlock) < 1)
|
||||
return false;
|
||||
|
||||
// and if this block is not an instant break
|
||||
return player.getClientVersion().isOlderThan(ClientVersion.V_1_14_4) || getBlockDamage(player, pos) < 1;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPl
|
||||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityAnimation;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -87,6 +86,7 @@ public class PostCheck extends Check implements PacketCheck, PostPredictionCheck
|
||||
post.clear();
|
||||
sentFlying = false;
|
||||
} else if (PLAYER_ABILITIES.equals(packetType)
|
||||
|| (HELD_ITEM_CHANGE.equals(packetType) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8))
|
||||
|| INTERACT_ENTITY.equals(packetType) || PLAYER_BLOCK_PLACEMENT.equals(packetType)
|
||||
|| USE_ITEM.equals(packetType) || PLAYER_DIGGING.equals(packetType)) {
|
||||
if (sentFlying) post.add(event.getPacketType());
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package ac.grim.grimac.checks.impl.scaffolding;
|
||||
|
||||
import ac.grim.grimac.checks.CheckData;
|
||||
import ac.grim.grimac.checks.type.BlockPlaceCheck;
|
||||
import ac.grim.grimac.player.GrimPlayer;
|
||||
import ac.grim.grimac.utils.anticheat.MessageUtil;
|
||||
import ac.grim.grimac.utils.anticheat.update.BlockPlace;
|
||||
import ac.grim.grimac.utils.anticheat.update.PredictionComplete;
|
||||
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.world.BlockFace;
|
||||
import com.github.retrooper.packetevents.util.Vector3f;
|
||||
import com.github.retrooper.packetevents.util.Vector3i;
|
||||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CheckData(name = "MultiPlace", experimental = true)
|
||||
public class MultiPlace extends BlockPlaceCheck {
|
||||
public MultiPlace(GrimPlayer player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
private final List<String> flags = new ArrayList<>();
|
||||
|
||||
private boolean hasPlaced;
|
||||
private BlockFace lastFace;
|
||||
private Vector3f lastCursor;
|
||||
private Vector3i lastPos;
|
||||
|
||||
@Override
|
||||
public void onBlockPlace(final BlockPlace place) {
|
||||
final BlockFace face = place.getDirection();
|
||||
final Vector3f cursor = place.getCursor();
|
||||
final Vector3i pos = place.getPlacedAgainstBlockLocation();
|
||||
|
||||
if (hasPlaced && (face != lastFace || !cursor.equals(lastCursor) || !pos.equals(lastPos))) {
|
||||
final String verbose = "face=" + face + ", lastFace=" + lastFace
|
||||
+ ", cursor=" + MessageUtil.toUnlabledString(cursor) + ", lastCursor=" + MessageUtil.toUnlabledString(lastCursor)
|
||||
+ ", pos=" + MessageUtil.toUnlabledString(pos) + ", lastPos=" + MessageUtil.toUnlabledString(lastPos);
|
||||
if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) {
|
||||
if (flagAndAlert(verbose) && shouldModifyPackets() && shouldCancel()) {
|
||||
place.resync();
|
||||
}
|
||||
} else {
|
||||
flags.add(verbose);
|
||||
}
|
||||
}
|
||||
|
||||
lastFace = face;
|
||||
lastCursor = cursor;
|
||||
lastPos = pos;
|
||||
hasPlaced = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceive(PacketReceiveEvent event) {
|
||||
if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && !player.packetStateData.lastPacketWasTeleport && !player.packetStateData.lastPacketWasOnePointSeventeenDuplicate) {
|
||||
hasPlaced = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPredictionComplete(PredictionComplete predictionComplete) {
|
||||
if (player.getClientVersion().isNewerThan(ClientVersion.V_1_8) && !player.skippedTickInActualMovement) {
|
||||
for (String verbose : flags) {
|
||||
flagAndAlert(verbose);
|
||||
}
|
||||
}
|
||||
|
||||
flags.clear();
|
||||
}
|
||||
}
|
||||
@@ -71,8 +71,8 @@ public class RotationPlace extends BlockPlaceCheck {
|
||||
SimpleCollisionBox box = new SimpleCollisionBox(place.getPlacedAgainstBlockLocation());
|
||||
|
||||
List<Vector3f> possibleLookDirs = new ArrayList<>(Arrays.asList(
|
||||
new Vector3f(player.lastXRot, player.yRot, 0),
|
||||
new Vector3f(player.xRot, player.yRot, 0)
|
||||
new Vector3f(player.xRot, player.yRot, 0),
|
||||
new Vector3f(player.lastXRot, player.yRot, 0)
|
||||
));
|
||||
|
||||
// Start checking if player is in the block
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.github.retrooper.packetevents.util.Vector3i;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPlaceCheck extends Check implements RotationCheck {
|
||||
public class BlockPlaceCheck extends Check implements RotationCheck, PostPredictionCheck {
|
||||
private static final List<StateType> weirdBoxes = new ArrayList<>();
|
||||
private static final List<StateType> buggyBoxes = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ public class PacketPlayerDigging extends PacketListenerAbstract {
|
||||
if (player == null) return;
|
||||
|
||||
if (!player.packetStateData.lastPacketWasTeleport && !player.packetStateData.lastPacketWasOnePointSeventeenDuplicate) {
|
||||
if (player.packetStateData.isSlowedByUsingItem() && player.packetStateData.getSlowedByUsingItemSlot() != player.packetStateData.lastSlotSelected) {
|
||||
if (player.packetStateData.isSlowedByUsingItem() && player.packetStateData.eatingHand != InteractionHand.OFF_HAND && player.packetStateData.getSlowedByUsingItemSlot() != player.packetStateData.lastSlotSelected) {
|
||||
player.packetStateData.setSlowedByUsingItem(false);
|
||||
player.checkManager.getPostPredictionCheck(NoSlowA.class).didSlotChangeLastTick = true;
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class PacketPlayerDigging extends PacketListenerAbstract {
|
||||
|
||||
if (player.packetStateData.lastSlotSelected != slot) {
|
||||
// just assume they tick after this
|
||||
if (!player.isTickingReliablyFor(3) && player.skippedTickInActualMovement) {
|
||||
if (!player.isTickingReliablyFor(3) && player.skippedTickInActualMovement && player.packetStateData.eatingHand != InteractionHand.OFF_HAND) {
|
||||
player.packetStateData.setSlowedByUsingItem(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,6 @@ public class PacketPlayerRespawn extends PacketListenerAbstract {
|
||||
player.compensatedEntities.serverPositionsMap.clear();
|
||||
}
|
||||
|
||||
// TODO: What does keep all metadata do?
|
||||
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> {
|
||||
player.isSneaking = false;
|
||||
player.lastOnGround = false;
|
||||
@@ -141,8 +140,16 @@ public class PacketPlayerRespawn extends PacketListenerAbstract {
|
||||
player.packetStateData.lastClaimedPosition = new Vector3d();
|
||||
player.filterMojangStupidityOnMojangStupidity = new Vector3d();
|
||||
|
||||
final boolean keepTrackedData = this.hasFlag(respawn, KEEP_TRACKED_DATA);
|
||||
|
||||
if (!keepTrackedData) {
|
||||
player.powderSnowFrozenTicks = 0;
|
||||
player.compensatedEntities.getSelf().hasGravity = true;
|
||||
player.playerEntityHasGravity = true;
|
||||
}
|
||||
|
||||
if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19_4)) {
|
||||
if (!this.hasFlag(respawn, KEEP_TRACKED_DATA)) {
|
||||
if (!keepTrackedData) {
|
||||
player.isSprinting = false;
|
||||
}
|
||||
} else {
|
||||
@@ -184,7 +191,6 @@ public class PacketPlayerRespawn extends PacketListenerAbstract {
|
||||
player.compensatedWorld.setDimension(respawn.getDimensionType(), event.getUser());
|
||||
}
|
||||
|
||||
// TODO And there should probably be some attribute holder that we can just call reset() on.
|
||||
if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) && !this.hasFlag(respawn, KEEP_ATTRIBUTES)) {
|
||||
// Reset attributes if not kept
|
||||
player.compensatedEntities.getSelf().resetAttributes();
|
||||
|
||||
@@ -139,6 +139,7 @@ public class CheckManager {
|
||||
.put(InvalidPlaceA.class, new InvalidPlaceA(player))
|
||||
.put(InvalidPlaceB.class, new InvalidPlaceB(player))
|
||||
.put(AirLiquidPlace.class, new AirLiquidPlace(player))
|
||||
.put(MultiPlace.class, new MultiPlace(player))
|
||||
.put(FarPlace.class, new FarPlace(player))
|
||||
.put(FabricatedPlace.class, new FabricatedPlace(player))
|
||||
.put(PositionPlace.class, new PositionPlace(player))
|
||||
@@ -201,6 +202,9 @@ public class CheckManager {
|
||||
for (PostPredictionCheck check : postPredictionCheck.values()) {
|
||||
check.onPacketReceive(packet);
|
||||
}
|
||||
for (BlockPlaceCheck check : blockPlaceCheck.values()) {
|
||||
check.onPacketReceive(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPacketSend(final PacketSendEvent packet) {
|
||||
@@ -213,6 +217,9 @@ public class CheckManager {
|
||||
for (PostPredictionCheck check : postPredictionCheck.values()) {
|
||||
check.onPacketSend(packet);
|
||||
}
|
||||
for (BlockPlaceCheck check : blockPlaceCheck.values()) {
|
||||
check.onPacketSend(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPositionUpdate(final PositionUpdate position) {
|
||||
@@ -240,6 +247,9 @@ public class CheckManager {
|
||||
for (PostPredictionCheck check : postPredictionCheck.values()) {
|
||||
check.onPredictionComplete(complete);
|
||||
}
|
||||
for (BlockPlaceCheck check : blockPlaceCheck.values()) {
|
||||
check.onPredictionComplete(complete);
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockPlace(final BlockPlace place) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package ac.grim.grimac.manager;
|
||||
import ac.grim.grimac.GrimAC;
|
||||
import ac.grim.grimac.GrimAPI;
|
||||
import ac.grim.grimac.utils.anticheat.LogUtil;
|
||||
import ac.grim.grimac.utils.math.GrimMath;
|
||||
import github.scarsz.configuralize.DynamicConfig;
|
||||
import github.scarsz.configuralize.Language;
|
||||
import lombok.Getter;
|
||||
@@ -77,7 +78,15 @@ public class ConfigManager {
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to load config", e);
|
||||
}
|
||||
maxPingTransaction = config.getIntElse("max-transaction-time", 60);
|
||||
|
||||
final int configuredMaxTransactionTime = config.getIntElse("max-transaction-time", 60);
|
||||
maxPingTransaction = (int) GrimMath.clamp(configuredMaxTransactionTime, 1, 180);
|
||||
if (maxPingTransaction != configuredMaxTransactionTime) {
|
||||
LogUtil.warn("Detected invalid max-transaction-time! This setting is clamped between 1 and 180 to prevent issues. " +
|
||||
"Changed: " + configuredMaxTransactionTime + " -> " + maxPingTransaction);
|
||||
LogUtil.warn("Attempting to disable or set this too high can result in memory usage issues.");
|
||||
}
|
||||
|
||||
ignoredClientPatterns.clear();
|
||||
for (String string : config.getStringList("client-brand.ignored-clients")) {
|
||||
try {
|
||||
|
||||
@@ -19,6 +19,7 @@ public class DiscordManager implements Initable {
|
||||
private static WebhookClient client;
|
||||
private int embedColor;
|
||||
private String staticContent = "";
|
||||
private String embedTitle = "";
|
||||
|
||||
public static final Pattern WEBHOOK_PATTERN = Pattern.compile("(?:https?://)?(?:\\w+\\.)?\\w+\\.\\w+/api(?:/v\\d+)?/webhooks/(\\d+)/([\\w-]+)(?:/(?:\\w+)?)?");
|
||||
|
||||
@@ -40,6 +41,8 @@ public class DiscordManager implements Initable {
|
||||
client = WebhookClient.withId(Long.parseUnsignedLong(matcher.group(1)), matcher.group(2));
|
||||
client.setTimeout(15000); // Requests expire after 15 seconds
|
||||
|
||||
embedTitle = GrimAPI.INSTANCE.getConfigManager().getConfig().getStringElse("embed-title", "**Grim Alert**");
|
||||
|
||||
try {
|
||||
embedColor = Color.decode(GrimAPI.INSTANCE.getConfigManager().getConfig().getStringElse("embed-color", "#00FFFF")).getRGB();
|
||||
} catch (NumberFormatException e) {
|
||||
@@ -70,7 +73,7 @@ public class DiscordManager implements Initable {
|
||||
public void sendAlert(GrimPlayer player, String verbose, String checkName, String violations) {
|
||||
if (client != null) {
|
||||
|
||||
String content = staticContent + "";
|
||||
String content = staticContent;
|
||||
content = content.replace("%check%", checkName);
|
||||
content = content.replace("%violations%", violations);
|
||||
content = GrimAPI.INSTANCE.getExternalAPI().replaceVariables(player, content, false);
|
||||
@@ -80,7 +83,7 @@ public class DiscordManager implements Initable {
|
||||
.setImageUrl("https://i.stack.imgur.com/Fzh0w.png") // Constant width
|
||||
.setThumbnailUrl("https://crafthead.net/helm/" + player.user.getProfile().getUUID())
|
||||
.setColor(embedColor)
|
||||
.setTitle(new WebhookEmbed.EmbedTitle("**Grim Alert**", null))
|
||||
.setTitle(new WebhookEmbed.EmbedTitle(embedTitle, null))
|
||||
.setDescription(content)
|
||||
.setTimestamp(Instant.now())
|
||||
.setFooter(new WebhookEmbed.EmbedFooter("", "https://grim.ac/images/grim.png"));
|
||||
|
||||
@@ -3,6 +3,7 @@ package ac.grim.grimac.player;
|
||||
import ac.grim.grimac.GrimAPI;
|
||||
import ac.grim.grimac.api.AbstractCheck;
|
||||
import ac.grim.grimac.api.GrimUser;
|
||||
import ac.grim.grimac.checks.Check;
|
||||
import ac.grim.grimac.checks.impl.aim.processor.AimProcessor;
|
||||
import ac.grim.grimac.checks.impl.misc.ClientBrand;
|
||||
import ac.grim.grimac.checks.impl.misc.TransactionOrder;
|
||||
@@ -35,7 +36,6 @@ import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.GameMode;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
import com.github.retrooper.packetevents.protocol.world.BlockFace;
|
||||
import com.github.retrooper.packetevents.protocol.world.Dimension;
|
||||
import com.github.retrooper.packetevents.protocol.world.dimension.DimensionType;
|
||||
import com.github.retrooper.packetevents.util.Vector3d;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
@@ -504,6 +504,13 @@ public class GrimPlayer implements GrimUser {
|
||||
if (bukkitPlayer == null) return;
|
||||
this.noModifyPacketPermission = bukkitPlayer.hasPermission("grim.nomodifypacket");
|
||||
this.noSetbackPermission = bukkitPlayer.hasPermission("grim.nosetback");
|
||||
FoliaScheduler.getAsyncScheduler().runNow(GrimAPI.INSTANCE.getPlugin(), t -> {
|
||||
for (AbstractCheck check : checkManager.allChecks.values()) {
|
||||
if (check instanceof Check) {
|
||||
((Check) check).updateExempted();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private int spamThreshold = 100;
|
||||
|
||||
@@ -364,7 +364,7 @@ public class MovementCheckRunner extends Check implements PositionCheck {
|
||||
}
|
||||
player.uncertaintyHandler.isSteppingOnHoney = true;
|
||||
}
|
||||
if (BlockTags.BEDS.contains(data.getType()) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8)) {
|
||||
if (BlockTags.BEDS.contains(data.getType()) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_12)) {
|
||||
player.uncertaintyHandler.isSteppingOnBouncyBlock = true;
|
||||
}
|
||||
if (BlockTags.ICE.contains(data.getType())) {
|
||||
|
||||
@@ -16,9 +16,10 @@ import com.github.retrooper.packetevents.protocol.world.BlockFace;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
import com.github.retrooper.packetevents.util.Vector3d;
|
||||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class PlayerBaseTick {
|
||||
GrimPlayer player;
|
||||
|
||||
@@ -149,9 +150,14 @@ public class PlayerBaseTick {
|
||||
// Pre-1.17 clients don't have powder snow and therefore don't desync
|
||||
if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_16_4)) return;
|
||||
|
||||
// The client first desync's this attribute
|
||||
final ValuedAttribute playerSpeed = player.compensatedEntities.getSelf().getAttribute(Attributes.GENERIC_MOVEMENT_SPEED).get();
|
||||
playerSpeed.property().get().getModifiers().removeIf(modifier -> modifier.getUUID().equals(CompensatedEntities.SNOW_MODIFIER_UUID) || modifier.getName().getKey().equals("powder_snow"));
|
||||
|
||||
// Might be null after respawn?
|
||||
final Optional<WrapperPlayServerUpdateAttributes.Property> property = playerSpeed.property();
|
||||
if (!property.isPresent()) return;
|
||||
|
||||
// The client first desync's this attribute
|
||||
property.get().getModifiers().removeIf(modifier -> modifier.getUUID().equals(CompensatedEntities.SNOW_MODIFIER_UUID) || modifier.getName().getKey().equals("powder_snow"));
|
||||
playerSpeed.recalculate();
|
||||
|
||||
// And then re-adds it using purely what the server has sent it
|
||||
@@ -165,7 +171,7 @@ public class PlayerBaseTick {
|
||||
float percentFrozen = (float) Math.min(i, ticksToFreeze) / (float) ticksToFreeze;
|
||||
float percentFrozenReducedToSpeed = -0.05F * percentFrozen;
|
||||
|
||||
playerSpeed.property().get().getModifiers().add(new WrapperPlayServerUpdateAttributes.PropertyModifier(CompensatedEntities.SNOW_MODIFIER_UUID, percentFrozenReducedToSpeed, WrapperPlayServerUpdateAttributes.PropertyModifier.Operation.ADDITION));
|
||||
property.get().getModifiers().add(new WrapperPlayServerUpdateAttributes.PropertyModifier(CompensatedEntities.SNOW_MODIFIER_UUID, percentFrozenReducedToSpeed, WrapperPlayServerUpdateAttributes.PropertyModifier.Operation.ADDITION));
|
||||
playerSpeed.recalculate();
|
||||
}
|
||||
}
|
||||
|
||||
+35
-5
@@ -1,14 +1,20 @@
|
||||
package ac.grim.grimac.predictionengine.movementtick;
|
||||
|
||||
import ac.grim.grimac.player.GrimPlayer;
|
||||
import ac.grim.grimac.utils.data.attribute.ValuedAttribute;
|
||||
import ac.grim.grimac.utils.data.packetentity.PacketEntityStrider;
|
||||
import ac.grim.grimac.utils.nmsutil.BlockProperties;
|
||||
import com.github.retrooper.packetevents.protocol.attribute.Attributes;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.defaulttags.BlockTags;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
import com.github.retrooper.packetevents.util.Vector3d;
|
||||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MovementTickerStrider extends MovementTickerRideable {
|
||||
|
||||
public MovementTickerStrider(GrimPlayer player) {
|
||||
@@ -34,21 +40,45 @@ public class MovementTickerStrider extends MovementTickerRideable {
|
||||
public void livingEntityAIStep() {
|
||||
super.livingEntityAIStep();
|
||||
|
||||
((PacketEntityStrider) player.compensatedEntities.getSelf().getRiding()).isShaking = true;
|
||||
|
||||
StateType posMaterial = player.compensatedWorld.getStateTypeAt(player.x, player.y, player.z);
|
||||
StateType belowMaterial = BlockProperties.getOnPos(player, player.mainSupportingBlockData, new Vector3d(player.x, player.y, player.z));
|
||||
|
||||
((PacketEntityStrider) player.compensatedEntities.getSelf().getRiding()).isShaking =
|
||||
!BlockTags.STRIDER_WARM_BLOCKS.contains(posMaterial) &&
|
||||
final PacketEntityStrider strider = (PacketEntityStrider) player.compensatedEntities.getSelf().getRiding();
|
||||
strider.isShaking = !BlockTags.STRIDER_WARM_BLOCKS.contains(posMaterial) &&
|
||||
!BlockTags.STRIDER_WARM_BLOCKS.contains(belowMaterial) &&
|
||||
!player.wasTouchingLava;
|
||||
}
|
||||
|
||||
private static final WrapperPlayServerUpdateAttributes.PropertyModifier SUFFOCATING_MODIFIER = new WrapperPlayServerUpdateAttributes.PropertyModifier(
|
||||
ResourceLocation.minecraft("suffocating"), -0.34F, WrapperPlayServerUpdateAttributes.PropertyModifier.Operation.MULTIPLY_BASE);
|
||||
|
||||
@Override
|
||||
public float getSteeringSpeed() {
|
||||
PacketEntityStrider strider = (PacketEntityStrider) player.compensatedEntities.getSelf().getRiding();
|
||||
return (float) strider.getAttributeValue(Attributes.GENERIC_MOVEMENT_SPEED) * (strider.isShaking ? 0.23F : 0.55F);
|
||||
// Unsure which version the speed changed in
|
||||
final boolean newSpeed = player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20);
|
||||
final float coldSpeed = newSpeed ? 0.35F : 0.23F;
|
||||
|
||||
// Client desyncs the attribute
|
||||
// Again I don't know when this was changed, or whether it always existed, so I will just put it behind 1.20+
|
||||
final ValuedAttribute movementSpeedAttr = strider.getAttribute(Attributes.GENERIC_MOVEMENT_SPEED).get();
|
||||
float updatedMovementSpeed = (float) movementSpeedAttr.get();
|
||||
if (newSpeed) {
|
||||
final WrapperPlayServerUpdateAttributes.Property lastProperty = movementSpeedAttr.property().orElse(null);
|
||||
if (lastProperty != null && (!strider.isShaking || lastProperty.getModifiers().stream().noneMatch(mod -> mod.getName().getKey().equals("suffocating")))) {
|
||||
WrapperPlayServerUpdateAttributes.Property newProperty = new WrapperPlayServerUpdateAttributes.Property(lastProperty.getAttribute(), lastProperty.getValue(), new ArrayList<>(lastProperty.getModifiers()));
|
||||
if (!strider.isShaking) {
|
||||
newProperty.getModifiers().removeIf(modifier -> modifier.getName().getKey().equals("suffocating"));
|
||||
} else {
|
||||
newProperty.getModifiers().add(SUFFOCATING_MODIFIER);
|
||||
}
|
||||
movementSpeedAttr.with(newProperty);
|
||||
updatedMovementSpeed = (float) movementSpeedAttr.get();
|
||||
movementSpeedAttr.with(lastProperty);
|
||||
}
|
||||
}
|
||||
|
||||
return updatedMovementSpeed * (strider.isShaking ? coldSpeed : 0.55F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,8 @@ package ac.grim.grimac.utils.anticheat;
|
||||
import ac.grim.grimac.GrimAPI;
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.util.Vector3f;
|
||||
import com.github.retrooper.packetevents.util.Vector3i;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
@@ -11,6 +13,13 @@ import java.util.regex.Pattern;
|
||||
|
||||
@UtilityClass
|
||||
public class MessageUtil {
|
||||
public String toUnlabledString(Vector3i vec) {
|
||||
return vec == null ? "null" : vec.x + ", " + vec.y + ", " + vec.z;
|
||||
}
|
||||
|
||||
public String toUnlabledString(Vector3f vec) {
|
||||
return vec == null ? "null" : vec.x + ", " + vec.y + ", " + vec.z;
|
||||
}
|
||||
|
||||
public String format(String string) {
|
||||
string = formatWithNoColor(string);
|
||||
|
||||
@@ -3,12 +3,11 @@ package ac.grim.grimac.utils.collisions;
|
||||
import ac.grim.grimac.player.GrimPlayer;
|
||||
import ac.grim.grimac.predictionengine.movementtick.MovementTickerStrider;
|
||||
import ac.grim.grimac.utils.collisions.blocks.*;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicFence;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicPane;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicWall;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicCollisionFence;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicCollisionPane;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicCollisionWall;
|
||||
import ac.grim.grimac.utils.collisions.datatypes.*;
|
||||
import ac.grim.grimac.utils.data.packetentity.PacketEntityStrider;
|
||||
import ac.grim.grimac.utils.math.GrimMath;
|
||||
import ac.grim.grimac.utils.nmsutil.Materials;
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
@@ -25,6 +24,7 @@ import com.viaversion.viaversion.api.Via;
|
||||
import io.github.retrooper.packetevents.util.viaversion.ViaVersionUtil;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
// Warning for major game updates!
|
||||
// Do not use an enum for stuff like Axis and other data types not in 1.7
|
||||
@@ -71,9 +71,7 @@ public enum CollisionData {
|
||||
return NoCollisionBox.INSTANCE;
|
||||
}, StateTypes.LAVA),
|
||||
|
||||
WATER(NoCollisionBox.INSTANCE, StateTypes.WATER),
|
||||
|
||||
BREWINGSTAND((player, version, block, x, y, z) -> {
|
||||
BREWING_STAND((player, version, block, x, y, z) -> {
|
||||
int base = 0;
|
||||
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_13))
|
||||
@@ -86,27 +84,13 @@ public enum CollisionData {
|
||||
}, StateTypes.BREWING_STAND),
|
||||
|
||||
BAMBOO((player, version, block, x, y, z) -> {
|
||||
// ViaVersion replacement block - sugarcane
|
||||
if (version.isOlderThan(ClientVersion.V_1_13_2))
|
||||
// ViaVersion replacement, sugarcane
|
||||
if (version.isOlderThan(ClientVersion.V_1_14)) {
|
||||
return NoCollisionBox.INSTANCE;
|
||||
|
||||
// Offset taken from NMS
|
||||
long i = (x * 3129871L) ^ (long) z * 116129781L ^ (long) 0;
|
||||
i = i * i * 42317861L + i * 11L;
|
||||
i = i >> 16;
|
||||
|
||||
return new HexCollisionBox(6.5D, 0.0D, 6.5D, 9.5D, 16.0D, 9.5D).offset((((i & 15L) / 15.0F) - 0.5D) * 0.5D, 0, (((i >> 8 & 15L) / 15.0F) - 0.5D) * 0.5D);
|
||||
}
|
||||
return new HexOffsetCollisionBox(block.getType(), 6.5D, 0.0D, 6.5D, 9.5D, 16.0D, 9.5D);
|
||||
}, StateTypes.BAMBOO),
|
||||
|
||||
|
||||
BAMBOO_SAPLING((player, version, block, x, y, z) -> {
|
||||
long i = (x * 3129871L) ^ (long) z * 116129781L ^ (long) 0;
|
||||
i = i * i * 42317861L + i * 11L;
|
||||
i = i >> 16;
|
||||
|
||||
return new HexCollisionBox(4.0D, 0.0D, 4.0D, 12.0D, 12.0D, 12.0D).offset((((i & 15L) / 15.0F) - 0.5D) * 0.5D, 0, (((i >> 8 & 15L) / 15.0F) - 0.5D) * 0.5D);
|
||||
}, StateTypes.BAMBOO_SAPLING),
|
||||
|
||||
COMPOSTER((player, version, block, x, y, z) -> {
|
||||
double height = 0.125;
|
||||
|
||||
@@ -159,7 +143,7 @@ public enum CollisionData {
|
||||
}
|
||||
}, BlockTags.ANVIL.getStates().toArray(new StateType[0])),
|
||||
|
||||
WALL(new DynamicWall(), BlockTags.WALLS.getStates().toArray(new StateType[0])),
|
||||
WALL(new DynamicCollisionWall(), BlockTags.WALLS.getStates().toArray(new StateType[0])),
|
||||
|
||||
SLAB((player, version, data, x, y, z) -> {
|
||||
Type slabType = data.getTypeData();
|
||||
@@ -177,7 +161,7 @@ public enum CollisionData {
|
||||
SKULL(new SimpleCollisionBox(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F, false),
|
||||
StateTypes.CREEPER_HEAD, StateTypes.ZOMBIE_HEAD, StateTypes.DRAGON_HEAD, StateTypes.PLAYER_HEAD,
|
||||
StateTypes.SKELETON_SKULL, StateTypes.WITHER_SKELETON_SKULL, StateTypes.HEAVY_CORE),
|
||||
|
||||
|
||||
PIGLIN_HEAD(new HexCollisionBox(3.0D, 0.0D, 3.0D, 13.0D, 8.0D, 13.0D), StateTypes.PIGLIN_HEAD),
|
||||
|
||||
// Overwrite previous SKULL enum for legacy, where head and wall skull isn't separate
|
||||
@@ -210,13 +194,6 @@ public enum CollisionData {
|
||||
}
|
||||
}, StateTypes.PIGLIN_WALL_HEAD),
|
||||
|
||||
BANNER(new HexCollisionBox(4.0D, 0.0D, 4.0D, 12.0D, 16.0D, 12.0D),
|
||||
BlockTags.BANNERS.getStates().toArray(new StateType[0])),
|
||||
|
||||
CORAL_FAN((player, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 4.0D, 14.0D);
|
||||
}, BlockTags.CORALS.getStates().toArray(new StateType[0])),
|
||||
|
||||
DOOR(new DoorHandler(), BlockTags.DOORS.getStates().toArray(new StateType[0])),
|
||||
|
||||
HOPPER((player, version, data, x, y, z) -> {
|
||||
@@ -281,43 +258,31 @@ public enum CollisionData {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D);
|
||||
}, StateTypes.STONECUTTER),
|
||||
|
||||
SWEET_BERRY((player, version, data, x, y, z) -> {
|
||||
if (data.getAge() == 0) {
|
||||
return new HexCollisionBox(3.0D, 0.0D, 3.0D, 13.0D, 8.0D, 13.0D);
|
||||
} else if (data.getAge() < 3) {
|
||||
return new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
}
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true);
|
||||
}, StateTypes.SWEET_BERRY_BUSH),
|
||||
CORAL_FAN(NoCollisionBox.INSTANCE, BlockTags.CORALS.getStates().toArray(new StateType[0])),
|
||||
|
||||
SAPLING(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D),
|
||||
BlockTags.SAPLINGS.getStates().toArray(new StateType[0])),
|
||||
RAILS(NoCollisionBox.INSTANCE, BlockTags.RAILS.getStates().toArray(new StateType[0])),
|
||||
|
||||
ROOTS(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D),
|
||||
StateTypes.WARPED_ROOTS, StateTypes.CRIMSON_ROOTS),
|
||||
BANNER(NoCollisionBox.INSTANCE, BlockTags.BANNERS.getStates().toArray(new StateType[0])),
|
||||
|
||||
FLOWER(new HexCollisionBox(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D),
|
||||
BlockTags.SMALL_FLOWERS.getStates().toArray(new StateType[0])),
|
||||
SMALL_FLOWER(NoCollisionBox.INSTANCE, BlockTags.SMALL_FLOWERS.getStates().toArray(new StateType[0])),
|
||||
|
||||
DEAD_BUSH(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D), StateTypes.DEAD_BUSH),
|
||||
TALL_FLOWER(NoCollisionBox.INSTANCE, BlockTags.TALL_FLOWERS.getStates().toArray(new StateType[0])),
|
||||
|
||||
SUGARCANE(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D), StateTypes.SUGAR_CANE),
|
||||
SAPLING(NoCollisionBox.INSTANCE, BlockTags.SAPLINGS.getStates().toArray(new StateType[0])),
|
||||
|
||||
NETHER_SPROUTS(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 3.0D, 14.0D), StateTypes.NETHER_SPROUTS),
|
||||
BUTTON(NoCollisionBox.INSTANCE, BlockTags.BUTTONS.getStates().toArray(new StateType[0])),
|
||||
|
||||
GRASS_FERN(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D),
|
||||
StateTypes.GRASS, StateTypes.FERN),
|
||||
|
||||
TALL_GRASS(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), StateTypes.TALL_GRASS),
|
||||
|
||||
SEA_GRASS(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D),
|
||||
StateTypes.SEAGRASS),
|
||||
|
||||
CAVE_VINES(new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D), StateTypes.CAVE_VINES, StateTypes.CAVE_VINES_PLANT),
|
||||
|
||||
TWISTING_VINES_BLOCK(new HexCollisionBox(4.0D, 0.0D, 4.0D, 12.0D, 15.0D, 12.0D), StateTypes.TWISTING_VINES, StateTypes.WEEPING_VINES),
|
||||
|
||||
TWISTING_VINES(new HexCollisionBox(4.0D, 0.0D, 4.0D, 12.0D, 16.0D, 12.0D), StateTypes.TWISTING_VINES_PLANT, StateTypes.WEEPING_VINES_PLANT),
|
||||
// All states that unconditionally have no collision and are not in a group where every member also has no collision.
|
||||
NO_COLLISION(NoCollisionBox.INSTANCE, StateTypes.TWISTING_VINES_PLANT, StateTypes.WEEPING_VINES_PLANT,
|
||||
StateTypes.TWISTING_VINES, StateTypes.WEEPING_VINES, StateTypes.CAVE_VINES, StateTypes.CAVE_VINES_PLANT,
|
||||
StateTypes.TALL_SEAGRASS, StateTypes.SEAGRASS, StateTypes.SHORT_GRASS, StateTypes.FERN, StateTypes.NETHER_SPROUTS,
|
||||
StateTypes.DEAD_BUSH, StateTypes.SUGAR_CANE, StateTypes.SWEET_BERRY_BUSH, StateTypes.WARPED_ROOTS,
|
||||
StateTypes.CRIMSON_ROOTS, StateTypes.TORCHFLOWER_CROP, StateTypes.PINK_PETALS, StateTypes.TALL_GRASS,
|
||||
StateTypes.LARGE_FERN, StateTypes.BAMBOO_SAPLING, StateTypes.HANGING_ROOTS,
|
||||
StateTypes.SMALL_DRIPLEAF, StateTypes.END_PORTAL, StateTypes.LEVER, StateTypes.PUMPKIN_STEM, StateTypes.MELON_STEM,
|
||||
StateTypes.ATTACHED_MELON_STEM, StateTypes.ATTACHED_PUMPKIN_STEM, StateTypes.BEETROOTS, StateTypes.POTATOES,
|
||||
StateTypes.WHEAT, StateTypes.CARROTS, StateTypes.NETHER_WART, StateTypes.MOVING_PISTON, StateTypes.AIR, StateTypes.CAVE_AIR,
|
||||
StateTypes.VOID_AIR, StateTypes.LIGHT, StateTypes.WATER),
|
||||
|
||||
KELP(new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D), StateTypes.KELP),
|
||||
// Kelp block is a full block, so it by default is correct
|
||||
@@ -445,33 +410,6 @@ public enum CollisionData {
|
||||
return new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D); // post
|
||||
}, StateTypes.HONEY_BLOCK),
|
||||
|
||||
SPORE_BLOSSOM(new HexCollisionBox(2.0D, 13.0D, 2.0D, 14.0D, 16.0D, 14.0D), StateTypes.SPORE_BLOSSOM),
|
||||
|
||||
GLOW_LICHEN((player, version, data, x, y, z) -> {
|
||||
ComplexCollisionBox box = new ComplexCollisionBox();
|
||||
|
||||
if (data.isUp()) {
|
||||
box.add(new HexCollisionBox(0.0D, 15.0D, 0.0D, 16.0D, 16.0D, 16.0D));
|
||||
}
|
||||
if (data.isDown()) {
|
||||
box.add(new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D));
|
||||
}
|
||||
if (data.getWest() == West.TRUE) {
|
||||
box.add(new HexCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 16.0D, 16.0D));
|
||||
}
|
||||
if (data.getEast() == East.TRUE) {
|
||||
box.add(new HexCollisionBox(15.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D));
|
||||
}
|
||||
if (data.getNorth() == North.TRUE) {
|
||||
box.add(new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 1.0D));
|
||||
}
|
||||
if (data.getSouth() == South.TRUE) {
|
||||
box.add(new HexCollisionBox(0.0D, 0.0D, 15.0D, 16.0D, 16.0D, 16.0D));
|
||||
}
|
||||
|
||||
return box;
|
||||
}, StateTypes.GLOW_LICHEN),
|
||||
|
||||
DRAGON_EGG_BLOCK(new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D), StateTypes.DRAGON_EGG),
|
||||
|
||||
GRINDSTONE((player, version, data, x, y, z) -> {
|
||||
@@ -567,7 +505,14 @@ public enum CollisionData {
|
||||
|
||||
}, StateTypes.GRINDSTONE),
|
||||
|
||||
PANE(new DynamicCollisionPane(), Materials.getPanes().toArray(new StateType[0])),
|
||||
|
||||
CHAIN_BLOCK((player, version, data, x, y, z) -> {
|
||||
if (version.isOlderThan(ClientVersion.V_1_16)) {
|
||||
// viaversion replacement - iron bars
|
||||
return CollisionData.PANE.dynamic.fetch(player, version, data, x, y, z);
|
||||
}
|
||||
|
||||
if (data.getAxis() == Axis.X) {
|
||||
return new HexCollisionBox(0.0D, 6.5D, 6.5D, 16.0D, 9.5D, 9.5D);
|
||||
} else if (data.getAxis() == Axis.Y) {
|
||||
@@ -597,9 +542,7 @@ public enum CollisionData {
|
||||
|
||||
}, BlockTags.FENCE_GATES.getStates().toArray(new StateType[0])),
|
||||
|
||||
FENCE(new DynamicFence(), BlockTags.FENCES.getStates().toArray(new StateType[0])),
|
||||
|
||||
PANE(new DynamicPane(), Materials.getPanes().toArray(new StateType[0])),
|
||||
FENCE(new DynamicCollisionFence(), BlockTags.FENCES.getStates().toArray(new StateType[0])),
|
||||
|
||||
SNOW((player, version, data, x, y, z) -> {
|
||||
if (data.getLayers() == 1 && version.isNewerThanOrEquals(ClientVersion.V_1_13)) {
|
||||
@@ -677,8 +620,6 @@ public enum CollisionData {
|
||||
|
||||
}, StateTypes.FARMLAND),
|
||||
|
||||
HANGING_ROOTS(new HexCollisionBox(2.0D, 10.0D, 2.0D, 14.0D, 16.0D, 14.0D), StateTypes.HANGING_ROOTS),
|
||||
|
||||
GRASS_PATH((player, version, data, x, y, z) -> {
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_9))
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 15.0D, 16.0D);
|
||||
@@ -741,17 +682,36 @@ public enum CollisionData {
|
||||
}, StateTypes.END_ROD, StateTypes.LIGHTNING_ROD),
|
||||
|
||||
CAULDRON((player, version, data, x, y, z) -> {
|
||||
double height = 0.25;
|
||||
if (version.isNewerThan(ClientVersion.getById(467))) { // changed in 19w13a, 1.14 Snapshot
|
||||
return new ComplexCollisionBox(
|
||||
new SimpleCollisionBox(0.0, 0.0, 0.0, 0.125, 1.0, 0.25, false),
|
||||
new SimpleCollisionBox(0.0, 0.0, 0.75, 0.125, 1.0, 1.0, false),
|
||||
new SimpleCollisionBox(0.125, 0.0, 0.0, 0.25, 1.0, 0.125, false),
|
||||
new SimpleCollisionBox(0.125, 0.0, 0.875, 0.25, 1.0, 1.0, false),
|
||||
new SimpleCollisionBox(0.75, 0.0, 0.0, 1.0, 1.0, 0.125, false),
|
||||
new SimpleCollisionBox(0.75, 0.0, 0.875, 1.0, 1.0, 1.0, false),
|
||||
new SimpleCollisionBox(0.875, 0.0, 0.125, 1.0, 1.0, 0.25, false),
|
||||
new SimpleCollisionBox(0.875, 0.0, 0.75, 1.0, 1.0, 0.875, false),
|
||||
new SimpleCollisionBox(0.0, 0.1875, 0.25, 1.0, 0.25, 0.75, false),
|
||||
new SimpleCollisionBox(0.125, 0.1875, 0.125, 0.875, 0.25, 0.25, false),
|
||||
new SimpleCollisionBox(0.125, 0.1875, 0.75, 0.875, 0.25, 0.875, false),
|
||||
new SimpleCollisionBox(0.25, 0.1875, 0.0, 0.75, 1.0, 0.125, false),
|
||||
new SimpleCollisionBox(0.25, 0.1875, 0.875, 0.75, 1.0, 1.0, false),
|
||||
new SimpleCollisionBox(0.0, 0.25, 0.25, 0.125, 1.0, 0.75, false),
|
||||
new SimpleCollisionBox(0.875, 0.25, 0.25, 1.0, 1.0, 0.75, false)
|
||||
);
|
||||
} else {
|
||||
double height = 0.25;
|
||||
if (version.isOlderThan(ClientVersion.V_1_13))
|
||||
height = 0.3125;
|
||||
|
||||
if (version.isOlderThan(ClientVersion.V_1_13))
|
||||
height = 0.3125;
|
||||
|
||||
return new ComplexCollisionBox(
|
||||
new SimpleCollisionBox(0, 0, 0, 1, height, 1, false),
|
||||
new SimpleCollisionBox(0, height, 0, 0.125, 1, 1, false),
|
||||
new SimpleCollisionBox(1 - 0.125, height, 0, 1, 1, 1, false),
|
||||
new SimpleCollisionBox(0, height, 0, 1, 1, 0.125, false),
|
||||
new SimpleCollisionBox(0, height, 1 - 0.125, 1, 1, 1, false));
|
||||
return new ComplexCollisionBox(
|
||||
new SimpleCollisionBox(0, 0, 0, 1, height, 1, false),
|
||||
new SimpleCollisionBox(0, height, 0, 0.125, 1, 1, false),
|
||||
new SimpleCollisionBox(1 - 0.125, height, 0, 1, 1, 1, false),
|
||||
new SimpleCollisionBox(0, height, 0, 1, 1, 0.125, false),
|
||||
new SimpleCollisionBox(0, height, 1 - 0.125, 1, 1, 1, false));
|
||||
}
|
||||
}, BlockTags.CAULDRONS.getStates().toArray(new StateType[0])),
|
||||
|
||||
CACTUS(new SimpleCollisionBox(0.0625, 0, 0.0625,
|
||||
@@ -824,71 +784,18 @@ public enum CollisionData {
|
||||
|
||||
CORAL_PLANT((player, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 15.0D, 14.0D);
|
||||
}, BlockTags.CORAL_PLANTS.getStates().toArray(new StateType[0])),
|
||||
}, Stream.concat(
|
||||
Arrays.stream(BlockTags.CORAL_PLANTS.getStates().toArray(new StateType[0])),
|
||||
Stream.of(StateTypes.DEAD_HORN_CORAL, StateTypes.DEAD_TUBE_CORAL, StateTypes.DEAD_BRAIN_CORAL,
|
||||
StateTypes.DEAD_BUBBLE_CORAL, StateTypes.DEAD_FIRE_CORAL)
|
||||
)
|
||||
.distinct() // This will remove duplicates
|
||||
.toArray(StateType[]::new)
|
||||
),
|
||||
|
||||
SIGN(new SimpleCollisionBox(0.25, 0.0, 0.25, 0.75, 1.0, 0.75, false),
|
||||
BlockTags.STANDING_SIGNS.getStates().toArray(new StateType[0])),
|
||||
|
||||
BEETROOT((player, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, (data.getAge() + 1) * 2, 1.0D);
|
||||
}, StateTypes.BEETROOTS),
|
||||
|
||||
WHEAT((player, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, (data.getAge() + 1) * 2, 1.0D);
|
||||
}, StateTypes.WHEAT),
|
||||
|
||||
CARROT_NETHERWART((player, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, data.getAge() + 2, 1.0D);
|
||||
}, StateTypes.CARROTS, StateTypes.NETHER_WART),
|
||||
|
||||
NETHER_WART((player, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 5 + (data.getAge() * 3), 1.0D);
|
||||
}, StateTypes.NETHER_WART),
|
||||
|
||||
BUTTON((player, version, data, x, y, z) -> {
|
||||
double f2 = (float) (data.isPowered() ? 1 : 2) / 16.0;
|
||||
|
||||
switch (data.getFacing()) {
|
||||
case WEST:
|
||||
return new SimpleCollisionBox(0.0, 0.375, 0.3125, f2, 0.625, 0.6875, false);
|
||||
case EAST:
|
||||
return new SimpleCollisionBox(1.0 - f2, 0.375, 0.3125, 1.0, 0.625, 0.6875, false);
|
||||
case NORTH:
|
||||
return new SimpleCollisionBox(0.3125, 0.375, 0.0, 0.6875, 0.625, f2, false);
|
||||
case SOUTH:
|
||||
return new SimpleCollisionBox(0.3125, 0.375, 1.0 - f2, 0.6875, 0.625, 1.0, false);
|
||||
case DOWN:
|
||||
return new SimpleCollisionBox(0.3125, 0.0, 0.375, 0.6875, 0.0 + f2, 0.625, false);
|
||||
case UP:
|
||||
return new SimpleCollisionBox(0.3125, 1.0 - f2, 0.375, 0.6875, 1.0, 0.625, false);
|
||||
}
|
||||
|
||||
return NoCollisionBox.INSTANCE;
|
||||
|
||||
}, BlockTags.BUTTONS.getStates().toArray(new StateType[0])),
|
||||
|
||||
LEVER((player, version, data, x, y, z) -> {
|
||||
double f = 0.1875;
|
||||
|
||||
switch (data.getFacing()) {
|
||||
case WEST:
|
||||
return new SimpleCollisionBox(1.0 - f * 2.0, 0.2, 0.5 - f, 1.0, 0.8, 0.5 + f, false);
|
||||
case EAST:
|
||||
return new SimpleCollisionBox(0.0, 0.2, 0.5 - f, f * 2.0, 0.8, 0.5 + f, false);
|
||||
case NORTH:
|
||||
return new SimpleCollisionBox(0.5 - f, 0.2, 1.0 - f * 2.0, 0.5 + f, 0.8, 1.0, false);
|
||||
case SOUTH:
|
||||
return new SimpleCollisionBox(0.5 - f, 0.2, 0.0, 0.5 + f, 0.8, f * 2.0, false);
|
||||
case DOWN:
|
||||
return new SimpleCollisionBox(0.25, 0.4, 0.25, 0.75, 1.0, 0.75, false);
|
||||
case UP:
|
||||
return new SimpleCollisionBox(0.25, 0.0, 0.25, 0.75, 0.6, 0.75, false);
|
||||
}
|
||||
|
||||
return NoCollisionBox.INSTANCE;
|
||||
|
||||
}, StateTypes.LEVER),
|
||||
|
||||
STONE_PRESSURE_PLATE((player, version, data, x, y, z) -> {
|
||||
if (data.isPowered()) { // Pressed
|
||||
return new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D);
|
||||
@@ -920,27 +827,6 @@ public enum CollisionData {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
|
||||
}, StateTypes.TRIPWIRE),
|
||||
|
||||
ATTACHED_PUMPKIN_STEM((player, version, data, x, y, z) -> {
|
||||
if (version.isOlderThan(ClientVersion.V_1_13))
|
||||
return new HexCollisionBox(7.0D, 0.0D, 7.0D, 9.0D, 16.0D, 9.0D);
|
||||
|
||||
switch (data.getFacing()) {
|
||||
case SOUTH:
|
||||
return new HexCollisionBox(6.0D, 0.0D, 6.0D, 10.0D, 10.0D, 16.0D);
|
||||
case WEST:
|
||||
return new HexCollisionBox(0.0D, 0.0D, 6.0D, 10.0D, 10.0D, 10.0D);
|
||||
case NORTH:
|
||||
return new HexCollisionBox(6.0D, 0.0D, 0.0D, 10.0D, 10.0D, 10.0D);
|
||||
case EAST:
|
||||
default:
|
||||
return new HexCollisionBox(6.0D, 0.0D, 6.0D, 16.0D, 10.0D, 10.0D);
|
||||
}
|
||||
}, StateTypes.ATTACHED_MELON_STEM, StateTypes.ATTACHED_PUMPKIN_STEM),
|
||||
|
||||
PUMPKIN_STEM((player, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(7, 0, 7, 9, 2 * (data.getAge() + 1), 9);
|
||||
}, StateTypes.PUMPKIN_STEM, StateTypes.MELON_STEM),
|
||||
|
||||
TRIPWIRE_HOOK((player, version, data, x, y, z) -> {
|
||||
switch (data.getFacing()) {
|
||||
case NORTH:
|
||||
@@ -975,20 +861,6 @@ public enum CollisionData {
|
||||
|
||||
}, StateTypes.WALL_TORCH, StateTypes.REDSTONE_WALL_TORCH),
|
||||
|
||||
RAILS((player, version, data, x, y, z) -> {
|
||||
Shape shape = data.getShape();
|
||||
if (shape == Shape.ASCENDING_EAST || shape == Shape.ASCENDING_WEST ||
|
||||
shape == Shape.ASCENDING_NORTH || shape == Shape.ASCENDING_SOUTH) {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
|
||||
}
|
||||
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
|
||||
|
||||
}, BlockTags.RAILS.getStates().toArray(new StateType[0])),
|
||||
|
||||
// Known as block 36 - has no collision box
|
||||
TECHNICAL_MOVING_PISTON(NoCollisionBox.INSTANCE, StateTypes.MOVING_PISTON),
|
||||
|
||||
// 1.17 blocks
|
||||
CANDLE((player, version, data, x, y, z) -> {
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_17)) {
|
||||
@@ -1017,7 +889,13 @@ public enum CollisionData {
|
||||
|
||||
SCULK_SENSOR(new HexCollisionBox(0.0, 0.0, 0.0, 16.0, 8.0, 16.0), StateTypes.SCULK_SENSOR, StateTypes.CALIBRATED_SCULK_SENSOR),
|
||||
|
||||
DECORATED_POT(new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0), StateTypes.DECORATED_POT),
|
||||
DECORATED_POT((player, version, data, x, y, z) -> {
|
||||
if (version.isNewerThan(ClientVersion.V_1_19_3)) {
|
||||
return new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0);
|
||||
} else { // ViaVersion replacement is a Brick
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true);
|
||||
}
|
||||
}, StateTypes.DECORATED_POT),
|
||||
|
||||
BIG_DRIPLEAF((player, version, data, x, y, z) -> {
|
||||
if (version.isOlderThanOrEquals(ClientVersion.V_1_16_4))
|
||||
@@ -1033,34 +911,29 @@ public enum CollisionData {
|
||||
|
||||
}, StateTypes.BIG_DRIPLEAF),
|
||||
|
||||
DRIPSTONE((player, version, data, x, y, z) -> {
|
||||
POINTED_DRIPSTONE((player, version, data, x, y, z) -> {
|
||||
if (version.isOlderThan(ClientVersion.V_1_17))
|
||||
return getEndRod(version, BlockFace.UP);
|
||||
|
||||
HexCollisionBox box;
|
||||
SimpleCollisionBox box;
|
||||
|
||||
if (data.getThickness() == Thickness.TIP_MERGE) {
|
||||
box = new HexCollisionBox(5.0, 0.0, 5.0, 11.0, 16.0, 11.0);
|
||||
box = new HexOffsetCollisionBox(data.getType(), 5.0, 0.0, 5.0, 11.0, 16.0, 11.0);
|
||||
} else if (data.getThickness() == Thickness.TIP) {
|
||||
if (data.getVerticalDirection() == VerticalDirection.DOWN) {
|
||||
box = new HexCollisionBox(5.0, 5.0, 5.0, 11.0, 16.0, 11.0);
|
||||
box = new HexOffsetCollisionBox(data.getType(), 5.0, 5.0, 5.0, 11.0, 16.0, 11.0);
|
||||
} else {
|
||||
box = new HexCollisionBox(5.0, 0.0, 5.0, 11.0, 11.0, 11.0);
|
||||
box = new HexOffsetCollisionBox(data.getType(), 5.0, 0.0, 5.0, 11.0, 11.0, 11.0);
|
||||
}
|
||||
} else if (data.getThickness() == Thickness.FRUSTUM) {
|
||||
box = new HexCollisionBox(4.0, 0.0, 4.0, 12.0, 16.0, 12.0);
|
||||
box = new HexOffsetCollisionBox(data.getType(), 4.0, 0.0, 4.0, 12.0, 16.0, 12.0);
|
||||
} else if (data.getThickness() == Thickness.MIDDLE) {
|
||||
box = new HexCollisionBox(3.0, 0.0, 3.0, 13.0, 16.0, 13.0);
|
||||
box = new HexOffsetCollisionBox(data.getType(), 3.0, 0.0, 3.0, 13.0, 16.0, 13.0);
|
||||
} else {
|
||||
box = new HexCollisionBox(2.0, 0.0, 2.0, 14.0, 16.0, 14.0);
|
||||
box = new HexOffsetCollisionBox(data.getType(), 2.0, 0.0, 2.0, 14.0, 16.0, 14.0);
|
||||
}
|
||||
|
||||
// Copied from NMS and it works! That's all you need to know.
|
||||
long i = (x * 3129871L) ^ (long) z * 116129781L ^ (long) 0;
|
||||
i = i * i * 42317861L + i * 11L;
|
||||
i = i >> 16;
|
||||
|
||||
return box.offset(GrimMath.clamp((((i & 15L) / 15.0F) - 0.5D) * 0.5D, -0.125f, 0.125f), 0, GrimMath.clamp((((i >> 8 & 15L) / 15.0F) - 0.5D) * 0.5D, -0.125f, 0.125f));
|
||||
return box;
|
||||
}, StateTypes.POINTED_DRIPSTONE),
|
||||
|
||||
POWDER_SNOW((player, version, data, x, y, z) -> {
|
||||
@@ -1087,8 +960,6 @@ public enum CollisionData {
|
||||
return new HexCollisionBox(6.0D, 0.0D, 0.0D, 10.0D, 16.0D, 16.0D);
|
||||
}, StateTypes.NETHER_PORTAL),
|
||||
|
||||
END_PORTAL(new HexCollisionBox(0.0D, 6.0D, 0.0D, 16.0D, 12.0D, 16.0D), StateTypes.END_PORTAL),
|
||||
|
||||
AZALEA((player, version, data, x, y, z) -> {
|
||||
return new ComplexCollisionBox(new HexCollisionBox(0.0, 8.0, 0.0, 16.0, 16.0, 16.0),
|
||||
new HexCollisionBox(6.0, 0.0, 6.0, 10.0, 8.0, 10.0));
|
||||
@@ -1136,30 +1007,34 @@ public enum CollisionData {
|
||||
}
|
||||
}, StateTypes.MANGROVE_PROPAGULE),
|
||||
|
||||
SCULK_SHRIKER(new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D), StateTypes.SCULK_SHRIEKER),
|
||||
|
||||
FROGSPAWN(new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 1.5D, 16.0D), StateTypes.FROGSPAWN),
|
||||
|
||||
SNIFFER_EGG(new HexCollisionBox(1.0D, 0.0D, 2.0D, 15.0D, 16.0D, 14.0D), StateTypes.SNIFFER_EGG),
|
||||
|
||||
PINK_PETALS_BLOCK(new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 3.0D, 16.0D), StateTypes.PINK_PETALS),
|
||||
|
||||
TORCHFLOWER_CROP((player, version, data, x, y, z) -> {
|
||||
if (data.getAge() == 0) {
|
||||
return new HexCollisionBox(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D);
|
||||
SCULK_SHRIKER((player, version, data, x, y, z) -> {
|
||||
if (version.isNewerThan(ClientVersion.V_1_18_2)) {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
|
||||
} else {
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true);
|
||||
}
|
||||
// age is 1
|
||||
return new HexCollisionBox(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D);
|
||||
}, StateTypes.TORCHFLOWER_CROP),
|
||||
}, StateTypes.SCULK_SHRIEKER),
|
||||
|
||||
SNIFFER_EGG((player, version, data, x, y, z) -> {
|
||||
if (version.isNewerThan(ClientVersion.V_1_19_4)) {
|
||||
return new HexCollisionBox(1.0D, 0.0D, 2.0D, 15.0D, 16.0D, 14.0D);
|
||||
} else {
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true);
|
||||
}
|
||||
}, StateTypes.SNIFFER_EGG),
|
||||
|
||||
PITCHER_CROP((player, version, data, x, y, z) -> {
|
||||
final SimpleCollisionBox COLLISION_SHAPE_BULB = new HexCollisionBox(5.0D, -1.0D, 5.0D, 11.0D, 3.0D, 11.0D);
|
||||
final SimpleCollisionBox COLLISION_SHAPE_CROP = new HexCollisionBox(3.0D, -1.0D, 3.0D, 13.0D, 5.0D, 13.0D);
|
||||
if (version.isNewerThan(ClientVersion.V_1_19_4)) {
|
||||
final SimpleCollisionBox COLLISION_SHAPE_BULB = new HexCollisionBox(5.0D, -1.0D, 5.0D, 11.0D, 3.0D, 11.0D);
|
||||
final SimpleCollisionBox COLLISION_SHAPE_CROP = new HexCollisionBox(3.0D, -1.0D, 3.0D, 13.0D, 5.0D, 13.0D);
|
||||
|
||||
if (data.getAge() == 0) {
|
||||
return COLLISION_SHAPE_BULB;
|
||||
if (data.getAge() == 0) {
|
||||
return COLLISION_SHAPE_BULB;
|
||||
} else {
|
||||
return data.getHalf() == Half.LOWER ? COLLISION_SHAPE_CROP : NoCollisionBox.INSTANCE;
|
||||
}
|
||||
} else {
|
||||
return data.getHalf() == Half.LOWER ? COLLISION_SHAPE_CROP : NoCollisionBox.INSTANCE;
|
||||
return NoCollisionBox.INSTANCE;
|
||||
}
|
||||
}, StateTypes.PITCHER_CROP),
|
||||
|
||||
@@ -1176,8 +1051,6 @@ public enum CollisionData {
|
||||
}
|
||||
}, BlockTags.WALL_HANGING_SIGNS.getStates().toArray(new StateType[0])),
|
||||
|
||||
NONE(NoCollisionBox.INSTANCE, StateTypes.AIR, StateTypes.CAVE_AIR, StateTypes.VOID_AIR, StateTypes.LIGHT),
|
||||
|
||||
DEFAULT(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), StateTypes.STONE);
|
||||
|
||||
// This should be an array... but a hashmap will do for now...
|
||||
@@ -1249,7 +1122,7 @@ public enum CollisionData {
|
||||
return NoCollisionBox.INSTANCE;
|
||||
}
|
||||
|
||||
private static CollisionBox getCocoa(ClientVersion version, int age, BlockFace direction) {
|
||||
public static CollisionBox getCocoa(ClientVersion version, int age, BlockFace direction) {
|
||||
// From 1.9 - 1.10, the large cocoa block is the same as the medium one
|
||||
// https://bugs.mojang.com/browse/MC-94274
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_9_1) && version.isOlderThan(ClientVersion.V_1_11))
|
||||
@@ -1318,7 +1191,7 @@ public enum CollisionData {
|
||||
// Would pre-computing all states be worth the memory cost? I doubt it
|
||||
public static CollisionData getData(StateType state) { // TODO: Find a better hack for lava and scaffolding
|
||||
// What the fuck mojang, why put noCollision() and then give PITCHER_CROP collision?
|
||||
return state.isSolid() || state == StateTypes.LAVA || state == StateTypes.SCAFFOLDING || state == StateTypes.PITCHER_CROP || state == StateTypes.HEAVY_CORE || BlockTags.WALL_HANGING_SIGNS.contains(state) ? rawLookupMap.getOrDefault(state, DEFAULT) : NONE;
|
||||
return state.isSolid() || state == StateTypes.LAVA || state == StateTypes.SCAFFOLDING || state == StateTypes.PITCHER_CROP || state == StateTypes.HEAVY_CORE || BlockTags.WALL_HANGING_SIGNS.contains(state) ? rawLookupMap.getOrDefault(state, DEFAULT) : NO_COLLISION;
|
||||
}
|
||||
|
||||
// TODO: This is wrong if a block doesn't have any hitbox and isn't specified, light block?
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package ac.grim.grimac.utils.collisions;
|
||||
|
||||
import ac.grim.grimac.player.GrimPlayer;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicFence;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicWall;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicHitboxFence;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicHitboxPane;
|
||||
import ac.grim.grimac.utils.collisions.blocks.connecting.DynamicHitboxWall;
|
||||
import ac.grim.grimac.utils.collisions.datatypes.*;
|
||||
import ac.grim.grimac.utils.nmsutil.Materials;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
@@ -17,9 +18,510 @@ import java.util.*;
|
||||
|
||||
// Expansion to the CollisionData class, which is different than regular ray tracing hitboxes
|
||||
public enum HitboxData {
|
||||
|
||||
RAILS((player, item, version, data, x, y, z) -> {
|
||||
switch (data.getShape()) {
|
||||
case ASCENDING_NORTH:
|
||||
case ASCENDING_SOUTH:
|
||||
case ASCENDING_EAST:
|
||||
case ASCENDING_WEST:
|
||||
if (version.isOlderThan(ClientVersion.V_1_8)) {
|
||||
StateType railType = data.getType();
|
||||
// Activator rails always appear as flat detector rails in 1.7.10 because of ViaVersion
|
||||
// Ascending power rails in 1.7 have flat rail hitbox https://bugs.mojang.com/browse/MC-9134
|
||||
if (railType == StateTypes.ACTIVATOR_RAIL || (railType == StateTypes.POWERED_RAIL && data.isPowered())) {
|
||||
return new SimpleCollisionBox(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F, false);
|
||||
}
|
||||
return new SimpleCollisionBox(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F, false);
|
||||
} else if (version.isOlderThan(ClientVersion.V_1_9)) {
|
||||
return new SimpleCollisionBox(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F, false);
|
||||
} else if (version.isNewerThanOrEquals(ClientVersion.V_1_9) && version.isOlderThan(ClientVersion.V_1_10)) {
|
||||
// https://bugs.mojang.com/browse/MC-89552 sloped rails in 1.9 - it is slightly taller than a regular rail
|
||||
return new SimpleCollisionBox(0.0F, 0.0F, 0.0F, 1.0F, 0.1875F, 1.0F, false);
|
||||
} else if (version.isOlderThan(ClientVersion.V_1_11)) {
|
||||
// https://bugs.mojang.com/browse/MC-102638 All sloped rails are full blocks in 1.10
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true);
|
||||
}
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
|
||||
default:
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
|
||||
}
|
||||
}, BlockTags.RAILS.getStates().toArray(new StateType[0])),
|
||||
|
||||
END_PORTAL((player, item, version, data, x, y, z) -> {
|
||||
if (version.isOlderThan(ClientVersion.V_1_9)) {
|
||||
return new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D);
|
||||
} else if (version.isOlderThan(ClientVersion.V_1_17)) {
|
||||
return new SimpleCollisionBox(0.0, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D);
|
||||
}
|
||||
return new HexCollisionBox(0.0D, 6.0D, 0.0D, 16.0D, 12.0D, 16.0D);
|
||||
}, StateTypes.END_PORTAL),
|
||||
|
||||
FENCE_GATE((player, item, version, data, x, y, z) -> {
|
||||
// This technically should be taken from the block data/made multi-version/run block updates... but that's too far even for me
|
||||
// This way is so much easier and works unless the magic stick wand is used
|
||||
boolean isInWall;
|
||||
boolean isXAxis = data.getFacing() == BlockFace.WEST || data.getFacing() == BlockFace.EAST;
|
||||
if (isXAxis) {
|
||||
boolean zPosWall = Materials.isWall(player.compensatedWorld.getStateTypeAt(x, y, z + 1));
|
||||
boolean zNegWall = Materials.isWall(player.compensatedWorld.getStateTypeAt(x, y, z - 1));
|
||||
isInWall = zPosWall || zNegWall;
|
||||
} else {
|
||||
boolean xPosWall = Materials.isWall(player.compensatedWorld.getStateTypeAt(x + 1, y, z));
|
||||
boolean xNegWall = Materials.isWall(player.compensatedWorld.getStateTypeAt(x - 1, y, z));
|
||||
isInWall = xPosWall || xNegWall;
|
||||
}
|
||||
|
||||
if (isInWall) {
|
||||
return isXAxis ? new HexCollisionBox(6.0D, 0.0D, 0.0D, 10.0D, 13.0D, 16.0D) : new HexCollisionBox(0.0D, 0.0D, 6.0D, 16.0D, 13.0D, 10.0D);
|
||||
}
|
||||
|
||||
return isXAxis ? new HexCollisionBox(6.0D, 0.0D, 0.0D, 10.0D, 16.0D, 16.0D) : new HexCollisionBox(0.0D, 0.0D, 6.0D, 16.0D, 16.0D, 10.0D);
|
||||
}, BlockTags.FENCE_GATES.getStates().toArray(new StateType[0])),
|
||||
|
||||
|
||||
FENCE(new DynamicHitboxFence(), BlockTags.FENCES.getStates().toArray(new StateType[0])),
|
||||
|
||||
PANE(new DynamicHitboxPane(), Materials.getPanes().toArray(new StateType[0])),
|
||||
|
||||
LEVER(((player, item, version, data, x, y, z) -> {
|
||||
Face face = data.getFace();
|
||||
BlockFace facing = data.getFacing();
|
||||
if (version.isOlderThan(ClientVersion.V_1_13)) {
|
||||
double f = 0.1875;
|
||||
|
||||
switch (face) {
|
||||
case WALL:
|
||||
switch (facing) {
|
||||
case WEST:
|
||||
return new SimpleCollisionBox(1.0 - f * 2.0, 0.2, 0.5 - f, 1.0, 0.8, 0.5 + f, false);
|
||||
case EAST:
|
||||
return new SimpleCollisionBox(0.0, 0.2, 0.5 - f, f * 2.0, 0.8, 0.5 + f, false);
|
||||
case NORTH:
|
||||
return new SimpleCollisionBox(0.5 - f, 0.2, 1.0 - f * 2.0, 0.5 + f, 0.8, 1.0, false);
|
||||
case SOUTH:
|
||||
return new SimpleCollisionBox(0.5 - f, 0.2, 0.0, 0.5 + f, 0.8, f * 2.0, false);
|
||||
}
|
||||
case CEILING:
|
||||
return new SimpleCollisionBox(0.25, 0.4, 0.25, 0.75, 1.0, 0.75, false);
|
||||
case FLOOR:
|
||||
return new SimpleCollisionBox(0.25, 0.0, 0.25, 0.75, 0.6, 0.75, false);
|
||||
}
|
||||
}
|
||||
|
||||
switch (face) {
|
||||
case FLOOR:
|
||||
// X-AXIS
|
||||
if (facing == BlockFace.EAST || facing == BlockFace.WEST) {
|
||||
return new SimpleCollisionBox(0.25, 0.0, 0.3125, 0.75, 0.375, 0.6875, false);
|
||||
}
|
||||
// Z-AXIS
|
||||
return new SimpleCollisionBox(0.3125, 0.0, 0.25, 0.6875, 0.375, 0.75, false);
|
||||
case WALL:
|
||||
switch (facing) {
|
||||
case EAST:
|
||||
return new SimpleCollisionBox(0.0, 0.25, 0.3125, 0.375, 0.75, 0.6875, false);
|
||||
case WEST:
|
||||
return new SimpleCollisionBox(0.625, 0.25, 0.3125, 1.0, 0.75, 0.6875, false);
|
||||
case SOUTH:
|
||||
return new SimpleCollisionBox(0.3125, 0.25, 0.0, 0.6875, 0.75, 0.375, false);
|
||||
case NORTH:
|
||||
default:
|
||||
return new SimpleCollisionBox(0.3125, 0.25, 0.625, 0.6875, 0.75, 1.0, false);
|
||||
}
|
||||
case CEILING:
|
||||
default:
|
||||
// X-AXIS
|
||||
if (facing == BlockFace.EAST || facing == BlockFace.WEST) {
|
||||
return new SimpleCollisionBox(0.25, 0.625, 0.3125, 0.75, 1.0, 0.6875, false);
|
||||
}
|
||||
// Z-Axis
|
||||
return new SimpleCollisionBox(0.3125, 0.625, 0.25, 0.6875, 1.0, 0.75, false);
|
||||
}
|
||||
}), StateTypes.LEVER),
|
||||
|
||||
BUTTON((player, item, version, data, x, y, z) -> {
|
||||
final Face face = data.getFace();
|
||||
final BlockFace facing = data.getFacing();
|
||||
final boolean powered = data.isPowered();
|
||||
|
||||
|
||||
if (version.isOlderThan(ClientVersion.V_1_13)) {
|
||||
double f2 = (float) (data.isPowered() ? 1 : 2) / 16.0;
|
||||
|
||||
switch (face) {
|
||||
case WALL:
|
||||
switch (facing) {
|
||||
case WEST:
|
||||
return new SimpleCollisionBox(0.0, 0.375, 0.3125, f2, 0.625, 0.6875, false);
|
||||
case EAST:
|
||||
return new SimpleCollisionBox(1.0 - f2, 0.375, 0.3125, 1.0, 0.625, 0.6875, false);
|
||||
case NORTH:
|
||||
return new SimpleCollisionBox(0.3125, 0.375, 0.0, 0.6875, 0.625, f2, false);
|
||||
case SOUTH:
|
||||
return new SimpleCollisionBox(0.3125, 0.375, 1.0 - f2, 0.6875, 0.625, 1.0, false);
|
||||
}
|
||||
case CEILING:
|
||||
return new SimpleCollisionBox(0.3125, 1.0 - f2, 0.375, 0.6875, 1.0, 0.625, false);
|
||||
case FLOOR:
|
||||
return new SimpleCollisionBox(0.3125, 0.0, 0.375, 0.6875, 0.0 + f2, 0.625, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (face) {
|
||||
case WALL:
|
||||
CollisionBox shape;
|
||||
switch (facing) {
|
||||
case EAST:
|
||||
shape = powered ? new HexCollisionBox(0.0, 6.0, 5.0, 1.0, 10.0, 11.0) : new HexCollisionBox(0.0, 6.0, 5.0, 2.0, 10.0, 11.0);
|
||||
break;
|
||||
case WEST:
|
||||
shape = powered ? new HexCollisionBox(15.0, 6.0, 5.0, 16.0, 10.0, 11.0) : new HexCollisionBox(14.0, 6.0, 5.0, 16.0, 10.0, 11.0);
|
||||
break;
|
||||
case SOUTH:
|
||||
shape = powered ? new HexCollisionBox(5.0, 6.0, 0.0, 11.0, 10.0, 1.0) : new HexCollisionBox(5.0, 6.0, 0.0, 11.0, 10.0, 2.0);
|
||||
break;
|
||||
case NORTH:
|
||||
case UP:
|
||||
case DOWN:
|
||||
shape = powered ? new HexCollisionBox(5.0, 6.0, 15.0, 11.0, 10.0, 16.0) : new HexCollisionBox(5.0, 6.0, 14.0, 11.0, 10.0, 16.0);
|
||||
break;
|
||||
default:
|
||||
shape = NoCollisionBox.INSTANCE;
|
||||
}
|
||||
|
||||
return shape;
|
||||
case CEILING:
|
||||
// ViaVersion shows lever
|
||||
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_8)) {
|
||||
return LEVER.dynamic.fetch(player, item, version, data, x, y, z);
|
||||
}
|
||||
// x axis
|
||||
if (facing == BlockFace.EAST || facing == BlockFace.WEST) {
|
||||
return powered ? new HexCollisionBox(6.0, 15.0, 5.0, 10.0, 16.0, 11.0) : new HexCollisionBox(6.0, 14.0, 5.0, 10.0, 16.0, 11.0);
|
||||
} else {
|
||||
return powered ? new HexCollisionBox(5.0, 15.0, 6.0, 11.0, 16.0, 10.0) : new HexCollisionBox(5.0, 14.0, 6.0, 11.0, 16.0, 10.0);
|
||||
}
|
||||
case FLOOR:
|
||||
// ViaVersion shows lever
|
||||
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_8)) {
|
||||
return LEVER.dynamic.fetch(player, item, version, data, x, y, z);
|
||||
}
|
||||
// x axis
|
||||
if (facing == BlockFace.EAST || facing == BlockFace.WEST) {
|
||||
return powered ? new HexCollisionBox(6.0, 0.0, 5.0, 10.0, 1.0, 11.0) : new HexCollisionBox(6.0, 0.0, 5.0, 10.0, 2.0, 11.0);
|
||||
}
|
||||
|
||||
return powered ? new HexCollisionBox(5.0, 0.0, 6.0, 11.0, 1.0, 10.0) : new HexCollisionBox(5.0, 0.0, 6.0, 11.0, 2.0, 10.0);
|
||||
default:
|
||||
throw new IllegalStateException("Impossible Hitbox State");
|
||||
}
|
||||
}, BlockTags.BUTTONS.getStates().toArray(new StateType[0])),
|
||||
|
||||
WALL(new DynamicHitboxWall(), BlockTags.WALLS.getStates().toArray(new StateType[0])),
|
||||
|
||||
WALL_SIGN((player, item, version, data, x, y, z) -> {
|
||||
switch (data.getFacing()) {
|
||||
case NORTH:
|
||||
return new HexCollisionBox(0.0, 4.5, 14.0, 16.0, 12.5, 16.0);
|
||||
case SOUTH:
|
||||
return new HexCollisionBox(0.0, 4.5, 0.0, 16.0, 12.5, 2.0);
|
||||
case EAST:
|
||||
return new HexCollisionBox(0.0, 4.5, 0.0, 2.0, 12.5, 16.0);
|
||||
case WEST:
|
||||
return new HexCollisionBox(14.0, 4.5, 0.0, 16.0, 12.5, 16.0);
|
||||
default:
|
||||
return NoCollisionBox.INSTANCE;
|
||||
}
|
||||
}, BlockTags.WALL_SIGNS.getStates().toArray(new StateType[0])),
|
||||
|
||||
WALL_HANGING_SIGN((player, item, version, data, x, y, z) -> {
|
||||
switch (data.getFacing()) {
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
return new ComplexCollisionBox(new HexCollisionBox(0.0D, 14.0D, 6.0D, 16.0D, 16.0D, 10.0D),
|
||||
new HexCollisionBox(1.0D, 0.0D, 7.0D, 15.0D, 10.0D, 9.0D));
|
||||
default:
|
||||
return new ComplexCollisionBox(new HexCollisionBox(6.0D, 14.0D, 0.0D, 10.0D, 16.0D, 16.0D),
|
||||
new HexCollisionBox(7.0D, 0.0D, 1.0D, 9.0D, 10.0D, 15.0D));
|
||||
}
|
||||
}, BlockTags.WALL_HANGING_SIGNS.getStates().toArray(new StateType[0])),
|
||||
|
||||
STANDING_SIGN((player, item, version, data, x, y, z) ->
|
||||
new HexCollisionBox(4.0, 0.0, 4.0, 12.0, 16.0, 12.0),
|
||||
BlockTags.STANDING_SIGNS.getStates().toArray(new StateType[0])),
|
||||
|
||||
SAPLING(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D),
|
||||
BlockTags.SAPLINGS.getStates().toArray(new StateType[0])),
|
||||
|
||||
ROOTS(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D),
|
||||
StateTypes.WARPED_ROOTS, StateTypes.CRIMSON_ROOTS),
|
||||
|
||||
BANNER(new HexCollisionBox(4.0D, 0.0D, 4.0D, 12.0D, 16.0D, 12.0D),
|
||||
StateTypes.WHITE_BANNER, StateTypes.ORANGE_BANNER, StateTypes.MAGENTA_BANNER, StateTypes.LIGHT_BLUE_BANNER,
|
||||
StateTypes.YELLOW_BANNER, StateTypes.LIME_BANNER, StateTypes.PINK_BANNER, StateTypes.GRAY_BANNER,
|
||||
StateTypes.LIGHT_GRAY_BANNER, StateTypes.CYAN_BANNER, StateTypes.PURPLE_BANNER, StateTypes.BLUE_BANNER,
|
||||
StateTypes.BROWN_BANNER, StateTypes.GREEN_BANNER, StateTypes.RED_BANNER, StateTypes.BLACK_BANNER),
|
||||
|
||||
WALL_BANNER((player, item, version, data, x, y, z) -> {
|
||||
// ViaVersion replacement block
|
||||
if (version.isOlderThan(ClientVersion.V_1_8)) {
|
||||
return WALL_SIGN.dynamic.fetch(player, item, version, data, x, y, z);
|
||||
}
|
||||
|
||||
switch (data.getFacing()) {
|
||||
case NORTH:
|
||||
return new HexCollisionBox(0.0, 0.0, 14.0, 16.0, 12.5, 16.0);
|
||||
case EAST:
|
||||
return new HexCollisionBox(0.0, 0.0, 0.0, 2.0, 12.5, 16.0);
|
||||
case WEST:
|
||||
return new HexCollisionBox(14.0, 0.0, 0.0, 16.0, 12.5, 16.0);
|
||||
case SOUTH:
|
||||
return new HexCollisionBox(0.0, 0.0, 0.0, 16.0, 12.5, 2.0);
|
||||
default:
|
||||
throw new IllegalStateException("Impossible Banner Facing State; Something very wrong is going on");
|
||||
}
|
||||
}, StateTypes.WHITE_WALL_BANNER, StateTypes.ORANGE_WALL_BANNER, StateTypes.MAGENTA_WALL_BANNER,
|
||||
StateTypes.LIGHT_BLUE_WALL_BANNER, StateTypes.YELLOW_WALL_BANNER, StateTypes.LIME_WALL_BANNER,
|
||||
StateTypes.PINK_WALL_BANNER, StateTypes.GRAY_WALL_BANNER, StateTypes.LIGHT_GRAY_WALL_BANNER,
|
||||
StateTypes.CYAN_WALL_BANNER, StateTypes.PURPLE_WALL_BANNER, StateTypes.BLUE_WALL_BANNER,
|
||||
StateTypes.BROWN_WALL_BANNER, StateTypes.GREEN_WALL_BANNER, StateTypes.RED_WALL_BANNER, StateTypes.BLACK_WALL_BANNER),
|
||||
|
||||
BREWING_STAND((player, item, version, block, x, y, z) -> {
|
||||
// BEWARE OF https://bugs.mojang.com/browse/MC-85109 FOR 1.8 PLAYERS
|
||||
if (version.isOlderThan(ClientVersion.V_1_13)) {
|
||||
return new SimpleCollisionBox(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
||||
} else {
|
||||
return new ComplexCollisionBox(
|
||||
new HexCollisionBox(1.0, 0.0, 1.0, 15.0, 2.0, 15.0),
|
||||
new SimpleCollisionBox(0.4375, 0.0, 0.4375, 0.5625, 0.875, 0.5625, false));
|
||||
}
|
||||
}, StateTypes.BREWING_STAND),
|
||||
|
||||
SMALL_FLOWER((player, item, version, data, x, y, z) -> player.getClientVersion().isOlderThan(ClientVersion.V_1_13)
|
||||
? new SimpleCollisionBox(0.3125D, 0.0D, 0.3125D, 0.6875D, 0.625D, 0.6875D)
|
||||
: new OffsetCollisionBox(data.getType(), 0.3125D, 0.0D, 0.3125D, 0.6875D, 0.625D, 0.6875D),
|
||||
BlockTags.SMALL_FLOWERS.getStates().toArray(new StateType[0])),
|
||||
|
||||
TALL_FLOWERS(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), BlockTags.TALL_FLOWERS.getStates().toArray(new StateType[0])),
|
||||
|
||||
FIRE((player, item, version, data, x, y, z) -> {
|
||||
// Since 1.16 fire has a small hitbox
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_16)) {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D);
|
||||
}
|
||||
return NoCollisionBox.INSTANCE;
|
||||
}, BlockTags.FIRE.getStates().toArray(new StateType[0])),
|
||||
|
||||
HONEY_BLOCK(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), StateTypes.HONEY_BLOCK),
|
||||
|
||||
POWDER_SNOW(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), StateTypes.POWDER_SNOW),
|
||||
|
||||
SOUL_SAND(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), StateTypes.SOUL_SAND),
|
||||
|
||||
CACTUS((player, item, version, data, x, y, z) -> {
|
||||
if (version.isOlderThan(ClientVersion.V_1_13)) {
|
||||
// https://bugs.mojang.com/browse/MC-59610
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true);
|
||||
}
|
||||
return new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
}, StateTypes.CACTUS),
|
||||
|
||||
SNOW((player, item, version, data, x, y, z) -> {
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, data.getLayers() * 0.125, 1);
|
||||
}, StateTypes.SNOW),
|
||||
|
||||
LECTERN_BLOCK((player, item, version, data, x, y, z) -> {
|
||||
ComplexCollisionBox common = new ComplexCollisionBox(new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D),
|
||||
new HexCollisionBox(4.0D, 2.0D, 4.0D, 12.0D, 14.0D, 12.0D));
|
||||
|
||||
if (data.getFacing() == BlockFace.WEST) {
|
||||
common.add(new HexCollisionBox(1.0D, 10.0D, 0.0D, 5.333333D, 14.0D, 16.0D));
|
||||
common.add(new HexCollisionBox(5.333333D, 12.0D, 0.0D, 9.666667D, 16.0D, 16.0D));
|
||||
common.add(new HexCollisionBox(9.666667D, 14.0D, 0.0D, 14.0D, 18.0D, 16.0D));
|
||||
} else if (data.getFacing() == BlockFace.NORTH) {
|
||||
common.add(new HexCollisionBox(0.0D, 10.0D, 1.0D, 16.0D, 14.0D, 5.333333D));
|
||||
common.add(new HexCollisionBox(0.0D, 12.0D, 5.333333D, 16.0D, 16.0D, 9.666667D));
|
||||
common.add(new HexCollisionBox(0.0D, 14.0D, 9.666667D, 16.0D, 18.0D, 14.0D));
|
||||
} else if (data.getFacing() == BlockFace.EAST) {
|
||||
common.add(new HexCollisionBox(10.666667D, 10.0D, 0.0D, 15.0D, 14.0D, 16.0D));
|
||||
common.add(new HexCollisionBox(6.333333D, 12.0D, 0.0D, 10.666667D, 16.0D, 16.0D));
|
||||
common.add(new HexCollisionBox(2.0D, 14.0D, 0.0D, 6.333333D, 18.0D, 16.0D));
|
||||
} else { // SOUTH
|
||||
common.add(new HexCollisionBox(0.0D, 10.0D, 10.666667D, 16.0D, 14.0D, 15.0D));
|
||||
common.add(new HexCollisionBox(0.0D, 12.0D, 6.333333D, 16.0D, 16.0D, 10.666667D));
|
||||
common.add(new HexCollisionBox(0.0D, 14.0D, 2.0D, 16.0D, 18.0D, 6.333333D));
|
||||
}
|
||||
|
||||
return common;
|
||||
}, StateTypes.LECTERN),
|
||||
|
||||
GLOW_LICHEN_SCULK_VEIN((player, item, version, data, x, y, z) -> {
|
||||
if (version.isNewerThan(ClientVersion.V_1_16_4)) {
|
||||
ComplexCollisionBox box = new ComplexCollisionBox();
|
||||
|
||||
if (data.isUp()) {
|
||||
box.add(new HexCollisionBox(0.0D, 15.0D, 0.0D, 16.0D, 16.0D, 16.0D));
|
||||
}
|
||||
if (data.isDown()) {
|
||||
box.add(new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D));
|
||||
}
|
||||
if (data.getWest() == West.TRUE) {
|
||||
box.add(new HexCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 16.0D, 16.0D));
|
||||
}
|
||||
if (data.getEast() == East.TRUE) {
|
||||
box.add(new HexCollisionBox(15.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D));
|
||||
}
|
||||
if (data.getNorth() == North.TRUE) {
|
||||
box.add(new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 1.0D));
|
||||
}
|
||||
if (data.getSouth() == South.TRUE) {
|
||||
box.add(new HexCollisionBox(0.0D, 0.0D, 15.0D, 16.0D, 16.0D, 16.0D));
|
||||
}
|
||||
|
||||
return box;
|
||||
} else { // ViaVersion just replaces this with... nothing
|
||||
return NoCollisionBox.INSTANCE;
|
||||
}
|
||||
}, StateTypes.GLOW_LICHEN, StateTypes.SCULK_CATALYST),
|
||||
|
||||
SPORE_BLOSSOM((player, item, version, data, x, y, z) -> {
|
||||
if (version.isNewerThan(ClientVersion.V_1_16_4)) {
|
||||
return new HexCollisionBox(2.0D, 13.0D, 2.0D, 14.0D, 16.0D, 14.0D);
|
||||
} else { // ViaVersion replacement is a Peony
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true);
|
||||
}
|
||||
}, StateTypes.SPORE_BLOSSOM),
|
||||
|
||||
PITCHER_CROP((player, item, version, data, x, y, z) -> {
|
||||
if (version.isNewerThan(ClientVersion.V_1_19_4)) {
|
||||
final SimpleCollisionBox FULL_UPPER_SHAPE = new HexCollisionBox(3.0D, 0.0D, 3.0D, 13.0D, 15.0D, 13.0D);
|
||||
final SimpleCollisionBox FULL_LOWER_SHAPE = new HexCollisionBox(3.0D, -1.0D, 3.0D, 13.0D, 16.0D, 13.0D);
|
||||
final SimpleCollisionBox COLLISION_SHAPE_BULB = new HexCollisionBox(5.0D, -1.0D, 5.0D, 11.0D, 3.0D, 11.0D);
|
||||
final SimpleCollisionBox COLLISION_SHAPE_CROP = new HexCollisionBox(3.0D, -1.0D, 3.0D, 13.0D, 5.0D, 13.0D);
|
||||
final SimpleCollisionBox[] UPPER_SHAPE_BY_AGE = new SimpleCollisionBox[]{new HexCollisionBox(3.0D, 0.0D, 3.0D, 13.0D, 11.0D, 13.0D), FULL_UPPER_SHAPE};
|
||||
final SimpleCollisionBox[] LOWER_SHAPE_BY_AGE = new SimpleCollisionBox[]{COLLISION_SHAPE_BULB, new HexCollisionBox(3.0D, -1.0D, 3.0D, 13.0D, 14.0D, 13.0D), FULL_LOWER_SHAPE, FULL_LOWER_SHAPE, FULL_LOWER_SHAPE};
|
||||
|
||||
return data.getHalf() == Half.UPPER ? UPPER_SHAPE_BY_AGE[Math.min(Math.abs(4 - (data.getAge() + 1)), UPPER_SHAPE_BY_AGE.length - 1)] : LOWER_SHAPE_BY_AGE[data.getAge()];
|
||||
} else {
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true);
|
||||
}
|
||||
}, StateTypes.PITCHER_CROP),
|
||||
|
||||
WHEAT_BEETROOTS((player, item, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, (data.getAge() + 1) * 2, 16.0D);
|
||||
}, StateTypes.WHEAT, StateTypes.BEETROOTS),
|
||||
|
||||
CARROT_POTATOES((player, item, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, data.getAge() + 2, 16.0D);
|
||||
}, StateTypes.CARROTS, StateTypes.POTATOES),
|
||||
|
||||
NETHER_WART((player, item, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0, 5 + (data.getAge() * 3), 16.0D);
|
||||
}, StateTypes.NETHER_WART),
|
||||
|
||||
ATTACHED_PUMPKIN_STEM((player, item, version, data, x, y, z) -> {
|
||||
if (version.isOlderThan(ClientVersion.V_1_13))
|
||||
return new HexCollisionBox(7.0D, 0.0D, 7.0D, 9.0D, 16.0D, 9.0D);
|
||||
|
||||
switch (data.getFacing()) {
|
||||
case SOUTH:
|
||||
return new HexCollisionBox(6.0D, 0.0D, 6.0D, 10.0D, 10.0D, 16.0D);
|
||||
case WEST:
|
||||
return new HexCollisionBox(0.0D, 0.0D, 6.0D, 10.0D, 10.0D, 10.0D);
|
||||
case NORTH:
|
||||
return new HexCollisionBox(6.0D, 0.0D, 0.0D, 10.0D, 10.0D, 10.0D);
|
||||
case EAST:
|
||||
default:
|
||||
return new HexCollisionBox(6.0D, 0.0D, 6.0D, 16.0D, 10.0D, 10.0D);
|
||||
}
|
||||
}, StateTypes.ATTACHED_MELON_STEM, StateTypes.ATTACHED_PUMPKIN_STEM),
|
||||
|
||||
PUMPKIN_STEM((player, item, version, data, x, y, z) -> {
|
||||
return new HexCollisionBox(7, 0, 7, 9, 2 * (data.getAge() + 1), 9);
|
||||
}, StateTypes.PUMPKIN_STEM, StateTypes.MELON_STEM),
|
||||
|
||||
// Hitbox/Outline is Same as Collision
|
||||
COCOA_BEANS((player, item, version, data, x, y, z) -> {
|
||||
return CollisionData.getCocoa(version, data.getAge(), data.getFacing());
|
||||
}, StateTypes.COCOA),
|
||||
|
||||
|
||||
// Easier to just use no collision box
|
||||
// Redstone wire is very complex with its collision shapes and has many de-syncs
|
||||
REDSTONE_WIRE(NoCollisionBox.INSTANCE, StateTypes.REDSTONE_WIRE),
|
||||
|
||||
SWEET_BERRY((player, item, version, data, x, y, z) -> {
|
||||
if (data.getAge() == 0) {
|
||||
return new HexCollisionBox(3.0D, 0.0D, 3.0D, 13.0D, 8.0D, 13.0D);
|
||||
} else if (data.getAge() < 3) {
|
||||
return new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
}
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true);
|
||||
}, StateTypes.SWEET_BERRY_BUSH),
|
||||
|
||||
CORAL_FAN(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 4.0D, 14.0D), BlockTags.CORALS.getStates().toArray(new StateType[0])),
|
||||
|
||||
TORCHFLOWER_CROP((player, item, version, data, x, y, z) -> {
|
||||
if (data.getAge() == 0) {
|
||||
return new HexCollisionBox(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D);
|
||||
}
|
||||
// age is 1
|
||||
return new HexCollisionBox(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D);
|
||||
}, StateTypes.TORCHFLOWER_CROP),
|
||||
|
||||
DEAD_BUSH(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D), StateTypes.DEAD_BUSH),
|
||||
|
||||
SUGARCANE(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D), StateTypes.SUGAR_CANE),
|
||||
|
||||
NETHER_SPROUTS(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 3.0D, 14.0D), StateTypes.NETHER_SPROUTS),
|
||||
|
||||
HANGING_ROOTS(new HexCollisionBox(2.0D, 10.0D, 2.0D, 14.0D, 16.0D, 14.0D), StateTypes.HANGING_ROOTS),
|
||||
|
||||
GRASS_FERN((player, item, version, data, x ,y, z) -> {
|
||||
if (version.isOlderThan(ClientVersion.V_1_13)) {
|
||||
return new SimpleCollisionBox(0.1F, 0.0F, 0.1F, 0.9F, 0.8F, 0.9F);
|
||||
}
|
||||
return new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
|
||||
}, StateTypes.SHORT_GRASS, StateTypes.FERN),
|
||||
|
||||
SEA_GRASS(new HexCollisionBox(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D),
|
||||
StateTypes.SEAGRASS),
|
||||
|
||||
TALL_SEAGRASS(new HexCollisionBox(2.0, 0.0, 2.0, 14.0, 16.0, 14.0),
|
||||
StateTypes.TALL_SEAGRASS),
|
||||
|
||||
SMALL_DRIPLEAF(new HexCollisionBox(2.0, 0.0, 2.0, 14.0, 13.0, 14.0), StateTypes.SMALL_DRIPLEAF),
|
||||
|
||||
CAVE_VINES(new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D), StateTypes.CAVE_VINES, StateTypes.CAVE_VINES_PLANT),
|
||||
|
||||
// Then your enum entries become:
|
||||
TWISTING_VINES_BLOCK((player, item, version, data, x, y, z) ->
|
||||
getVineCollisionBox(version, false, true), StateTypes.TWISTING_VINES),
|
||||
|
||||
WEEPING_VINES_BLOCK((player, item, version, data, x, y, z) ->
|
||||
getVineCollisionBox(version, true, true), StateTypes.WEEPING_VINES),
|
||||
|
||||
TWISTING_VINES((player, item, version, data, x, y, z) ->
|
||||
getVineCollisionBox(version, false, false), StateTypes.TWISTING_VINES_PLANT),
|
||||
|
||||
WEEPING_VINES((player, item, version, data, x, y, z) ->
|
||||
getVineCollisionBox(version, true, false), StateTypes.WEEPING_VINES_PLANT),
|
||||
|
||||
TALL_PLANT(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), StateTypes.TALL_GRASS, StateTypes.LARGE_FERN),
|
||||
|
||||
BAMBOO((player, item, version, data, x, y, z) -> data.getLeaves() == Leaves.LARGE
|
||||
? new HexOffsetCollisionBox(data.getType(), 3.0, 0.0, 3.0, 13.0, 16.0, 13.0)
|
||||
: new HexOffsetCollisionBox(data.getType(), 5.0, 0.0, 5.0, 11.0, 16.0, 11.0), StateTypes.BAMBOO),
|
||||
|
||||
BAMBOO_SAPLING((player, item, version, data, x, y, z) -> {
|
||||
return new HexOffsetCollisionBox(data.getType(), 4.0D, 0.0D, 4.0D, 12.0D, 12.0D, 12.0D);
|
||||
}, StateTypes.BAMBOO_SAPLING),
|
||||
|
||||
SCAFFOLDING((player, item, version, data, x, y, z) -> {
|
||||
// If is holding scaffolding
|
||||
if (item == StateTypes.SCAFFOLDING) {
|
||||
// If is holding scaffolding or Via replacement - hay bale
|
||||
if (item == StateTypes.SCAFFOLDING || version.isOlderThan(ClientVersion.V_1_14)) {
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true);
|
||||
}
|
||||
|
||||
@@ -67,222 +569,54 @@ public enum HitboxData {
|
||||
|
||||
}, StateTypes.BIG_DRIPLEAF),
|
||||
|
||||
FENCE_GATE((player, item, version, data, x, y, z) -> {
|
||||
// This technically should be taken from the block data/made multi-version/run block updates... but that's too far even for me
|
||||
// This way is so much easier and works unless the magic stick wand is used
|
||||
boolean isInWall;
|
||||
boolean isXAxis = data.getFacing() == BlockFace.WEST || data.getFacing() == BlockFace.EAST;
|
||||
if (isXAxis) {
|
||||
boolean zPosWall = Materials.isWall(player.compensatedWorld.getStateTypeAt(x, y, z + 1));
|
||||
boolean zNegWall = Materials.isWall(player.compensatedWorld.getStateTypeAt(x, y, z - 1));
|
||||
isInWall = zPosWall || zNegWall;
|
||||
PINK_PETALS_BLOCK((player, item, version, data, x, y, z) -> {
|
||||
if (version.isNewerThan(ClientVersion.V_1_20_2)) {
|
||||
int flowerAmount = data.getFlowerAmount();
|
||||
int horizontalIndex = getHorizontalID(data.getFacing());
|
||||
|
||||
CollisionBox result = NoCollisionBox.INSTANCE;
|
||||
|
||||
// Pre-defined collision boxes for each quadrant
|
||||
HexCollisionBox[] boxes = new HexCollisionBox[] {
|
||||
new HexCollisionBox(8, 0, 8, 16, 3, 16), // SE
|
||||
new HexCollisionBox(8, 0, 0, 16, 3, 8), // NE
|
||||
new HexCollisionBox(0, 0, 0, 8, 3, 8), // NW
|
||||
new HexCollisionBox(0, 0, 8, 8, 3, 16) // SW
|
||||
};
|
||||
|
||||
// Add boxes based on flower amount and facing
|
||||
for (int i = 0; i < flowerAmount; i++) {
|
||||
int index = Math.floorMod(i - horizontalIndex, 4);
|
||||
result = result.union(boxes[index]);
|
||||
}
|
||||
|
||||
return result;
|
||||
} else if (version.isNewerThan(ClientVersion.V_1_19_3)) {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 3.0D, 16.0D);
|
||||
} else if (version.isNewerThan(ClientVersion.V_1_12_2)) {
|
||||
return CORAL_FAN.dynamic.fetch(player, item, version, data, x, y, z);
|
||||
}
|
||||
return GRASS_FERN.dynamic.fetch(player, item, version, data, x, y, z);
|
||||
}, StateTypes.PINK_PETALS),
|
||||
|
||||
MANGROVE_PROPAGULE(((player, item, version, data, x, y, z) -> {
|
||||
if (data.isHanging()) {
|
||||
return new HexOffsetCollisionBox(data.getType(), 7.0, 0.0, 7.0, 9.0, 16.0, 9.0);
|
||||
} else {
|
||||
boolean xPosWall = Materials.isWall(player.compensatedWorld.getStateTypeAt(x + 1, y, z));
|
||||
boolean xNegWall = Materials.isWall(player.compensatedWorld.getStateTypeAt(x - 1, y, z));
|
||||
isInWall = xPosWall || xNegWall;
|
||||
return new HexOffsetCollisionBox(data.getType(), 7.0, getPropaguleMinHeight(data.getAge()), 7.0, 9.0, 16.0, 9.0);
|
||||
}
|
||||
}), StateTypes.MANGROVE_PROPAGULE),
|
||||
|
||||
if (isInWall) {
|
||||
return isXAxis ? new HexCollisionBox(6.0D, 0.0D, 0.0D, 10.0D, 13.0D, 16.0D) : new HexCollisionBox(0.0D, 0.0D, 6.0D, 16.0D, 13.0D, 10.0D);
|
||||
FROGSPAWN((player, item, version, data, x, y, z) -> {
|
||||
if (version.isNewerThan(ClientVersion.V_1_18_2)) {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 1.5D, 16.0D);
|
||||
} else { // ViaVersion just replaces this with... nothing
|
||||
return NoCollisionBox.INSTANCE;
|
||||
}
|
||||
}, StateTypes.FROGSPAWN),
|
||||
|
||||
return isXAxis ? new HexCollisionBox(6.0D, 0.0D, 0.0D, 10.0D, 16.0D, 16.0D) : new HexCollisionBox(0.0D, 0.0D, 6.0D, 16.0D, 16.0D, 10.0D);
|
||||
}, BlockTags.FENCE_GATES.getStates().toArray(new StateType[0])),
|
||||
|
||||
|
||||
FENCE((player, item, version, data, x, y, z) -> {
|
||||
WrappedBlockState state = player.compensatedWorld.getWrappedBlockStateAt(x, y, z);
|
||||
|
||||
if (version.isOlderThanOrEquals(ClientVersion.V_1_12_2)) {
|
||||
int i = 0;
|
||||
if (data.getSouth() == South.TRUE) {
|
||||
i |= 0b1;
|
||||
}
|
||||
if (data.getWest() == West.TRUE) {
|
||||
i |= 0b10;
|
||||
}
|
||||
if (data.getNorth() == North.TRUE) {
|
||||
i |= 0b100;
|
||||
}
|
||||
if (data.getEast() == East.TRUE) {
|
||||
i |= 0b1000;
|
||||
}
|
||||
|
||||
return DynamicFence.LEGACY_BOUNDING_BOXES[i].copy();
|
||||
}
|
||||
|
||||
List<SimpleCollisionBox> boxes = new ArrayList<>();
|
||||
CollisionData.getData(state.getType()).getMovementCollisionBox(player, version, state, x, y, z).downCast(boxes);
|
||||
|
||||
for (SimpleCollisionBox box : boxes) {
|
||||
box.maxY = 1;
|
||||
}
|
||||
|
||||
return new ComplexCollisionBox(boxes.toArray(new SimpleCollisionBox[0]));
|
||||
}, BlockTags.FENCES.getStates().toArray(new StateType[0])),
|
||||
|
||||
WALL((player, item, version, data, x, y, z) -> {
|
||||
WrappedBlockState state = player.compensatedWorld.getWrappedBlockStateAt(x, y, z);
|
||||
return new DynamicWall().fetchRegularBox(player, state, version, x, y, z);
|
||||
}, BlockTags.WALLS.getStates().toArray(new StateType[0])),
|
||||
|
||||
HONEY_BLOCK(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), StateTypes.HONEY_BLOCK),
|
||||
|
||||
POWDER_SNOW(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), StateTypes.POWDER_SNOW),
|
||||
|
||||
SOUL_SAND(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), StateTypes.SOUL_SAND),
|
||||
|
||||
CACTUS(new HexCollisionBox(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D), StateTypes.CACTUS),
|
||||
|
||||
SNOW((player, item, version, data, x, y, z) -> {
|
||||
return new SimpleCollisionBox(0, 0, 0, 1, data.getLayers() * 0.125, 1);
|
||||
}, StateTypes.SNOW),
|
||||
|
||||
LECTERN_BLOCK((player, item, version, data, x, y, z) -> {
|
||||
ComplexCollisionBox common = new ComplexCollisionBox(new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D),
|
||||
new HexCollisionBox(4.0D, 2.0D, 4.0D, 12.0D, 14.0D, 12.0D));
|
||||
|
||||
if (data.getFacing() == BlockFace.WEST) {
|
||||
common.add(new HexCollisionBox(1.0D, 10.0D, 0.0D, 5.333333D, 14.0D, 16.0D));
|
||||
common.add(new HexCollisionBox(5.333333D, 12.0D, 0.0D, 9.666667D, 16.0D, 16.0D));
|
||||
common.add(new HexCollisionBox(9.666667D, 14.0D, 0.0D, 14.0D, 18.0D, 16.0D));
|
||||
} else if (data.getFacing() == BlockFace.NORTH) {
|
||||
common.add(new HexCollisionBox(0.0D, 10.0D, 1.0D, 16.0D, 14.0D, 5.333333D));
|
||||
common.add(new HexCollisionBox(0.0D, 12.0D, 5.333333D, 16.0D, 16.0D, 9.666667D));
|
||||
common.add(new HexCollisionBox(0.0D, 14.0D, 9.666667D, 16.0D, 18.0D, 14.0D));
|
||||
} else if (data.getFacing() == BlockFace.EAST) {
|
||||
common.add(new HexCollisionBox(10.666667D, 10.0D, 0.0D, 15.0D, 14.0D, 16.0D));
|
||||
common.add(new HexCollisionBox(6.333333D, 12.0D, 0.0D, 10.666667D, 16.0D, 16.0D));
|
||||
common.add(new HexCollisionBox(2.0D, 14.0D, 0.0D, 6.333333D, 18.0D, 16.0D));
|
||||
} else { // SOUTH
|
||||
common.add(new HexCollisionBox(0.0D, 10.0D, 10.666667D, 16.0D, 14.0D, 15.0D));
|
||||
common.add(new HexCollisionBox(0.0D, 12.0D, 6.333333D, 16.0D, 16.0D, 10.666667D));
|
||||
common.add(new HexCollisionBox(0.0D, 14.0D, 2.0D, 16.0D, 18.0D, 6.333333D));
|
||||
}
|
||||
|
||||
return common;
|
||||
}, StateTypes.LECTERN),
|
||||
|
||||
WALL_HANGING_SIGNS((player, item, version, data, x, y, z) -> {
|
||||
switch (data.getFacing()) {
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
return new ComplexCollisionBox(new HexCollisionBox(0.0D, 14.0D, 6.0D, 16.0D, 16.0D, 10.0D),
|
||||
new HexCollisionBox(1.0D, 0.0D, 7.0D, 15.0D, 10.0D, 9.0D));
|
||||
case WEST:
|
||||
case EAST:
|
||||
return new ComplexCollisionBox(new HexCollisionBox(6.0D, 14.0D, 0.0D, 10.0D, 16.0D, 16.0D),
|
||||
new HexCollisionBox(7.0D, 0.0D, 1.0D, 9.0D, 10.0D, 15.0D));
|
||||
default:
|
||||
return NoCollisionBox.INSTANCE;
|
||||
}
|
||||
}, BlockTags.WALL_HANGING_SIGNS.getStates().toArray(new StateType[0])),
|
||||
|
||||
PITCHER_CROP((player, item, version, data, x, y, z) -> {
|
||||
final SimpleCollisionBox FULL_UPPER_SHAPE = new HexCollisionBox(3.0D, 0.0D, 3.0D, 13.0D, 15.0D, 13.0D);
|
||||
final SimpleCollisionBox FULL_LOWER_SHAPE = new HexCollisionBox(3.0D, -1.0D, 3.0D, 13.0D, 16.0D, 13.0D);
|
||||
final SimpleCollisionBox COLLISION_SHAPE_BULB = new HexCollisionBox(5.0D, -1.0D, 5.0D, 11.0D, 3.0D, 11.0D);
|
||||
final SimpleCollisionBox COLLISION_SHAPE_CROP = new HexCollisionBox(3.0D, -1.0D, 3.0D, 13.0D, 5.0D, 13.0D);
|
||||
final SimpleCollisionBox[] UPPER_SHAPE_BY_AGE = new SimpleCollisionBox[]{new HexCollisionBox(3.0D, 0.0D, 3.0D, 13.0D, 11.0D, 13.0D), FULL_UPPER_SHAPE};
|
||||
final SimpleCollisionBox[] LOWER_SHAPE_BY_AGE = new SimpleCollisionBox[]{COLLISION_SHAPE_BULB, new HexCollisionBox(3.0D, -1.0D, 3.0D, 13.0D, 14.0D, 13.0D), FULL_LOWER_SHAPE, FULL_LOWER_SHAPE, FULL_LOWER_SHAPE};
|
||||
|
||||
return data.getHalf() == Half.UPPER ? UPPER_SHAPE_BY_AGE[Math.min(Math.abs(4 - (data.getAge() + 1)), UPPER_SHAPE_BY_AGE.length - 1)] : LOWER_SHAPE_BY_AGE[data.getAge()];
|
||||
}, StateTypes.PITCHER_CROP),
|
||||
|
||||
BUTTON((player, item, version, data, x, y, z) -> {
|
||||
final BlockFace facing = data.getFacing();
|
||||
final boolean powered = data.isPowered();
|
||||
switch (data.getFace()) {
|
||||
case FLOOR:
|
||||
// x axis
|
||||
if (facing == BlockFace.EAST || facing == BlockFace.WEST) {
|
||||
return powered ? new HexCollisionBox(6.0, 0.0, 5.0, 10.0, 1.0, 11.0) : new HexCollisionBox(6.0, 0.0, 5.0, 10.0, 2.0, 11.0);
|
||||
}
|
||||
|
||||
return powered ? new HexCollisionBox(5.0, 0.0, 6.0, 11.0, 1.0, 10.0) : new HexCollisionBox(5.0, 0.0, 6.0, 11.0, 2.0, 10.0);
|
||||
case WALL:
|
||||
CollisionBox shape;
|
||||
switch (facing) {
|
||||
case EAST:
|
||||
shape = powered ? new HexCollisionBox(0.0, 6.0, 5.0, 1.0, 10.0, 11.0) : new HexCollisionBox(0.0, 6.0, 5.0, 2.0, 10.0, 11.0);
|
||||
break;
|
||||
case WEST:
|
||||
shape = powered ? new HexCollisionBox(15.0, 6.0, 5.0, 16.0, 10.0, 11.0) : new HexCollisionBox(14.0, 6.0, 5.0, 16.0, 10.0, 11.0);
|
||||
break;
|
||||
case SOUTH:
|
||||
shape = powered ? new HexCollisionBox(5.0, 6.0, 0.0, 11.0, 10.0, 1.0) : new HexCollisionBox(5.0, 6.0, 0.0, 11.0, 10.0, 2.0);
|
||||
break;
|
||||
case NORTH:
|
||||
case UP:
|
||||
case DOWN:
|
||||
shape = powered ? new HexCollisionBox(5.0, 6.0, 15.0, 11.0, 10.0, 16.0) : new HexCollisionBox(5.0, 6.0, 14.0, 11.0, 10.0, 16.0);
|
||||
break;
|
||||
default:
|
||||
shape = NoCollisionBox.INSTANCE;
|
||||
}
|
||||
|
||||
return shape;
|
||||
case CEILING:
|
||||
default:
|
||||
// x axis
|
||||
if (facing == BlockFace.EAST || facing == BlockFace.WEST) {
|
||||
return powered ? new HexCollisionBox(6.0, 15.0, 5.0, 10.0, 16.0, 11.0) : new HexCollisionBox(6.0, 14.0, 5.0, 10.0, 16.0, 11.0);
|
||||
} else {
|
||||
return powered ? new HexCollisionBox(5.0, 15.0, 6.0, 11.0, 16.0, 10.0) : new HexCollisionBox(5.0, 14.0, 6.0, 11.0, 16.0, 10.0);
|
||||
}
|
||||
}
|
||||
}, BlockTags.BUTTONS.getStates().toArray(new StateType[0])),
|
||||
|
||||
WALL_SIGN((player, item, version, data, x, y, z) -> {
|
||||
switch (data.getFacing()) {
|
||||
case NORTH:
|
||||
return new HexCollisionBox(0.0, 4.5, 14.0, 16.0, 12.5, 16.0);
|
||||
case SOUTH:
|
||||
return new HexCollisionBox(0.0, 4.5, 0.0, 16.0, 12.5, 2.0);
|
||||
case EAST:
|
||||
return new HexCollisionBox(0.0, 4.5, 0.0, 2.0, 12.5, 16.0);
|
||||
case WEST:
|
||||
return new HexCollisionBox(14.0, 4.5, 0.0, 16.0, 12.5, 16.0);
|
||||
default:
|
||||
return NoCollisionBox.INSTANCE;
|
||||
}
|
||||
}, BlockTags.WALL_SIGNS.getStates().toArray(new StateType[0])),
|
||||
|
||||
WALL_HANGING_SIGN((player, item, version, data, x, y, z) -> {
|
||||
switch (data.getFacing()) {
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
return new ComplexCollisionBox(new HexCollisionBox(0.0D, 14.0D, 6.0D, 16.0D, 16.0D, 10.0D),
|
||||
new HexCollisionBox(1.0D, 0.0D, 7.0D, 15.0D, 10.0D, 9.0D));
|
||||
default:
|
||||
return new ComplexCollisionBox(new HexCollisionBox(6.0D, 14.0D, 0.0D, 10.0D, 16.0D, 16.0D),
|
||||
new HexCollisionBox(7.0D, 0.0D, 1.0D, 9.0D, 10.0D, 15.0D));
|
||||
}
|
||||
}, BlockTags.WALL_HANGING_SIGNS.getStates().toArray(new StateType[0])),
|
||||
|
||||
STANDING_SIGN((player, item, version, data, x, y, z) ->
|
||||
new HexCollisionBox(4.0, 0.0, 4.0, 12.0, 16.0, 12.0),
|
||||
BlockTags.STANDING_SIGNS.getStates().toArray(new StateType[0])),
|
||||
|
||||
REDSTONE_WIRE((player, item, version, data, x, y, z) ->
|
||||
// Easier to just use no collision box
|
||||
// Redstone wire is very complex with its collision shapes and has many de-syncs
|
||||
NoCollisionBox.INSTANCE,
|
||||
StateTypes.REDSTONE_WIRE),
|
||||
|
||||
FIRE((player, item, version, data, x, y, z) -> {
|
||||
// Since 1.16 fire has a small hitbox
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_16)) {
|
||||
return new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D);
|
||||
}
|
||||
|
||||
return NoCollisionBox.INSTANCE;
|
||||
}, BlockTags.FIRE.getStates().toArray(new StateType[0])),
|
||||
|
||||
BANNER(((player, item, version, data, x, y, z) ->
|
||||
new SimpleCollisionBox(4.0, 0.0, 4.0, 12.0, 16.0, 12.0)),
|
||||
BlockTags.BANNERS.getStates().toArray(new StateType[0]));
|
||||
|
||||
// always a fullblock hitbox. Via replacement is obsidian
|
||||
SCULK_SHRIKER(new SimpleCollisionBox(0, 0, 0, 1, 1, 1, true), StateTypes.SCULK_SHRIEKER);
|
||||
|
||||
private static final Map<StateType, HitboxData> lookup = new HashMap<>();
|
||||
|
||||
@@ -329,6 +663,59 @@ public enum HitboxData {
|
||||
return data.box.copy().offset(x, y, z);
|
||||
|
||||
// Allow this class to override collision boxes when they aren't the same as regular boxes
|
||||
return HitboxData.getData(block.getType()).dynamic.fetch(player, heldItem, version, block, x, y, z).offset(x, y, z);
|
||||
HitBoxFactory hitBoxFactory = data.dynamic;
|
||||
CollisionBox collisionBox = hitBoxFactory.fetch(player, heldItem, version, block, x, y, z);
|
||||
collisionBox.offset(x, y, z);
|
||||
return collisionBox;
|
||||
}
|
||||
|
||||
private static int getPropaguleMinHeight(int age) {
|
||||
switch (age) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
return 13 - age * 3;
|
||||
case 3:
|
||||
case 4:
|
||||
return (4 - age) * 3;
|
||||
}
|
||||
throw new IllegalStateException("Impossible Propagule Height");
|
||||
}
|
||||
|
||||
private static CollisionBox getVineCollisionBox(ClientVersion version, boolean isWeeping, boolean isBlock) {
|
||||
if (version.isNewerThan(ClientVersion.V_1_15_2)) {
|
||||
if (isWeeping) {
|
||||
return isBlock
|
||||
? new HexCollisionBox(4.0, 9.0, 4.0, 12.0, 16.0, 12.0)
|
||||
: new HexCollisionBox(1.0, 0.0, 1.0, 15.0, 16.0, 15.0);
|
||||
} else {
|
||||
return new HexCollisionBox(4.0D, 0.0D, 4.0D, 12.0D, isBlock ? 15.0D : 16.0D, 12.0D);
|
||||
}
|
||||
} else {
|
||||
// Via replacement - 4 sided vine
|
||||
return new ComplexCollisionBox(
|
||||
new HexCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 16.0D, 16.0D),
|
||||
new HexCollisionBox(15.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D),
|
||||
new HexCollisionBox(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 1.0D),
|
||||
new HexCollisionBox(0.0D, 0.0D, 15.0D, 16.0D, 16.0D, 16.0D)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getHorizontalID(BlockFace facing) {
|
||||
switch (facing) {
|
||||
case DOWN:
|
||||
case UP:
|
||||
return -1;
|
||||
case NORTH:
|
||||
return 2;
|
||||
case SOUTH:
|
||||
return 0;
|
||||
case WEST:
|
||||
return 1;
|
||||
case EAST:
|
||||
return 3;
|
||||
}
|
||||
throw new IllegalStateException("Impossible blockface for getHorizontalID");
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -18,11 +18,9 @@ import com.github.retrooper.packetevents.protocol.world.states.enums.West;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;
|
||||
|
||||
public class DynamicFence extends DynamicConnecting implements CollisionFactory {
|
||||
public class DynamicCollisionFence extends DynamicConnecting implements CollisionFactory {
|
||||
private static final CollisionBox[] COLLISION_BOXES = makeShapes(2.0F, 2.0F, 24.0F, 0.0F, 24.0F, true);
|
||||
|
||||
public static SimpleCollisionBox[] LEGACY_BOUNDING_BOXES = new SimpleCollisionBox[] {new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)};
|
||||
|
||||
@Override
|
||||
public CollisionBox fetch(GrimPlayer player, ClientVersion version, WrappedBlockState block, int x, int y, int z) {
|
||||
boolean east;
|
||||
+2
-2
@@ -19,7 +19,7 @@ import com.github.retrooper.packetevents.protocol.world.states.enums.West;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;
|
||||
|
||||
public class DynamicPane extends DynamicConnecting implements CollisionFactory {
|
||||
public class DynamicCollisionPane extends DynamicConnecting implements CollisionFactory {
|
||||
|
||||
private static final CollisionBox[] COLLISION_BOXES = makeShapes(1.0F, 1.0F, 16.0F, 0.0F, 16.0F, true);
|
||||
|
||||
@@ -84,7 +84,7 @@ public class DynamicPane extends DynamicConnecting implements CollisionFactory {
|
||||
|
||||
@Override
|
||||
public boolean checkCanConnect(GrimPlayer player, WrappedBlockState state, StateType one, StateType two, BlockFace direction) {
|
||||
if (BlockTags.GLASS_PANES.contains(one) || one == StateTypes.IRON_BARS)
|
||||
if (BlockTags.GLASS_PANES.contains(one) || one == StateTypes.IRON_BARS || one == StateTypes.CHAIN && player.getClientVersion().isOlderThan(ClientVersion.V_1_16))
|
||||
return true;
|
||||
else
|
||||
return CollisionData.getData(one).getMovementCollisionBox(player, player.getClientVersion(), state, 0, 0, 0).isSideFullBlock(direction);
|
||||
+5
-1
@@ -15,12 +15,16 @@ import com.github.retrooper.packetevents.protocol.world.states.enums.South;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.enums.West;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
|
||||
public class DynamicWall extends DynamicConnecting implements CollisionFactory {
|
||||
public class DynamicCollisionWall extends DynamicConnecting implements CollisionFactory {
|
||||
public static final CollisionBox[] BOXES = makeShapes(4.0F, 3.0F, 16.0F, 0.0F, 16.0F, false);
|
||||
// https://bugs.mojang.com/browse/MC-9565
|
||||
// https://bugs.mojang.com/browse/MC-94016
|
||||
private static final CollisionBox[] COLLISION_BOXES = makeShapes(4.0F, 3.0F, 24.0F, 0.0F, 24.0F, false);
|
||||
|
||||
/**
|
||||
* @deprecated use DynamicHitboxWall
|
||||
*/
|
||||
@Deprecated
|
||||
public CollisionBox fetchRegularBox(GrimPlayer player, WrappedBlockState state, ClientVersion version, int x, int y, int z) {
|
||||
int north, south, west, east, up;
|
||||
north = south = west = east = up = 0;
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package ac.grim.grimac.utils.collisions.blocks.connecting;
|
||||
|
||||
import ac.grim.grimac.player.GrimPlayer;
|
||||
import ac.grim.grimac.utils.collisions.CollisionData;
|
||||
import ac.grim.grimac.utils.collisions.datatypes.CollisionBox;
|
||||
import ac.grim.grimac.utils.collisions.datatypes.ComplexCollisionBox;
|
||||
import ac.grim.grimac.utils.collisions.datatypes.HitBoxFactory;
|
||||
import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.world.BlockFace;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.defaulttags.BlockTags;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.enums.*;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DynamicHitboxFence extends DynamicConnecting implements HitBoxFactory {
|
||||
private static final CollisionBox[] MODERN_HITBOXES = makeShapes(2.0F, 2.0F, 24.0F, 0.0F, 24.0F, true);
|
||||
|
||||
public static SimpleCollisionBox[] LEGACY_HITBOXES = new SimpleCollisionBox[] {new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)};
|
||||
|
||||
static {
|
||||
for (int i = 0; i < MODERN_HITBOXES.length; i++) {
|
||||
CollisionBox collisionBox = MODERN_HITBOXES[i];
|
||||
List<SimpleCollisionBox> boxes = new ArrayList<>();
|
||||
collisionBox.downCast(boxes);
|
||||
|
||||
for (SimpleCollisionBox box : boxes) {
|
||||
if (box.maxY > 1) {
|
||||
box.maxY = 1;
|
||||
}
|
||||
}
|
||||
|
||||
MODERN_HITBOXES[i] = new ComplexCollisionBox(boxes.toArray(new SimpleCollisionBox[0]));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollisionBox fetch(GrimPlayer player, StateType heldItem, ClientVersion version, WrappedBlockState block, int x, int y, int z) {
|
||||
boolean east;
|
||||
boolean north;
|
||||
boolean south;
|
||||
boolean west;
|
||||
|
||||
// 1.13+ servers on 1.13+ clients send the full fence data
|
||||
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_13)
|
||||
&& version.isNewerThanOrEquals(ClientVersion.V_1_13)) {
|
||||
east = block.getEast() != East.FALSE;
|
||||
north = block.getNorth() != North.FALSE;
|
||||
south = block.getSouth() != South.FALSE;
|
||||
west = block.getWest() != West.FALSE;
|
||||
} else {
|
||||
east = connectsTo(player, version, x, y, z, BlockFace.EAST);
|
||||
north = connectsTo(player, version, x, y, z, BlockFace.NORTH);
|
||||
south = connectsTo(player, version, x, y, z, BlockFace.SOUTH);
|
||||
west = connectsTo(player, version, x, y, z, BlockFace.WEST);
|
||||
}
|
||||
|
||||
return version.isNewerThanOrEquals(ClientVersion.V_1_12_2)
|
||||
? getModernCollisionBox(north, east, south, west)
|
||||
: getLegacyCollisionBox(north, east, south, west);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private CollisionBox getLegacyCollisionBox(boolean north, boolean east, boolean south, boolean west) {
|
||||
return LEGACY_HITBOXES[getAABBIndex(north, east, south, west)].copy();
|
||||
}
|
||||
|
||||
private CollisionBox getModernCollisionBox(boolean north, boolean east, boolean south, boolean west) {
|
||||
return MODERN_HITBOXES[getAABBIndex(north, east, south, west)].copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkCanConnect(GrimPlayer player, WrappedBlockState state, StateType one, StateType two, BlockFace direction) {
|
||||
if (BlockTags.FENCES.contains(one))
|
||||
return !(one == StateTypes.NETHER_BRICK_FENCE) && !(two == StateTypes.NETHER_BRICK_FENCE);
|
||||
else
|
||||
return BlockTags.FENCES.contains(one) || CollisionData.getData(one).getMovementCollisionBox(player, player.getClientVersion(), state, 0, 0, 0).isSideFullBlock(direction);
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package ac.grim.grimac.utils.collisions.blocks.connecting;
|
||||
|
||||
import ac.grim.grimac.player.GrimPlayer;
|
||||
import ac.grim.grimac.utils.collisions.CollisionData;
|
||||
import ac.grim.grimac.utils.collisions.datatypes.*;
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.world.BlockFace;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.defaulttags.BlockTags;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.enums.*;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;
|
||||
|
||||
public class DynamicHitboxPane extends DynamicConnecting implements HitBoxFactory {
|
||||
|
||||
private static final CollisionBox[] COLLISION_BOXES = makeShapes(1.0F, 1.0F, 16.0F, 0.0F, 16.0F, true);
|
||||
|
||||
@Override
|
||||
public CollisionBox fetch(GrimPlayer player, StateType item, ClientVersion version, WrappedBlockState block, int x, int y, int z) {
|
||||
boolean east, north, south, west;
|
||||
|
||||
// 1.13+ servers on 1.13+ clients send the full fence data
|
||||
if (isModernVersion(version)) {
|
||||
east = block.getEast() != East.FALSE;
|
||||
north = block.getNorth() != North.FALSE;
|
||||
south = block.getSouth() != South.FALSE;
|
||||
west = block.getWest() != West.FALSE;
|
||||
} else {
|
||||
east = connectsTo(player, version, x, y, z, BlockFace.EAST);
|
||||
north = connectsTo(player, version, x, y, z, BlockFace.NORTH);
|
||||
south = connectsTo(player, version, x, y, z, BlockFace.SOUTH);
|
||||
west = connectsTo(player, version, x, y, z, BlockFace.WEST);
|
||||
}
|
||||
|
||||
// On 1.7 and 1.8 clients, and 1.13+ clients on 1.7 and 1.8 servers, the glass pane is + instead of |
|
||||
if (shouldUseOldPaneShape(version, north, south, east, west)) {
|
||||
north = south = east = west = true;
|
||||
}
|
||||
|
||||
return version.isNewerThanOrEquals(ClientVersion.V_1_9)
|
||||
? getModernCollisionBox(north, east, south, west)
|
||||
: getLegacyCollisionBox(north, east, south, west);
|
||||
}
|
||||
|
||||
private boolean isModernVersion(ClientVersion version) {
|
||||
return PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_13)
|
||||
&& version.isNewerThanOrEquals(ClientVersion.V_1_13);
|
||||
}
|
||||
|
||||
private boolean shouldUseOldPaneShape(ClientVersion version, boolean north, boolean south, boolean east, boolean west) {
|
||||
return (!north && !south && !east && !west) &&
|
||||
(version.isOlderThanOrEquals(ClientVersion.V_1_8) ||
|
||||
(PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8) &&
|
||||
version.isNewerThanOrEquals(ClientVersion.V_1_13)));
|
||||
}
|
||||
|
||||
private CollisionBox getModernCollisionBox(boolean north, boolean east, boolean south, boolean west) {
|
||||
return COLLISION_BOXES[getAABBIndex(north, east, south, west)].copy();
|
||||
}
|
||||
|
||||
private CollisionBox getLegacyCollisionBox(boolean north, boolean east, boolean south, boolean west) {
|
||||
float minX = 0.4375F;
|
||||
float maxX = 0.5625F;
|
||||
float minZ = 0.4375F;
|
||||
float maxZ = 0.5625F;
|
||||
|
||||
if ((!west || !east) && (west || east || north || south)) {
|
||||
if (west) {
|
||||
minX = 0.0F;
|
||||
} else if (east) {
|
||||
maxX = 1.0F;
|
||||
}
|
||||
} else {
|
||||
minX = 0.0F;
|
||||
maxX = 1.0F;
|
||||
}
|
||||
|
||||
if ((!north || !south) && (west || east || north || south)) {
|
||||
if (north) {
|
||||
minZ = 0.0F;
|
||||
} else if (south) {
|
||||
maxZ = 1.0F;
|
||||
}
|
||||
} else {
|
||||
minZ = 0.0F;
|
||||
maxZ = 1.0F;
|
||||
}
|
||||
|
||||
return new SimpleCollisionBox(minX, 0.0F, minZ, maxX, 1.0F, maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectToGlassBlock() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkCanConnect(GrimPlayer player, WrappedBlockState state, StateType one, StateType two, BlockFace direction) {
|
||||
if (BlockTags.GLASS_PANES.contains(one) || one == StateTypes.IRON_BARS) {
|
||||
return true;
|
||||
} else {
|
||||
return CollisionData.getData(one)
|
||||
.getMovementCollisionBox(player, player.getClientVersion(), state, 0, 0, 0)
|
||||
.isSideFullBlock(direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package ac.grim.grimac.utils.collisions.blocks.connecting;
|
||||
|
||||
import ac.grim.grimac.player.GrimPlayer;
|
||||
import ac.grim.grimac.utils.collisions.CollisionData;
|
||||
import ac.grim.grimac.utils.collisions.datatypes.*;
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.world.BlockFace;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.defaulttags.BlockTags;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.enums.*;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
|
||||
public class DynamicHitboxWall extends DynamicConnecting implements HitBoxFactory {
|
||||
private static final CollisionBox[] HIT_BOXES = makeShapes(4.0F, 3.0F, 16.0F, 0.0F, 16.0F, false);
|
||||
|
||||
@Override
|
||||
public CollisionBox fetch(GrimPlayer player, StateType heldItem, ClientVersion version, WrappedBlockState state, int x, int y, int z) {
|
||||
int[] connections = getConnections(player, version, state, x, y, z);
|
||||
int north = connections[0], south = connections[1], west = connections[2], east = connections[3], up = connections[4];
|
||||
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_13)) {
|
||||
return getModernHitBox(north, south, west, east, up);
|
||||
} else {
|
||||
return getLegacyHitBox(north, south, west, east);
|
||||
}
|
||||
}
|
||||
|
||||
private int[] getConnections(GrimPlayer player, ClientVersion version, WrappedBlockState state, int x, int y, int z) {
|
||||
int north = 0, south = 0, west = 0, east = 0, up = 0;
|
||||
|
||||
if (isModernServer()) {
|
||||
boolean sixteen = PacketEvents.getAPI().getServerManager().getVersion().isNewerThan(ServerVersion.V_1_16);
|
||||
north = getConnectionValue(state.getNorth(), sixteen);
|
||||
east = getConnectionValue(state.getEast(), sixteen);
|
||||
south = getConnectionValue(state.getSouth(), sixteen);
|
||||
west = getConnectionValue(state.getWest(), sixteen);
|
||||
up = state.isUp() ? 1 : 0;
|
||||
} else {
|
||||
north = connectsTo(player, version, x, y, z, BlockFace.NORTH) ? 1 : 0;
|
||||
south = connectsTo(player, version, x, y, z, BlockFace.SOUTH) ? 1 : 0;
|
||||
west = connectsTo(player, version, x, y, z, BlockFace.WEST) ? 1 : 0;
|
||||
east = connectsTo(player, version, x, y, z, BlockFace.EAST) ? 1 : 0;
|
||||
up = 1;
|
||||
}
|
||||
|
||||
return new int[]{north, south, west, east, up};
|
||||
}
|
||||
|
||||
private boolean isModernServer() {
|
||||
return PacketEvents.getAPI().getServerManager().getVersion().isNewerThan(ServerVersion.V_1_12_2);
|
||||
}
|
||||
|
||||
private int getConnectionValue(Enum<?> direction, boolean sixteen) {
|
||||
if (direction == North.NONE || direction == East.NONE || direction == South.NONE || direction == West.NONE) {
|
||||
return 0;
|
||||
}
|
||||
return (direction == North.LOW || direction == East.LOW || direction == South.LOW || direction == West.LOW || sixteen) ? 1 : 2;
|
||||
}
|
||||
|
||||
private CollisionBox getModernHitBox(int north, int south, int west, int east, int up) {
|
||||
ComplexCollisionBox box = new ComplexCollisionBox();
|
||||
if (up == 1) {
|
||||
box.add(new HexCollisionBox(4, 0, 4, 12, 16, 12));
|
||||
}
|
||||
|
||||
addDirectionalBox(box, north, 5, 0, 0.0D, 11, 14, 11);
|
||||
addDirectionalBox(box, south, 5, 0, 5, 11, 14, 16);
|
||||
addDirectionalBox(box, west, 0, 0, 5, 11, 14, 11);
|
||||
addDirectionalBox(box, east, 5, 0, 5, 16, 14, 11);
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
private void addDirectionalBox(ComplexCollisionBox box, int direction, double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||
if (direction == 1) {
|
||||
box.add(new HexCollisionBox(x1, y1, z1, x2, y2, z2));
|
||||
} else if (direction == 2) {
|
||||
box.add(new HexCollisionBox(x1, y1, z1, x2, 16, z2));
|
||||
}
|
||||
}
|
||||
|
||||
private CollisionBox getLegacyHitBox(int north, int south, int west, int east) {
|
||||
float minX = 0.25F, maxX = 0.75F, minZ = 0.25F, maxZ = 0.75F;
|
||||
float maxY = 1.0F;
|
||||
|
||||
if (north == 1) minZ = 0.0F;
|
||||
if (south == 1) maxZ = 1.0F;
|
||||
if (west == 1) minX = 0.0F;
|
||||
if (east == 1) maxX = 1.0F;
|
||||
|
||||
if (north == 1 && south == 1 && west == 0 && east == 0) {
|
||||
maxY = 0.8125F;
|
||||
minX = 0.3125F;
|
||||
maxX = 0.6875F;
|
||||
} else if (west == 1 && east == 1 && north == 0 && south == 0) {
|
||||
maxY = 0.8125F;
|
||||
minZ = 0.3125F;
|
||||
maxZ = 0.6875F;
|
||||
}
|
||||
|
||||
return new SimpleCollisionBox(minX, 0.0F, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkCanConnect(GrimPlayer player, WrappedBlockState state, StateType one, StateType two, BlockFace direction) {
|
||||
return BlockTags.WALLS.contains(one) ||
|
||||
CollisionData.getData(one).getMovementCollisionBox(player, player.getClientVersion(), state, 0, 0, 0).isSideFullBlock(direction);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import com.github.retrooper.packetevents.protocol.world.BlockFace;
|
||||
import java.util.List;
|
||||
|
||||
public interface CollisionBox {
|
||||
CollisionBox union(SimpleCollisionBox other);
|
||||
|
||||
boolean isCollided(SimpleCollisionBox other);
|
||||
|
||||
boolean isIntersected(SimpleCollisionBox other);
|
||||
|
||||
@@ -16,6 +16,12 @@ public class ComplexCollisionBox implements CollisionBox {
|
||||
return boxes.add(collisionBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollisionBox union(SimpleCollisionBox other) {
|
||||
add(other);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollided(SimpleCollisionBox other) {
|
||||
for (CollisionBox box : boxes) {
|
||||
|
||||
@@ -21,6 +21,14 @@ public class DynamicCollisionBox implements CollisionBox {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
// Untested but currently unused
|
||||
// *should* work because every single one of these eventually becomes a Complex, Simple, or NoCollision Box
|
||||
@Override
|
||||
public CollisionBox union(SimpleCollisionBox other) {
|
||||
CollisionBox dynamicBox = box.fetch(player, version, block, x, y, z).offset(x, y, z);
|
||||
return dynamicBox.union(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollided(SimpleCollisionBox other) {
|
||||
return box.fetch(player, version, block, x, y, z).offset(x, y, z).isCollided(other);
|
||||
|
||||
@@ -2,6 +2,18 @@ package ac.grim.grimac.utils.collisions.datatypes;
|
||||
|
||||
public class HexCollisionBox extends SimpleCollisionBox {
|
||||
|
||||
/**
|
||||
* Creates a box defined by two points in 3d space; used to represent hitboxes and collision boxes.
|
||||
* Mojang's block hitbox values are all based on chunks, so they're stored in game as 16 * the actual size
|
||||
* When copying block hitbox values, it may be easier to simple copy the multiplied values and use this class
|
||||
* If your min/max values are < 1 you should probably check out {@link SimpleCollisionBox}
|
||||
* @param minX 16 * x position of first corner
|
||||
* @param minY 16 * y position of first corner
|
||||
* @param minZ 16 * z position of first corner
|
||||
* @param maxX 16 * x position of second corner
|
||||
* @param maxY 16 * y position of second corner
|
||||
* @param maxZ 16 * z position of second corner
|
||||
*/
|
||||
public HexCollisionBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||
this.minX = minX / 16d;
|
||||
this.minY = minY / 16d;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package ac.grim.grimac.utils.collisions.datatypes;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
|
||||
// Exists for the same reason as HexCollisionBox but for offset blocks; read comments there if unsure
|
||||
public class HexOffsetCollisionBox extends OffsetCollisionBox {
|
||||
public HexOffsetCollisionBox(StateType block, double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||
super(block, minX / 16d, minY / 16d, minZ / 16d, maxX / 16d, maxY / 16d, maxZ / 16d);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,11 @@ public class NoCollisionBox implements CollisionBox {
|
||||
private NoCollisionBox() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollisionBox union(SimpleCollisionBox other) {
|
||||
return other;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollided(SimpleCollisionBox other) {
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package ac.grim.grimac.utils.collisions.datatypes;
|
||||
|
||||
import ac.grim.grimac.utils.math.GrimMath;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.defaulttags.BlockTags;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class OffsetCollisionBox extends SimpleCollisionBox {
|
||||
|
||||
public static enum OffsetType {
|
||||
NONE,
|
||||
XZ,
|
||||
XYZ,
|
||||
}
|
||||
|
||||
float maxHorizontalModelOffset = 0.25F;
|
||||
float maxVerticalModelOffset = 0.2F;
|
||||
double offsetX = 0;
|
||||
double offsetY = 0;
|
||||
double offsetZ = 0;
|
||||
|
||||
OffsetType offsetType;
|
||||
|
||||
private static final HashSet<StateType> XZ_OFFSET_BLOCKSTATES = new HashSet<>();
|
||||
private static final HashSet<StateType> XYZ_OFFSET_BLOCKSTATES = new HashSet<>();
|
||||
|
||||
static {
|
||||
// Can we add a hasOffSet to StateType() ?
|
||||
// Or a new BlockTag for XZ and XYZ Offset ?
|
||||
XZ_OFFSET_BLOCKSTATES.add(StateTypes.MANGROVE_PROPAGULE);
|
||||
|
||||
XZ_OFFSET_BLOCKSTATES.addAll(BlockTags.SMALL_FLOWERS.getStates());
|
||||
XZ_OFFSET_BLOCKSTATES.add(StateTypes.BAMBOO_SAPLING);
|
||||
XZ_OFFSET_BLOCKSTATES.add(StateTypes.BAMBOO);
|
||||
XZ_OFFSET_BLOCKSTATES.add(StateTypes.POINTED_DRIPSTONE);
|
||||
// Only offsets rendering HitBox on XZ // we should document this somewhere for future reference
|
||||
// XZ_OFFSET_BLOCKSTATES.addAll(BlockTags.TALL_FLOWERS.getStates());
|
||||
// XZ_OFFSET_BLOCKSTATES.add(StateTypes.TALL_SEAGRASS);
|
||||
// XZ_OFFSET_BLOCKSTATES.add(StateTypes.TALL_GRASS);
|
||||
// XZ_OFFSET_BLOCKSTATES.add(StateTypes.LARGE_FERN);
|
||||
// XZ_OFFSET_BLOCKSTATES.add(StateTypes.WARPED_ROOTS);
|
||||
// XZ_OFFSET_BLOCKSTATES.add(StateTypes.NETHER_SPROUTS);
|
||||
// XZ_OFFSET_BLOCKSTATES.add(StateTypes.CRIMSON_ROOTS);
|
||||
// XZ_OFFSET_BLOCKSTATES.add(StateTypes.HANGING_ROOTS);
|
||||
|
||||
// Only offsets rendering on XYZ, not HitBox
|
||||
// XYZ_OFFSET_BLOCKSTATES.add(StateTypes.SHORT_GRASS);
|
||||
// XYZ_OFFSET_BLOCKSTATES.add(StateTypes.FERN);
|
||||
// XYZ_OFFSET_BLOCKSTATES.add(StateTypes.SMALL_DRIPLEAF);
|
||||
}
|
||||
|
||||
public OffsetCollisionBox(StateType block, double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||
super(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
if (block.equals(StateTypes.POINTED_DRIPSTONE)) {
|
||||
maxHorizontalModelOffset = 0.125F;
|
||||
}
|
||||
// else if (block.equals(StateTypes.SMALL_DRIPLEAF)) {
|
||||
// maxVerticalModelOffset = 0.1F;
|
||||
// }
|
||||
|
||||
if (XZ_OFFSET_BLOCKSTATES.contains(block)) {
|
||||
offsetType = OffsetType.XZ;
|
||||
return;
|
||||
} else if (XYZ_OFFSET_BLOCKSTATES.contains(block)) {
|
||||
offsetType = OffsetType.XYZ;
|
||||
return;
|
||||
}
|
||||
throw new RuntimeException("Invalid State Type for OffSetCollisionBox: " + block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleCollisionBox offset(double x, double y, double z) {
|
||||
// In case you want to call .offset() again or get the box values without offset.
|
||||
resetBlockStateOffSet();
|
||||
long l;
|
||||
switch (offsetType) {
|
||||
case NONE:
|
||||
return super.offset(x, y, z);
|
||||
case XZ:
|
||||
l = GrimMath.hashCode(x, 0, z);
|
||||
offsetX = GrimMath.clamp(((double)((float)(l & 15L) / 15.0F) - 0.5) * 0.5, (double)(-maxHorizontalModelOffset), (double)maxHorizontalModelOffset);
|
||||
offsetZ = GrimMath.clamp(((double)((float)(l >> 8 & 15L) / 15.0F) - 0.5) * 0.5, (double)(-maxHorizontalModelOffset), (double)maxHorizontalModelOffset);
|
||||
return super.offset(x + offsetX, y, z + offsetZ);
|
||||
case XYZ:
|
||||
l = GrimMath.hashCode(x, 0, z);
|
||||
offsetY = ((double)((float)(l >> 4 & 15L) / 15.0F) - 1.0) * (double) maxVerticalModelOffset;
|
||||
offsetX = GrimMath.clamp(((double)((float)(l & 15L) / 15.0F) - 0.5) * 0.5, (double)(-maxHorizontalModelOffset), (double)maxHorizontalModelOffset);
|
||||
offsetZ = GrimMath.clamp(((double)((float)(l >> 8 & 15L) / 15.0F) - 0.5) * 0.5, (double)(-maxHorizontalModelOffset), (double)maxHorizontalModelOffset);
|
||||
return super.offset(x + offsetX, offsetY, z + offsetZ);
|
||||
}
|
||||
// You *really* shouldn't be using this class if offsetType = null
|
||||
return null;
|
||||
}
|
||||
|
||||
public void resetBlockStateOffSet() {
|
||||
this.minX += offsetX;
|
||||
this.minY += offsetY;
|
||||
this.minZ += offsetZ;
|
||||
this.maxX += offsetX;
|
||||
this.maxY += offsetY;
|
||||
this.maxZ += offsetZ;
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,17 @@ public class SimpleCollisionBox implements CollisionBox {
|
||||
this(0, 0, 0, 0, 0, 0, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a box defined by two points in 3d space; used to represent hitboxes and collision boxes.
|
||||
* If your min/max values are > 1 you should probably check out {@link HexCollisionBox}
|
||||
* @param minX x position of first corner
|
||||
* @param minY y position of first corner
|
||||
* @param minZ z position of first corner
|
||||
* @param maxX x position of second corner
|
||||
* @param maxY y position of second corner
|
||||
* @param maxZ z position of second corner
|
||||
* @param fullBlock - whether on not the box is a perfect 1x1x1 sized block
|
||||
*/
|
||||
public SimpleCollisionBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, boolean fullBlock) {
|
||||
this.minX = minX;
|
||||
this.maxX = maxX;
|
||||
@@ -47,7 +58,17 @@ public class SimpleCollisionBox implements CollisionBox {
|
||||
this(minX, minY, minZ, minX + 1, minY + 1, minZ + 1, true);
|
||||
}
|
||||
|
||||
// Use only if you don't know the fullBlock status, which is rare
|
||||
/**
|
||||
* Creates a box defined by two points in 3d space; used to represent hitboxes and collision boxes.
|
||||
* If your min/max values are > 1 you should probably check out {@link HexCollisionBox}
|
||||
* Use only if you don't know the fullBlock status, which is rare
|
||||
* @param minX x position of first corner
|
||||
* @param minY y position of first corner
|
||||
* @param minZ z position of first corner
|
||||
* @param maxX x position of second corner
|
||||
* @param maxY y position of second corner
|
||||
* @param maxZ z position of second corner
|
||||
*/
|
||||
public SimpleCollisionBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||
this.minX = minX;
|
||||
this.maxX = maxX;
|
||||
@@ -142,7 +163,8 @@ public class SimpleCollisionBox implements CollisionBox {
|
||||
return vectors;
|
||||
}
|
||||
|
||||
public SimpleCollisionBox union(SimpleCollisionBox other) {
|
||||
@Override
|
||||
public CollisionBox union(SimpleCollisionBox other) {
|
||||
this.minX = Math.min(this.minX, other.minX);
|
||||
this.minY = Math.min(this.minY, other.minY);
|
||||
this.minZ = Math.min(this.minZ, other.minZ);
|
||||
|
||||
@@ -80,6 +80,7 @@ public final class ValuedAttribute {
|
||||
|
||||
public void reset() {
|
||||
this.value = defaultValue;
|
||||
this.lastProperty = null; // Remove the old property with its modifiers so we don't accidentally use it again, messing up the calculation.
|
||||
}
|
||||
|
||||
public double get() {
|
||||
|
||||
@@ -2,6 +2,8 @@ package ac.grim.grimac.utils.data.packetentity;
|
||||
|
||||
import ac.grim.grimac.player.GrimPlayer;
|
||||
import ac.grim.grimac.utils.data.attribute.ValuedAttribute;
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.protocol.attribute.Attributes;
|
||||
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
|
||||
import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
|
||||
@@ -20,7 +22,16 @@ public class PacketEntityHorse extends PacketEntityTrackXRot {
|
||||
setAttribute(Attributes.GENERIC_STEP_HEIGHT, 1.0f);
|
||||
|
||||
final boolean preAttribute = player.getClientVersion().isOlderThan(ClientVersion.V_1_20_5);
|
||||
trackAttribute(ValuedAttribute.ranged(Attributes.GENERIC_JUMP_STRENGTH, 0.7, 0, preAttribute ? 2 : 32));
|
||||
// This was horse.jump_strength pre-attribute
|
||||
trackAttribute(ValuedAttribute.ranged(Attributes.GENERIC_JUMP_STRENGTH, 0.7, 0, preAttribute ? 2 : 32)
|
||||
.withSetRewriter((oldValue, newValue) -> {
|
||||
// Seems viabackwards doesn't rewrite this (?)
|
||||
if (preAttribute && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_20_5)) {
|
||||
return oldValue;
|
||||
}
|
||||
// Modern player OR an old server setting legacy horse.jump_strength attribute
|
||||
return newValue;
|
||||
}));
|
||||
trackAttribute(ValuedAttribute.ranged(Attributes.GENERIC_MOVEMENT_SPEED, 0.225f, 0, 1024));
|
||||
|
||||
if (EntityTypes.isTypeInstanceOf(type, EntityTypes.CHESTED_HORSE)) {
|
||||
|
||||
@@ -105,4 +105,10 @@ public class GrimMath {
|
||||
public static boolean isNearlySame(double a, double b, double epoch) {
|
||||
return Math.abs(a-b) < epoch;
|
||||
}
|
||||
|
||||
public static long hashCode(double x, int y, double z) {
|
||||
long l = (long)(x * 3129871) ^ (long)z * 116129781L ^ (long)y;
|
||||
l = l * l * 42317861L + l * 11L;
|
||||
return l >> 16;
|
||||
}
|
||||
}
|
||||
@@ -110,10 +110,11 @@ public class BlockBreakSpeed {
|
||||
if (tool.getType().hasAttribute(ItemTypes.ItemAttribute.SWORD)) {
|
||||
if (block.getType() == StateTypes.COBWEB) {
|
||||
speedMultiplier = 15.0f;
|
||||
} else if (block.getType().getMaterialType() == MaterialType.PLANT ||
|
||||
BlockTags.LEAVES.contains(block.getType()) ||
|
||||
block.getType() == StateTypes.PUMPKIN ||
|
||||
block.getType() == StateTypes.MELON) {
|
||||
} else if (block.getType().getMaterialType() == MaterialType.PLANT
|
||||
|| BlockTags.LEAVES.contains(block.getType())
|
||||
|| block.getType() == StateTypes.VINE
|
||||
|| block.getType() == StateTypes.PUMPKIN
|
||||
|| block.getType() == StateTypes.MELON) {
|
||||
speedMultiplier = 1.5f;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,11 @@ public class BlockProperties {
|
||||
}
|
||||
|
||||
if (player.compensatedEntities.getSelf().getRiding() instanceof PacketEntityStrider) {
|
||||
// Unsure which version the speed changed in
|
||||
if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20)) {
|
||||
return (float) player.speed * 0.1f;
|
||||
}
|
||||
|
||||
PacketEntityStrider strider = (PacketEntityStrider) player.compensatedEntities.getSelf().getRiding();
|
||||
// Vanilla multiplies by 0.1 to calculate speed
|
||||
return (float) strider.getAttributeValue(Attributes.GENERIC_MOVEMENT_SPEED) * (strider.isShaking ? 0.66F : 1.0F) * 0.1f;
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.bukkit.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class Collisions {
|
||||
@@ -699,7 +700,7 @@ public class Collisions {
|
||||
int x = currX | chunkXGlobalPos;
|
||||
int z = currZ | chunkZGlobalPos;
|
||||
|
||||
WrappedBlockState data = section.get(CompensatedWorld.blockVersion, x & 0xF, y & 0xF, z & 0xF);
|
||||
WrappedBlockState data = section.get(CompensatedWorld.blockVersion, x & 0xF, y & 0xF, z & 0xF, false);
|
||||
|
||||
if (searchingFor.test(new Pair<>(data, new Vector3d(x, y, z)))) return true;
|
||||
}
|
||||
@@ -710,6 +711,85 @@ public class Collisions {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Thanks Tuinity
|
||||
public static void forEachCollisionBox(GrimPlayer player, SimpleCollisionBox checkBox, Consumer<Vector3d> searchingFor) {
|
||||
int minBlockX = (int) Math.floor(checkBox.minX - COLLISION_EPSILON) - 1;
|
||||
int maxBlockX = (int) Math.floor(checkBox.maxX + COLLISION_EPSILON) + 1;
|
||||
int minBlockY = (int) Math.floor(checkBox.minY - COLLISION_EPSILON) - 1;
|
||||
int maxBlockY = (int) Math.floor(checkBox.maxY + COLLISION_EPSILON) + 1;
|
||||
int minBlockZ = (int) Math.floor(checkBox.minZ - COLLISION_EPSILON) - 1;
|
||||
int maxBlockZ = (int) Math.floor(checkBox.maxZ + COLLISION_EPSILON) + 1;
|
||||
|
||||
final int minSection = player.compensatedWorld.getMinHeight() >> 4;
|
||||
final int minBlock = minSection << 4;
|
||||
final int maxBlock = player.compensatedWorld.getMaxHeight() - 1;
|
||||
|
||||
int minChunkX = minBlockX >> 4;
|
||||
int maxChunkX = maxBlockX >> 4;
|
||||
|
||||
int minChunkZ = minBlockZ >> 4;
|
||||
int maxChunkZ = maxBlockZ >> 4;
|
||||
|
||||
int minYIterate = Math.max(minBlock, minBlockY);
|
||||
int maxYIterate = Math.min(maxBlock, maxBlockY);
|
||||
|
||||
for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {
|
||||
int minZ = currChunkZ == minChunkZ ? minBlockZ & 15 : 0; // coordinate in chunk
|
||||
int maxZ = currChunkZ == maxChunkZ ? maxBlockZ & 15 : 15; // coordinate in chunk
|
||||
|
||||
for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) {
|
||||
int minX = currChunkX == minChunkX ? minBlockX & 15 : 0; // coordinate in chunk
|
||||
int maxX = currChunkX == maxChunkX ? maxBlockX & 15 : 15; // coordinate in chunk
|
||||
|
||||
int chunkXGlobalPos = currChunkX << 4;
|
||||
int chunkZGlobalPos = currChunkZ << 4;
|
||||
|
||||
Column chunk = player.compensatedWorld.getChunk(currChunkX, currChunkZ);
|
||||
|
||||
if (chunk == null) continue;
|
||||
BaseChunk[] sections = chunk.getChunks();
|
||||
|
||||
for (int y = minYIterate; y <= maxYIterate; ++y) {
|
||||
BaseChunk section = sections[(y >> 4) - minSection];
|
||||
|
||||
if (section == null || (IS_FOURTEEN && section.isEmpty())) { // Check for empty on 1.13+ servers
|
||||
// empty
|
||||
// skip to next section
|
||||
y = (y & ~(15)) + 15; // increment by 15: iterator loop increments by the extra one
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int currZ = minZ; currZ <= maxZ; ++currZ) {
|
||||
for (int currX = minX; currX <= maxX; ++currX) {
|
||||
int x = currX | chunkXGlobalPos;
|
||||
int z = currZ | chunkZGlobalPos;
|
||||
|
||||
WrappedBlockState data = section.get(CompensatedWorld.blockVersion, x & 0xF, y & 0xF, z & 0xF, false);
|
||||
|
||||
// Works on both legacy and modern! Faster than checking for material types, most common case
|
||||
if (data.getGlobalId() == 0) continue;
|
||||
|
||||
// Thanks SpottedLeaf for this optimization, I took edgeCount from Tuinity
|
||||
int edgeCount = ((x == minBlockX || x == maxBlockX) ? 1 : 0) +
|
||||
((y == minBlockY || y == maxBlockY) ? 1 : 0) +
|
||||
((z == minBlockZ || z == maxBlockZ) ? 1 : 0);
|
||||
|
||||
final StateType type = data.getType();
|
||||
if (edgeCount != 3 && (edgeCount != 1 || Materials.isShapeExceedsCube(type))
|
||||
&& (edgeCount != 2 || type == StateTypes.PISTON_HEAD)) {
|
||||
final CollisionBox collisionBox = CollisionData.getData(type).getMovementCollisionBox(player, player.getClientVersion(), data, x, y, z);
|
||||
|
||||
if (collisionBox.isIntersected(checkBox)) {
|
||||
searchingFor.accept(new Vector3d(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean onClimbable(GrimPlayer player, double x, double y, double z) {
|
||||
WrappedBlockState blockState = player.compensatedWorld.getWrappedBlockStateAt(x, y, z);
|
||||
StateType blockMaterial = blockState.getType();
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package ac.grim.grimac.utils.nmsutil;
|
||||
|
||||
import ac.grim.grimac.player.GrimPlayer;
|
||||
import ac.grim.grimac.utils.collisions.CollisionData;
|
||||
import ac.grim.grimac.utils.collisions.datatypes.CollisionBox;
|
||||
import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;
|
||||
import ac.grim.grimac.utils.data.MainSupportingBlockData;
|
||||
import com.github.retrooper.packetevents.util.Vector3d;
|
||||
@@ -42,12 +40,8 @@ public class MainSupportingBlockPosFinder {
|
||||
AtomicReference<Vector3i> bestBlockPos = new AtomicReference<>();
|
||||
AtomicDouble blockPosDistance = new AtomicDouble(Double.MAX_VALUE);
|
||||
|
||||
Collisions.hasMaterial(player, searchBox, (thing) -> {
|
||||
Vector3i blockPos = thing.getSecond().toVector3i();
|
||||
|
||||
CollisionBox collision = CollisionData.getData(thing.getFirst().getType()).getMovementCollisionBox(player, player.getClientVersion(), thing.getFirst(), blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
if (!collision.isIntersected(searchBox)) return false;
|
||||
|
||||
Collisions.forEachCollisionBox(player, searchBox, (pos) -> {
|
||||
Vector3i blockPos = pos.toVector3i();
|
||||
Vector3d blockPosAsVector3d = new Vector3d(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5);
|
||||
double distance = playerPos.distanceSquared(blockPosAsVector3d);
|
||||
|
||||
@@ -55,8 +49,6 @@ public class MainSupportingBlockPosFinder {
|
||||
bestBlockPos.set(blockPos);
|
||||
blockPosDistance.set(distance);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -10,16 +10,17 @@ alerts:
|
||||
# Isso controla se/como os alertas são compartilhados entre os servidores conectados ao proxy.
|
||||
# Deve-se ter 'bungee-plugin-message-channel' habilitado na configuração do Velocity se estiver usando.
|
||||
proxy:
|
||||
# Os alertas deveriam ser enviados para outros servidores conectados no mesmo proxy?
|
||||
# Deviam os alertas ser enviados para outros servidores conectados no mesmo proxy?
|
||||
send: false
|
||||
# Os alertas deveriam ser recebidos de outros servidores conectados no mesmo proxy?
|
||||
# Deviam os alertas ser recebidos de outros servidores conectados no mesmo proxy?
|
||||
receive: false
|
||||
|
||||
verbose:
|
||||
print-to-console: false
|
||||
|
||||
client-brand:
|
||||
# Isso signifia que, caso o nome do cliente seja igual aos listados abaixo, não será notificados aos operadores.
|
||||
# Isso signifia que, caso a marca do cliente seja igual às listadas abaixo, não será notificado aos
|
||||
# administradores.
|
||||
ignored-clients:
|
||||
- "^vanilla$"
|
||||
- "^fabric$"
|
||||
@@ -27,7 +28,7 @@ client-brand:
|
||||
- "^Feather Fabric$"
|
||||
|
||||
spectators:
|
||||
# Esconde todos espectadores com a permissão 'grim.spectator' mesmo se não estiverem espectando ativamente.
|
||||
# Esconde todos espectadores com a permissão 'grim.spectator' mesmo se não estiverem ativamente espectando.
|
||||
hide-regardless: false
|
||||
# Fará os espectadores serem escondidos apenas nos mundos listados abaixo, deixe em branco para habilitar em todos os mundos.
|
||||
allowed-worlds:
|
||||
@@ -36,35 +37,35 @@ spectators:
|
||||
# Quanto tempo os jogadores tem até expulsarmos eles por inatividade? Padrão = 60 segundos.
|
||||
max-transaction-time: 60
|
||||
|
||||
# Should the duplicate movement packet be cancelled?
|
||||
# Mojang has fixed this issue in 1.21. This was their attempt to fix the "bucket desync". https://bugs.mojang.com/browse/MC-12363
|
||||
# This setting only applies to 1.17-1.20.5 clients on 1.8 servers.
|
||||
# Deve-se cancelar o pacote de movimento duplicado?
|
||||
# A Mojang arrumou esse erro na 1.21, sendo sua tentativa de concertar a dessincronização do balde. https://bugs.mojang.com/browse/MC-12363
|
||||
# Isso só se aplica à clientes da 1.17-1.20.5 em servidores da 1.8.
|
||||
cancel-duplicate-packet: true
|
||||
|
||||
# Whether or not to ignore the rotation in duplicate packets
|
||||
# Deve-se ignorar rotação em pacotes duplicados?
|
||||
ignore-duplicate-packet-rotation: false
|
||||
|
||||
Simulation:
|
||||
# Por quanto deveríamos multiplicar a vantagem caso o jogador não tenha falhado em nem uma verificação?
|
||||
# Por quanto deve-se multiplicar a vantagem desde a última vez que falhou uma verificação?
|
||||
# Isso é como a configuração padrão se parece (eixo X = segundos, eixo Y = 1/1000 blocos): https://www.desmos.com/calculator/d4ufgxrxer
|
||||
setback-decay-multiplier: 0.999
|
||||
# O quão longe o jogador deve estar da área simulada para adicionarmos violações?
|
||||
# O quão longe o jogador deve estar da área simulada para registrar violações?
|
||||
# Medido em blocos do último movimento legítmo.
|
||||
# Aceitamos o Optifine trocando as tabelas trigonométricas, mas abaixar para 0.001 reduzirá o 'FastMath'
|
||||
# de falhar, caso esta compensação não funcionar...
|
||||
# Incluímos o Optifine trocando as tabelas trigonométricas; entretanto, abaixar para 0.001 reduzirá o 'FastMath'
|
||||
# de falhar, caso essa compensação não funcionar.
|
||||
threshold: 0.001
|
||||
# O quão longe o jogador deve estar da área simulada para imediatamente recuá-lo?
|
||||
# -1 desabilitará
|
||||
immediate-setback-threshold: 0.1
|
||||
# O quão longe da área simulada sobre todos os ticks para começarmos a recuar?
|
||||
# Qual é a soma do desalinhamento da simulação em todos os ticks até começarmos a recuar?
|
||||
# -1 desabilitará
|
||||
max-advantage: 1
|
||||
# Depois de 50 segundos, com a configuração padrão, o jogador irá de 4 blocos -> 1 bloco de vantagem.
|
||||
# Depois de 50 segundos, com a configuração padrão, o jogador irá de 4 blocos a 1 bloco de vantagem.
|
||||
# Isso serve para previnir o jogador de alcançar violações demais e nunca conseguir se livrar delas.
|
||||
# Cela de vantagens padrão (eixo X = segundos, eixo Y = 1/1000 blocos): https://www.desmos.com/calculator/4lovswdarj
|
||||
max-ceiling: 4
|
||||
|
||||
# Verifica se um jogador entrou em um bloco durante o movimento.
|
||||
# Verifica se um jogador entrou em um bloco ao se mover.
|
||||
Phase:
|
||||
setbackvl: 1 # Entrar em blocos possibilita escalar paredes, além disso, essa verificação é relativamente estável.
|
||||
decay: 0.005
|
||||
@@ -85,29 +86,29 @@ RotationPlace:
|
||||
cancelvl: 5
|
||||
|
||||
# Verificação de NoSlow por simulação.
|
||||
# Grim considera erros no netcode... difícil de gerar falsos positivos, até mesmo spamando o blotão direito e a offhand.
|
||||
# Muito mais estável que outros anticheats, mas por favor, reporte quaisquer falsos positivos... eu já arrumei diversos
|
||||
# Grim considera erros no netcode. Difícil de gerar falsos positivos, até mesmo spamando o blotão direito e a offhand.
|
||||
# Muito mais estável que outros anticheats, mas por favor, reporte quaisquer falsos positivos. Eu já arrumei diversos
|
||||
# erros de netcode.
|
||||
NoSlowA:
|
||||
# Quanto de desvio da simulação é considerado trapaça?
|
||||
# Por padrão isso é menor que outros desvios.
|
||||
# Acusa com 0.03-0.2 com consistência com o NoSlow ativo.
|
||||
# Quanto de desalinhamento é considerado trapaça?
|
||||
# Por padrão é menor que os outros.
|
||||
# Em 0.03-0.2 detecta com consistência.
|
||||
threshold: 0.001
|
||||
# Recua rapidamente no primeiro item para remover quaisquer vantagens que o NoSlow dá.
|
||||
# Recuo imediato para inibir as vantagens rapidamente.
|
||||
setbackvl: 5
|
||||
# Decai quando o jogador usa um item E é desasceletado por isso.
|
||||
# Decai quando o jogador usa um item e é efetivamente desacelerado.
|
||||
decay: 0.05
|
||||
|
||||
Knockback:
|
||||
# Por quanto deveriamos multiplicar a vantagem caso o jogador não tenha falhado nessa verificação?
|
||||
# Por quanto deve-se multiplicar a vantagem desde a última vez que falhou na verificação?
|
||||
setback-decay-multiplier: 0.999
|
||||
# O quão longe da área do recuo recebido o jogador deve estar para adicionarmos uma violação?
|
||||
# O quão longe da área do recuo recebido o jogador deve estar para registrar violações?
|
||||
# Medido em blocos do recuo recebido.
|
||||
threshold: 0.001
|
||||
# O quão longe o jogador deve estar da área simulada para imediatamente recuá-lo?
|
||||
# -1 desabilitará.
|
||||
immediate-setback-threshold: 0.1
|
||||
# O quão longe da área simulada sobre todos os ticks deverá ser para começarmos a recuar?
|
||||
# Qual é a soma do desalinhamento da simulação em todos os ticks até começarmos a recuar?
|
||||
# -1 desabilitará.
|
||||
max-advantage: 1
|
||||
# Isso serve para previnir o jogador de alcançar violações demais e nunca conseguir se livrar delas.
|
||||
@@ -120,16 +121,16 @@ Explosion:
|
||||
TimerA:
|
||||
setbackvl: 10
|
||||
# Milissegundos que o jogador pode acumular para depois usar quando eles têm um atraso no ping.
|
||||
# Pode permitir o uso de fast use / fast heal / fast bow na 1.8 caso o valor seja definido muito alto. 120ms parece
|
||||
# um bom balanceamento.
|
||||
# Pode ignorar o uso de fast use / fast heal / fast bow na 1.8 caso o valor seja definido muito alto.
|
||||
# 120ms parece um bom balanceamento.
|
||||
drift: 120
|
||||
# Ping no qual a verificação vai começar a limitar o balançeamento do timer para previnir abuso.
|
||||
# Pode causar recuos a jogadores legítmos, mas somente se estiverem acima deste ping.
|
||||
# Pode causar recuos a jogadores legítmos, mas somente se estiverem acima desse ping.
|
||||
# -1 desabilitará.
|
||||
ping-abuse-limit-threshold: 1000
|
||||
|
||||
NegativeTimer:
|
||||
# Número de milissegundos perdidos ao se mover antes de começarmos a adicionar violações.
|
||||
# Número de milissegundos perdidos ao se mover antes de começarmos a registrar violações.
|
||||
drift: 1200
|
||||
|
||||
# Mesmo método usado no TimerA, mas para veículos.
|
||||
@@ -141,56 +142,54 @@ EntityControl:
|
||||
setbackvl: 25
|
||||
|
||||
Reach:
|
||||
# Por quanto devíamos expandir as caixas de colisão? 0.0005 deve detectar 3.0005+ de alcance.
|
||||
# Por quanto deve-se expandir as caixas de colisão? 0.0005 deve detectar 3.0005+ de alcance.
|
||||
#
|
||||
# Há 0.03 de expansão forçada nas versões 1.9-1.18.1 (não a 1.18.2), ou algumas combinações de cliente/servidor por
|
||||
# conta de mudanças no protocolo e limitações. Essa verificação é mais poderosa com clientes da 1.7/1.8 em servidores
|
||||
# da 1.8.
|
||||
threshold: 0.0005
|
||||
# Deveríamos cancelar hits que sabemos que são impossíveis?
|
||||
# O alcance de 3.00-3.03 pode acabar passando, mas continuarão adicionando violações, por conta de limitações na
|
||||
# ordem de pacotes.
|
||||
# Deve-se cancelar hits que sabemos que são impossíveis?
|
||||
# O alcance de 3.00-3.03 pode acabar passando, por conta da ordem de pacotes, mas continuará registrando violações.
|
||||
block-impossible-hits: true
|
||||
# Isso enviará um pacote adicional no final de todos os ticks para aumentar a probabilidade de detectarmos trapaceiros.
|
||||
# Isso injeta na lista de conecção do servidor para envar um pacote final logo antes do servidor recarregar.
|
||||
# Habilitando isso, irá aumentar o uso de banda para todos os jogadores.
|
||||
# Isso não irá interferir na performance do servidor.
|
||||
# Habilitando isso, aumentará a probabilidade de detectarmos trapaceiros.
|
||||
# Deixando-o desabilitado, continuará detectando cheaters e não irá causar falsos positivos.
|
||||
# A menos que estiver em um servidor focado em PvP esse pacote adicional não é recomendado.
|
||||
# Deixando-o desabilitado, continuará detectando trapaceiros e não irá causar falsos positivos.
|
||||
# A menos que estiver em um servidor focado em PvP, esse pacote adicional não é recomendado.
|
||||
enable-post-packet: false
|
||||
|
||||
exploit:
|
||||
# Você pode ganhar altas velocidades enquanto pular correndo com uma elytra, isso previne o exploitação de ocorrer quando
|
||||
# definido falso.
|
||||
# Você pode ganhar altas velocidades se pular correndo com uma elytra, previne isso de ocorrer quando definido falso.
|
||||
# A Mojang vacilou com o netcode por fazer a Elytra iniciar pelo lado do cliente.
|
||||
# As Elytras levam 0.99 de fricção horizontal, então constantemente adicionando 0.2 de velocidade horizontal resulta
|
||||
# em velocidades altíssimas.
|
||||
allow-sprint-jumping-when-using-elytra: true
|
||||
# Essa opção mitiga o posicionamento de blocos em blocos fantasmas, ressincronizando o jogador quando isso ocorrer.
|
||||
# Essa opção mitiga posicionar blocos em blocos fantasma, ressincronizando o jogador quando isso ocorrer.
|
||||
allow-building-on-ghostblocks: true
|
||||
# Este ajuste, influenciado pelo booleano acima, define a distância para verificar blocos fantasmas.
|
||||
# Seu intervalo válido é limitado de 2 a 4.
|
||||
# Esse ajuste, influído pela opção acima, define a distância para verificar blocos fantasmas.
|
||||
# O valor válido é limitado de 2 a 4.
|
||||
distance-to-check-if-ghostblocks: 2
|
||||
|
||||
# Habilita registrar plugins que são injetados na netty ao entrar para depurar erros de compatibilidade.
|
||||
# Registra plugins que são injetados na netty ao entrar para depurar erros de compatibilidade.
|
||||
debug-pipeline-on-join: false
|
||||
|
||||
# Habilita verificações experimentais.
|
||||
experimental-checks: false
|
||||
|
||||
# Grim às vezes cancela pacotes ilegais como com o timer, depois de X pacotes em um segundo que foram cancelados, quando
|
||||
# devemos simplesmente expulsar o jogador? Isso é requirido já que alguns limitadores de pacotes não contam pacotes
|
||||
# deve-se simplesmente expulsar o jogador? Isso é requirido já que alguns limitadores de pacotes não contam pacotes
|
||||
# cancelados pelo Grim.
|
||||
packet-spam-threshold: 100
|
||||
|
||||
# Grim é capaz de garantir que um jogador fora do estado de voo não possa ter mais de X milissegundos de ping.
|
||||
# Grim pode impor que o jogador fora do estado de voo não possa ter mais de X milissegundos de ping.
|
||||
# Isso ocorre porque o Grim atualmente não verifica os jogadores que estão voando.
|
||||
# To disable, use -1
|
||||
# -1 desabilitará.
|
||||
max-ping-out-of-flying: 1000
|
||||
|
||||
# Maximum ping when a firework boost is removed from the player.
|
||||
# This prevents high latency players from being able to use 1 firework boost with an elytra forever.
|
||||
# Ping máximo quando o impulso do foguete acaba.
|
||||
# Previne jogadores com ping alto de usarem um foguete ara voar indefinidamente.
|
||||
max-ping-firework-boost: 1000
|
||||
|
||||
config-version: 9
|
||||
@@ -0,0 +1,192 @@
|
||||
# GrimAC ana konfigrasyon dosyası
|
||||
# Kaynak kodu: https://github.com/MWHunter/Grim
|
||||
# Telif Hakkı 2024 DefineOutside ve katkıda bulunanlar, GPLv3 altında lisanslanmıştır.
|
||||
# Değiştirilmiş ikili dosyalar veya kopyalanmış grim kodlu eklentiler özel olmalıdır,
|
||||
# veya ek ücret ödemeden alıcılara sunulan tam kaynak kodu ile.
|
||||
|
||||
alerts:
|
||||
# Oyunculara uyarı yayınlamanın yanı sıra, uyarılar konsola da gönderilmeli mi?
|
||||
print-to-console: true
|
||||
# Bu, uyarıların proxy'nize bağlı sunucular arasında paylaşılıp paylaşılmayacağını/nasıl paylaşılacağını kontrol eder.
|
||||
# Velocity kullanılıyorsa, Velocity yapılandırmanızda 'bungee-plugin-message-channel' etkinleştirilmiş olmalıdır.
|
||||
proxy:
|
||||
# Proxy'nize bağlı diğer sunuculara uyarılar gönderilmeli mi?
|
||||
send: false
|
||||
# Diğer sunuculardan alınan uyarılar bu sunucuya duyurulmalı mı?
|
||||
receive: false
|
||||
|
||||
verbose:
|
||||
print-to-console: false
|
||||
|
||||
client-brand:
|
||||
# Bu, giriş yapılan clientin aşağıdaki regex'lerle eşleşmesi durumunda markalarını operatörlere yayınlamayacağı anlamına gelir
|
||||
ignored-clients:
|
||||
- "^vanilla$"
|
||||
- "^fabric$"
|
||||
- "^lunarclient:v\\d+\\.\\d+\\.\\d+-\\d{4}$"
|
||||
- "^Feather Fabric$"
|
||||
|
||||
spectators:
|
||||
# Seyirciler aktif olarak izliyor olsalar bile, grim.spectator iznine sahip tüm seyircileri gizle
|
||||
hide-regardless: false
|
||||
# Sadece bu dünyalarda seyircileri gizleyecek, tüm dünyalara izin vermek için boş bırakın
|
||||
allowed-worlds:
|
||||
- ""
|
||||
|
||||
# Oyuncuların zaman aşımından dolayı sunucudan atılmadan önce ne kadar süreleri olmalı? Varsayılan = 60 saniye
|
||||
max-transaction-time: 60
|
||||
|
||||
# Kopya hareket paketinin iptal edilip edilmemesi gerektiği
|
||||
# Mojang bu sorunu 1.21'de çözdü. Bu, "kova senkronizasyonu" sorununu düzeltme girişimiydi. https://bugs.mojang.com/browse/MC-12363
|
||||
# Bu ayar yalnızca 1.17-1.20.5 istemcileri için 1.8 sunucularında geçerlidir.
|
||||
cancel-duplicate-packet: true
|
||||
|
||||
# Eşya çoğaltma paketlerindeki rotayı göz ardı edip etmeyeceğimiz
|
||||
ignore-duplicate-packet-rotation: false
|
||||
|
||||
Simulation:
|
||||
# Oyuncu meşru olduğunda toplam avantajı ne kadar çarpmalıyız?
|
||||
# Varsayılan yapılandırma bu şekilde görünür (x ekseni = saniye, y ekseni = 1/1000 blok): https://www.desmos.com/calculator/d4ufgxrxer
|
||||
setback-decay-multiplier: 0.999
|
||||
# Oyuncunun hareketinden ne kadar büyük bir sapma ihlal oluşturmalıyız?
|
||||
# Mümkün olan hareketten blok cinsinden ölçülür
|
||||
# Optifine için trig tablolarını değiştirerek hesaba katıyoruz, ancak bunu 0.001'e düşürmek FastMath'ı azaltır
|
||||
# Bu telafi işe yaramazsa anticheat'i işaretle...
|
||||
threshold: 0.001
|
||||
# Bir tik içinde ne kadar büyük bir ihlal olmalı ki oyuncu hemen geri dönsün?
|
||||
# Devre dışı bırakmak için -1 yazın
|
||||
immediate-setback-threshold: 0.1
|
||||
# Tüm tikler boyunca ne kadar büyük bir avantaja sahip olmalıyız ki geri dönüş yapmaya başlayalım?
|
||||
# Devre dışı bırakmak için -1 yazın
|
||||
max-advantage: 1
|
||||
# Varsayılan config ile 50 saniye sonra, oyuncu 4 bloktan -> 1 bloğa kadar avantaj kazanır
|
||||
# Bu, oyuncunun çok fazla ihlal biriktirmesini ve bunların hepsini temizleyememesini önlemek içindir
|
||||
# Varsayılan avantaj tavanı (x ekseni = saniye, y ekseni = 1/1000 blok): https://www.desmos.com/calculator/4lovswdarj
|
||||
max-ceiling: 4
|
||||
|
||||
# Bir oyuncunun bir hareket sırasında bir bloğa girip girmediğini kontrol eder
|
||||
Phase:
|
||||
setbackvl: 1 # Blokların içinde glitch yapmak duvara tırmanmaya izin verebilir, ayrıca bu kontrol nispeten stabildir
|
||||
decay: 0.005
|
||||
|
||||
AirLiquidPlace:
|
||||
cancelvl: 0
|
||||
|
||||
FabricatedPlace:
|
||||
cancelvl: 5
|
||||
|
||||
FarPlace:
|
||||
cancelvl: 5
|
||||
|
||||
PositionPlace:
|
||||
cancelvl: 5
|
||||
|
||||
RotationPlace:
|
||||
cancelvl: 5
|
||||
|
||||
# Tahmin tabanlı yavaşlama kontrolü
|
||||
# Grim burada hatalı ağ kodunu dikkate alır... sağ tıklama ve el yan tuşunu spam yapsanız bile yanlış pozitiflik oluşturması zordur
|
||||
# Diğer anti-hilelerden çok daha stabil, ancak herhangi bir yanlış pozitif rapor edin... burada birçok ağ kodu sorununu çözdüm.
|
||||
NoSlowA:
|
||||
# Ne kadar bir sapma "hile" olarak kabul edilir?
|
||||
# Varsayılan olarak bu, diğer sapmalardan daha düşüktür
|
||||
# NoSlow açıkken 0.03-0.2 aralığında sürekli olarak uyarı verir
|
||||
threshold: 0.001
|
||||
# NoSlow'un sağladığı avantajı ortadan kaldırmak için ilk itemi hızlı bir şekilde geri alın
|
||||
setbackvl: 5
|
||||
# Oyuncu bir eşya kullandığında VE onun tarafından yavaşlatıldığında beklenilen zaman
|
||||
decay: 0.05
|
||||
|
||||
Knockback:
|
||||
# Oyuncu legit olduğunda toplam avantajı ne kadarla çarpmalıyız
|
||||
setback-decay-multiplier: 0.999
|
||||
# Oyuncunun hızından ne kadar büyük bir sapma ihlal oluşturmalıyız?
|
||||
# Mümkün olan hızdan blok cinsinden ölçülür
|
||||
threshold: 0.001
|
||||
# Bir tik içinde ne kadar büyük bir ihlal olmalı ki oyuncu hemen geri dönsün?
|
||||
# Devre dışı bırakmak için -1 yazın
|
||||
immediate-setback-threshold: 0.1
|
||||
# Tüm tikler boyunca ne kadar büyük bir avantaja sahip olmalıyız ki geri dönüş yapmaya başlayalım?
|
||||
# Devre dışı bırakmak için -1 yazın
|
||||
max-advantage: 1
|
||||
# Bu, oyuncunun çok fazla ihlal toplamasını ve asla hepsini temizleyememesini engellemek içindir
|
||||
max-ceiling: 4
|
||||
|
||||
Explosion:
|
||||
threshold: 0.001
|
||||
setbackvl: 3
|
||||
|
||||
TimerA:
|
||||
setbackvl: 10
|
||||
# Oyuncunun geri kaldığında biriktirebileceği milisaniye miktarı
|
||||
# Çok yüksek ayarlandığında 1.8 hızlı kullanma/hızlı iyileşme/hızlı yay atlama durumlarına izin verebilir, 120 ms iyi bir denge gibi görünüyor
|
||||
drift: 120
|
||||
# Kontrolün zamanlayıcı dengesini sınırlamaya başlayacağı ping değeri, kötüye kullanımı önlemek için.
|
||||
# Bu, yalnızca bu ping eşiğini aşan meşru oyuncular için bazı geri dönüşlere neden olabilir.
|
||||
# Devre dışı bırakmak için -1 yazın
|
||||
ping-abuse-limit-threshold: 1000
|
||||
|
||||
NegativeTimer:
|
||||
# Uyarı vermeye başlamadan önce hareket halindeyken kaybedilen milisaniye sayısı
|
||||
drift: 1200
|
||||
|
||||
# TimerA ile aynı kontrol yöntemi, ancak araçlar için
|
||||
TimerVehicle:
|
||||
# Hedef 1.005 timer
|
||||
setbackvl: 10
|
||||
|
||||
EntityControl:
|
||||
setbackvl: 25
|
||||
|
||||
Reach:
|
||||
# Hitbox'ları ne kadar genişletmeliyiz? 0.0005, 3.0005+ menzili tespit etmelidir
|
||||
#
|
||||
# 1.9-1.18.1 (1.18.2 değil) ile zorunlu olarak 0.03 genişletme vardır veya bazı istemci/sunucu kombinasyonları nedeniyle
|
||||
# protokol değişiklikleri ve sınırlamaları nedeniyle. Bu kontrol, 1.7/1.8 istemcilerle 1.8 sunucularda en güçlüdür.
|
||||
threshold: 0.0005
|
||||
# İmkansız olduğunu bildiğimiz vuruşları iptal etmeli miyiz?
|
||||
# Paket sırası sınırlamaları nedeniyle 3.00-3.03 arası vuruşlar gerçekleşebilir, ancak yine de işaretlenebilir
|
||||
block-impossible-hits: true
|
||||
# Bu, hileleri yakalama olasılığını artırmak için her tikin sonunda ek bir paket gönderecektir
|
||||
# Bu, sunucunun bağlantı listesine enjekte edilerek sunucu boşaltmadan hemen önce son bir paket göndermek için yapılır
|
||||
# Bunu etkinleştirmek, tüm oyuncular için bant genişliği kullanımını artıracaktır
|
||||
# Bu, genel sunucu performansını düşürmez
|
||||
# Bunu etkinleştirmek, daha fazla hilecinin yakalanmasını sağlar
|
||||
# Bu özellik devre dışı bırakılsa bile hileciler yakalanır ve yanlış pozitifler oluşmaz
|
||||
# 1.8 PvP odaklı bir sunucu değilseniz, bu ek paket önerilmez
|
||||
enable-post-packet: false
|
||||
|
||||
exploit:
|
||||
# Elytra ile sprint zıplarken yüksek hızlar kazanabilirsiniz, bu ayar false olarak ayarlandığında bu istismarı önler
|
||||
# Mojang, elytra'nın istemci tarafında başlamasını ve sunucu tarafında bitmesini sağlayarak netcode'u bozdu
|
||||
# Elytra'lar 0.99 yatay sürtünme alır, bu yüzden sürekli olarak 0.2 yatay hız eklemek çok yüksek hızlara yol açar
|
||||
allow-sprint-jumping-when-using-elytra: true
|
||||
# Bu seçenek, oyuncunun hayalet bloklar üzerindeki yerleşimini, gerçekleştiğinde oyuncuyu yeniden senkronize ederek hafifletir
|
||||
allow-building-on-ghostblocks: true
|
||||
# Bu ayar, yukarıdaki boolean ile etkilenen hayalet blokları kontrol etmek için mesafeyi tanımlar
|
||||
# Geçerli aralığı 2 ile 4 arasında sınırlıdır
|
||||
distance-to-check-if-ghostblocks: 2
|
||||
|
||||
# Netty'ye enjekte olan eklentileri giriş sırasında günlüklemeyi etkinleştirerek uyumluluk sorunlarını gider
|
||||
debug-pipeline-on-join: false
|
||||
|
||||
# Deneysel kontrolleri etkinleştir
|
||||
experimental-checks: false
|
||||
|
||||
# Grim bazen timer gibi yasa dışı paketleri iptal eder; bir saniyede X paket iptal edildikten sonra, ne zaman
|
||||
# oyuncuyu basitçe atmalıyız? Bu, bazı paket sınırlayıcılarının Grim tarafından iptal edilen paketleri saymaması gerektiğindendir.
|
||||
packet-spam-threshold: 100
|
||||
|
||||
# Grim, uçma durumundan çıkmış bir oyuncunun X milisaniyeden fazla ping'e sahip olamayacağını uygulayabilir
|
||||
# Bu, Grim'in şu anda uçan oyuncuları kontrol etmemesindendir
|
||||
# Devre dışı bırakmak için -1 yazın
|
||||
max-ping-out-of-flying: 1000
|
||||
|
||||
# Bir havai fişek ivmesi oyuncudan çıkarıldığında maksimum ping.
|
||||
# Bu, yüksek gecikmeli oyuncuların bir havai fişek ivmesini elytra ile sonsuza kadar kullanmalarını engeller.
|
||||
max-ping-firework-boost: 1000
|
||||
|
||||
config-version: 9
|
||||
|
||||
# Translated by Kayera
|
||||
# Have a nice day :)
|
||||
@@ -2,7 +2,7 @@
|
||||
# 源代码链接: https://github.com/MWHunter/Grim
|
||||
# 版权归 DefineOutside 和 贡献者所有,基于GPLv3开源协议。
|
||||
# 修改过的二进制文件,或带有复制的Grim代码的插件,必须是私有仓库,不得公开售卖此插件。
|
||||
# 中文翻译提供 nuym ,如有错误请提交 Issues 并@我
|
||||
# 中文翻译提供 nuym/Dg32z_ ,如有错误请提交 Issues 并@我
|
||||
|
||||
alerts:
|
||||
# 是否在控制台显示作弊消息?
|
||||
@@ -27,21 +27,22 @@ client-brand:
|
||||
- "^Feather Fabric$"
|
||||
|
||||
spectators:
|
||||
# 把所有拥有 grim.spectartor 权限的人都隐藏起来,不管他是否观察玩家。
|
||||
# 将拥有 grim.spectator 权限的人进行隐藏,不管他是否在观察玩家
|
||||
hide-regardless: false
|
||||
# 观察者这些世界不会隐藏
|
||||
allowed-worlds:
|
||||
- ""
|
||||
|
||||
# 在我们让他们超时之前,玩家应该有多长时间? 此处的60 指60s
|
||||
# 在玩家无法接收 GrimAC的 transaction 数据包后,多少秒对玩家进行踢出
|
||||
# 踢出原因为: disconnect.timeout
|
||||
max-transaction-time: 60
|
||||
|
||||
# Should the duplicate movement packet be cancelled?
|
||||
# Mojang has fixed this issue in 1.21. This was their attempt to fix the "bucket desync". https://bugs.mojang.com/browse/MC-12363
|
||||
# This setting only applies to 1.17-1.20.5 clients on 1.8 servers.
|
||||
# 是否对重复的移动数据包进行撤销?
|
||||
# 这可以修复 "bucket desync". https://bugs.mojang.com/browse/MC-12363,不过Mojang已经在1.21修复了这个问题
|
||||
# 这仅仅适用于1.8服务器中使用1.17-1.20.5版本的玩家
|
||||
cancel-duplicate-packet: true
|
||||
|
||||
# Whether or not to ignore the rotation in duplicate packets
|
||||
# 是否忽视重复的数据包中的玩家转头
|
||||
ignore-duplicate-packet-rotation: false
|
||||
|
||||
Simulation:
|
||||
@@ -84,7 +85,7 @@ PositionPlace:
|
||||
RotationPlace:
|
||||
cancelvl: 5
|
||||
|
||||
# Prediction-based NoSlow 检查
|
||||
# 使用模拟移动进行的NoSlow(使用物品时不会减速)检查
|
||||
# 在这里解释错误的服务器代码......即使在发送垃圾数据包时右键单击和副手按钮也很分辨
|
||||
# 比其他反作弊更稳定,但请报告任何错误......我在这里修复了大量的代码问题。
|
||||
NoSlowA:
|
||||
@@ -121,13 +122,13 @@ TimerA:
|
||||
# 玩家卡顿时可以累积以供以后使用的毫秒数
|
||||
# 如果设置得太高,可能会允许 1.8 快速使用/快速治疗/快速弓箭绕过,120 毫秒似乎是一个很好的平衡
|
||||
drift: 120
|
||||
# Ping at which the check will start to limit timer balance, to prevent abuse.
|
||||
# Can cause some setbacks for legitimate players but only if they are over this ping threshold.
|
||||
# -1 to disable
|
||||
# 在检查玩家的延迟时对timer balance进行限制, 防止滥用
|
||||
# 在合法玩家的延迟超过这个延迟阈值时可能会造成误拉回
|
||||
# 填写-1则关闭
|
||||
ping-abuse-limit-threshold: 1000
|
||||
|
||||
NegativeTimer:
|
||||
# Number of milliseconds lost while moving before we should start flagging
|
||||
# 在开始检查玩家时,玩家的移动丢失了多少毫秒数
|
||||
drift: 1200
|
||||
|
||||
# 与 TimerA 相同的检查方法,但适用于坐骑
|
||||
@@ -157,8 +158,10 @@ Reach:
|
||||
enable-post-packet: false
|
||||
|
||||
exploit:
|
||||
#是否允许玩家在使用鞘翅时候进行的疾跑跳跃
|
||||
allow-sprint-jumping-when-using-elytra: true
|
||||
# 该选项可在发生鬼块时重新同步玩家,从而减轻玩家在鬼块上的位置。
|
||||
# 这可以在玩家遇到幽灵方块时进行同步,这可以减少玩家所碰到幽灵方块
|
||||
allow-building-on-ghostblocks: true
|
||||
distance-to-check-if-ghostblocks: 2
|
||||
|
||||
@@ -173,11 +176,12 @@ experimental-checks: false
|
||||
packet-spam-threshold: 100
|
||||
|
||||
# Grim 能够强制执行一个规则:被设置为非飞行状态的玩家的 ping 值不能超过 X 毫秒。这是因为 Grim 目前不检查处于飞行状态的玩家。
|
||||
# To disable, use -1
|
||||
# 填写-1则关闭
|
||||
max-ping-out-of-flying: 1000
|
||||
|
||||
# Maximum ping when a firework boost is removed from the player.
|
||||
# This prevents high latency players from being able to use 1 firework boost with an elytra forever.
|
||||
# 限制玩家在使用鞘翅飞行时使用烟花加速的延迟
|
||||
# 这可以解决高延迟的玩家可以使用鞘翅时一直使用 1 个烟花就可以加速
|
||||
# 填写-1则关闭
|
||||
max-ping-firework-boost: 1000
|
||||
|
||||
config-version: 9
|
||||
@@ -1,6 +1,7 @@
|
||||
# Ob Discord Webhook aktiviert werden soll
|
||||
enabled: false
|
||||
webhook: ""
|
||||
embed-title: "**Grim Alert**"
|
||||
embed-color: "#00FFFF"
|
||||
violation-content:
|
||||
- "**Spieler**: %player%"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
enabled: false
|
||||
webhook: ""
|
||||
embed-title: "**Grim Alert**"
|
||||
embed-color: "#00FFFF"
|
||||
violation-content:
|
||||
- "**Player**: %player%"
|
||||
|
||||
@@ -7,6 +7,8 @@ enabled: false
|
||||
# La URL del webhook.
|
||||
webhook: ""
|
||||
|
||||
embed-title: "**Grim Alert**"
|
||||
|
||||
# El color del embed que se mandara por este webhook.
|
||||
embed-color: "#00FFFF"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
enabled: false
|
||||
webhook: ""
|
||||
embed-title: "**Grim Alert**"
|
||||
embed-color: "#00FFFF"
|
||||
violation-content:
|
||||
- "**Joueur**: %player%"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
enabled: false
|
||||
webhook: ""
|
||||
embed-title: "**Grim Alert**"
|
||||
embed-color: "#00FFFF"
|
||||
violation-content:
|
||||
- "**Giocatore**: %player%"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
enabled: false
|
||||
webhook: ""
|
||||
embed-title: "**Grim Alert**"
|
||||
embed-color: "#00FFFF"
|
||||
violation-content:
|
||||
- "**Speler**: %player%"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
enabled: false
|
||||
webhook: ""
|
||||
embed-title: "**Grim Alert**"
|
||||
embed-color: "#00FFFF"
|
||||
violation-content:
|
||||
- "**Jogador**: %player%"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Включать ли веб-крючок discord
|
||||
enabled: false
|
||||
webhook: ""
|
||||
embed-title: "**Grim Alert**"
|
||||
embed-color: "#00FFFF"
|
||||
violation-content:
|
||||
- "**Игрок**: %player%"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
enabled: false
|
||||
webhook: ""
|
||||
embed-color: "#00FFFF"
|
||||
violation-content:
|
||||
- "**Oyuncu**: %player%"
|
||||
- "**Kontrol**: %check%"
|
||||
- "**İhlaller**: %violations%"
|
||||
- "**Client Versiyonu**: %version%"
|
||||
- "**Kullanılan Client**: %brand%"
|
||||
- "**Gecikme**: %ping%"
|
||||
- "**TPS**: %tps%"
|
||||
@@ -1,12 +1,13 @@
|
||||
# 是否启用discord webhook
|
||||
enabled: false
|
||||
webhook: ""
|
||||
embed-title: "**Grim Alert**"
|
||||
embed-color: "#00FFFF"
|
||||
violation-content:
|
||||
- "**Player**: %player%"
|
||||
- "**Check**: %check%"
|
||||
- "**Violations**: %violations%"
|
||||
- "**Client Version**: %version%"
|
||||
- "**Brand**: %brand%"
|
||||
- "**Ping**: %ping%"
|
||||
- "**TPS**: %tps%"
|
||||
- "**玩家名**: %player%"
|
||||
- "**检查**: %check%"
|
||||
- "**违规率**: %violations%"
|
||||
- "**游戏版本**: %version%"
|
||||
- "**客户端品牌**: %brand%"
|
||||
- "**延迟**: %ping%"
|
||||
- "**服务器卡顿程度**: %tps%"
|
||||
@@ -1,34 +1,31 @@
|
||||
# Você pode usar códigos hexadecimais também, no formato #FFFFFF ou #ffffff.
|
||||
|
||||
# \u00BB é » (>> duplo), ANSI e UTF-8 interpretam isso diferentemente... você pode acabar vendo '?' por conta disso.
|
||||
prefix: "&bGrim &8\u00BB"
|
||||
|
||||
alerts-enabled: "%prefix% &fAlertas do AntiCheat foram habilitados para você."
|
||||
alerts-disabled: "%prefix% &fAlertas do AntiCheat foram desabilitados para você."
|
||||
client-brand-format: "%prefix% &f%player% entrou usando: &c%brand%"
|
||||
console-specify-target: "%prefix% &cVocê deve especificar o nome do alvo como o terminal!"
|
||||
alerts-enabled: "%prefix% &fAlertas habilitados."
|
||||
alerts-disabled: "%prefix% &fAlertas desabilitados."
|
||||
client-brand-format: "%prefix% &f%player% entrou usando %brand%."
|
||||
console-specify-target: "%prefix% &cVocê deve especificar o nome do alvo!"
|
||||
player-not-found: "%prefix% &cJogador não encontrado!"
|
||||
player-not-this-server: "%prefix% &cO jogador não está nesse servidor!"
|
||||
player-not-this-server: "%prefix% &cO jogador não está no servidor!"
|
||||
spectate-return: "\n%prefix% &fClique aqui para retornar a localização anterior\n"
|
||||
cannot-spectate-return: "%prefix% &cVocê só pode fazer isso enquanto estiver espectando alguém."
|
||||
cannot-run-on-self: "%prefix% &cVocê não pode usar esse comando em você mesmo!"
|
||||
upload-log: "%prefix% &fLogs enviadas para: %url%"
|
||||
upload-log-start: "%prefix% &fEnviando a log... Por favor, aguarde..."
|
||||
upload-log-not-found: "%prefix% &cNão foi possível encontrar essa log."
|
||||
upload-log-upload-failure: "%prefix% &cAlgo deu errado ao enviar essa log, veja o terminal para mais informações."
|
||||
cannot-spectate-return: "%prefix% &cVocê só pode fazer isso após espectar um jogador."
|
||||
cannot-run-on-self: "%prefix% &cVocê não pode usar esse comando em sí mesmo!"
|
||||
upload-log: "%prefix% &fRegistro enviado para: %url%"
|
||||
upload-log-start: "%prefix% &fEnviando o registro. Aguarde."
|
||||
upload-log-not-found: "%prefix% &cNúmero do registro não encontrado."
|
||||
upload-log-upload-failure: "%prefix% &cAlgo deu errado ao enviar o registro, veja o terminal para mais informações."
|
||||
|
||||
# Placeholders válidos:
|
||||
# %prefix%
|
||||
# %player%
|
||||
# %check_name%
|
||||
# %description%
|
||||
# %experimental%
|
||||
# %vl% - violações
|
||||
# %verbose% - Informação extra da verificação, como os desvios, nem todas as verifiações terão essa informação.
|
||||
# %verbose% - Informação extra da verificação, como os desalinhamentos, nem todas as verifiações terão essa informação.
|
||||
alerts-format: "%prefix% &f%player% &bfalhou em &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
|
||||
alerts-format-proxy: "%prefix% &f[&cproxy&f] &f%player% &bfalhou em &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
|
||||
experimental-symbol: "*"
|
||||
|
||||
profile:
|
||||
- "&7======================"
|
||||
- "%prefix% &bPerfil de &f%player%"
|
||||
@@ -41,13 +38,13 @@ profile:
|
||||
- "&7======================"
|
||||
help:
|
||||
- "&7======================"
|
||||
- "/grim alerts &f- &7Alterna entre &aon&f/&coff &7as notificações."
|
||||
- "/grim alerts &f- &7Alterna noificações."
|
||||
- "/grim profile <player> &f- &7Mosta as informações do jogador."
|
||||
- "/grim help &f- &7Mostra essa mensagem de ajuda."
|
||||
- "/grim debug <player> &f- &7Modo de depuração do plugin."
|
||||
- "/grim perf &f- &7Informações de performance do plugin."
|
||||
- "/grim reload &f- &7Recarregar configurações do AntiCheat."
|
||||
- "/grim spectate <player> &f- &7Espectar um jogador."
|
||||
- "/grim verbose &f- &7Mostra todos os flags para você sem os buffers."
|
||||
- "/grim log [0-255] &f- &7Envie um log para visualização externa."
|
||||
- "/grim debug <player> &f- &7Depura a simulação."
|
||||
- "/grim perf &f- &7Depura a performance."
|
||||
- "/grim reload &f- &7Recarrega as configurações."
|
||||
- "/grim spectate <player> &f- &7Especta um jogador."
|
||||
- "/grim verbose &f- &7Esconde as informações extra."
|
||||
- "/grim log [0-255] &f- &7Envia o registro da simulação."
|
||||
- "&7======================"
|
||||
@@ -0,0 +1,56 @@
|
||||
# Hex kodlarını #FFFFFF veya #ffffff formatında kullanabilirsiniz :)
|
||||
|
||||
# \u00BB eşittir » (çift >>), ANSI ve UTF-8 bunu farklı yorumlar. bu nedenle ? bile görebilirsiniz
|
||||
prefix: "&bGrim &8\u00BB"
|
||||
|
||||
alerts-enabled: "%prefix% &fUyarılar aktif edildi."
|
||||
alerts-disabled: "%prefix% &fUyarılar deaktif edildi."
|
||||
client-brand-format: "%prefix% &f%player% adlı oyuncu %brand% kullanarak giriş yaptı."
|
||||
console-specify-target: "%prefix% &cKonsol olarak bir hedef belirtmelisiniz!"
|
||||
player-not-found: "%prefix% &cOyuncu bulunamadı veya aktif değil!"
|
||||
player-not-this-server: "%prefix% &cBu oyuncu sunucuda değil!"
|
||||
spectate-return: "\n%prefix% &fBir önceki konuma dönmek için buraya tıklayın.\n"
|
||||
cannot-spectate-return: "%prefix% &cBunu yalnızca bir oyuncuyu izledikten sonra yapabilirsiniz."
|
||||
cannot-run-on-self: "%prefix% &cBu komutu kendi üzerinizde kullanamazsınız!"
|
||||
upload-log: "%prefix% &fDebug şu adrese yüklendi: %url%"
|
||||
upload-log-start: "%prefix% &fLog yükleniyor... lütfen bekleyin."
|
||||
upload-log-not-found: "%prefix% &cLog bulunamadı."
|
||||
upload-log-upload-failure: "%prefix% &cLog yüklenirken bir problem oluştu, lütfen konsolu kontrol edin."
|
||||
|
||||
# Geçerli placeholderlar:
|
||||
# %prefix%
|
||||
# %player%
|
||||
# %check_name%
|
||||
# %description%
|
||||
# %experimental%
|
||||
# %vl% - ihlal uyarıları
|
||||
# %verbose% - detaylı olarak verilen tüm uyarılar, checkler tüm bilgileri vermez
|
||||
alerts-format: "%prefix% &b%player% &fadlı oyuncuda &f(x&c%vl%&f) &fadet &b%check_name%%experimental% &ftespit edildi: &7%verbose%"
|
||||
alerts-format-proxy: "%prefix% &f[&cproxy&f] &b%player% &fadlı oyuncuda &f(x&c%vl%&f) &fadet &b%check_name%%experimental% &ftespit edildi: &7%verbose%"
|
||||
experimental-symbol: "*"
|
||||
|
||||
profile:
|
||||
- "&7======================"
|
||||
- "%prefix% &f%player% &badlı oyuncunun profili:"
|
||||
- "&bGecikme: &f%ping%"
|
||||
- "&bVersiyon: &f%version%"
|
||||
- "&bKullanılan Client: &f%brand%"
|
||||
- "&bDikey Hassasiyet: &f%h_sensitivity%%"
|
||||
- "&bYatay Hassasiyet: &f%v_sensitivity%%"
|
||||
- "&bFastMath Ayarı: &f%fast_math%"
|
||||
- "&7======================"
|
||||
help:
|
||||
- "&7======================"
|
||||
- "/grim alerts &f- &7Uyarıları aktif/deaktif eder"
|
||||
- "/grim profile (oyuncu) &f- &7Oyuncu profilini gösterir"
|
||||
- "/grim help &f- &7Bu yardım mesajını gösterir"
|
||||
- "/grim debug <player> &f- &7Geliştirici Debug'ını verir"
|
||||
- "/grim perf &f- &7Geliştirici Performansını verir"
|
||||
- "/grim reload &f- &7Configi yeniden yükler"
|
||||
- "/grim spectate (oyuncu) &f- &7Bir oyuncuyu izlemenizi sağlar"
|
||||
- "/grim verbose &f- &7Arabelleğe almadan tüm uyarıları görmenizi sağlar"
|
||||
- "/grim log (0-255) &f- &7Uyarılar için bir debug logu çıktısı verir"
|
||||
- "&7======================"
|
||||
|
||||
# Translated by Kayera
|
||||
# Have a nice day ;)
|
||||
@@ -17,12 +17,12 @@ upload-log-start: "%prefix% &f上传中...请等待"
|
||||
upload-log-not-found: "%prefix% &c找不到该日志."
|
||||
upload-log-upload-failure: "%prefix% &c上载此日志时出错, 有关详细信息, 请参阅控制台"
|
||||
|
||||
# Valid placeholders:
|
||||
# 变量:
|
||||
# %prefix% - 前缀
|
||||
# %player% - 玩家
|
||||
# %check_name% - 检查名字
|
||||
# %description%
|
||||
# %experimental%
|
||||
# %description% - 检查的介绍
|
||||
# %experimental% - 检查是否是实验性
|
||||
# %vl% - VL值
|
||||
# %verbose% - 检查中的额外信息,例如偏移量,并非所有检查都会添加信息
|
||||
alerts-format: "%prefix% &f%player% &b触发了 &f%check_name%%experimental% &f(x&c%vl%&f) &7%verbose%"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# %check_name% - nome da verificação
|
||||
# %description% - description of the check
|
||||
# %description% - descrição da verificação
|
||||
# %vl% - violações
|
||||
# %verbose% - informação extra
|
||||
# %player% - nome do jogador
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
# %check_name% - Kontrolün ismi
|
||||
# %description% - Kontrolün açıklaması
|
||||
# %vl% - Yapılan ihlaller
|
||||
# %verbose% - Ekstra bilgilendirme
|
||||
# %player% - Oyuncu ismi
|
||||
# [alert] - Uyarılar için bunu kullanın
|
||||
# [webhook] - Discord webhook için bunu kullanın
|
||||
# [proxy] - Proxy'nize bağlı diğer sunuculara uyarı göndermek için bunu kullanın (BungeeCord/Velocity)
|
||||
Punishments:
|
||||
Simulation:
|
||||
# Kaç saniye sonra ihlaller kaldırılsın?
|
||||
remove-violations-after: 300
|
||||
# Bu bölüm, aşağıdaki adlara sahip tüm kontrollerle eşleşecektir,
|
||||
# Aksi takdirde eşleşecek bir denetimi hariç tutmak için, isminin önüne ünlem işareti koyun
|
||||
# Örnek olarak, !BadPacketsN
|
||||
checks:
|
||||
- "Simulation"
|
||||
- "GroundSpoof"
|
||||
- "Timer"
|
||||
- "NoFall"
|
||||
# Eşik:Aralık Komutu
|
||||
#
|
||||
# Örnek: 100 ihlalde "yanlış hareket!" mesajıyla oyuncuyu atmak için, aralık komutu olmadan:
|
||||
# - "100:0 kick %player% Yanlış hareket!"
|
||||
# 0, tam olarak bir kez çalıştırılmasını ifade eder
|
||||
# - "100:50 say %player% Hile yapıyor!"
|
||||
# Kullanıcı 100 işaretine ulaştığında çalışır ve bundan sonra, 100'ün üzerindeki her 50. işarette çalışır
|
||||
commands:
|
||||
- "100:40 [alert]"
|
||||
- "100:100 [webhook]"
|
||||
- "100:100 [proxy]"
|
||||
Knockback:
|
||||
remove-violations-after: 300
|
||||
checks:
|
||||
- "Knockback"
|
||||
- "Explosion"
|
||||
commands:
|
||||
- "5:5 [alert]"
|
||||
- "20:20 [webhook]"
|
||||
- "20:20 [proxy]"
|
||||
Post:
|
||||
remove-violations-after: 300
|
||||
checks:
|
||||
- "Post"
|
||||
commands:
|
||||
- "20:20 [alert]"
|
||||
- "40:40 [webhook]"
|
||||
- "40:40 [proxy]"
|
||||
BadPackets:
|
||||
remove-violations-after: 300
|
||||
checks:
|
||||
- "BadPackets"
|
||||
- "Crash"
|
||||
commands:
|
||||
- "20:20 [alert]"
|
||||
- "40:40 [webhook]"
|
||||
- "40:40 [proxy]"
|
||||
Reach:
|
||||
remove-violations-after: 300
|
||||
checks:
|
||||
- "Reach"
|
||||
commands:
|
||||
- "5:5 [alert]"
|
||||
- "5:5 [webhook]"
|
||||
- "5:5 [proxy]"
|
||||
Misc:
|
||||
remove-violations-after: 300
|
||||
checks:
|
||||
- "EntityControl"
|
||||
- "NoSlow"
|
||||
- "Place"
|
||||
- "Baritone"
|
||||
- "FastBreak"
|
||||
- "TransactionOrder"
|
||||
commands:
|
||||
- "10:5 [alert]"
|
||||
- "20:10 [webhook]"
|
||||
- "20:10 [proxy]"
|
||||
Combat:
|
||||
remove-violations-after: 300
|
||||
checks:
|
||||
- "Killaura"
|
||||
- "Aim"
|
||||
commands:
|
||||
- "20:40 [alert]"
|
||||
# 2.2.10 itibarıyla, AutoClicker denetimleri yoktur ve bu bir yer tutucudur. Grim, gelecekte AutoClicker denetimlerini dahil edecektir.
|
||||
Autoclicker:
|
||||
remove-violations-after: 300
|
||||
checks:
|
||||
- "Autoclicker"
|
||||
commands:
|
||||
- "20:40 [alert]"
|
||||
@@ -1,31 +1,31 @@
|
||||
# %check_name% - 检查名称
|
||||
# %description% - description of the check
|
||||
# %description% - 检查的介绍
|
||||
# %vl% - 违规
|
||||
# %verbose% - 额外信息
|
||||
# %player% - 玩家名字
|
||||
# [alert] - 警告的特殊命令
|
||||
# [webhook] - 警告discord webhook 的特殊命令
|
||||
# [proxy] - special command to alert to other servers connected to your proxy (BungeeCord/Velocity)
|
||||
# [proxy] - 用于使用(BungeeCord/Velocity)服务器时的警报
|
||||
Punishments:
|
||||
Simulation:
|
||||
# 多少秒后重置VL
|
||||
remove-violations-after: 300
|
||||
# This section will match all checks with the name,
|
||||
# To exclude a check that would otherwise be matched, put an exclamation mark in front of the name
|
||||
# For example, !BadPacketsN
|
||||
# 这个部分将会匹配检查的名字
|
||||
# 要关闭掉一个检查就在检查前面加感叹号
|
||||
# 例如, !BadPacketsN
|
||||
checks:
|
||||
- "Simulation"
|
||||
- "GroundSpoof"
|
||||
- "Timer"
|
||||
- "NoFall"
|
||||
# Threshold:Interval Command
|
||||
# 最大vl:下一次执行需要的vl
|
||||
#
|
||||
# 这是个例子, 当到达100VL时为了以 "incorrect movement!" 为理由踢出玩家
|
||||
# commands:
|
||||
# - "100:0 kick %player% incorrect movement!"
|
||||
# 0 means execute exactly once
|
||||
# 后面的数如果使用0就代表只执行一次
|
||||
# - "100:50 say %player% is cheating"
|
||||
# Execute when the user hits flag 100, and after that, every 50th flag after 100
|
||||
# 在100vl后执行say %player% is cheating,之后的每50vl都执行一次say %player% is cheating
|
||||
#
|
||||
commands:
|
||||
- "100:40 [alert]"
|
||||
|
||||
Reference in new issue
Block a user