本文整理汇总了Java中net.minecraft.block.BlockObserver类的典型用法代码示例。如果您正苦于以下问题:Java BlockObserver类的具体用法?Java BlockObserver怎么用?Java BlockObserver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockObserver类属于net.minecraft.block包,在下文中一共展示了BlockObserver类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_190529_b
import net.minecraft.block.BlockObserver; //导入依赖的package包/类
public void func_190529_b(BlockPos p_190529_1_, final Block p_190529_2_, BlockPos p_190529_3_)
{
if (!this.isRemote)
{
IBlockState iblockstate = this.getBlockState(p_190529_1_);
if (iblockstate.getBlock() == Blocks.field_190976_dk)
{
try
{
((BlockObserver)iblockstate.getBlock()).func_190962_b(iblockstate, this, p_190529_1_, p_190529_2_, p_190529_3_);
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception while updating neighbours");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being updated");
crashreportcategory.setDetail("Source block type", new ICrashReportDetail<String>()
{
public String call() throws Exception
{
try
{
return String.format("ID #%d (%s // %s)", new Object[] {Integer.valueOf(Block.getIdFromBlock(p_190529_2_)), p_190529_2_.getUnlocalizedName(), p_190529_2_.getClass().getCanonicalName()});
}
catch (Throwable var2)
{
return "ID #" + Block.getIdFromBlock(p_190529_2_);
}
}
});
CrashReportCategory.addBlockInfo(crashreportcategory, p_190529_1_, iblockstate);
throw new ReportedException(crashreport);
}
}
}
}
示例2: dispense
import net.minecraft.block.BlockObserver; //导入依赖的package包/类
/**
* pulled from BlockDispenser
*
* @param worldIn
* @param pos
*/
protected void dispense(BlockPos pos) {
if (this.timeSinceDropped > 0) {
this.timeSinceDropped--;
return;
}
this.timeSinceDropped = TIME_BTW_DROPS;
EnumFacing enumfacing = this.getDisplayTile().getValue(BlockObserver.FACING);
shootThisDirection(enumfacing);
shootThisDirection(enumfacing.getOpposite());
}
示例3: moveAlongTrack
import net.minecraft.block.BlockObserver; //导入依赖的package包/类
@Override
protected void moveAlongTrack(BlockPos pos, IBlockState state) {
BlockRailBase blockrailbase = (BlockRailBase) state.getBlock();
if (blockrailbase != Blocks.ACTIVATOR_RAIL) {
this.timeSinceDropped = 0;
}
//force DISPENSER to face sime direction as my movemene
// double slopeAdjustment = getSlopeAdjustment();
BlockRailBase.EnumRailDirection raildirection = blockrailbase.getRailDirection(world, pos, state, this);
EnumFacing fac = null;
switch (raildirection) {
case ASCENDING_EAST:
fac = EnumFacing.EAST;
break;
case ASCENDING_WEST:
fac = EnumFacing.WEST;
break;
case ASCENDING_NORTH:
fac = EnumFacing.NORTH;
break;
case ASCENDING_SOUTH:
fac = EnumFacing.SOUTH;
case EAST_WEST:
fac = (this.motionX > 0) ? EnumFacing.SOUTH : EnumFacing.NORTH;
break;
case NORTH_SOUTH:
fac = (this.motionZ < 0) ? EnumFacing.WEST : EnumFacing.EAST;
break;
default:
break;
}
super.moveAlongTrack(pos, state);
if (fac != null) {
this.setDisplayTile(getDefaultDisplayTile().withProperty(BlockObserver.FACING, fac));
}
}