本文整理匯總了Java中net.minecraft.util.MovingObjectPosition.MovingObjectType.BLOCK屬性的典型用法代碼示例。如果您正苦於以下問題:Java MovingObjectType.BLOCK屬性的具體用法?Java MovingObjectType.BLOCK怎麽用?Java MovingObjectType.BLOCK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類net.minecraft.util.MovingObjectPosition.MovingObjectType
的用法示例。
在下文中一共展示了MovingObjectType.BLOCK屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onItemRightClick
@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player)
{
MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);
if (mop == null)
return is;
if (mop.typeOfHit == MovingObjectType.BLOCK)
{
int x = mop.blockX;
int y = mop.blockY;
int z = mop.blockZ;
if (!world.canMineBlock(player, x, y, z))
return is;
return new ItemStack(TFCItems.woodenBucketEmpty);
}
return is;
}
示例2: rayTraceCuboids
public void rayTraceCuboids(Vector3 start, Vector3 end, List<IndexedCuboid6> cuboids, BlockCoord pos, Block block, List<ExtendedMOP> hitList)
{
for(IndexedCuboid6 cuboid : cuboids)
{
MovingObjectPosition mop = rayTraceCuboid(start, end, cuboid);
if(mop != null)
{
ExtendedMOP emop = new ExtendedMOP(mop, cuboid.data, s_dist);
emop.typeOfHit = MovingObjectType.BLOCK;
emop.blockX = pos.x;
emop.blockY = pos.y;
emop.blockZ = pos.z;
hitList.add(emop);
}
}
}
示例3: renderOverlay
public static void renderOverlay() {
Minecraft mc = Minecraft.getMinecraft();
if (mc.currentScreen == null &&
mc.theWorld != null &&
!mc.gameSettings.keyBindPlayerList.getIsKeyPressed() &&
NEIClientConfig.getBooleanSetting("world.highlight_tips") &&
mc.objectMouseOver != null &&
mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
World world = mc.theWorld;
ArrayList<ItemStack> items = ItemInfo.getIdentifierItems(world, mc.thePlayer, mc.objectMouseOver);
if (items.isEmpty())
return;
int minDamage = Integer.MAX_VALUE;
ItemStack stack = null;
for(ItemStack astack : items) {
if(astack.getItem() != null && astack.getItemDamage() < minDamage) {
stack = astack;
minDamage = stack.getItemDamage();
}
}
renderOverlay(stack, ItemInfo.getText(stack, world, mc.thePlayer, mc.objectMouseOver), getPositioning());
}
}
示例4: renderOverlay
public static void renderOverlay() {
Minecraft mc = Minecraft.getMinecraft();
if (mc.currentScreen == null &&
mc.theWorld != null &&
!mc.gameSettings.keyBindPlayerList.isKeyDown() &&
NEIClientConfig.getBooleanSetting("world.highlight_tips") &&
mc.objectMouseOver != null &&
mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
World world = mc.theWorld;
ArrayList<ItemStack> items = ItemInfo.getIdentifierItems(world, mc.thePlayer, mc.objectMouseOver);
if (items.isEmpty())
return;
int minDamage = Integer.MAX_VALUE;
ItemStack stack = null;
for(ItemStack astack : items) {
if(astack.getItem() != null && astack.getItemDamage() < minDamage) {
stack = astack;
minDamage = stack.getItemDamage();
}
}
renderOverlay(stack, ItemInfo.getText(stack, world, mc.thePlayer, mc.objectMouseOver), getPositioning());
}
}
示例5: onItemRightClick
@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player) {
MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);
if (mop == null)
return is;
if (mop.typeOfHit == MovingObjectType.BLOCK) {
int x = mop.blockX;
int y = mop.blockY;
int z = mop.blockZ;
if (!world.canMineBlock(player, x, y, z))
return is;
return new ItemStack(this);
}
return is;
}
示例6: onItemRightClick
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player)
{
MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);
if (mop == null)
return is;
if (mop.typeOfHit == MovingObjectType.BLOCK)
{
int x = mop.blockX;
int y = mop.blockY;
int z = mop.blockZ;
if (!world.canMineBlock(player, x, y, z))
return is;
return new ItemStack(TFCItems.woodenBucketEmpty);
}
return is;
}
示例7: onEntitySwing
/**
* Called when the player left-clicks
*/
@Override
public boolean onEntitySwing( final EntityLivingBase entity, final ItemStack wandStack )
{
// Is the entity a player?
if( entity instanceof EntityPlayer )
{
// Cast to player
EntityPlayer player = (EntityPlayer)entity;
// Ray trace
MovingObjectPosition position = this.getMovingObjectPositionFromPlayer( player.worldObj, player, true );
// Was a block hit?
if( ( position != null ) && ( position.typeOfHit == MovingObjectType.BLOCK ) )
{
// Use the focus
return this.onUse( player.worldObj, player, position, wandStack, Action.LEFT_CLICK_BLOCK );
}
}
return false;
}
示例8: onImpact
@Override
protected void onImpact(MovingObjectPosition mop)
{
if(mop.typeOfHit == MovingObjectType.BLOCK)
{
this.worldObj.newExplosion(this, mop.blockX, mop.blockY, mop.blockZ, 2.0F, true, true);
}
if (mop.entityHit != null)
{
this.worldObj.newExplosion(this, mop.blockX, mop.blockY, mop.blockZ, 2.0F, true, true);
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
示例9: onUse
@Override
public void onUse(World world, EntityPlayer player, IPlayerSession session, ItemStack stack, int boost, int cost) {
if (session.hasEnoughMana(cost())) {
MovingObjectPosition mop = SimpleUtil.rayTrace(player, world, 43);
if (mop != null) {
if (mop.typeOfHit == MovingObjectType.BLOCK) {
int blockX = mop.blockX;
int blockY = mop.blockY;
int blockZ = mop.blockZ;
Block block = world.getBlock(blockX, blockY, blockZ);
if (block != null && !world.isAirBlock(blockX, blockY, blockZ)) {
EntityLightningBolt light = new EntityLightningBolt(world, blockX, blockY, blockZ);
world.spawnEntityInWorld(light);
session.adjustMana(-cost(), false);
}
}
}
}
}
示例10: onImpact
/**
* Called when this EntityThrowable hits a block or entity.
*/
@Override
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null)
{
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 6F);
}
else if (par1MovingObjectPosition.typeOfHit == MovingObjectType.BLOCK)
{
if(!(worldObj.getBlock(par1MovingObjectPosition.blockX, par1MovingObjectPosition.blockY, par1MovingObjectPosition.blockZ) == Blocks.ice) && !(worldObj.getBlock(par1MovingObjectPosition.blockX, par1MovingObjectPosition.blockY, par1MovingObjectPosition.blockZ) == ModBlocks.boltObsidian))
worldObj.setBlock(par1MovingObjectPosition.blockX, par1MovingObjectPosition.blockY, par1MovingObjectPosition.blockZ, Blocks.ice);
}
for (int i = 0; i < 4; ++i)
{
if (worldObj.isRemote)
FrozenParticles.spawnParticle("iceBolt", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
setDead();
//send package for player removal
FrozenCraft.frozenCraftNetworkManager.sendToServer(new FrozenIceBoltRemoveMessage());
}
示例11: onItemRightClick
@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player)
{
MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);
if (mop == null)
return is;
if (mop.typeOfHit == MovingObjectType.BLOCK)
{
int x = mop.blockX;
int y = mop.blockY;
int z = mop.blockZ;
if (!world.canMineBlock(player, x, y, z))
return is;
if (mop.sideHit == 0) --y;
if (mop.sideHit == 1) ++y;
if (mop.sideHit == 2) --z;
if (mop.sideHit == 3) ++z;
if (mop.sideHit == 4) --x;
if (mop.sideHit == 5) ++x;
tryPlaceContainedLiquid(world, x, y, z);
return new ItemStack(TFCItems.redSteelBucketEmpty);
}
return is;
}
示例12: impactSprout
private void impactSprout(MovingObjectPosition mop, boolean enhanced) {
if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK) {
int itemEntity1 = mop.blockX;
int newBrewStack1 = mop.blockY;
int posZ = mop.blockZ;
World world = super.worldObj;
int sideHit = mop.sideHit;
growBranch(itemEntity1, newBrewStack1, posZ, world, sideHit, enhanced?20:15, super.boundingBox);
} else {
EntityItem itemEntity = null;
if(mop != null) {
ItemStack newBrewStack = Witchery.Items.GENERIC.itemBrewOfSprouting.createStack();
switch(EntityWitchProjectile.NamelessClass2036201851.$SwitchMap$net$minecraft$util$MovingObjectPosition$MovingObjectType[mop.typeOfHit.ordinal()]) {
case 1:
itemEntity = new EntityItem(super.worldObj, (double)mop.blockX + 0.5D, (double)(mop.blockY + (mop.sideHit == 0?-1:1)) + 0.5D, (double)mop.blockZ + 0.5D, newBrewStack);
break;
case 2:
itemEntity = new EntityItem(super.worldObj, mop.entityHit.posX, mop.entityHit.posY, mop.entityHit.posZ, newBrewStack);
}
}
this.skipFX = true;
if(itemEntity != null) {
super.worldObj.spawnEntityInWorld(itemEntity);
}
}
}
示例13: rayTraceCuboid
public MovingObjectPosition rayTraceCuboid(Vector3 start, Vector3 end, Cuboid6 cuboid, BlockCoord pos)
{
MovingObjectPosition mop = rayTraceCuboid(start, end, cuboid);
if(mop != null)
{
mop.typeOfHit = MovingObjectType.BLOCK;
mop.blockX = pos.x;
mop.blockY = pos.y;
mop.blockZ = pos.z;
}
return mop;
}
示例14: getPlayerLookingAtBlock
public ChunkPosition getPlayerLookingAtBlock(EntityPlayerMP player, float reach)
{
Vec3 vec3d = Vec3.createVectorHelper(player.posX, (player.posY + 1.6200000000000001D) - player.yOffset, player.posZ);
Vec3 vec3d1 = player.getLook(1.0F);
Vec3 vec3d2 = vec3d.addVector(vec3d1.xCoord * reach, vec3d1.yCoord * reach, vec3d1.zCoord * reach);
MovingObjectPosition hit = player.worldObj.rayTraceBlocks(vec3d, vec3d2);
if(hit == null || hit.typeOfHit != MovingObjectType.BLOCK)
{
return null;
}
return new ChunkPosition(hit.blockX, hit.blockY, hit.blockZ);
}
示例15: onItemRightClick
@Override
public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player)
{
MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);
if (mop == null)
return is;
if (mop.typeOfHit == MovingObjectType.BLOCK)
{
int x = mop.blockX;
int y = mop.blockY;
int z = mop.blockZ;
if (!world.canMineBlock(player, x, y, z))
return is;
if (mop.sideHit == 0) --y;
if (mop.sideHit == 1) ++y;
if (mop.sideHit == 2) --z;
if (mop.sideHit == 3) ++z;
if (mop.sideHit == 4) --x;
if (mop.sideHit == 5) ++x;
tryPlaceContainedLiquid(world, x, y, z);
return new ItemStack(TFCItems.blueSteelBucketEmpty);
}
return is;
}