Spaces:
Build error
Build error
File size: 25,610 Bytes
d46f4a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
package net.minecraft.client.multiplayer;
import com.google.common.collect.Lists;
import com.mojang.logging.LogUtils;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nullable;
import net.minecraft.client.ClientRecipeBook;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen;
import net.minecraft.client.multiplayer.prediction.BlockStatePredictionHandler;
import net.minecraft.client.multiplayer.prediction.PredictiveAction;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ServerGamePacketListener;
import net.minecraft.network.protocol.game.ServerboundContainerButtonClickPacket;
import net.minecraft.network.protocol.game.ServerboundContainerClickPacket;
import net.minecraft.network.protocol.game.ServerboundContainerSlotStateChangedPacket;
import net.minecraft.network.protocol.game.ServerboundInteractPacket;
import net.minecraft.network.protocol.game.ServerboundPickItemFromBlockPacket;
import net.minecraft.network.protocol.game.ServerboundPickItemFromEntityPacket;
import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket;
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
import net.minecraft.network.protocol.game.ServerboundSetCarriedItemPacket;
import net.minecraft.network.protocol.game.ServerboundSetCreativeModeSlotPacket;
import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket;
import net.minecraft.network.protocol.game.ServerboundUseItemPacket;
import net.minecraft.sounds.SoundSource;
import net.minecraft.stats.StatsCounter;
import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.HasCustomInventoryScreen;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ClickType;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.item.crafting.display.RecipeDisplayId;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.GameMasterBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.commons.lang3.mutable.MutableObject;
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
public class MultiPlayerGameMode {
private static final Logger LOGGER = LogUtils.getLogger();
private final Minecraft minecraft;
private final ClientPacketListener connection;
private BlockPos destroyBlockPos = new BlockPos(-1, -1, -1);
private ItemStack destroyingItem = ItemStack.EMPTY;
private float destroyProgress;
private float destroyTicks;
private int destroyDelay;
private boolean isDestroying;
private GameType localPlayerMode = GameType.DEFAULT_MODE;
@Nullable
private GameType previousLocalPlayerMode;
private int carriedIndex;
public MultiPlayerGameMode(Minecraft p_105203_, ClientPacketListener p_105204_) {
this.minecraft = p_105203_;
this.connection = p_105204_;
}
public void adjustPlayer(Player p_105222_) {
this.localPlayerMode.updatePlayerAbilities(p_105222_.getAbilities());
}
public void setLocalMode(GameType p_171806_, @Nullable GameType p_171807_) {
this.localPlayerMode = p_171806_;
this.previousLocalPlayerMode = p_171807_;
this.localPlayerMode.updatePlayerAbilities(this.minecraft.player.getAbilities());
}
public void setLocalMode(GameType p_105280_) {
if (p_105280_ != this.localPlayerMode) {
this.previousLocalPlayerMode = this.localPlayerMode;
}
this.localPlayerMode = p_105280_;
this.localPlayerMode.updatePlayerAbilities(this.minecraft.player.getAbilities());
}
public boolean canHurtPlayer() {
return this.localPlayerMode.isSurvival();
}
public boolean destroyBlock(BlockPos p_105268_) {
if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) {
return false;
} else {
Level level = this.minecraft.level;
BlockState blockstate = level.getBlockState(p_105268_);
if (!this.minecraft.player.getMainHandItem().getItem().canAttackBlock(blockstate, level, p_105268_, this.minecraft.player)) {
return false;
} else {
Block block = blockstate.getBlock();
if (block instanceof GameMasterBlock && !this.minecraft.player.canUseGameMasterBlocks()) {
return false;
} else if (blockstate.isAir()) {
return false;
} else {
block.playerWillDestroy(level, p_105268_, blockstate, this.minecraft.player);
FluidState fluidstate = level.getFluidState(p_105268_);
boolean flag = level.setBlock(p_105268_, fluidstate.createLegacyBlock(), 11);
if (flag) {
block.destroy(level, p_105268_, blockstate);
}
return flag;
}
}
}
}
public boolean startDestroyBlock(BlockPos p_105270_, Direction p_105271_) {
if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105270_, this.localPlayerMode)) {
return false;
} else if (!this.minecraft.level.getWorldBorder().isWithinBounds(p_105270_)) {
return false;
} else {
if (this.localPlayerMode.isCreative()) {
BlockState blockstate = this.minecraft.level.getBlockState(p_105270_);
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate, 1.0F);
this.startPrediction(this.minecraft.level, p_233757_ -> {
this.destroyBlock(p_105270_);
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_);
});
this.destroyDelay = 5;
} else if (!this.isDestroying || !this.sameDestroyTarget(p_105270_)) {
if (this.isDestroying) {
this.connection
.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_));
}
BlockState blockstate1 = this.minecraft.level.getBlockState(p_105270_);
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate1, 0.0F);
this.startPrediction(this.minecraft.level, p_233728_ -> {
boolean flag = !blockstate1.isAir();
if (flag && this.destroyProgress == 0.0F) {
blockstate1.attack(this.minecraft.level, p_105270_, this.minecraft.player);
}
if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) {
this.destroyBlock(p_105270_);
} else {
this.isDestroying = true;
this.destroyBlockPos = p_105270_;
this.destroyingItem = this.minecraft.player.getMainHandItem();
this.destroyProgress = 0.0F;
this.destroyTicks = 0.0F;
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
}
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
});
}
return true;
}
}
public void stopDestroyBlock() {
if (this.isDestroying) {
BlockState blockstate = this.minecraft.level.getBlockState(this.destroyBlockPos);
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, this.destroyBlockPos, blockstate, -1.0F);
this.connection
.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, Direction.DOWN));
this.isDestroying = false;
this.destroyProgress = 0.0F;
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, -1);
this.minecraft.player.resetAttackStrengthTicker();
}
}
public boolean continueDestroyBlock(BlockPos p_105284_, Direction p_105285_) {
this.ensureHasSentCarriedItem();
if (this.destroyDelay > 0) {
this.destroyDelay--;
return true;
} else if (this.localPlayerMode.isCreative() && this.minecraft.level.getWorldBorder().isWithinBounds(p_105284_)) {
this.destroyDelay = 5;
BlockState blockstate1 = this.minecraft.level.getBlockState(p_105284_);
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate1, 1.0F);
this.startPrediction(this.minecraft.level, p_233753_ -> {
this.destroyBlock(p_105284_);
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_);
});
return true;
} else if (this.sameDestroyTarget(p_105284_)) {
BlockState blockstate = this.minecraft.level.getBlockState(p_105284_);
if (blockstate.isAir()) {
this.isDestroying = false;
return false;
} else {
this.destroyProgress = this.destroyProgress + blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_);
if (this.destroyTicks % 4.0F == 0.0F) {
SoundType soundtype = blockstate.getSoundType();
this.minecraft
.getSoundManager()
.play(
new SimpleSoundInstance(
soundtype.getHitSound(),
SoundSource.BLOCKS,
(soundtype.getVolume() + 1.0F) / 8.0F,
soundtype.getPitch() * 0.5F,
SoundInstance.createUnseededRandom(),
p_105284_
)
);
}
this.destroyTicks++;
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F));
if (this.destroyProgress >= 1.0F) {
this.isDestroying = false;
this.startPrediction(this.minecraft.level, p_233739_ -> {
this.destroyBlock(p_105284_);
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, p_105284_, p_105285_, p_233739_);
});
this.destroyProgress = 0.0F;
this.destroyTicks = 0.0F;
this.destroyDelay = 5;
}
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
return true;
}
} else {
return this.startDestroyBlock(p_105284_, p_105285_);
}
}
private void startPrediction(ClientLevel p_233730_, PredictiveAction p_233731_) {
try (BlockStatePredictionHandler blockstatepredictionhandler = p_233730_.getBlockStatePredictionHandler().startPredicting()) {
int i = blockstatepredictionhandler.currentSequence();
Packet<ServerGamePacketListener> packet = p_233731_.predict(i);
this.connection.send(packet);
}
}
public void tick() {
this.ensureHasSentCarriedItem();
if (this.connection.getConnection().isConnected()) {
this.connection.getConnection().tick();
} else {
this.connection.getConnection().handleDisconnection();
}
}
private boolean sameDestroyTarget(BlockPos p_105282_) {
ItemStack itemstack = this.minecraft.player.getMainHandItem();
return p_105282_.equals(this.destroyBlockPos) && ItemStack.isSameItemSameComponents(itemstack, this.destroyingItem);
}
private void ensureHasSentCarriedItem() {
int i = this.minecraft.player.getInventory().selected;
if (i != this.carriedIndex) {
this.carriedIndex = i;
this.connection.send(new ServerboundSetCarriedItemPacket(this.carriedIndex));
}
}
public InteractionResult useItemOn(LocalPlayer p_233733_, InteractionHand p_233734_, BlockHitResult p_233735_) {
this.ensureHasSentCarriedItem();
if (!this.minecraft.level.getWorldBorder().isWithinBounds(p_233735_.getBlockPos())) {
return InteractionResult.FAIL;
} else {
MutableObject<InteractionResult> mutableobject = new MutableObject<>();
this.startPrediction(this.minecraft.level, p_233745_ -> {
mutableobject.setValue(this.performUseItemOn(p_233733_, p_233734_, p_233735_));
return new ServerboundUseItemOnPacket(p_233734_, p_233735_, p_233745_);
});
return mutableobject.getValue();
}
}
private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
BlockPos blockpos = p_233749_.getBlockPos();
ItemStack itemstack = p_233747_.getItemInHand(p_233748_);
if (this.localPlayerMode == GameType.SPECTATOR) {
return InteractionResult.CONSUME;
} else {
boolean flag = !p_233747_.getMainHandItem().isEmpty() || !p_233747_.getOffhandItem().isEmpty();
boolean flag1 = p_233747_.isSecondaryUseActive() && flag;
if (!flag1) {
BlockState blockstate = this.minecraft.level.getBlockState(blockpos);
if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) {
return InteractionResult.FAIL;
}
InteractionResult interactionresult = blockstate.useItemOn(
p_233747_.getItemInHand(p_233748_), this.minecraft.level, p_233747_, p_233748_, p_233749_
);
if (interactionresult.consumesAction()) {
return interactionresult;
}
if (interactionresult instanceof InteractionResult.TryEmptyHandInteraction && p_233748_ == InteractionHand.MAIN_HAND) {
InteractionResult interactionresult1 = blockstate.useWithoutItem(this.minecraft.level, p_233747_, p_233749_);
if (interactionresult1.consumesAction()) {
return interactionresult1;
}
}
}
if (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack)) {
UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
InteractionResult interactionresult2;
if (this.localPlayerMode.isCreative()) {
int i = itemstack.getCount();
interactionresult2 = itemstack.useOn(useoncontext);
itemstack.setCount(i);
} else {
interactionresult2 = itemstack.useOn(useoncontext);
}
return interactionresult2;
} else {
return InteractionResult.PASS;
}
}
}
public InteractionResult useItem(Player p_233722_, InteractionHand p_233723_) {
if (this.localPlayerMode == GameType.SPECTATOR) {
return InteractionResult.PASS;
} else {
this.ensureHasSentCarriedItem();
MutableObject<InteractionResult> mutableobject = new MutableObject<>();
this.startPrediction(
this.minecraft.level,
p_357795_ -> {
ServerboundUseItemPacket serverbounduseitempacket = new ServerboundUseItemPacket(
p_233723_, p_357795_, p_233722_.getYRot(), p_233722_.getXRot()
);
ItemStack itemstack = p_233722_.getItemInHand(p_233723_);
if (p_233722_.getCooldowns().isOnCooldown(itemstack)) {
mutableobject.setValue(InteractionResult.PASS);
return serverbounduseitempacket;
} else {
InteractionResult interactionresult = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
ItemStack itemstack1;
if (interactionresult instanceof InteractionResult.Success interactionresult$success) {
itemstack1 = Objects.requireNonNullElseGet(interactionresult$success.heldItemTransformedTo(), () -> p_233722_.getItemInHand(p_233723_));
} else {
itemstack1 = p_233722_.getItemInHand(p_233723_);
}
if (itemstack1 != itemstack) {
p_233722_.setItemInHand(p_233723_, itemstack1);
}
mutableobject.setValue(interactionresult);
return serverbounduseitempacket;
}
}
);
return mutableobject.getValue();
}
}
public LocalPlayer createPlayer(ClientLevel p_105247_, StatsCounter p_105248_, ClientRecipeBook p_105249_) {
return this.createPlayer(p_105247_, p_105248_, p_105249_, false, false);
}
public LocalPlayer createPlayer(ClientLevel p_105251_, StatsCounter p_105252_, ClientRecipeBook p_105253_, boolean p_105254_, boolean p_105255_) {
return new LocalPlayer(this.minecraft, p_105251_, this.connection, p_105252_, p_105253_, p_105254_, p_105255_);
}
public void attack(Player p_105224_, Entity p_105225_) {
this.ensureHasSentCarriedItem();
this.connection.send(ServerboundInteractPacket.createAttackPacket(p_105225_, p_105224_.isShiftKeyDown()));
if (this.localPlayerMode != GameType.SPECTATOR) {
p_105224_.attack(p_105225_);
p_105224_.resetAttackStrengthTicker();
}
}
public InteractionResult interact(Player p_105227_, Entity p_105228_, InteractionHand p_105229_) {
this.ensureHasSentCarriedItem();
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105228_, p_105227_.isShiftKeyDown(), p_105229_));
return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105227_.interactOn(p_105228_, p_105229_));
}
public InteractionResult interactAt(Player p_105231_, Entity p_105232_, EntityHitResult p_105233_, InteractionHand p_105234_) {
this.ensureHasSentCarriedItem();
Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ());
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3));
return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105232_.interactAt(p_105231_, vec3, p_105234_));
}
public void handleInventoryMouseClick(int p_171800_, int p_171801_, int p_171802_, ClickType p_171803_, Player p_171804_) {
AbstractContainerMenu abstractcontainermenu = p_171804_.containerMenu;
if (p_171800_ != abstractcontainermenu.containerId) {
LOGGER.warn("Ignoring click in mismatching container. Click in {}, player has {}.", p_171800_, abstractcontainermenu.containerId);
} else {
NonNullList<Slot> nonnulllist = abstractcontainermenu.slots;
int i = nonnulllist.size();
List<ItemStack> list = Lists.newArrayListWithCapacity(i);
for (Slot slot : nonnulllist) {
list.add(slot.getItem().copy());
}
abstractcontainermenu.clicked(p_171801_, p_171802_, p_171803_, p_171804_);
Int2ObjectMap<ItemStack> int2objectmap = new Int2ObjectOpenHashMap<>();
for (int j = 0; j < i; j++) {
ItemStack itemstack = list.get(j);
ItemStack itemstack1 = nonnulllist.get(j).getItem();
if (!ItemStack.matches(itemstack, itemstack1)) {
int2objectmap.put(j, itemstack1.copy());
}
}
this.connection
.send(
new ServerboundContainerClickPacket(
p_171800_,
abstractcontainermenu.getStateId(),
p_171801_,
p_171802_,
p_171803_,
abstractcontainermenu.getCarried().copy(),
int2objectmap
)
);
}
}
public void handlePlaceRecipe(int p_105218_, RecipeDisplayId p_365843_, boolean p_105220_) {
this.connection.send(new ServerboundPlaceRecipePacket(p_105218_, p_365843_, p_105220_));
}
public void handleInventoryButtonClick(int p_105209_, int p_105210_) {
this.connection.send(new ServerboundContainerButtonClickPacket(p_105209_, p_105210_));
}
public void handleCreativeModeItemAdd(ItemStack p_105242_, int p_105243_) {
if (this.localPlayerMode.isCreative() && this.connection.isFeatureEnabled(p_105242_.getItem().requiredFeatures())) {
this.connection.send(new ServerboundSetCreativeModeSlotPacket(p_105243_, p_105242_));
}
}
public void handleCreativeModeItemDrop(ItemStack p_105240_) {
boolean flag = this.minecraft.screen instanceof AbstractContainerScreen && !(this.minecraft.screen instanceof CreativeModeInventoryScreen);
if (this.localPlayerMode.isCreative() && !flag && !p_105240_.isEmpty() && this.connection.isFeatureEnabled(p_105240_.getItem().requiredFeatures())) {
this.connection.send(new ServerboundSetCreativeModeSlotPacket(-1, p_105240_));
this.minecraft.player.getDropSpamThrottler().increment();
}
}
public void releaseUsingItem(Player p_105278_) {
this.ensureHasSentCarriedItem();
this.connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.RELEASE_USE_ITEM, BlockPos.ZERO, Direction.DOWN));
p_105278_.releaseUsingItem();
}
public boolean hasExperience() {
return this.localPlayerMode.isSurvival();
}
public boolean hasMissTime() {
return !this.localPlayerMode.isCreative();
}
public boolean hasInfiniteItems() {
return this.localPlayerMode.isCreative();
}
public boolean isServerControlledInventory() {
return this.minecraft.player.isPassenger() && this.minecraft.player.getVehicle() instanceof HasCustomInventoryScreen;
}
public boolean isAlwaysFlying() {
return this.localPlayerMode == GameType.SPECTATOR;
}
@Nullable
public GameType getPreviousPlayerMode() {
return this.previousLocalPlayerMode;
}
public GameType getPlayerMode() {
return this.localPlayerMode;
}
public boolean isDestroying() {
return this.isDestroying;
}
public int getDestroyStage() {
return this.destroyProgress > 0.0F ? (int)(this.destroyProgress * 10.0F) : -1;
}
public void handlePickItemFromBlock(BlockPos p_376249_, boolean p_375534_) {
this.connection.send(new ServerboundPickItemFromBlockPacket(p_376249_, p_375534_));
}
public void handlePickItemFromEntity(Entity p_378506_, boolean p_375481_) {
this.connection.send(new ServerboundPickItemFromEntityPacket(p_378506_.getId(), p_375481_));
}
public void handleSlotStateChanged(int p_312970_, int p_309738_, boolean p_310073_) {
this.connection.send(new ServerboundContainerSlotStateChangedPacket(p_312970_, p_309738_, p_310073_));
}
} |