本文整理汇总了Java中net.minecraft.network.play.client.CPacketEntityAction类的典型用法代码示例。如果您正苦于以下问题:Java CPacketEntityAction类的具体用法?Java CPacketEntityAction怎么用?Java CPacketEntityAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CPacketEntityAction类属于net.minecraft.network.play.client包,在下文中一共展示了CPacketEntityAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDisable
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Override
public void onDisable()
{
wurst.events.remove(UpdateListener.class, this);
wurst.events.remove(PostUpdateListener.class, this);
switch(mode.getSelected())
{
case 0:
WConnection.sendPacket(new CPacketEntityAction(
WMinecraft.getPlayer(), Action.STOP_SNEAKING));
break;
case 1:
mc.gameSettings.keyBindSneak.pressed =
GameSettings.isKeyDown(mc.gameSettings.keyBindSneak);
break;
}
}
示例2: onUpdate
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Override
public void onUpdate()
{
switch(mode.getSelected())
{
case 0:
WConnection.sendPacket(new CPacketEntityAction(
WMinecraft.getPlayer(), Action.START_SNEAKING));
WConnection.sendPacket(new CPacketEntityAction(
WMinecraft.getPlayer(), Action.STOP_SNEAKING));
break;
case 1:
mc.gameSettings.keyBindSneak.pressed = true;
break;
}
}
示例3: onUpdate
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Override
public void onUpdate() {
mode = Client.getValueManager().getValueByName("DerpLegit").getValueBoolean();
Random rand = new Random();
int yaw = rand.nextInt((1000 - 0) + 1) + 0;
int pitch = rand.nextInt((1000 - 0) + 1) + 0;
if(mode){
mc.thePlayer.rotationYaw = yaw;
mc.thePlayer.rotationPitch = pitch;
KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false);
KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), true);
}else{
mc.thePlayer.sendQueue.addToSendQueue(new C05PacketPlayerLook(yaw, pitch, mc.thePlayer.onGround));
mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, Action.STOP_SNEAKING));
mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, Action.START_SNEAKING));
}
}
示例4: processEntityAction
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Hook("net.minecraft.network.NetHandlerPlayServer#func_147357_a")
public static Hook.Result processEntityAction(NetHandlerPlayServer handler, CPacketEntityAction action) {
if (action.getAction() == Action.START_FALL_FLYING) {
PacketThreadUtil.checkThreadAndEnqueue(action, handler, handler.player.getServerWorld());
handler.player.markPlayerActive();
if (!handler.player.onGround && handler.player.motionY < 0.0D &&
!handler.player.isElytraFlying() && !handler.player.isInWater()) {
ItemStack item = getFormLiving0(handler.player);
if (item.getItem() == Items.ELYTRA && ItemElytra.isUsable(item))
handler.player.setElytraFlying();
} else
handler.player.clearElytraFlying();
return Hook.Result.NULL;
}
return Hook.Result.VOID;
}
示例5: onLocalPlayerUpdate
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@SubscribeEvent
public void onLocalPlayerUpdate(LocalPlayerUpdateEvent event) {
try {
double[] dir = moveLooking(0);
double xDir = dir[0];
double zDir = dir[1];
if ((MC.gameSettings.keyBindForward.isKeyDown() || MC.gameSettings.keyBindLeft.isKeyDown() || MC.gameSettings.keyBindRight.isKeyDown() || MC.gameSettings.keyBindBack.isKeyDown()) && !MC.gameSettings.keyBindJump.isKeyDown()) {
MC.player.motionX = xDir * 0.26;
MC.player.motionZ = zDir * 0.26;
}
double posX = MC.player.posX + MC.player.motionX;
double posY = MC.player.posY + (MC.gameSettings.keyBindJump.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000001) - (MC.gameSettings.keyBindSneak.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000002);
double posZ = MC.player.posZ + MC.player.motionX;
getNetworkManager().sendPacket(new CPacketPlayer.PositionRotation(MC.player.posX + MC.player.motionX, MC.player.posY + (MC.gameSettings.keyBindJump.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000001) - (MC.gameSettings.keyBindSneak.isKeyDown() ? (zoomies ? 0.0625 : 0.0624) : 0.00000002), MC.player.posZ + MC.player.motionZ, MC.player.rotationYaw, MC.player.rotationPitch, false));
getNetworkManager().sendPacket(new CPacketPlayer.PositionRotation(MC.player.posX + MC.player.motionX, 1337 + MC.player.posY, MC.player.posZ + MC.player.motionZ, MC.player.rotationYaw, MC.player.rotationPitch, true));
getNetworkManager().sendPacket(new CPacketEntityAction(MC.player, Action.START_FALL_FLYING));
MC.player.setPosition(posX, posY, posZ);
zoomies = !zoomies;
MC.player.motionX = 0;
MC.player.motionY = 0;
MC.player.motionZ = 0;
MC.player.noClip = true;
} catch (Exception e) {
Helper.printStackTrace(e);
}
}
示例6: onEnabled
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Override
protected void onEnabled() {
if(fly_on_enable.get()) MC.addScheduledTask(() -> {
if(getLocalPlayer() != null &&
!getLocalPlayer().isElytraFlying()) getNetworkManager().sendPacket(new CPacketEntityAction(getLocalPlayer(), Action.START_FALL_FLYING));
});
}
示例7: onDisabled
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Override
public void onDisabled() {
// Are we still here?
if (getLocalPlayer() != null) {
// Disable creativeflight.
getLocalPlayer().capabilities.isFlying = false;
// Ensure the player starts flying again.
getNetworkManager().sendPacket(new CPacketEntityAction(getLocalPlayer(), Action.START_FALL_FLYING));
}
}
示例8: afterUpdate
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Override
public void afterUpdate()
{
if(mode.getSelected() == 1)
return;
WConnection.sendPacket(new CPacketEntityAction(WMinecraft.getPlayer(),
Action.STOP_SNEAKING));
WConnection.sendPacket(new CPacketEntityAction(WMinecraft.getPlayer(),
Action.START_SNEAKING));
}
示例9: onUpdate
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Override
public void onUpdate() {
legit = Client.getValueManager().getValueByName("SneakLegit").getValueBoolean();
if(legit){
KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), true);
}else{
mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, CPacketEntityAction.Action.START_SNEAKING));
}
}
示例10: onUpdate
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Override
public void onUpdate() {
legit = Client.getValueManager().getValueByName("SprintLegit").getValueBoolean();
if(legit){
if (canSprint()) {
mc.thePlayer.setSprinting(true);
}else{
mc.thePlayer.setSprinting(false);
}
}else{
mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, CPacketEntityAction.Action.START_SPRINTING));
}
}
示例11: onDisable
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Override
public void onDisable() {
if(mc.inGameHasFocus){
mc.thePlayer.setSprinting(false);
mc.thePlayer.sendQueue.addToSendQueue(new CPacketEntityAction(mc.thePlayer, CPacketEntityAction.Action.START_SPRINTING));
}
}
示例12: onLivingUpdate_tail
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
@Hook(value = "net.minecraft.client.entity.EntityPlayerSP#func_70636_d", type = Type.TAIL)
public static void onLivingUpdate_tail(EntityPlayerSP player) {
ItemStack item = getFormLiving0(player);
KeyBinding jump = Minecraft.getMinecraft().gameSettings.keyBindJump;
boolean flag = Keyboard.isKeyDown(jump.getKeyCode());
if (item.getItem() == Items.ELYTRA) {
if (flag && jump.getKeyConflictContext().isActive() && !HookClient.flag &&
player.motionY < 0.0D && !player.isElytraFlying() && !player.capabilities.isFlying)
if (ItemElytra.isUsable(item))
player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_FALL_FLYING));
}
HookClient.flag = flag;
}
示例13: onUpdateWalkingPlayer
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
/**
* @reason In addition to firing pre and post events, we also want to override some position values (prefixed with p).
* @author Brady
*/
@Overwrite
private void onUpdateWalkingPlayer() {
EntityPlayerSP _this = (EntityPlayerSP) (Object) this;
MotionUpdateEvent pre = new MotionUpdateEvent(EventState.PRE);
ClientAPI.EVENT_BUS.post(pre);
boolean clientSprintState = this.isSprinting();
if (clientSprintState != this.serverSprintState) {
this.connection.sendPacket(new CPacketEntityAction(_this, clientSprintState ? CPacketEntityAction.Action.START_SPRINTING : CPacketEntityAction.Action.STOP_SPRINTING));
this.serverSprintState = clientSprintState;
}
boolean clientSneakState = this.isSneaking();
if (clientSneakState != this.serverSneakState) {
this.connection.sendPacket(new CPacketEntityAction(_this, clientSneakState ? CPacketEntityAction.Action.START_SNEAKING : CPacketEntityAction.Action.STOP_SNEAKING));
this.serverSneakState = clientSneakState;
}
if (this.isCurrentViewEntity()) {
// Override vanilla defaults of this.posX, this.posY, etc.
// This is why we need to overwrite the method body.
double pX = pre.getX();
double pY = pre.getY();
double pZ = pre.getZ();
float pYaw = pre.getYaw();
float pPitch = pre.getPitch();
boolean pGround = pre.isOnGround();
double d0 = pX - this.lastReportedPosX;
double d1 = pY - this.lastReportedPosY;
double d2 = pZ - this.lastReportedPosZ;
double d3 = pYaw - this.lastReportedYaw;
double d4 = pPitch - this.lastReportedPitch;
boolean position = d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || ++this.positionUpdateTicks >= 20;
boolean rotation = d3 != 0.0D || d4 != 0.0D;
if (this.isRiding()) {
this.connection.sendPacket(new CPacketPlayer.PositionRotation(this.motionX, -999.0D, this.motionZ, this.rotationYaw, this.rotationPitch, this.onGround));
position = false;
} else if (position && rotation) {
this.connection.sendPacket(new CPacketPlayer.PositionRotation(pX, pY, pZ, pYaw, pPitch, pGround));
} else if (position) {
this.connection.sendPacket(new CPacketPlayer.Position(pX, pY, pZ, pGround));
} else if (rotation) {
this.connection.sendPacket(new CPacketPlayer.Rotation(pYaw, pPitch, pGround));
} else if (this.prevOnGround != pGround) {
this.connection.sendPacket(new CPacketPlayer(pGround));
}
if (position) {
this.lastReportedPosX = pX;
this.lastReportedPosY = pY;
this.lastReportedPosZ = pZ;
this.positionUpdateTicks = 0;
}
if (rotation) {
this.lastReportedYaw = pYaw;
this.lastReportedPitch = pPitch;
}
this.prevOnGround = pGround;
this.autoJumpEnabled = this.mc.gameSettings.autoJump;
}
ClientAPI.EVENT_BUS.post(new MotionUpdateEvent(EventState.POST));
}
示例14: sendHorseJump
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
protected void sendHorseJump()
{
this.connection.sendPacket(new CPacketEntityAction(this, CPacketEntityAction.Action.START_RIDING_JUMP, MathHelper.floor(this.getHorseJumpPower() * 100.0F)));
}
示例15: sendHorseInventory
import net.minecraft.network.play.client.CPacketEntityAction; //导入依赖的package包/类
public void sendHorseInventory()
{
this.connection.sendPacket(new CPacketEntityAction(this, CPacketEntityAction.Action.OPEN_INVENTORY));
}