本文整理汇总了Java中net.minecraft.network.play.client.CPacketVehicleMove类的典型用法代码示例。如果您正苦于以下问题:Java CPacketVehicleMove类的具体用法?Java CPacketVehicleMove怎么用?Java CPacketVehicleMove使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CPacketVehicleMove类属于net.minecraft.network.play.client包,在下文中一共展示了CPacketVehicleMove类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdate
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
if (this.worldObj.isBlockLoaded(new BlockPos(this.posX, 0.0D, this.posZ)))
{
super.onUpdate();
if (this.isRiding())
{
this.connection.sendPacket(new CPacketPlayer.Rotation(this.rotationYaw, this.rotationPitch, this.onGround));
this.connection.sendPacket(new CPacketInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak));
Entity entity = this.getLowestRidingEntity();
if (entity != this && entity.canPassengerSteer())
{
this.connection.sendPacket(new CPacketVehicleMove(entity));
}
}
else
{
this.onUpdateWalkingPlayer();
}
}
}
示例2: onUpdate
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
if (this.world.isBlockLoaded(new BlockPos(this.posX, 0.0D, this.posZ)))
{
//-ZMod-----------------------------------------------------------
ZHandle.handle("onClientUpdate",this);
//----------------------------------------------------------------
super.onUpdate();
if (this.isRiding())
{
this.connection.sendPacket(new CPacketPlayer.Rotation(this.rotationYaw, this.rotationPitch, this.onGround));
this.connection.sendPacket(new CPacketInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak));
Entity entity = this.getLowestRidingEntity();
if (entity != this && entity.canPassengerSteer())
{
this.connection.sendPacket(new CPacketVehicleMove(entity));
}
}
else
{
//-ZMod-------------------------------------------------------
ZHandle.handle("beforeSendMotion", this);
this.onUpdateWalkingPlayer();
ZHandle.handle("afterSendMotion", this);
//------------------------------------------------------------
}
}
}
示例3: handleMoveVehicle
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
public void handleMoveVehicle(SPacketMoveVehicle packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Entity entity = this.gameController.player.getLowestRidingEntity();
if (entity != this.gameController.player && entity.canPassengerSteer())
{
entity.setPositionAndRotation(packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getYaw(), packetIn.getPitch());
this.netManager.sendPacket(new CPacketVehicleMove(entity));
}
}
示例4: handleMoveVehicle
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
public void handleMoveVehicle(SPacketMoveVehicle packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Entity entity = this.gameController.thePlayer.getLowestRidingEntity();
if (entity != this.gameController.thePlayer && entity.canPassengerSteer())
{
entity.setPositionAndRotation(packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getYaw(), packetIn.getPitch());
this.netManager.sendPacket(new CPacketVehicleMove(entity));
}
}
示例5: isMoveVehiclePacketInvalid
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
private static boolean isMoveVehiclePacketInvalid(CPacketVehicleMove packetIn)
{
return !Doubles.isFinite(packetIn.getX()) || !Doubles.isFinite(packetIn.getY()) || !Doubles.isFinite(packetIn.getZ()) || !Floats.isFinite(packetIn.getPitch()) || !Floats.isFinite(packetIn.getYaw());
}
示例6: processVehicleMove
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
public void processVehicleMove(CPacketVehicleMove packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
if (isMoveVehiclePacketInvalid(packetIn))
{
this.kickPlayerFromServer("Invalid move vehicle packet received");
}
else
{
Entity entity = this.playerEntity.getLowestRidingEntity();
if (entity != this.playerEntity && entity.getControllingPassenger() == this.playerEntity && entity == this.lowestRiddenEnt)
{
WorldServer worldserver = this.playerEntity.getServerWorld();
double d0 = entity.posX;
double d1 = entity.posY;
double d2 = entity.posZ;
double d3 = packetIn.getX();
double d4 = packetIn.getY();
double d5 = packetIn.getZ();
float f = packetIn.getYaw();
float f1 = packetIn.getPitch();
double d6 = d3 - this.lowestRiddenX;
double d7 = d4 - this.lowestRiddenY;
double d8 = d5 - this.lowestRiddenZ;
double d9 = entity.motionX * entity.motionX + entity.motionY * entity.motionY + entity.motionZ * entity.motionZ;
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
if (d10 - d9 > 100.0D && (!this.serverController.isSinglePlayer() || !this.serverController.getServerOwner().equals(entity.getName())))
{
LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[] {entity.getName(), this.playerEntity.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)});
this.netManager.sendPacket(new SPacketMoveVehicle(entity));
return;
}
boolean flag = worldserver.getCollisionBoxes(entity, entity.getEntityBoundingBox().contract(0.0625D)).isEmpty();
d6 = d3 - this.lowestRiddenX1;
d7 = d4 - this.lowestRiddenY1 - 1.0E-6D;
d8 = d5 - this.lowestRiddenZ1;
entity.moveEntity(MoverType.PLAYER, d6, d7, d8);
double d11 = d7;
d6 = d3 - entity.posX;
d7 = d4 - entity.posY;
if (d7 > -0.5D || d7 < 0.5D)
{
d7 = 0.0D;
}
d8 = d5 - entity.posZ;
d10 = d6 * d6 + d7 * d7 + d8 * d8;
boolean flag1 = false;
if (d10 > 0.0625D)
{
flag1 = true;
LOGGER.warn("{} moved wrongly!", new Object[] {entity.getName()});
}
entity.setPositionAndRotation(d3, d4, d5, f, f1);
boolean flag2 = worldserver.getCollisionBoxes(entity, entity.getEntityBoundingBox().contract(0.0625D)).isEmpty();
if (flag && (flag1 || !flag2))
{
entity.setPositionAndRotation(d0, d1, d2, f, f1);
this.netManager.sendPacket(new SPacketMoveVehicle(entity));
return;
}
this.serverController.getPlayerList().serverUpdateMovingPlayer(this.playerEntity);
this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2);
this.vehicleFloating = d11 >= -0.03125D && !this.serverController.isFlightAllowed() && !worldserver.checkBlockCollision(entity.getEntityBoundingBox().expandXyz(0.0625D).addCoord(0.0D, -0.55D, 0.0D));
this.lowestRiddenX1 = entity.posX;
this.lowestRiddenY1 = entity.posY;
this.lowestRiddenZ1 = entity.posZ;
}
}
}
示例7: registerDefaults
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
@DelayedRegistration(RegistrationPhase.PRE_INIT)
@Override
public void registerDefaults() {
// Handshake
register("handshake", "Handshake", PacketSide.SERVERBOUND, PacketPhase.HANDSHAKE, C00Handshake.class);
// Entity
clientbound("destroy_entities", "Destroy Entities", SPacketDestroyEntities.class, PacketControlFactory::createDestroyEntities);
clientbound("entity_metadata", "Entity Metadata", SPacketEntityMetadata.class, PacketControlFactory::createEntityMetadata);
clientbound("entity_velocity", "Entity Velocity", SPacketEntityVelocity.class);
clientbound("spawn_experience_orb", "Spawn Experience Orb", SPacketSpawnExperienceOrb.class);
clientbound("spawn_global_entity", "Spawn Global Entity", SPacketSpawnGlobalEntity.class);
clientbound("spawn_mob", "Spawn Mob", SPacketSpawnMob.class);
clientbound("spawn_object", "Spawn Object", SPacketSpawnObject.class, PacketControlFactory::createSpawnObject);
clientbound("spawn_painting", "Spawn Painting", SPacketSpawnPainting.class);
// Inventory
clientbound("close_window", "Close Window", SPacketCloseWindow.class, PacketControlFactory::createCloseWindow);
clientbound("confirm_transaction", "Confirm Transaction", SPacketConfirmTransaction.class, PacketControlFactory::createConfirmTransaction);
clientbound("open_window", "Open Window", SPacketOpenWindow.class, PacketControlFactory::createOpenWindow);
clientbound("set_slot", "Set Slot", SPacketSetSlot.class, PacketControlFactory::createSetSlot);
clientbound("window_items", "Window Items", SPacketWindowItems.class, PacketControlFactory::createWindowItems);
// Player
clientbound("player_abilities", "Player Abilities", SPacketPlayerAbilities.class, PacketControlFactory::createPlayerAbilities);
clientbound("spawn_player", "Spawn Player", SPacketSpawnPlayer.class);
clientbound("use_bed", "Use Bed", SPacketUseBed.class, PacketControlFactory::createUseBed);
clientbound("vehicle_position", "Vehicle Position", SPacketMoveVehicle.class);
// World
clientbound("custom_sound", "Custom Sound", SPacketCustomSound.class, PacketControlFactory::createCustomSound);
clientbound("game_sound", "Game Sound", SPacketSoundEffect.class, PacketControlFactory::createGameSound);
clientbound("open_sign_editor", "Open Sign Editor", SPacketSignEditorOpen.class, PacketControlFactory::createOpenSignEditor);
clientbound("world_time", "World Time", SPacketTimeUpdate.class, PacketControlFactory::createWorldTime);
// Client
serverbound("click_window", "Click Window", CPacketClickWindow.class);
serverbound("move_vehicle", "Move Vehicle", CPacketVehicleMove.class);
serverbound("update_sign", "Update Sign", CPacketUpdateSign.class);
serverbound("window_close", "Window Close", CPacketCloseWindow.class);
}
示例8: processVehicleMove
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
public void processVehicleMove(CPacketVehicleMove packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
if (isMoveVehiclePacketInvalid(packetIn))
{
this.kickPlayerFromServer("Invalid move vehicle packet received");
}
else
{
Entity entity = this.playerEntity.getLowestRidingEntity();
if (entity != this.playerEntity && entity.getControllingPassenger() == this.playerEntity && entity == this.lowestRiddenEnt)
{
WorldServer worldserver = this.playerEntity.getServerWorld();
double d0 = entity.posX;
double d1 = entity.posY;
double d2 = entity.posZ;
double d3 = packetIn.getX();
double d4 = packetIn.getY();
double d5 = packetIn.getZ();
float f = packetIn.getYaw();
float f1 = packetIn.getPitch();
double d6 = d3 - this.lowestRiddenX;
double d7 = d4 - this.lowestRiddenY;
double d8 = d5 - this.lowestRiddenZ;
double d9 = entity.motionX * entity.motionX + entity.motionY * entity.motionY + entity.motionZ * entity.motionZ;
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
if (d10 - d9 > 100.0D && (!this.serverController.isSinglePlayer() || !this.serverController.getServerOwner().equals(entity.getName())))
{
LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[] {entity.getName(), this.playerEntity.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)});
this.netManager.sendPacket(new SPacketMoveVehicle(entity));
return;
}
boolean flag = worldserver.getCollisionBoxes(entity, entity.getEntityBoundingBox().contract(0.0625D)).isEmpty();
d6 = d3 - this.lowestRiddenX1;
d7 = d4 - this.lowestRiddenY1 - 1.0E-6D;
d8 = d5 - this.lowestRiddenZ1;
entity.moveEntity(d6, d7, d8);
double d11 = d7;
d6 = d3 - entity.posX;
d7 = d4 - entity.posY;
if (d7 > -0.5D || d7 < 0.5D)
{
d7 = 0.0D;
}
d8 = d5 - entity.posZ;
d10 = d6 * d6 + d7 * d7 + d8 * d8;
boolean flag1 = false;
if (d10 > 0.0625D)
{
flag1 = true;
LOGGER.warn("{} moved wrongly!", new Object[] {entity.getName()});
}
entity.setPositionAndRotation(d3, d4, d5, f, f1);
boolean flag2 = worldserver.getCollisionBoxes(entity, entity.getEntityBoundingBox().contract(0.0625D)).isEmpty();
if (flag && (flag1 || !flag2))
{
entity.setPositionAndRotation(d0, d1, d2, f, f1);
this.netManager.sendPacket(new SPacketMoveVehicle(entity));
return;
}
this.serverController.getPlayerList().serverUpdateMountedMovingPlayer(this.playerEntity);
this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2);
this.vehicleFloating = d11 >= -0.03125D && !this.serverController.isFlightAllowed() && !worldserver.checkBlockCollision(entity.getEntityBoundingBox().expandXyz(0.0625D).addCoord(0.0D, -0.55D, 0.0D));
this.lowestRiddenX1 = entity.posX;
this.lowestRiddenY1 = entity.posY;
this.lowestRiddenZ1 = entity.posZ;
}
}
}
示例9: processVehicleMove
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
@Override
public void processVehicleMove(CPacketVehicleMove packetIn)
{
}
示例10: processVehicleMove
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
@Override
public void processVehicleMove(@Nonnull CPacketVehicleMove packetIn) {
}
示例11: processVehicleMove
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
@Override
public void processVehicleMove(CPacketVehicleMove packetIn) {
}
示例12: processVehicleMove
import net.minecraft.network.play.client.CPacketVehicleMove; //导入依赖的package包/类
void processVehicleMove(CPacketVehicleMove packetIn);