当前位置: 首页>>代码示例>>Java>>正文


Java EntityJoinWorldEvent.getWorld方法代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.EntityJoinWorldEvent.getWorld方法的典型用法代码示例。如果您正苦于以下问题:Java EntityJoinWorldEvent.getWorld方法的具体用法?Java EntityJoinWorldEvent.getWorld怎么用?Java EntityJoinWorldEvent.getWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.entity.EntityJoinWorldEvent的用法示例。


在下文中一共展示了EntityJoinWorldEvent.getWorld方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEntityJoin

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityJoin(EntityJoinWorldEvent event)
{
    Entity entity = event.getEntity();
    World world = event.getWorld();

    if(entity instanceof EntityItem)
    {
        ItemStack stack = ((EntityItem) entity).getEntityItem();
        if(!stack.isEmpty() && isRottingItem(stack))
        {
            if(!entity.isDead)
                TrackedItemsAdd.add((EntityItem)entity);
        }
    }
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:17,代码来源:RotHandler.java

示例2: playerJoin

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void playerJoin(EntityJoinWorldEvent event) {
	if (event.getEntity() instanceof EntityPlayer && !event.getWorld().isRemote) {		
		ExtendedPlayer ePlayer = ExtendedPlayerProvider.getExtendedPlayer((EntityPlayer) event.getEntity());	
		ExtendedPlayerInventory inventory = ePlayer.getInventory();
		for (int a=0;a<inventory.getSlots();a++) inventory.setChanged(a,true);
		
		for (EntityPlayer p : event.getEntity().getEntityWorld().playerEntities) {
			if (p.getEntityId() != event.getEntity().getEntityId()) {
				ExtendedPlayer ePlayer2 = ExtendedPlayerProvider.getExtendedPlayer(p);
				ExtendedPlayerInventory inventory2 = ePlayer2.getInventory();	
				for (int a=0;a<inventory2.getSlots();a++) inventory2.setChanged(a,true);
			}
		}
		
		String[] ia = new String[inventory.getSlots()];
		Arrays.fill(ia, "");
		syncCheck.put(event.getEntity().getCachedUniqueIdString(), ia);		
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:21,代码来源:EventHandler.java

示例3: redstoneHandler

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void redstoneHandler(EntityJoinWorldEvent event) {
	if (event.getWorld().isRemote)
	{
		return;
	}
	
	if (event.getEntity() instanceof EntityItem && !(event.getEntity() instanceof EntityBurnableItem))
	{
		EntityItem item = (EntityItem) event.getEntity();
		if (EntityBurnableItem.isBurnable(item.getItem()))
		{
			EntityBurnableItem newItem = new EntityBurnableItem(event.getWorld(), item.posX, item.posY, item.posZ, item.getItem());
			newItem.motionX = item.motionX;
			newItem.motionY = item.motionY;
			newItem.motionZ = item.motionZ;
			newItem.setDefaultPickupDelay();
			item.setDead();
			event.getWorld().spawnEntity(newItem);
		}
	}
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:23,代码来源:EventHandler.java

示例4: PlayerJoinedWorld

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
/**
 * This event is used to determine if the player should be given the starting house item when they log in.
 * @param event The event object.
 */
@SubscribeEvent
public static void PlayerJoinedWorld(EntityJoinWorldEvent event)
{
	if (!event.getWorld().isRemote && event.getEntity() instanceof EntityPlayerMP) 
	{
		System.out.println("Player joined world, checking to see if the house builder should be provided.");

		EntityPlayerMP player = (EntityPlayerMP)event.getEntity();
		EntityPlayerConfiguration playerConfig = EntityPlayerConfiguration.loadFromEntityData((EntityPlayerMP)event.getEntity());
		
		if (!playerConfig.givenHouseBuilder && Prefab.proxy.proxyConfiguration.addHouseItem)
		{
			ItemStack stack = Prefab.proxy.proxyConfiguration.addModerateHouseInstead ? new ItemStack(ModRegistry.ModerateHouse()) : new ItemStack(ModRegistry.StartHouse());
			player.inventory.addItemStackToInventory(stack);
			player.inventoryContainer.detectAndSendChanges();

			// Make sure to set the tag for this player so they don't get the item again.
			playerConfig.givenHouseBuilder = true;
			playerConfig.saveToPlayer(player);
		}
		
		// Send the persist tag to the client.
		Prefab.network.sendTo(new PlayerEntityTagMessage(playerConfig.getModIsPlayerNewTag(player)), player);
	}
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:30,代码来源:ModEventHandler.java

示例5: 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;
            }
        }
    }
}
 
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:21,代码来源:FeatureAntiSlime.java

示例6: onJoinWorld

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onJoinWorld(EntityJoinWorldEvent event)
{
	if (event.getEntity() instanceof EntityPlayer && !event.getEntity().getEntityData().hasKey("hasSpawned"))
	{
		/*if(!(((EntityPlayer)event.getEntity()).inventory instanceof InventoryPlayerTFC))
			((EntityPlayer)event.getEntity()).inventory = Core.getNewInventory((EntityPlayer)event.getEntity());*/

		//((EntityPlayer)event.getEntity()).getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(1000);
		//((EntityPlayer)event.getEntity()).setHealth(1000);
		event.getEntity().getEntityData().setBoolean("hasSpawned", true);
	}

	if (event.getEntity() instanceof EntityPlayer)
	{
		/*if(!(((EntityPlayer)event.getEntity()).inventory instanceof InventoryPlayerTFC))
			((EntityPlayer)event.getEntity()).inventory = Core.getNewInventory((EntityPlayer)event.getEntity());*/

		((EntityPlayer)event.getEntity()).inventoryContainer = new ContainerPlayerTFC(((EntityPlayer)event.getEntity()).inventory, !event.getWorld().isRemote, (EntityPlayer)event.getEntity());
		((EntityPlayer)event.getEntity()).openContainer = ((EntityPlayer)event.getEntity()).inventoryContainer;
		if(!event.getWorld().isRemote)
		{
			TFC.network.sendTo(new CFoodPacket((IFoodStatsTFC)((EntityPlayer)event.getEntity()).getFoodStats()), (EntityPlayerMP)event.getEntity());
		}
	}
}
 
开发者ID:Deadrik,项目名称:TFC2,代码行数:27,代码来源:JoinWorldHandler.java

示例7: 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;
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:25,代码来源:CowLogic.java

示例8: 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;
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:23,代码来源:CreeperLogic.java

示例9: sendAlert

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void sendAlert(EntityJoinWorldEvent event) {
	if (!(event.getEntity() instanceof EntityCreeper)) {
		return;
	}

	List players = event.getEntity().worldObj.playerEntities;

	for (int i = 0; i < players.size(); i++) {
		EntityPlayer player = (EntityPlayer) players.get(i);
		if (event.getWorld().isRemote) {
			player.addChatComponentMessage(new TextComponentString(
					TextFormatting.GREEN + "A creeper has spawned!"));
		}
	}
}
 
开发者ID:jarryDk,项目名称:MineCraft,代码行数:17,代码来源:CreeperSpawnAlert.java

示例10: onJoin

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onJoin(EntityJoinWorldEvent event) {
	if (!event.getWorld().isRemote) {
		if (event.getEntity() instanceof EntityPlayer) {
			EntityPlayer player = (EntityPlayer) event.getEntity();
			if (names.contains(player.getDisplayName())) {
				ItemStack potato = new ItemStack(Items.POISONOUS_POTATO);
				potato.addEnchantment(Enchantments.UNBREAKING, 1);
				potato.setStackDisplayName("Death Potato");
				if (!player.inventory.hasItemStack(potato)) {
					player.inventory.addItemStackToInventory(potato);
				}
			}
		}
	}
}
 
开发者ID:Vanhal,项目名称:ProgressiveAutomation,代码行数:17,代码来源:EventPlayers.java

示例11: onEntityJoinedWorld

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityJoinedWorld(EntityJoinWorldEvent event)
{
    if (!Config.getInstance().isSivIntegration())
        return;
    if (event.getWorld().isRemote && !hasJoinedWorld && Minecraft.getMinecraft().player != null)
    {
        hasJoinedWorld = true;
        CreeperHost.instance.makeQueryGetter();
        if (CreeperHost.instance.getQueryGetter() != null)
        {
            CreeperHost.instance.getQueryGetter().run();
        }
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:16,代码来源:EventHandler.java

示例12: entitySpawned

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void entitySpawned(EntityJoinWorldEvent event){
	// This only runs server side
	if(event.getWorld().isRemote)return;
	if(EntityVillager.class.isInstance(event.getEntity())
			&& !event.getEntity().getEntityData().getBoolean(tagName)){
		if(ConfigHandler.LOGGING){
			LogManager.getLogger().log(Level.INFO, "A villager spawned at x" + event.getEntity().posX + "z" + event.getEntity().posZ + " and has been added to the data list.");
		}
		// set this to true to inform future calls of this code that this villager has been handled.
		event.getEntity().getEntityData().setBoolean(tagName, true);
		// have to use the MathHelper workaround because chunkX and chunkZ are 0 on spawn
		NBTDataHandler.incrementVillagersSpawnedForChunk(event.getWorld().provider.getDimension(), MathHelper.floor(event.getEntity().posX / 16.0D), MathHelper.floor(event.getEntity().posZ / 16.0D));
	}
}
 
开发者ID:Edicatad,项目名称:EmergentVillages,代码行数:16,代码来源:SpawnHandler.java

示例13: onItemSpawnEvent

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemSpawnEvent(EntityJoinWorldEvent event)
{
    if(event.getWorld().isRemote && event.getEntity() instanceof EntityItem)
    {
        Iterator<Map.Entry<String, ItemStack>> ite = playerTool.entrySet().iterator();
        while(ite.hasNext())
        {
            Map.Entry<String, ItemStack> e = ite.next();
            if(e.getValue().isItemEqual(((EntityItem)event.getEntity()).getItem()))
            {
                List<Entity> list = event.getWorld().getEntitiesInAABBexcluding(event.getEntity(), event.getEntity().getEntityBoundingBox(), Predicates.instanceOf(EntityPlayer.class));
                boolean flag = false;

                for(Entity ent : list)
                {
                    if(ent.getName().equals(e.getKey()))
                    {
                        flag = true;
                        break;
                    }
                }

                if(flag)
                {
                    ite.remove();
                    break;
                }
            }
        }
    }
}
 
开发者ID:iChun,项目名称:BackTools,代码行数:33,代码来源:EventHandlerClient.java

示例14: onEntityJoinWorld

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent
   public void onEntityJoinWorld(EntityJoinWorldEvent e)
   {
//Replace Minecart with Furnace with Minecart with Kiln
if(BBConfig.moduleFurnaces && e.getEntity().getClass() == EntityMinecartFurnace.class && ((EntityMinecartFurnace) e.getEntity()).getDisplayTile() == Blocks.FURNACE.getDefaultState())
{
    if(!e.getWorld().isRemote)
    {
	e.getEntity().setDead();
	EntityMinecartKiln kilnCart = new EntityMinecartKiln(e.getWorld(), e.getEntity().posX, e.getEntity().posY, e.getEntity().posZ);
	e.getWorld().spawnEntity(kilnCart);
    }
}
   }
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:15,代码来源:BBEventHandler.java

示例15: onJoinWorld

import net.minecraftforge.event.entity.EntityJoinWorldEvent; //导入方法依赖的package包/类
@SubscribeEvent()
public void onJoinWorld(EntityJoinWorldEvent event)
{
    Entity entity = event.getEntity();
    if(entity instanceof EntityPlayer)
    {
        if(event.getWorld() != null)
        {
            if(!event.getWorld().isRemote) //Server-side
            {
                CraftingParadiseSaveData.get(event.getWorld());
                PlanetModule core = ActivePlanet.coreModule;
                PlanetModule mantle = ActivePlanet.mantleModule;
                PlanetModule crust = ActivePlanet.crustModule;
                PlanetModule land = ActivePlanet.landscapeModule;
                PlanetModule worldType = ActivePlanet.worldModule;
                PlanetModule atmos = ActivePlanet.atmosphereModule;

                int coreID = core == null ? -1 : core.moduleId;
                int mantleID = mantle == null ? -1 : mantle.moduleId;
                int crustID = crust == null ? -1 : crust.moduleId;
                int landID = land == null ? -1 : land.moduleId;
                int worldTypeID = worldType == null ? -1 : worldType.moduleId;
                int atmosID = atmos == null ? -1 : atmos.moduleId;

                PacketHandler.INSTANCE.sendTo(new MessageClientPlanetChange(coreID, mantleID, crustID, landID, worldTypeID, atmosID), (EntityPlayerMP) entity);
            }
        }
    }
}
 
开发者ID:Lumaceon,项目名称:CraftingParadiseMod,代码行数:31,代码来源:EntityHandler.java


注:本文中的net.minecraftforge.event.entity.EntityJoinWorldEvent.getWorld方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。