mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-19 15:09:15 +00:00
修复错误
This commit is contained in:
@@ -46,7 +46,7 @@ public class BukkitEntity extends AbstractEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int entityID() {
|
||||
public int entityId() {
|
||||
return platformEntity().getEntityId();
|
||||
}
|
||||
|
||||
|
||||
@@ -588,7 +588,7 @@ public class BukkitServerPlayer extends Player {
|
||||
}
|
||||
if (Config.predictBreaking() && this.eyeLocation != null && !this.isDestroyingCustomBlock && !unsureEyeLocation.equals(this.eyeLocation)) {
|
||||
// if it's not destroying blocks, we do predict
|
||||
if ((gameTicks() + entityID()) % Config.predictBreakingInterval() == 0) {
|
||||
if ((gameTicks() + entityId()) % Config.predictBreakingInterval() == 0) {
|
||||
this.predictNextBlockToMine();
|
||||
}
|
||||
}
|
||||
@@ -807,7 +807,7 @@ public class BukkitServerPlayer extends Player {
|
||||
if (VersionHelper.isOrAbove1_20_5()) {
|
||||
Object serverPlayer = serverPlayer();
|
||||
Object attributeInstance = CoreReflections.methodHandle$ServerPlayer$getAttributeMethod.invokeExact(serverPlayer, MAttributeHolders.BLOCK_BREAK_SPEED);
|
||||
Object newPacket = NetworkReflections.methodHandle$ClientboundUpdateAttributesPacket0Constructor.invokeExact(entityID(), (List<?>) Lists.newArrayList(attributeInstance));
|
||||
Object newPacket = NetworkReflections.methodHandle$ClientboundUpdateAttributesPacket0Constructor.invokeExact(entityId(), (List<?>) Lists.newArrayList(attributeInstance));
|
||||
sendPacket(newPacket, true);
|
||||
} else {
|
||||
resetEffect(MMobEffects.MINING_FATIGUE);
|
||||
@@ -819,11 +819,11 @@ public class BukkitServerPlayer extends Player {
|
||||
CoreReflections.constructor$AttributeModifier.newInstance(KeyUtils.toResourceLocation(Key.DEFAULT_NAMESPACE, "custom_hardness"), -9999d, CoreReflections.instance$AttributeModifier$Operation$ADD_VALUE) :
|
||||
CoreReflections.constructor$AttributeModifier.newInstance(UUID.randomUUID(), Key.DEFAULT_NAMESPACE + ":custom_hardness", -9999d, CoreReflections.instance$AttributeModifier$Operation$ADD_VALUE);
|
||||
Object attributeSnapshot = NetworkReflections.constructor$ClientboundUpdateAttributesPacket$AttributeSnapshot.newInstance(MAttributeHolders.BLOCK_BREAK_SPEED, 1d, Lists.newArrayList(attributeModifier));
|
||||
Object newPacket = NetworkReflections.constructor$ClientboundUpdateAttributesPacket1.newInstance(entityID(), Lists.newArrayList(attributeSnapshot));
|
||||
Object newPacket = NetworkReflections.constructor$ClientboundUpdateAttributesPacket1.newInstance(entityId(), Lists.newArrayList(attributeSnapshot));
|
||||
sendPacket(newPacket, true);
|
||||
} else {
|
||||
Object fatiguePacket = MobEffectUtils.createPacket(MMobEffects.MINING_FATIGUE, entityID(), (byte) 9, -1, false, false, false);
|
||||
Object hastePacket = MobEffectUtils.createPacket(MMobEffects.HASTE, entityID(), (byte) 0, -1, false, false, false);
|
||||
Object fatiguePacket = MobEffectUtils.createPacket(MMobEffects.MINING_FATIGUE, entityId(), (byte) 9, -1, false, false, false);
|
||||
Object hastePacket = MobEffectUtils.createPacket(MMobEffects.HASTE, entityId(), (byte) 0, -1, false, false, false);
|
||||
sendPackets(List.of(fatiguePacket, hastePacket), true);
|
||||
}
|
||||
}
|
||||
@@ -863,9 +863,9 @@ public class BukkitServerPlayer extends Player {
|
||||
Object effectInstance = CoreReflections.method$ServerPlayer$getEffect.invoke(serverPlayer(), mobEffect);
|
||||
Object packet;
|
||||
if (effectInstance != null) {
|
||||
packet = NetworkReflections.constructor$ClientboundUpdateMobEffectPacket.newInstance(entityID(), effectInstance);
|
||||
packet = NetworkReflections.constructor$ClientboundUpdateMobEffectPacket.newInstance(entityId(), effectInstance);
|
||||
} else {
|
||||
packet = NetworkReflections.constructor$ClientboundRemoveMobEffectPacket.newInstance(entityID(), mobEffect);
|
||||
packet = NetworkReflections.constructor$ClientboundRemoveMobEffectPacket.newInstance(entityId(), mobEffect);
|
||||
}
|
||||
sendPacket(packet, true);
|
||||
}
|
||||
@@ -975,7 +975,7 @@ public class BukkitServerPlayer extends Player {
|
||||
}
|
||||
|
||||
private void broadcastDestroyProgress(org.bukkit.entity.Player player, BlockPos hitPos, Object blockPos, int stage) {
|
||||
Object packet = FastNMS.INSTANCE.constructor$ClientboundBlockDestructionPacket(Integer.MAX_VALUE - entityID(), blockPos, stage);
|
||||
Object packet = FastNMS.INSTANCE.constructor$ClientboundBlockDestructionPacket(Integer.MAX_VALUE - entityId(), blockPos, stage);
|
||||
for (org.bukkit.entity.Player other : player.getWorld().getPlayers()) {
|
||||
Location otherLocation = other.getLocation();
|
||||
double d0 = (double) hitPos.x() - otherLocation.getX();
|
||||
@@ -1036,7 +1036,7 @@ public class BukkitServerPlayer extends Player {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int entityID() {
|
||||
public int entityId() {
|
||||
return platformPlayer().getEntityId();
|
||||
}
|
||||
|
||||
|
||||
@@ -71,20 +71,20 @@ public final class PlayerUtils {
|
||||
Object previousOffHandItem = player.getItemInHand(InteractionHand.OFF_HAND).getLiteralObject();
|
||||
if (isMainHandTotem) {
|
||||
packets.add(NetworkReflections.constructor$ClientboundSetEquipmentPacket.newInstance(
|
||||
player.entityID(), List.of(Pair.of(CoreReflections.instance$EquipmentSlot$MAINHAND, BukkitItemManager.instance().uniqueEmptyItem().item().getLiteralObject()))
|
||||
player.entityId(), List.of(Pair.of(CoreReflections.instance$EquipmentSlot$MAINHAND, BukkitItemManager.instance().uniqueEmptyItem().item().getLiteralObject()))
|
||||
));
|
||||
}
|
||||
packets.add(NetworkReflections.constructor$ClientboundSetEquipmentPacket.newInstance(
|
||||
player.entityID(), List.of(Pair.of(CoreReflections.instance$EquipmentSlot$OFFHAND, totemItem))
|
||||
player.entityId(), List.of(Pair.of(CoreReflections.instance$EquipmentSlot$OFFHAND, totemItem))
|
||||
));
|
||||
packets.add(NetworkReflections.constructor$ClientboundEntityEventPacket.newInstance(player.serverPlayer(), (byte) 35));
|
||||
if (isMainHandTotem) {
|
||||
packets.add(NetworkReflections.constructor$ClientboundSetEquipmentPacket.newInstance(
|
||||
player.entityID(), List.of(Pair.of(CoreReflections.instance$EquipmentSlot$MAINHAND, previousMainHandItem.getLiteralObject()))
|
||||
player.entityId(), List.of(Pair.of(CoreReflections.instance$EquipmentSlot$MAINHAND, previousMainHandItem.getLiteralObject()))
|
||||
));
|
||||
}
|
||||
packets.add(NetworkReflections.constructor$ClientboundSetEquipmentPacket.newInstance(
|
||||
player.entityID(), List.of(Pair.of(CoreReflections.instance$EquipmentSlot$OFFHAND, previousOffHandItem))
|
||||
player.entityId(), List.of(Pair.of(CoreReflections.instance$EquipmentSlot$OFFHAND, previousOffHandItem))
|
||||
));
|
||||
if (sound != null || silent) {
|
||||
packets.add(NetworkReflections.constructor$ClientboundStopSoundPacket.newInstance(
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface Entity {
|
||||
|
||||
float yRot();
|
||||
|
||||
int entityID();
|
||||
int entityId();
|
||||
|
||||
World world();
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ public abstract class Furniture implements Cullable {
|
||||
}
|
||||
|
||||
public int entityId() {
|
||||
return this.metaDataEntity.entityID();
|
||||
return this.metaDataEntity.entityId();
|
||||
}
|
||||
|
||||
public boolean hasExternalModel() {
|
||||
|
||||
@@ -215,6 +215,9 @@ public class Config {
|
||||
protected int client_optimization$entity_culling$rate_limiting$bucket_size;
|
||||
protected int client_optimization$entity_culling$rate_limiting$restore_per_tick;
|
||||
|
||||
protected boolean bedrock_edition_support$enable;
|
||||
protected String bedrock_edition_support$player_prefix;
|
||||
|
||||
public Config(CraftEngine plugin) {
|
||||
this.plugin = plugin;
|
||||
this.configVersion = PluginProperties.getValue("config");
|
||||
@@ -589,6 +592,10 @@ public class Config {
|
||||
client_optimization$entity_culling$rate_limiting$bucket_size = config.getInt("client-optimization.entity-culling.rate-limiting.bucket-size", 300);
|
||||
client_optimization$entity_culling$rate_limiting$restore_per_tick = config.getInt("client-optimization.entity-culling.rate-limiting.restore-per-tick", 5);
|
||||
|
||||
// bedrock support
|
||||
bedrock_edition_support$enable = config.getBoolean("bedrock-edition-support.enable", true);
|
||||
bedrock_edition_support$player_prefix = config.getString("bedrock-edition-support.player-prefix", "!");
|
||||
|
||||
firstTime = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ public interface ArgumentString {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof Complex that)) return false;
|
||||
if (!(o instanceof Complex2 that)) return false;
|
||||
return this.rawText.equals(that.rawText);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user