本文整理汇总了Java中net.minecraft.world.World.addBlockEvent方法的典型用法代码示例。如果您正苦于以下问题:Java World.addBlockEvent方法的具体用法?Java World.addBlockEvent怎么用?Java World.addBlockEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.addBlockEvent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkForMove
import net.minecraft.world.World; //导入方法依赖的package包/类
private void checkForMove(World worldIn, BlockPos pos, IBlockState state)
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
boolean flag = this.shouldBeExtended(worldIn, pos, enumfacing);
if (flag && !((Boolean)state.getValue(EXTENDED)).booleanValue())
{
if ((new BlockPistonStructureHelper(worldIn, pos, enumfacing, true)).canMove())
{
worldIn.addBlockEvent(pos, this, 0, enumfacing.getIndex());
}
}
else if (!flag && ((Boolean)state.getValue(EXTENDED)).booleanValue())
{
worldIn.setBlockState(pos, state.withProperty(EXTENDED, Boolean.valueOf(false)), 2);
worldIn.addBlockEvent(pos, this, 1, enumfacing.getIndex());
}
}
示例2: checkForMove
import net.minecraft.world.World; //导入方法依赖的package包/类
private void checkForMove(World worldIn, BlockPos pos, IBlockState state)
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
boolean flag = this.shouldBeExtended(worldIn, pos, enumfacing);
if (flag && !((Boolean)state.getValue(EXTENDED)).booleanValue())
{
if ((new BlockPistonStructureHelper(worldIn, pos, enumfacing, true)).canMove())
{
worldIn.addBlockEvent(pos, this, 0, enumfacing.getIndex());
}
}
else if (!flag && ((Boolean)state.getValue(EXTENDED)).booleanValue())
{
worldIn.addBlockEvent(pos, this, 1, enumfacing.getIndex());
}
}
示例3: onNeighborBlockChange
import net.minecraft.world.World; //导入方法依赖的package包/类
/**
* Called when a neighboring block changes.
*/
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityBeacon)
{
((TileEntityBeacon)tileentity).updateBeacon();
worldIn.addBlockEvent(pos, this, 1, 0);
}
}
示例4: triggerNote
import net.minecraft.world.World; //导入方法依赖的package包/类
public void triggerNote(World worldIn, BlockPos p_175108_2_)
{
if (worldIn.getBlockState(p_175108_2_.up()).getBlock().getMaterial() == Material.air)
{
Material material = worldIn.getBlockState(p_175108_2_.down()).getBlock().getMaterial();
int i = 0;
if (material == Material.rock)
{
i = 1;
}
if (material == Material.sand)
{
i = 2;
}
if (material == Material.glass)
{
i = 3;
}
if (material == Material.wood)
{
i = 4;
}
worldIn.addBlockEvent(p_175108_2_, Blocks.noteblock, i, this.note);
}
}
示例5: neighborChanged
import net.minecraft.world.World; //导入方法依赖的package包/类
/**
* Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
* change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
* block, etc.
*/
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityBeacon)
{
((TileEntityBeacon)tileentity).updateBeacon();
worldIn.addBlockEvent(pos, this, 1, 0);
}
}
示例6: triggerNote
import net.minecraft.world.World; //导入方法依赖的package包/类
public void triggerNote(World worldIn, BlockPos posIn)
{
if (worldIn.getBlockState(posIn.up()).getMaterial() == Material.AIR)
{
Material material = worldIn.getBlockState(posIn.down()).getMaterial();
int i = 0;
if (material == Material.ROCK)
{
i = 1;
}
if (material == Material.SAND)
{
i = 2;
}
if (material == Material.GLASS)
{
i = 3;
}
if (material == Material.WOOD)
{
i = 4;
}
worldIn.addBlockEvent(posIn, Blocks.NOTEBLOCK, i, this.note);
}
}
示例7: neighborChanged
import net.minecraft.world.World; //导入方法依赖的package包/类
/**
* Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
* change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
* block, etc.
*/
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityBeacon)
{
((TileEntityBeacon)tileentity).updateBeacon();
worldIn.addBlockEvent(pos, this, 1, 0);
}
}