本文整理汇总了Java中net.minecraft.network.play.client.C08PacketPlayerBlockPlacement类的典型用法代码示例。如果您正苦于以下问题:Java C08PacketPlayerBlockPlacement类的具体用法?Java C08PacketPlayerBlockPlacement怎么用?Java C08PacketPlayerBlockPlacement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
C08PacketPlayerBlockPlacement类属于net.minecraft.network.play.client包,在下文中一共展示了C08PacketPlayerBlockPlacement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onPostUpdate
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
@EventTarget
private void onPostUpdate(UpdateEvent event) {
if (event.state == Event.State.POST) {
int soupSlot = this.getSoupFromInventory();
if ((double)this.mc.thePlayer.getHealth() < this.health * 2.0 && this.time.delay((float)this.delay) && soupSlot != -1) {
int prevSlot = this.mc.thePlayer.inventory.currentItem;
if (soupSlot < 9) {
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(soupSlot));
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(this.mc.thePlayer.inventory.getCurrentItem()));
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(prevSlot));
this.mc.playerController.syncCurrentPlayItem();
this.mc.thePlayer.inventory.currentItem = prevSlot;
} else {
this.swap(soupSlot, this.mc.thePlayer.inventory.currentItem + (this.mc.thePlayer.inventory.currentItem < 8 ? 1 : -1));
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(this.mc.thePlayer.inventory.currentItem + (this.mc.thePlayer.inventory.currentItem < 8 ? 1 : -1)));
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(this.mc.thePlayer.inventory.getCurrentItem()));
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(prevSlot));
}
this.time.reset();
}
}
}
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:AutoSoup.java
示例2: sendUseItem
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
public boolean sendUseItem(EntityPlayer p_78769_1_, World p_78769_2_, ItemStack p_78769_3_)
{
syncCurrentPlayItem();
this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(-1, -1, -1, 255, p_78769_1_.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F));
int i = p_78769_3_.stackSize;
ItemStack itemstack1 = p_78769_3_.useItemRightClick(p_78769_2_, p_78769_1_);
if ((itemstack1 == p_78769_3_) && ((itemstack1 == null) || (itemstack1.stackSize == i))) {
return false;
}
p_78769_1_.inventory.mainInventory[p_78769_1_.inventory.currentItem] = itemstack1;
if (itemstack1.stackSize <= 0)
{
p_78769_1_.inventory.mainInventory[p_78769_1_.inventory.currentItem] = null;
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(p_78769_1_, itemstack1));
}
return true;
}
开发者ID:4Space,项目名称:4Space-5,代码行数:18,代码来源:PlayerControllerMP.java
示例3: onOutwardPacket
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的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));
}
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:19,代码来源:ModuleFastBow.java
示例4: onOutwardPacket
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的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));
}
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:19,代码来源:ModuleFastEat.java
示例5: sendUseItem
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
/**
* Notifies the server of things like consuming food, etc...
*/
public boolean sendUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack)
{
this.syncCurrentPlayItem();
this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(-1, -1, -1, 255, par1EntityPlayer.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F));
int var4 = par3ItemStack.stackSize;
ItemStack var5 = par3ItemStack.useItemRightClick(par2World, par1EntityPlayer);
if (var5 == par3ItemStack && (var5 == null || var5.stackSize == var4))
{
return false;
}
else
{
par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = var5;
if (var5.stackSize == 0)
{
par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null;
}
return true;
}
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:27,代码来源:PlayerControllerMP.java
示例6: sendUseItem
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
public boolean sendUseItem(EntityPlayer p_78769_1_, World p_78769_2_, ItemStack p_78769_3_)
{
this.syncCurrentPlayItem();
this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(-1, -1, -1, 255, p_78769_1_.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F));
int i = p_78769_3_.stackSize;
ItemStack itemstack1 = p_78769_3_.useItemRightClick(p_78769_2_, p_78769_1_);
if (itemstack1 == p_78769_3_ && (itemstack1 == null || itemstack1.stackSize == i))
{
return false;
}
else
{
p_78769_1_.inventory.mainInventory[p_78769_1_.inventory.currentItem] = itemstack1;
if (itemstack1.stackSize <= 0)
{
p_78769_1_.inventory.mainInventory[p_78769_1_.inventory.currentItem] = null;
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(p_78769_1_, itemstack1));
}
return true;
}
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:25,代码来源:PlayerControllerMP.java
示例7: sendUseItem
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
/**
* Notifies the server of things like consuming food, etc...
*/
public boolean sendUseItem(EntityPlayer playerIn, World worldIn, ItemStack itemStackIn)
{
if (this.currentGameType == WorldSettings.GameType.SPECTATOR)
{
return false;
}
else
{
this.syncCurrentPlayItem();
this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(playerIn.inventory.getCurrentItem()));
int i = itemStackIn.stackSize;
ItemStack itemstack = itemStackIn.useItemRightClick(worldIn, playerIn);
if (itemstack != itemStackIn || itemstack != null && itemstack.stackSize != i)
{
playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack;
if (itemstack.stackSize == 0)
{
playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null;
}
return true;
}
else
{
return false;
}
}
}
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:34,代码来源:PlayerControllerMP.java
示例8: onUpdate
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的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));
}
}
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:AutoEat.java
示例9: onPacketSend
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
@EventTarget
private void onPacketSend(PacketSendEvent event) {
if (event.packet instanceof C0BPacketEntityAction || event.packet instanceof C03PacketPlayer || event.packet instanceof C02PacketUseEntity || event.packet instanceof C0APacketAnimation || event.packet instanceof C08PacketPlayerBlockPlacement) {
this.packetList.add(event.packet);
event.setCancelled(true);
}
}
开发者ID:SkidJava,项目名称:BaseClient,代码行数:8,代码来源:Blink.java
示例10: onUpdate
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的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()));
}
}
}
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:NoSlowdown.java
示例11: onTick
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
@EventTarget
private void onTick(TickEvent event) {
int i = 0;
while (i < 8) {
Item item;
if (this.mc.thePlayer.inventory.mainInventory[i] != null && ((item = this.mc.thePlayer.inventory.mainInventory[i].getItem()) instanceof ItemRedstone || Item.getIdFromItem((Item)item) == 353 || item instanceof ItemFirework)) {
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(i));
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(this.mc.thePlayer.inventory.mainInventory[i]));
this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(this.mc.thePlayer.inventory.currentItem));
}
++i;
}
}
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:AutoTaunt.java
示例12: sendUsePacket
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
@Override
public void sendUsePacket(final PlayerInteractEvent event) {
if (event.world.isRemote) {
final Vec3 hitVec = Minecraft.getMinecraft().objectMouseOver.hitVec;
final float f = (float)hitVec.xCoord - event.x;
final float f2 = (float)hitVec.yCoord - event.y;
final float f3 = (float)hitVec.zCoord - event.z;
Minecraft.getMinecraft().getNetHandler().addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(event.x, event.y, event.z, event.face, event.entityPlayer.inventory.getCurrentItem(), f, f2, f3));
}
}
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:11,代码来源:ExtraUtilsClient.java
示例13: processPlayerBlockPlacement
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
/**
* Processes block placement and block activation (anvil, furnace, etc.)
*/
public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
ItemStack itemstack = this.playerEntity.inventory.getCurrentItem();
boolean flag = false;
BlockPos blockpos = packetIn.getPosition();
EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection());
this.playerEntity.markPlayerActive();
if (packetIn.getPlacedBlockDirection() == 255)
{
if (itemstack == null)
{
return;
}
this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack);
}
else if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit())
{
if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos))
{
this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ());
}
flag = true;
}
else
{
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("build.tooHigh", new Object[] {Integer.valueOf(this.serverController.getBuildLimit())});
chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
this.playerEntity.playerNetServerHandler.sendPacket(new S02PacketChat(chatcomponenttranslation));
flag = true;
}
if (flag)
{
this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos));
this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos.offset(enumfacing)));
}
itemstack = this.playerEntity.inventory.getCurrentItem();
if (itemstack != null && itemstack.stackSize == 0)
{
this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = null;
itemstack = null;
}
if (itemstack == null || itemstack.getMaxItemUseDuration() == 0)
{
this.playerEntity.isChangingQuantityOnly = true;
this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack.copyItemStack(this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]);
Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem);
this.playerEntity.openContainer.detectAndSendChanges();
this.playerEntity.isChangingQuantityOnly = false;
if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()))
{
this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem()));
}
}
}
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:68,代码来源:NetHandlerPlayServer.java
示例14: onPlayerRightClick
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
public boolean onPlayerRightClick(EntityPlayerSP player, WorldClient worldIn, ItemStack heldStack, BlockPos hitPos, EnumFacing side, Vec3 hitVec)
{
this.syncCurrentPlayItem();
float f = (float)(hitVec.xCoord - (double)hitPos.getX());
float f1 = (float)(hitVec.yCoord - (double)hitPos.getY());
float f2 = (float)(hitVec.zCoord - (double)hitPos.getZ());
boolean flag = false;
if (!this.mc.theWorld.getWorldBorder().contains(hitPos))
{
return false;
}
else
{
if (this.currentGameType != WorldSettings.GameType.SPECTATOR)
{
IBlockState iblockstate = worldIn.getBlockState(hitPos);
if ((!player.isSneaking() || player.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2))
{
flag = true;
}
if (!flag && heldStack != null && heldStack.getItem() instanceof ItemBlock)
{
ItemBlock itemblock = (ItemBlock)heldStack.getItem();
if (!itemblock.canPlaceBlockOnSide(worldIn, hitPos, side, player, heldStack))
{
return false;
}
}
}
this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(hitPos, side.getIndex(), player.inventory.getCurrentItem(), f, f1, f2));
if (!flag && this.currentGameType != WorldSettings.GameType.SPECTATOR)
{
if (heldStack == null)
{
return false;
}
else if (this.currentGameType.isCreative())
{
int i = heldStack.getMetadata();
int j = heldStack.stackSize;
boolean flag1 = heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2);
heldStack.setItemDamage(i);
heldStack.stackSize = j;
return flag1;
}
else
{
return heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2);
}
}
else
{
return true;
}
}
}
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:63,代码来源:PlayerControllerMP.java
示例15: onPlayerRightClick
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
public boolean onPlayerRightClick(EntityPlayer p_78760_1_, World p_78760_2_, ItemStack p_78760_3_, int p_78760_4_, int p_78760_5_, int p_78760_6_, int p_78760_7_, Vec3 p_78760_8_)
{
syncCurrentPlayItem();
float f = (float)p_78760_8_.xCoord - p_78760_4_;
float f1 = (float)p_78760_8_.yCoord - p_78760_5_;
float f2 = (float)p_78760_8_.zCoord - p_78760_6_;
boolean flag = false;
if ((p_78760_3_ != null) && (p_78760_3_.getItem() != null) && (p_78760_3_.getItem().onItemUseFirst(p_78760_3_, p_78760_1_, p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, f, f1, f2))) {
return true;
}
if ((!p_78760_1_.isSneaking()) || (p_78760_1_.getHeldItem() == null) || (p_78760_1_.getHeldItem().getItem().doesSneakBypassUse(p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_1_))) {
flag = p_78760_2_.getBlock(p_78760_4_, p_78760_5_, p_78760_6_).onBlockActivated(p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_1_, p_78760_7_, f, f1, f2);
}
if ((!flag) && (p_78760_3_ != null) && ((p_78760_3_.getItem() instanceof ItemBlock)))
{
ItemBlock itemblock = (ItemBlock)p_78760_3_.getItem();
if (!itemblock.func_150936_a(p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, p_78760_1_, p_78760_3_)) {
return false;
}
}
this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, p_78760_1_.inventory.getCurrentItem(), f, f1, f2));
if (flag) {
return true;
}
if (p_78760_3_ == null) {
return false;
}
if (this.currentGameType.isCreative())
{
int j1 = p_78760_3_.getItemDamage();
int i1 = p_78760_3_.stackSize;
boolean flag1 = p_78760_3_.tryPlaceItemIntoWorld(p_78760_1_, p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, f, f1, f2);
p_78760_3_.setItemDamage(j1);
p_78760_3_.stackSize = i1;
return flag1;
}
if (!p_78760_3_.tryPlaceItemIntoWorld(p_78760_1_, p_78760_2_, p_78760_4_, p_78760_5_, p_78760_6_, p_78760_7_, f, f1, f2)) {
return false;
}
if (p_78760_3_.stackSize <= 0) {
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(p_78760_1_, p_78760_3_));
}
return true;
}
开发者ID:4Space,项目名称:4Space-5,代码行数:45,代码来源:PlayerControllerMP.java
示例16: buildNext
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
public static void buildNext(int[][] building, MovingObjectPosition mouseOver, float playerYaw, int i) {
if (playerYaw > -45 && playerYaw <= 45) {// F: 0 South
BlockUtils.faceBlockPacket(new BlockPos(mouseOver.getBlockPos().getX() + building[i][0],
mouseOver.getBlockPos().getY() + building[i][1], mouseOver.getBlockPos().getZ() + building[i][2]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos(mouseOver.getBlockPos().getX() + building[i][0],
mouseOver.getBlockPos().getY() + building[i][1],
mouseOver.getBlockPos().getZ() + building[i][2]), mouseOver.sideHit.getIndex(),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() + building[i][0]),
(float) mouseOver.hitVec.yCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.zCoord - (mouseOver.getBlockPos().getZ() + building[i][2])));
} else if (playerYaw > 45 && playerYaw <= 135) {// F: 1 West
BlockUtils.faceBlockPacket(new BlockPos(mouseOver.getBlockPos().getX() - building[i][2],
mouseOver.getBlockPos().getY() + building[i][1], mouseOver.getBlockPos().getZ() + building[i][0]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos(mouseOver.getBlockPos().getX() - building[i][2],
mouseOver.getBlockPos().getY() + building[i][1],
mouseOver.getBlockPos().getZ() + building[i][0]), mouseOver.sideHit.getIndex(),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() - building[i][2]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getZ() + building[i][0])));
} else if (playerYaw > 135 || playerYaw <= -135) {// F: 2 North
BlockUtils.faceBlockPacket(new BlockPos(mouseOver.getBlockPos().getX() - building[i][0],
mouseOver.getBlockPos().getY() + building[i][1], mouseOver.getBlockPos().getZ() - building[i][2]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos(mouseOver.getBlockPos().getX() - building[i][0],
mouseOver.getBlockPos().getY() + building[i][1],
mouseOver.getBlockPos().getZ() - building[i][2]), mouseOver.sideHit.getIndex(),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() - building[i][0]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getZ() - building[i][2])));
} else if (playerYaw > -135 && playerYaw <= -45) {// F: 3 East
BlockUtils.faceBlockPacket(new BlockPos(mouseOver.getBlockPos().getX() + building[i][2],
mouseOver.getBlockPos().getY() + building[i][1], mouseOver.getBlockPos().getZ() - building[i][0]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos(mouseOver.getBlockPos().getX() + building[i][2],
mouseOver.getBlockPos().getY() + building[i][1],
mouseOver.getBlockPos().getZ() - building[i][0]), mouseOver.sideHit.getIndex(),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() + building[i][2]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getZ() - building[i][0])));
}
}
开发者ID:null-dev,项目名称:EvenWurse,代码行数:52,代码来源:BuildUtils.java
示例17: advancedBuildNext
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
public static void advancedBuildNext(int[][] building, MovingObjectPosition mouseOver, float playerYaw, int i) {
if (playerYaw > -45 && playerYaw <= 45) {// F: 0 South
BlockUtils.faceBlockPacket(new BlockPos(convertPosNext(1, mouseOver) + building[i][0],
convertPosNext(2, mouseOver) + building[i][1], convertPosNext(3, mouseOver) + building[i][2]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos(convertPosNext(1, mouseOver) + building[i][0],
convertPosNext(2, mouseOver) + building[i][1],
convertPosNext(3, mouseOver) + building[i][2]), building[i][3],
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() + building[i][0]),
(float) mouseOver.hitVec.yCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.zCoord - (mouseOver.getBlockPos().getZ() + building[i][2])));
} else if (playerYaw > 45 && playerYaw <= 135) {// F: 1 West
BlockUtils.faceBlockPacket(new BlockPos(convertPosNext(1, mouseOver) - building[i][2],
convertPosNext(2, mouseOver) + building[i][1], convertPosNext(3, mouseOver) + building[i][0]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos(convertPosNext(1, mouseOver) - building[i][2],
convertPosNext(2, mouseOver) + building[i][1],
convertPosNext(3, mouseOver) + building[i][0]), convertSide(building[i][3], 1),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() - building[i][2]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getZ() + building[i][0])));
} else if (playerYaw > 135 || playerYaw <= -135) {// F: 2 North
BlockUtils.faceBlockPacket(new BlockPos(convertPosNext(1, mouseOver) - building[i][0],
convertPosNext(2, mouseOver) + building[i][1], convertPosNext(3, mouseOver) - building[i][2]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos(convertPosNext(1, mouseOver) - building[i][0],
convertPosNext(2, mouseOver) + building[i][1],
convertPosNext(3, mouseOver) - building[i][2]), convertSide(building[i][3], 2),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() - building[i][0]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getZ() - building[i][2])));
} else if (playerYaw > -135 && playerYaw <= -45) {// F: 3 East
BlockUtils.faceBlockPacket(new BlockPos(convertPosNext(1, mouseOver) + building[i][2],
convertPosNext(2, mouseOver) + building[i][1], convertPosNext(3, mouseOver) - building[i][0]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos(convertPosNext(1, mouseOver) + building[i][2],
convertPosNext(2, mouseOver) + building[i][1],
convertPosNext(3, mouseOver) - building[i][0]), convertSide(building[i][3], 3),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() + building[i][2]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getZ() - building[i][0])));
}
}
开发者ID:null-dev,项目名称:EvenWurse,代码行数:52,代码来源:BuildUtils.java
示例18: advancedInstantBuildNext
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
public static void advancedInstantBuildNext(int[][] building, MovingObjectPosition mouseOver, float playerYaw,
double posX, double posY, double posZ, int i) {
if (playerYaw > -45 && playerYaw <= 45) {// F: 0 South
BlockUtils.faceBlockPacket(new BlockPos((int) posX - 1 + building[i][0], (int) posY - 2 + building[i][1],
(int) posZ + building[i][2]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos((int) posX - 1 + building[i][0], (int) posY - 2 + building[i][1],
(int) posZ + building[i][2]), building[i][3],
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() + building[i][0]),
(float) mouseOver.hitVec.yCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.zCoord - (mouseOver.getBlockPos().getZ() + building[i][2])));
} else if (playerYaw > 45 && playerYaw <= 135) {// F: 1 West
BlockUtils.faceBlockPacket(new BlockPos((int) (posX - 1 - building[i][2]), (int) posY - 2 + building[i][1],
(int) posZ + building[i][0]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos((int) (posX - 1 - building[i][2]), (int) posY - 2 + building[i][1],
(int) posZ + building[i][0]), convertSide(building[i][3], 1),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() - building[i][2]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getZ() + building[i][0])));
} else if (playerYaw > 135 || playerYaw <= -135) {// F: 2 North
BlockUtils.faceBlockPacket(new BlockPos((int) posX - 1 - building[i][0], (int) posY - 2 + building[i][1],
(int) posZ - building[i][2]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos((int) posX - 1 - building[i][0], (int) posY - 2 + building[i][1],
(int) posZ - building[i][2]), convertSide(building[i][3], 2),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() - building[i][0]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getZ() - building[i][2])));
} else if (playerYaw > -135 && playerYaw <= -45) {// F: 3 East
BlockUtils.faceBlockPacket(new BlockPos((int) posX - 1 + building[i][2], (int) posY - 2 + building[i][1],
(int) posZ - building[i][0]));
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
new BlockPos((int) posX - 1 + building[i][2], (int) posY - 2 + building[i][1],
(int) posZ - building[i][0]), convertSide(building[i][3], 3),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getX() + building[i][2]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getY() + building[i][1]),
(float) mouseOver.hitVec.xCoord - (mouseOver.getBlockPos().getZ() - building[i][0])));
}
}
开发者ID:null-dev,项目名称:EvenWurse,代码行数:49,代码来源:BuildUtils.java
示例19: onUpdate
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
@Override
public void onUpdate() {
if (WurstClient.INSTANCE.mods.getModByClass(FreecamMod.class).isActive() ||
WurstClient.INSTANCE.mods.getModByClass(RemoteViewMod.class).isActive() ||
Minecraft.getMinecraft().objectMouseOver == null ||
Minecraft.getMinecraft().objectMouseOver.typeOfHit != MovingObjectType.BLOCK) {
return;
}
if (Minecraft.getMinecraft().rightClickDelayTimer > 0 &&
!WurstClient.INSTANCE.mods.getModByClass(FastPlaceMod.class).isActive()) {
return;
}
float xDiff;
float yDiff;
float zDiff;
float distance = RANGE + 1;
boolean hasBlocks = false;
for (int y = (int) RANGE; y >= -RANGE; y--) {
for (int x = (int) RANGE; x >= -RANGE - 1; x--) {
for (int z = (int) RANGE; z >= -RANGE; z--) {
if (Block.getIdFromBlock(Minecraft.getMinecraft().theWorld.getBlockState(
new BlockPos((int) (x + Minecraft.getMinecraft().thePlayer.posX),
(int) (y + Minecraft.getMinecraft().thePlayer.posY),
(int) (z + Minecraft.getMinecraft().thePlayer.posZ))).getBlock()) != 0 &&
BlockUtils.getBlockDistance(x, y, z) <= RANGE) {
hasBlocks = true;
break;
}
}
if (hasBlocks) break;
}
if (hasBlocks) break;
}
if (!hasBlocks) return;
BlockPos randomPos = null;
while (distance > RANGE || distance < -RANGE ||
Block.getIdFromBlock(Minecraft.getMinecraft().theWorld.getBlockState(randomPos).getBlock()) == 0) {
xDiff = (int) (Math.random() * RANGE * 2 - RANGE - 1);
yDiff = (int) (Math.random() * RANGE * 2 - RANGE);
zDiff = (int) (Math.random() * RANGE * 2 - RANGE);
distance = BlockUtils.getBlockDistance(xDiff, yDiff, zDiff);
int randomPosX = (int) (xDiff + Minecraft.getMinecraft().thePlayer.posX);
int randomPosY = (int) (yDiff + Minecraft.getMinecraft().thePlayer.posY);
int randomPosZ = (int) (zDiff + Minecraft.getMinecraft().thePlayer.posZ);
randomPos = new BlockPos(randomPosX, randomPosY, randomPosZ);
}
MovingObjectPosition fakeObjectMouseOver = Minecraft.getMinecraft().objectMouseOver;
if (fakeObjectMouseOver == null) return;
fakeObjectMouseOver.setBlockPos(randomPos);
BlockUtils.faceBlockPacket(randomPos);
Minecraft.getMinecraft().thePlayer.swingItem();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(
new C08PacketPlayerBlockPlacement(randomPos, fakeObjectMouseOver.sideHit.getIndex(),
Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
(float) fakeObjectMouseOver.hitVec.xCoord - fakeObjectMouseOver.getBlockPos().getX(),
(float) fakeObjectMouseOver.hitVec.yCoord - fakeObjectMouseOver.getBlockPos().getY(),
(float) fakeObjectMouseOver.hitVec.zCoord - fakeObjectMouseOver.getBlockPos().getZ()));
}
开发者ID:null-dev,项目名称:EvenWurse,代码行数:59,代码来源:BuildRandomMod.java
示例20: onPlayerRightClick
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; //导入依赖的package包/类
/**
* Handles a players right click. Args: player, world, x, y, z, si
|
请发表评论