本文整理匯總了Java中net.minecraftforge.event.entity.living.EnderTeleportEvent.setCanceled方法的典型用法代碼示例。如果您正苦於以下問題:Java EnderTeleportEvent.setCanceled方法的具體用法?Java EnderTeleportEvent.setCanceled怎麽用?Java EnderTeleportEvent.setCanceled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.event.entity.living.EnderTeleportEvent
的用法示例。
在下文中一共展示了EnderTeleportEvent.setCanceled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPlayerPearl
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onPlayerPearl(EnderTeleportEvent event)
{
if ( !(event.getEntityLiving() instanceof EntityPlayerMP) )
return;
if ( Config.getKnockBack() == 0.0 || !Config.getDenyEnderpearl() )
return;
EntityPlayerMP player = (EntityPlayerMP) event.getEntityLiving();
Log.trace( "Caught pearl teleport event by %s", player.getDisplayName() );
Location target = new Location(event, player);
Location newLoc = BorderCheck.checkPlayer(player, target, true, true);
if (newLoc != null)
{
event.setCanceled(true);
event.setTargetX(newLoc.posX);
event.setTargetY(newLoc.posY);
event.setTargetZ(newLoc.posZ);
}
}
示例2: magnumTorchDenyTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void magnumTorchDenyTeleport(final EnderTeleportEvent event) {
if (event.entityLiving instanceof EntityEnderman && !((EntityEnderman)event.entityLiving).isScreaming()) {
for (final int[] coord : EventHandlerServer.magnumTorchRegistry) {
if (coord[0] == event.entity.worldObj.provider.dimensionId && event.entity.worldObj.blockExists(coord[1], coord[2], coord[3]) && event.entity.worldObj.getTileEntity(coord[1], coord[2], coord[3]) instanceof IAntiMobTorch) {
final TileEntity tile = event.entity.worldObj.getTileEntity(coord[1], coord[2], coord[3]);
final double dx = tile.xCoord + 0.5f - event.targetX;
final double dy = tile.yCoord + 0.5f - event.targetY;
final double dz = tile.zCoord + 0.5f - event.targetZ;
if ((dx * dx + dz * dz) / ((IAntiMobTorch)tile).getHorizontalTorchRangeSquared() + dy * dy / ((IAntiMobTorch)tile).getVerticalTorchRangeSquared() > 1.0) {
continue;
}
final double dx2 = tile.xCoord + 0.5f - event.entity.posX;
final double dy2 = tile.yCoord + 0.5f - event.entity.posY;
final double dz2 = tile.zCoord + 0.5f - event.entity.posZ;
if (dx * dx + dy * dy + dz * dz >= dx2 * dx2 + dy2 * dy2 + dz2 * dz2) {
continue;
}
event.setCanceled(true);
}
}
}
}
示例3: onPlayerPearl
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onPlayerPearl(EnderTeleportEvent event)
{
if ( !(event.entityLiving instanceof EntityPlayerMP) )
return;
if ( Config.getKnockBack() == 0.0 || !Config.getDenyEnderpearl() )
return;
EntityPlayerMP player = (EntityPlayerMP) event.entityLiving;
Log.trace( "Caught pearl teleport event by %s", player.getDisplayName() );
Location target = new Location(event, player);
Location newLoc = BorderCheck.checkPlayer(player, target, true, true);
if (newLoc != null)
{
event.setCanceled(true);
event.targetX = newLoc.posX;
event.targetY = newLoc.posY;
event.targetZ = newLoc.posZ;
}
}
示例4: onTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@Override
public void onTeleport(EnderTeleportEvent event, EntityLivingBase entity, double targetX, double targetY, double targetZ, int amplifier) {
int redo = 5 - amplifier;
if (redo < 0 || entity.world.rand.nextInt(redo) == 0) {
event.setCanceled(true);
}
}
示例5: onEnderTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onEnderTeleport(EnderTeleportEvent event) {
if (isTeleportPrevented(event.getEntity().getEntityWorld(), event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, false)) {
event.setCanceled(true);
}
if (isTeleportPrevented(event.getEntity().getEntityWorld(), event.getTargetX(), event.getTargetY(), event.getTargetZ(), true)) {
event.setCanceled(true);
}
}
示例6: BlockMobTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void BlockMobTeleport(EnderTeleportEvent event){
if (!event.isCancelable()){return;}
for (MobInhibitorReference Ref : MobInhibitor.HostileInhibitors){
if (TestRange(Ref, event.targetX, event.targetY, event.targetZ, event.entity.worldObj.provider.dimensionId)) {
event.setCanceled(true);
LogHelper.debug("Blocked an Enderman teleport based on inhibitor at:"+Ref.i+", "+Ref.j+", "+Ref.k);
break;
}
}
}
示例7: on
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void on(EnderTeleportEvent e) {
if (!(e.entityLiving instanceof EntityPlayer) && !(e.entityLiving instanceof IBossDisplayData)) {
if (TileBlockProtector.isSpotProtected(e.entityLiving.worldObj, e.entityLiving)) {
e.setCanceled(true);
}
}
}
示例8: onEnderTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onEnderTeleport(EnderTeleportEvent event) {
// stop enderpearls from working
if (event.entityLiving.worldObj.provider.dimensionId == Reference.DIMENSION_ID) {
event.setCanceled(true);
}
}
示例9: onEnderTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onEnderTeleport(EnderTeleportEvent event){
if(!HackableEnderman.onEndermanTeleport(event.entity)) {
event.setCanceled(true);
} else {
if(Config.enableEndermanSeedDrop && Math.random() < 0.05D) {
if(!event.entity.worldObj.isRemote) ItemPlasticPlants.markInactive(event.entity.entityDropItem(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.ENDER_PLANT_DAMAGE), 0));
}
}
}
示例10: onEnderTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onEnderTeleport(EnderTeleportEvent event) {
if (isTeleportPrevented(event.getEntity().world, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ)) {
event.setCanceled(true);
}
if (isTeleportPrevented(event.getEntity().world, event.getTargetX(), event.getTargetY(), event.getTargetZ())) {
event.setCanceled(true);
}
}
示例11: onEnderTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onEnderTeleport(EnderTeleportEvent event) {
if (!HackableEnderman.onEndermanTeleport(event.getEntity())) {
event.setCanceled(true);
}
}
示例12: stopEndermanTeleporting
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void stopEndermanTeleporting(EnderTeleportEvent e){
if((e.getEntity() instanceof EntityEnderman || e.getEntity() instanceof EntityShulker) && ConfigurationFile.stopMobsFromTeleporting){
e.setCanceled(true);
}
}
示例13: onEvent
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@Override
public void onEvent(EnderTeleportEvent event) {
if (!this.endermanteleport) event.setCanceled(true);
}
示例14: onEnderTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@ForgeSubscribe
public void onEnderTeleport(EnderTeleportEvent event){
if(event.entityLiving.isPotionActive(PotionFreeze.instance)){
event.setCanceled(true);
}
}
示例15: onEndermanTeleport
import net.minecraftforge.event.entity.living.EnderTeleportEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onEndermanTeleport(EnderTeleportEvent event) {
if (event.getEntityLiving() instanceof EntityEnderman && event.getEntityLiving().getEntityData().getBoolean("EIO:tracked")) {
event.setCanceled(true);
}
}