本文整理汇总了Java中cpw.mods.fml.common.eventhandler.Event.setCanceled方法的典型用法代码示例。如果您正苦于以下问题:Java Event.setCanceled方法的具体用法?Java Event.setCanceled怎么用?Java Event.setCanceled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cpw.mods.fml.common.eventhandler.Event
的用法示例。
在下文中一共展示了Event.setCanceled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkBlockInteraction
import cpw.mods.fml.common.eventhandler.Event; //导入方法依赖的package包/类
public static void checkBlockInteraction(Resident res, BlockPos bp, PlayerInteractEvent.Action action, Event ev) {
if(!ev.isCancelable()) {
return;
}
World world = MinecraftServer.getServer().worldServerForDimension(bp.getDim());
Block block = world.getBlock(bp.getX(), bp.getY(), bp.getZ());
// Bypass for SellSign
if (block instanceof BlockSign) {
TileEntity te = world.getTileEntity(bp.getX(), bp.getY(), bp.getZ());
if(te instanceof TileEntitySign && SellSign.SellSignType.instance.isTileValid((TileEntitySign) te)) {
return;
}
}
for(SegmentBlock segment : segmentsBlock.get(block.getClass())) {
if(!segment.shouldInteract(res, bp, action)) {
ev.setCanceled(true);
}
}
}
示例2: checkImpact
import cpw.mods.fml.common.eventhandler.Event; //导入方法依赖的package包/类
public static void checkImpact(Entity entity, Resident owner, MovingObjectPosition mop, Event event) {
for(SegmentEntity segment : segmentsEntity.get(entity.getClass())) {
if(!segment.shouldImpact(entity, owner, mop)) {
event.setCanceled(true);
entity.isDead = true;
entity.setDead();
}
}
}
示例3: checkInteraction
import cpw.mods.fml.common.eventhandler.Event; //导入方法依赖的package包/类
public static void checkInteraction(Entity entity, Resident res, Event event) {
if(!event.isCancelable()) {
return;
}
for(SegmentEntity segment : segmentsEntity.get(entity.getClass())) {
if(!segment.shouldInteract(entity, res)) {
event.setCanceled(true);
}
}
}
示例4: checkPVP
import cpw.mods.fml.common.eventhandler.Event; //导入方法依赖的package包/类
public static void checkPVP(Entity entity, Resident res, Event event) {
if(!event.isCancelable()) {
return;
}
for(SegmentEntity segment : segmentsEntity.get(entity.getClass())) {
if(!segment.shouldAttack(entity, res)) {
event.setCanceled(true);
}
}
}
示例5: checkUsage
import cpw.mods.fml.common.eventhandler.Event; //导入方法依赖的package包/类
public static void checkUsage(ItemStack stack, Resident res, PlayerInteractEvent.Action action, BlockPos bp, int face, Event ev) {
if(!ev.isCancelable()) {
return;
}
for(SegmentItem segment : segmentsItem.get(stack.getItem().getClass())) {
if(!segment.shouldInteract(stack, res, action, bp, face)) {
ev.setCanceled(true);
}
}
}
示例6: checkBreakWithItem
import cpw.mods.fml.common.eventhandler.Event; //导入方法依赖的package包/类
public static void checkBreakWithItem(ItemStack stack, Resident res, BlockPos bp, Event ev) {
if(!ev.isCancelable()) {
return;
}
for(SegmentItem segment : segmentsItem.get(stack.getItem().getClass())) {
if(!segment.shouldBreakBlock(stack, res, bp)) {
ev.setCanceled(true);
}
}
}