本文整理汇总了Java中net.minecraftforge.event.entity.EntityJoinWorldEvent.setCanceled方法的典型用法代码示例。如果您正苦于以下问题:Java EntityJoinWorldEvent.setCanceled方法的具体用法?Java EntityJoinWorldEvent.setCanceled怎么用?Java EntityJoinWorldEvent.setCanceled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.entity.EntityJoinWorldEvent
的用法示例。
在下文中一共展示了EntityJoinWorldEvent.setCanceled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEntityJoinWorld
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityJoinWorld(EntityJoinWorldEvent event) {
int i = 0;
for (SpawnRule rule : RulesManager.rules) {
if (rule.isOnJoin() && rule.match(event)) {
Event.Result result = rule.getResult();
if (debug) {
InControl.logger.log(Level.INFO, "Join Rule " + i + ": "+ result
+ " entity: " + event.getEntity().getName()
+ " y: " + event.getEntity().getPosition().getY());
}
if (result != Event.Result.DENY) {
rule.action(event);
} else {
event.setCanceled(true);
}
return;
}
i++;
}
}
示例2: checkSpawn
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void checkSpawn (EntityJoinWorldEvent event) {
if (event.getEntity() instanceof EntitySlime && !event.getEntity().hasCustomName()) {
for (final TileEntity tile : event.getWorld().loadedTileEntityList) {
if (tile instanceof TileEntityAntiSlime && ((TileEntityAntiSlime) tile).shareChunks((EntityLivingBase) event.getEntity())) {
if (event.getWorld().isBlockPowered(tile.getPos())) {
continue;
}
event.setCanceled(true);
event.getEntity().setDead();
break;
}
}
}
}
示例3: on
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void on(EntityJoinWorldEvent event) {
if(!event.world.isRemote && event.entity instanceof EntityItem) {
ItemStack stack = ((EntityItem) event.entity).getEntityItem();
if(isDisguised(stack)) {
long time = event.world.getTotalWorldTime() + event.world.rand.nextInt(60) + 40;
trackedItems.put((EntityItem) event.entity, time);
}
if(stack.getItem() instanceof ItemElement && !(event.entity instanceof EntityItemElement)) {
event.setCanceled(true);
EntityItem newItem = new EntityItemElement(event.world,
event.entity.posX, event.entity.posY, event.entity.posZ,
((EntityItem) event.entity).getEntityItem());
newItem.delayBeforeCanPickup = ((EntityItem) event.entity).delayBeforeCanPickup;
newItem.motionX = event.entity.motionX;
newItem.motionY = event.entity.motionY;
newItem.motionZ = event.entity.motionZ;
event.world.spawnEntityInWorld(newItem);
}
}
}
示例4: onEntitySpawn
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onEntitySpawn(EntityJoinWorldEvent event)
{
if(event.entity.worldObj.isRemote && event.entity instanceof EntityMeteorite && FMLCommonHandler.instance().getEffectiveSide().isClient() && !event.entity.isDead)
{
event.setCanceled(true);
if(!event.entity.worldObj.weatherEffects.contains(event.entity))
{
boolean has = false;
for(int i = 0; i < event.entity.worldObj.weatherEffects.size(); i++)
{
Entity ent = (Entity)event.entity.worldObj.weatherEffects.get(i);
if(ent instanceof EntityMeteorite && ent.getEntityId() == event.entity.getEntityId())
{
has = true;
ent.setLocationAndAngles(event.entity.posX, event.entity.posY, event.entity.posZ, 0F, 0F);
break;
}
}
if(!has)
{
event.entity.worldObj.weatherEffects.add(event.entity);
}
}
}
}
示例5: onEntityJoinWorldEvent
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityJoinWorldEvent(EntityJoinWorldEvent e) {
if (!e.getWorld().isRemote) {
List<TileEntity> loadedTileEntityList = e.getWorld().loadedTileEntityList;
for (int i = loadedTileEntityList.size() - 1; i >= 0; i--) {
TileEntity tileEntity = loadedTileEntityList.get(i);
if (tileEntity instanceof OfferingBoxTileEntity) {
if (((OfferingBoxTileEntity) tileEntity).getChargeLevel() > 0) {
if (TotemHelper.hasTotemType((OfferingBoxTileEntity) tileEntity, TotemType.COW)) {
Modifiers mods = TotemHelper.getModifiers(e.getWorld(), (OfferingBoxTileEntity) tileEntity);
int radius = TotemHelper.DEFAULT_RADIUS + (int) (TotemHelper.RANGE_BOOST * mods.range);
if (!canSpawnMobHere(tileEntity.getPos(), e.getEntity(), radius)) {
//FMLLog.log(Level.ERROR, "Stopped mob from spawning with radius: " + radius);
e.setCanceled(true);
break;
}
}
}
}
}
}
}
示例6: onEntityJoinWorldEvent
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityJoinWorldEvent(EntityJoinWorldEvent e) {
if (!e.getWorld().isRemote) {
List<TileEntity> loadedTileEntityList = new ArrayList<>(e.getWorld().loadedTileEntityList);
for (TileEntity tileEntity : loadedTileEntityList) {
if (tileEntity instanceof OfferingBoxTileEntity) {
if (((OfferingBoxTileEntity) tileEntity).getChargeLevel() > 0) {
if (TotemHelper.hasTotemType((OfferingBoxTileEntity) tileEntity, TotemType.CREEPER)) {
Modifiers mods = TotemHelper.getModifiers(e.getWorld(), (OfferingBoxTileEntity) tileEntity);
int radius = TotemHelper.DEFAULT_RADIUS + (int) (TotemHelper.RANGE_BOOST * mods.range);
if (!canSpawnMobHere(tileEntity.getPos(), e.getEntity(), radius)) {
//FMLLog.log(Level.ERROR, "Stopped mob from spawning with radius: " + radius);
e.setCanceled(true);
break;
}
}
}
}
}
}
}
示例7: onBlockFall
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onBlockFall(EntityJoinWorldEvent event) {
if (event.getEntity() != null && event.getEntity() instanceof EntityFallingBlock) {
EntityPlayer player = event.getEntity().worldObj.getClosestPlayerToEntity(event.getEntity(), range);
if (player != null && player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() == UCItems.precisionShovel) {
if (NBTUtils.getInt(player.getHeldItemMainhand(), ItemGeneric.TAG_UPGRADE, -1) == 10)
event.setCanceled(true);
}
}
}
示例8: handleRespawnOfNemesis
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
private void handleRespawnOfNemesis(EntityJoinWorldEvent event) {
Entity entity = event.getEntity();
NemesisEntry nemesis = NemesisUtil.loadNemesisFromEntity(event.getEntity());
if (nemesis == null) {
/*
* missing nemesis data
*/
entity.setDead();
event.setCanceled(true);
} else if (entity.getTags().contains(NemesisSystem.TAG_SPAWNING)) {
/*
* new nemesis spawn in progress
*/
entity.removeTag(NemesisSystem.TAG_SPAWNING);
nemesis.setSpawned(entity.getEntityId());
nemesis.setUnloaded(null);
NemesisRegistryProvider.get(entity.world).update(nemesis);
sendNemesisDataToClient(nemesis);
} else if (!nemesis.isSpawned()) {
/*
* nemesis has been marked as despawned
*/
event.setCanceled(true);
} else {
/*
* nemesis is marked unloaded, mark as loaded now he is respawning
*/
if (!entity.getPersistentID().equals(nemesis.getEntityUuid())) {
event.setCanceled(true);
return;
}
nemesis.setSpawned(entity.getEntityId());
nemesis.setUnloaded(null);
nemesis.setLastSpawned(entity.world.getTotalWorldTime());
NemesisRegistryProvider.get(event.getWorld()).update(nemesis);
sendNemesisDataToClient(nemesis);
}
}
示例9: onEntityCreation
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityCreation(EntityJoinWorldEvent event){
if(Config.lockedTimeFalling && (event.getEntity() instanceof EntityFallingBlock)){
if(LockedTimeData.get(event.getWorld()).getNumRunes()>0){
EntityFallingBlock fb = (EntityFallingBlock)event.getEntity();
IBlockState state = fb.getBlock();
fb.setDead();
event.getWorld().setBlockState(fb.getPosition(), state);
event.setCanceled(true);
}
}
}
示例10: entitySpawn
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void entitySpawn(EntityJoinWorldEvent event){
if(ConfigValues.XPOVERRIDE && !event.getWorld().isRemote && event.getEntity().getClass() == EntityXPOrb.class){
event.setCanceled(true);
EntityXPOrb xp = (EntityXPOrb) event.getEntity();
EntityCustomXPOrb newXP = new EntityCustomXPOrb(xp.world, xp.posX, xp.posY, xp.posZ, xp.xpValue);
event.getWorld().spawnEntity(newXP);
}
}
示例11: entityJoinWorldEvent
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void entityJoinWorldEvent(EntityJoinWorldEvent event) {
Entity entity = event.getEntity();
if (ExtendedConfig.overrideVanillaFishing && entity instanceof EntityFishHook && entity.getClass().equals(EntityFishHook.class)) {
World world = event.getWorld();
if (!world.isRemote) {
EntityPlayer player = ((EntityFishHook) entity).getAngler();
ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND);
if (stack.getItem() != Items.FISHING_ROD) {
stack = player.getHeldItem(EnumHand.OFF_HAND);
}
entity.setDead();
EntityCustomFishHook hook = new EntityCustomFishHook(world, player);
int speed = EnchantmentHelper.getFishingSpeedBonus(stack);
if (speed > 0) {
hook.setLureSpeed(speed);
}
int luck = EnchantmentHelper.getFishingLuckBonus(stack);
if (luck > 0) {
hook.setLuck(luck);
}
world.spawnEntity(hook);
}
event.setCanceled(true);
}
}
示例12: onEntitySpawn
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntitySpawn(EntityJoinWorldEvent event)
{
if(event.entity instanceof EntityItem && isMonitoring)
{
event.setCanceled(true);
}
}
示例13: onEntityJoin
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityJoin(EntityJoinWorldEvent event)
{
Entity entity = event.entity;
Class<?> entityClass = entity.getClass();
if (blockedMobClasses.containsValue(entityClass) && SprinklesForVanilla.isOnServer)
{
if (entityClass == EntityZombie.class)
{
if (blockedMobClasses.containsKey("zombieVillager") && ((EntityZombie) entity).isVillager())
{
event.setCanceled(true);
}
else if (blockedMobClasses.containsKey("zombie") && !((EntityZombie) entity).isVillager())
{
event.setCanceled(true);
}
}
else if (entityClass == EntitySkeleton.class)
{
if (blockedMobClasses.containsKey("skeleton") && ((EntitySkeleton) entity).getSkeletonType() == 0)
{
event.setCanceled(true);
}
else if (blockedMobClasses.containsKey("witherSkeleton") && ((EntitySkeleton) entity).getSkeletonType() == 1)
{
event.setCanceled(true);
}
}
else
{
event.setCanceled(true);
}
}
}
示例14: entityJoin
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void entityJoin(EntityJoinWorldEvent evt) {
if (!evt.world.isRemote && evt.entity instanceof EntityPlayerMP) {
packetPipeline.sendTo(new WorldDataPacket(evt.world.getSeed()), (EntityPlayerMP)evt.entity);
}
if (evt.entity instanceof EntityZombie) {
if (((EntityZombie)evt.entity).isChild()) {
((EntityZombie)evt.entity).setChild(false);
evt.setCanceled(true);
}
}
}
示例15: onJoinWorld
import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onJoinWorld(EntityJoinWorldEvent event)
{
if (event.getWorld().isRemote == false)
{
if ((event.getEntity() instanceof EntityLiving) && event.getEntity().getTags().contains(ItemSyringe.TAG_PASSIFIED))
{
ItemSyringe.passifyEntity((EntityLiving) event.getEntity());
}
else if (preventItemSpawningInWorld && (event.getEntity() instanceof EntityItem))
{
event.setCanceled(true);
}
}
}