本文整理汇总了Java中net.minecraft.network.play.client.C07PacketPlayerDigging类的典型用法代码示例。如果您正苦于以下问题:Java C07PacketPlayerDigging类的具体用法?Java C07PacketPlayerDigging怎么用?Java C07PacketPlayerDigging使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
C07PacketPlayerDigging类属于net.minecraft.network.play.client包,在下文中一共展示了C07PacketPlayerDigging类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdate
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的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);
}
}
示例2: onBlockClicked
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的package包/类
@Override
public void onBlockClicked(EventBlockClick event){
if(!invoker.isInCreativeMode()) return;
for(int y = (int) Resilience.getInstance().getValues().nukerRadius.getValue(); y >= (int) -Resilience.getInstance().getValues().nukerRadius.getValue(); y--)
{
for(int z = (int) -Resilience.getInstance().getValues().nukerRadius.getValue(); z <= Resilience.getInstance().getValues().nukerRadius.getValue(); z++)
{
for(int x = (int) -Resilience.getInstance().getValues().nukerRadius.getValue(); x <= Resilience.getInstance().getValues().nukerRadius.getValue(); x++)
{
xPos = (int) Math.round(event.getX() + x);
yPos = (int) ((int) Math.round(event.getY() + y));
zPos = (int) Math.round(event.getZ() + z);
Block block = invoker.getBlock(xPos, yPos, zPos);
invoker.sendPacket(new C07PacketPlayerDigging(0, xPos, yPos, zPos, 1));
invoker.sendPacket(new C07PacketPlayerDigging(2, xPos, yPos, zPos, 1));
}
}
}
}
示例3: onOutwardPacket
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的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));
}
}
示例4: onOutwardPacket
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的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));
}
}
示例5: dropOneItem
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的package包/类
/**
* Called when player presses the drop item key
*/
public EntityItem dropOneItem(boolean dropAll)
{
C07PacketPlayerDigging.Action c07packetplayerdigging$action = dropAll ? C07PacketPlayerDigging.Action.DROP_ALL_ITEMS : C07PacketPlayerDigging.Action.DROP_ITEM;
this.sendQueue.addToSendQueue(new C07PacketPlayerDigging(c07packetplayerdigging$action, BlockPos.ORIGIN, EnumFacing.DOWN));
return null;
}
示例6: resetBlockRemoving
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的package包/类
/**
* Resets current block damage and isHittingBlock
*/
public void resetBlockRemoving()
{
if (this.isHittingBlock)
{
this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, EnumFacing.DOWN));
this.isHittingBlock = false;
this.curBlockDamageMP = 0.0F;
this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, -1);
}
}
示例7: onPostUpdate
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的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();
}
}
示例8: onPostUpdate
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的package包/类
@EventTarget
private void onPostUpdate(UpdateEvent event) {
if (event.state == Event.State.PRE && this.mc.thePlayer.getItemInUseDuration() == 16 && !(this.mc.thePlayer.getItemInUse().getItem() instanceof ItemBow)) {
int i = 0;
while (i < 17) {
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C03PacketPlayer(true));
++i;
}
this.mc.getNetHandler().getNetworkManager().dispatchPacket((Packet)new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN), null);
}
}
示例9: onUpdate
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的package包/类
@EventTarget(value=4)
private void onUpdate(UpdateEvent event) {
if (this.mc.thePlayer.isBlocking() && (this.mc.thePlayer.motionX != 0.0 || this.mc.thePlayer.motionZ != 0.0)) {
if (event.state == Event.State.PRE) {
this.mc.getNetHandler().getNetworkManager().dispatchPacket((Packet)new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN), null);
} else if (event.state == Event.State.POST) {
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(this.mc.thePlayer.inventory.getCurrentItem()));
}
}
}
示例10: dropOneItem
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的package包/类
/**
* Called when player presses the drop item key
*/
public EntityItem dropOneItem(boolean dropAll) {
C07PacketPlayerDigging.Action c07packetplayerdigging$action = dropAll
? C07PacketPlayerDigging.Action.DROP_ALL_ITEMS
: C07PacketPlayerDigging.Action.DROP_ITEM;
this.sendQueue.addToSendQueue(
new C07PacketPlayerDigging(c07packetplayerdigging$action, BlockPos.ORIGIN, EnumFacing.DOWN));
return null;
}
示例11: clickBlock
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的package包/类
public void clickBlock(int p_78743_1_, int p_78743_2_, int p_78743_3_, int p_78743_4_)
{
if ((!this.currentGameType.isAdventure()) || (this.mc.thePlayer.isCurrentToolAdventureModeExempt(p_78743_1_, p_78743_2_, p_78743_3_))) {
if (this.currentGameType.isCreative())
{
this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(0, p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_));
clickBlockCreative(this.mc, this, p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_);
this.blockHitDelay = 5;
}
else if ((!this.isHittingBlock) || (!sameToolAndBlock(p_78743_1_, p_78743_2_, p_78743_3_)))
{
if (this.isHittingBlock) {
this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, p_78743_4_));
}
this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(0, p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_));
Block block = this.mc.theWorld.getBlock(p_78743_1_, p_78743_2_, p_78743_3_);
boolean flag = block.getMaterial() != Material.air;
if ((flag) && (this.curBlockDamageMP == 0.0F)) {
block.onBlockClicked(this.mc.theWorld, p_78743_1_, p_78743_2_, p_78743_3_, this.mc.thePlayer);
}
if ((flag) && (block.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, p_78743_1_, p_78743_2_, p_78743_3_) >= 1.0F))
{
onPlayerDestroyBlock(p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_);
}
else
{
this.isHittingBlock = true;
this.currentBlockX = p_78743_1_;
this.currentBlockY = p_78743_2_;
this.currentblockZ = p_78743_3_;
this.currentItemHittingBlock = this.mc.thePlayer.getHeldItem();
this.curBlockDamageMP = 0.0F;
this.stepSoundTickCounter = 0.0F;
this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.getEntityId(), this.currentBlockX, this.currentBlockY, this.currentblockZ, (int)(this.curBlockDamageMP * 10.0F) - 1);
}
}
}
}
示例12: resetBlockRemoving
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的package包/类
public void resetBlockRemoving()
{
if (this.isHittingBlock) {
this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, -1));
}
this.isHittingBlock = false;
this.curBlockDamageMP = 0.0F;
this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.getEntityId(), this.currentBlockX, this.currentBlockY, this.currentblockZ, -1);
}
示例13: onUpdate
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的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) {
new Thread(() -> {
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);
String configKey = "Charge Level (1 - 20)";
int iters = ModuleConfiguration.forModule(this).getInt(configKey, 3);
if (iters > 20 || iters < 1) {
iters = 1;
Chat.sendWarning("BowSpam charge level range out of range, resetting!");
ModuleConfiguration.forModule(this).putString(configKey, String.valueOf(iters));
}
for (int i = 0; i < iters; i++) {
try {
Thread.sleep(ModuleConfiguration.forModule(this).getInt("Delay between charges (ms)", 10));
} catch (InterruptedException ignored) {
}
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(false));
}
Minecraft.getMinecraft().getNetHandler().addToSendQueue(
new C07PacketPlayerDigging(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);
}).start();
}
}
示例14: nukeAll
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的package包/类
private void nukeAll() {
for (int y = (int) realRange; y >= (mode == 2 ? 0 : -realRange); y--) {
for (int x = (int) realRange; x >= -realRange - 1; x--) {
for (int z = (int) realRange; z >= -realRange; z--) {
int posX = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posX) + x);
int posY = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posY) + y);
int posZ = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posZ) + z);
BlockPos blockPos = new BlockPos(posX, posY, posZ);
Block block = Minecraft.getMinecraft().theWorld.getBlockState(blockPos).getBlock();
float xDiff = (float) (Minecraft.getMinecraft().thePlayer.posX - posX);
float yDiff = (float) (Minecraft.getMinecraft().thePlayer.posY - posY);
float zDiff = (float) (Minecraft.getMinecraft().thePlayer.posZ - posZ);
float currentDistance = BlockUtils.getBlockDistance(xDiff, yDiff, zDiff);
MovingObjectPosition fakeObjectMouseOver = Minecraft.getMinecraft().objectMouseOver;
if (fakeObjectMouseOver == null) return;
fakeObjectMouseOver.setBlockPos(blockPos);
if (Block.getIdFromBlock(block) != 0 && posY >= 0 && currentDistance <= realRange) {
if (mode == 1 && Block.getIdFromBlock(block) != id) continue;
if (mode == 3 && block.getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer,
Minecraft.getMinecraft().theWorld, blockPos) < 1) {
continue;
}
side = fakeObjectMouseOver.sideHit;
shouldRenderESP = true;
BlockUtils.faceBlockPacket(pos);
Minecraft.getMinecraft().thePlayer.sendQueue
.addToSendQueue(new C07PacketPlayerDigging(Action.START_DESTROY_BLOCK, blockPos, side));
block.onBlockDestroyedByPlayer(Minecraft.getMinecraft().theWorld, blockPos,
Minecraft.getMinecraft().theWorld.getBlockState(blockPos));
}
}
}
}
}
示例15: nukeAll
import net.minecraft.network.play.client.C07PacketPlayerDigging; //导入依赖的package包/类
private void nukeAll() {
for (int y = 2; y >= 0; y--) {
for (int x = 1; x >= -1; x--) {
for (int z = 1; z >= -1; z--) {
int posX = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posX) + x);
int posY = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posY) + y);
int posZ = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posZ) + z);
BlockPos blockPos = new BlockPos(posX, posY, posZ);
Block block = Minecraft.getMinecraft().theWorld.getBlockState(blockPos).getBlock();
MovingObjectPosition fakeObjectMouseOver = Minecraft.getMinecraft().objectMouseOver;
fakeObjectMouseOver.setBlockPos(blockPos);
if (Block.getIdFromBlock(block) != 0 && posY >= 0) {
if (WurstClient.INSTANCE.mods.getModByClass(NukerMod.class).getMode() == 3 &&
block.getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer,
Minecraft.getMinecraft().theWorld, blockPos) < 1) {
continue;
}
side = fakeObjectMouseOver.sideHit;
shouldRenderESP = true;
BlockUtils.faceBlockPacket(pos);
Minecraft.getMinecraft().thePlayer.sendQueue
.addToSendQueue(new C07PacketPlayerDigging(Action.START_DESTROY_BLOCK, blockPos, side));
block.onBlockDestroyedByPlayer(Minecraft.getMinecraft().theWorld, blockPos,
Minecraft.getMinecraft().theWorld.getBlockState(blockPos));
}
}
}
}
}