本文整理汇总了Java中net.minecraft.network.play.client.C03PacketPlayer类的典型用法代码示例。如果您正苦于以下问题:Java C03PacketPlayer类的具体用法?Java C03PacketPlayer怎么用?Java C03PacketPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
C03PacketPlayer类属于net.minecraft.network.play.client包,在下文中一共展示了C03PacketPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdate
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的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.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(this.rotationYaw, this.rotationPitch, this.onGround));
this.sendQueue.addToSendQueue(new C0CPacketInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak));
}
else
{
this.onUpdateWalkingPlayer();
}
}
}
示例2: attack
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
private void attack(final EntityLivingBase ent, final boolean crit) {
this.swingItem();
if (crit) {
this.crit();
}
else {
this.mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer());
}
final float sharpLevel = EnchantmentHelper.func_152377_a(this.mc.thePlayer.getHeldItem(), ent.getCreatureAttribute());
final boolean vanillaCrit = this.mc.thePlayer.fallDistance > 0.0f && !this.mc.thePlayer.onGround && !this.mc.thePlayer.isOnLadder() && !this.mc.thePlayer.isInWater() && !this.mc.thePlayer.isPotionActive(Potion.blindness) && this.mc.thePlayer.ridingEntity == null;
this.mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(ent, C02PacketUseEntity.Action.ATTACK));
if (crit || vanillaCrit) {
this.mc.thePlayer.onCriticalHit(ent);
}
if (sharpLevel > 0.0f) {
this.mc.thePlayer.onEnchantmentCritical(ent);
}
}
示例3: onUpdate
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
/**
* Called to update the entity's position/logic.
*/
public void onUpdate() {
EventUpdate update = new EventUpdate();
update.call();
if (this.worldObj.isBlockLoaded(new BlockPos(this.posX, 0.0D, this.posZ))) {
super.onUpdate();
if (this.isRiding()) {
this.sendQueue.addToSendQueue(
new C03PacketPlayer.C05PacketPlayerLook(this.rotationYaw, this.rotationPitch, this.onGround));
this.sendQueue.addToSendQueue(new C0CPacketInput(this.moveStrafing, this.moveForward,
this.movementInput.jump, this.movementInput.sneak));
} else {
this.onUpdateWalkingPlayer();
// TODO:CLIENT
EventPostMotionUpdates post = new EventPostMotionUpdates(this.rotationYaw, this.rotationPitch,
this.onGround, this.posY);
post.call();
}
}
}
示例4: flush
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
private void flush() {
// lastFlushPosition = null;
if (isFlushing)
return;
lastFlushPosition = new Vector3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ);
isFlushing = true;
for (Packet packet : outboundPackets) {
mc.getNetHandler().getNetworkManager().sendPacket(packet);
if (packet instanceof C03PacketPlayer) {
C03PacketPlayer player = (C03PacketPlayer) packet;
if (player.isMoving()) {
lastFlushPosition = new Vector3(player.getPositionX(), player.getPositionY(), player.getPositionZ());
}
}
}
outboundPackets.clear();
isFlushing = false;
}
示例5: onUpdate
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
@Override
public void onUpdate() {
if (Minecraft.getMinecraft().thePlayer.getHealth() > 0 && (Minecraft.getMinecraft().thePlayer.onGround ||
Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) &&
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem() != null &&
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem() instanceof ItemBow &&
Minecraft.getMinecraft().gameSettings.keyBindUseItem.pressed) {
Minecraft.getMinecraft().playerController
.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld,
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem());
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem()
.onItemRightClick(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer);
for (int i = 0; i < 20; i++) {
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(false));
}
Minecraft.getMinecraft().getNetHandler().addToSendQueue(
new C07PacketPlayerDigging(Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem()
.onPlayerStoppedUsing(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer, 10);
}
}
示例6: onEnable
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
@Override
public void onEnable() {
WurstClient.INSTANCE.mods.disableModsByClass(JetpackMod.class);
if (WurstClient.INSTANCE.mods.getModByClass(YesCheatMod.class).isActive() ||
WurstClient.INSTANCE.mods.getModByClass(AntiMacMod.class).isActive()) {
double startX = Minecraft.getMinecraft().thePlayer.posX;
startY = Minecraft.getMinecraft().thePlayer.posY;
double startZ = Minecraft.getMinecraft().thePlayer.posZ;
for (int i = 0; i < 4; i++) {
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(
new C03PacketPlayer.C04PacketPlayerPosition(startX, startY + 1.01, startZ, false));
Minecraft.getMinecraft().thePlayer.sendQueue
.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(startX, startY, startZ, false));
}
Minecraft.getMinecraft().thePlayer.jump();
}
WurstClient.INSTANCE.events.add(UpdateListener.class, this);
}
示例7: onOutwardPacket
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
@Override
public void onOutwardPacket(EventOnOutwardPacket event){
if(!invoker.isOnGround()) return;
Packet packet = event.getPacket();
if (packet instanceof C08PacketPlayerBlockPlacement) {
if(Item.getIdFromItem(invoker.getCurrentItem().getItem()) != 261) return;
C08PacketPlayerBlockPlacement packetBlockPlacement = (C08PacketPlayerBlockPlacement) packet;
if (packetBlockPlacement.func_149576_c() != -1 || packetBlockPlacement.func_149571_d() != -1 || packetBlockPlacement.func_149570_e() != -1 || packetBlockPlacement.func_149568_f() != 255) {
return;
}
event.addPacketToList(new C09PacketHeldItemChange(Minecraft.getMinecraft().thePlayer.inventory.currentItem));
for (int i = 0; i < 40; i++) {
event.addPacketToList(new C03PacketPlayer(false));
}
event.addPacketToList(new C07PacketPlayerDigging(5, 0, 0, 0, 255));
}
}
示例8: onOutwardPacket
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
@Override
public void onOutwardPacket(EventOnOutwardPacket event){
if(!invoker.isOnGround()) return;
Packet packet = event.getPacket();
if (packet instanceof C08PacketPlayerBlockPlacement) {
if(!(invoker.getCurrentItem().getItem() instanceof ItemFood)) return;
C08PacketPlayerBlockPlacement packetBlockPlacement = (C08PacketPlayerBlockPlacement) packet;
if (packetBlockPlacement.func_149576_c() != -1 || packetBlockPlacement.func_149571_d() != -1 || packetBlockPlacement.func_149570_e() != -1 || packetBlockPlacement.func_149568_f() != 255) {
return;
}
event.addPacketToList(new C09PacketHeldItemChange(Minecraft.getMinecraft().thePlayer.inventory.currentItem));
for (int i = 0; i < 40; i++) {
event.addPacketToList(new C03PacketPlayer(false));
}
event.addPacketToList(new C07PacketPlayerDigging(5, 0, 0, 0, 255));
}
}
示例9: onUpdate
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
if (this.worldObj.blockExists(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ)))
{
super.onUpdate();
if (this.isRiding())
{
this.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(this.rotationYaw, this.rotationPitch, this.onGround));
this.sendQueue.addToSendQueue(new C0CPacketInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak));
}
else
{
this.sendMotionUpdates();
}
}
}
示例10: handlePlayerPosLook
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
/**
* Handles changes in player positioning and rotation such as when travelling to a new dimension, (re)spawning,
* mounting horses etc. Seems to immediately reply to the server with the clients post-processing perspective on the
* player positioning
*/
public void handlePlayerPosLook(S08PacketPlayerPosLook p_147258_1_)
{
EntityClientPlayerMP var2 = this.gameController.thePlayer;
double var3 = p_147258_1_.func_148932_c();
double var5 = p_147258_1_.func_148928_d();
double var7 = p_147258_1_.func_148933_e();
float var9 = p_147258_1_.func_148931_f();
float var10 = p_147258_1_.func_148930_g();
var2.ySize = 0.0F;
var2.motionX = var2.motionY = var2.motionZ = 0.0D;
var2.setPositionAndRotation(var3, var5, var7, var9, var10);
this.netManager.scheduleOutboundPacket(new C03PacketPlayer.C06PacketPlayerPosLook(var2.posX, var2.boundingBox.minY, var2.posY, var2.posZ, p_147258_1_.func_148931_f(), p_147258_1_.func_148930_g(), p_147258_1_.func_148929_h()), new GenericFutureListener[0]);
if (!this.doneLoadingTerrain)
{
this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX;
this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY;
this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ;
this.doneLoadingTerrain = true;
this.gameController.displayGuiScreen((GuiScreen)null);
}
}
示例11: onUpdate
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
public void onUpdate()
{
if (this.worldObj.blockExists(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ)))
{
super.onUpdate();
if (this.isRiding())
{
this.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(this.rotationYaw, this.rotationPitch, this.onGround));
this.sendQueue.addToSendQueue(new C0CPacketInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak));
}
else
{
this.sendMotionUpdates();
}
}
}
示例12: handlePlayerPosLook
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
public void handlePlayerPosLook(S08PacketPlayerPosLook p_147258_1_)
{
EntityClientPlayerMP entityclientplayermp = this.gameController.thePlayer;
double d0 = p_147258_1_.func_148932_c();
double d1 = p_147258_1_.func_148928_d();
double d2 = p_147258_1_.func_148933_e();
float f = p_147258_1_.func_148931_f();
float f1 = p_147258_1_.func_148930_g();
entityclientplayermp.ySize = 0.0F;
entityclientplayermp.motionX = entityclientplayermp.motionY = entityclientplayermp.motionZ = 0.0D;
entityclientplayermp.setPositionAndRotation(d0, d1, d2, f, f1);
this.netManager.scheduleOutboundPacket(new C03PacketPlayer.C06PacketPlayerPosLook(entityclientplayermp.posX, entityclientplayermp.boundingBox.minY, entityclientplayermp.posY, entityclientplayermp.posZ, p_147258_1_.func_148931_f(), p_147258_1_.func_148930_g(), p_147258_1_.func_148929_h()), new GenericFutureListener[0]);
if (!this.doneLoadingTerrain)
{
this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX;
this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY;
this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ;
this.doneLoadingTerrain = true;
this.gameController.displayGuiScreen((GuiScreen)null);
}
}
示例13: onPostUpdate
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
@EventTarget
private void onPostUpdate(UpdateEvent event) {
if (event.state == Event.State.PRE && this.mc.thePlayer.getItemInUse().getItem() instanceof ItemBow && this.mc.thePlayer.getItemInUseDuration() == 16) {
int i = 0;
while (i < 5) {
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C03PacketPlayer(true));
++i;
}
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
this.mc.thePlayer.stopUsingItem();
}
}
示例14: crit
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
private void crit() {
final double posY = this.mc.thePlayer.posY + Speed.yOffset;
this.mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(this.mc.thePlayer.posX, posY + 0.0625, this.mc.thePlayer.posZ, true));
this.mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(this.mc.thePlayer.posX, posY, this.mc.thePlayer.posZ, false));
this.mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(this.mc.thePlayer.posX, posY + 1.1E-5, this.mc.thePlayer.posZ, false));
this.mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(this.mc.thePlayer.posX, posY, this.mc.thePlayer.posZ, false));
}
示例15: onUpdate
import net.minecraft.network.play.client.C03PacketPlayer; //导入依赖的package包/类
@EventTarget
private void onUpdate(UpdateEvent event) {
int foodSlot;
if (event.state == Event.State.PRE && (foodSlot = this.getFoodSlotInHotbar()) != -1 && (double)this.mc.thePlayer.getFoodStats().getFoodLevel() < this.hunger * 2.0 && this.mc.thePlayer.isCollidedVertically) {
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(foodSlot));
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(this.mc.thePlayer.inventory.mainInventory[foodSlot]));
int i = 0;
while (i < 32) {
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C03PacketPlayer(false));
++i;
}
this.mc.thePlayer.stopUsingItem();
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(this.mc.thePlayer.inventory.currentItem));
}
}