當前位置: 首頁>>代碼示例>>Java>>正文


Java Entity.isNonBoss方法代碼示例

本文整理匯總了Java中net.minecraft.entity.Entity.isNonBoss方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.isNonBoss方法的具體用法?Java Entity.isNonBoss怎麽用?Java Entity.isNonBoss使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.Entity的用法示例。


在下文中一共展示了Entity.isNonBoss方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onHitEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@SubscribeEvent
public void onHitEntity(LivingHurtEvent event) {
	
	if (event.getAmount() <= 0 || event.getEntityLiving() instanceof EntityPlayer) return;
	
	if (!(event.getSource().getSourceOfDamage() instanceof EntityPlayer)) return;
	
	ItemStack transformer = BaublesApi.getBaublesHandler((EntityPlayer)event.getSource().getSourceOfDamage()).getStackInSlot(6);
	if (transformer == null || (transformer != null && transformer.getItem() != this)) return;
	
	Random rand = new Random();
	if (rand.nextInt(100) != 0) return;
	
	EntityLivingBase elb = event.getEntityLiving();
	List<String> entities = new ArrayList<String>(EntityList.ENTITY_EGGS.keySet());
	String randomString = entities.get(rand.nextInt(entities.size()));
	Entity entity = EntityList.createEntityByName(randomString, elb.worldObj);
	if (!entity.isNonBoss()) return;
	entity.setPositionAndRotation(elb.posX, elb.posY, elb.posZ, elb.rotationYaw, elb.rotationPitch);
	
	elb.worldObj.spawnEntityInWorld(entity);
	elb.setDead();
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:24,代碼來源:EmblemTransformation.java

示例2: onEntityCollidedWithBlock

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Called When an Entity Collided with the Block
 */
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
    if (!entityIn.isRiding() && !entityIn.isBeingRidden() && entityIn.isNonBoss())
    {
        entityIn.setPortal(pos);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:11,代碼來源:BlockPortal.java

示例3: onEntityCollidedWithBlock

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Called When an Entity Collided with the Block
 */
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
    if (!entityIn.isRiding() && !entityIn.isBeingRidden() && entityIn.isNonBoss() && !worldIn.isRemote && entityIn.getEntityBoundingBox().intersectsWith(state.getBoundingBox(worldIn, pos).offset(pos)))
    {
        entityIn.changeDimension(1);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:11,代碼來源:BlockEndPortal.java

示例4: initGui

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public void initGui() {
	player = new EntityOtherPlayerMP(this.mc.world, new GameProfile(mc.player.getUniqueID(), "name"));
	for(ResourceLocation entry:ForgeRegistries.ENTITIES.getKeys()) {
		Entity entity=EntityList.createEntityByIDFromName(entry, this.mc.world);
		if(entity instanceof EntityLivingBase && ((entity.width + entity.height < 6 && entity.isNonBoss())||this.mc.player.capabilities.isCreativeMode)) {
			mobList.add((EntityLivingBase) entity);
			if(entity instanceof EntitySpy) {
				entity.getCapability(TF2weapons.WEAPONS_CAP, null).invisTicks=0;
			}
		}
	}
	Collections.sort(mobList, new Comparator<EntityLivingBase>() {

		@Override
		public int compare(EntityLivingBase o1, EntityLivingBase o2) {
			// TODO Auto-generated method stub
			return EntityList.getKey(o2).toString().compareTo(EntityList.getKey(o1).toString());
		}
		
	});
	Keyboard.enableRepeatEvents(true);
	this.playerNameField = new GuiTextField(6, this.fontRenderer, this.width / 2 + 26, this.height / 2 + 60, 108,
			19);
	this.playerNameField.setMaxStringLength(64);
	this.playerNameField.setFocused(true);
	this.buttonList.clear();
	for(int i=0;i<16;i++) {
		this.buttonList.add(new GuiButton(i, this.width / 2 - 135 + (i%2) * 70, this.height / 2 - 60+i/2*20, 70, 20,
				I18n.format(EntityList.getTranslationName(EntityList.getKey(EntityZombie.class)), new Object[0])));
	}
	/*this.buttonList.add(new GuiButton(0, this.width / 2 - 135, this.height / 2 - 20, 60, 20,
			I18n.format(EntityList.getTranslationName(EntityList.getKey(EntityZombie.class)), new Object[0])));
	this.buttonList.add(new GuiButton(1, this.width / 2 - 65, this.height / 2 - 20, 60, 20,
			I18n.format(EntityList.getTranslationName(EntityList.getKey(EntityCreeper.class)), new Object[0])));
	this.buttonList.add(new GuiButton(2, this.width / 2 + 5, this.height / 2 - 20, 60, 20,
			I18n.format(EntityList.getTranslationName(EntityList.getKey(EntityEnderman.class)), new Object[0])));
	this.buttonList.add(new GuiButton(7, this.width / 2 + 75, this.height / 2 - 20, 60, 20,
			I18n.format(EntityList.getTranslationName(EntityList.getKey(EntitySpider.class)), new Object[0])));
	this.buttonList.add(new GuiButton(3, this.width / 2 - 135, this.height / 2 + 90, 60, 20,
			I18n.format(EntityList.getTranslationName(EntityList.getKey(EntityCow.class)), new Object[0])));
	this.buttonList.add(new GuiButton(4, this.width / 2 - 65, this.height / 2 + 90, 60, 20,
			I18n.format(EntityList.getTranslationName(EntityList.getKey(EntityPig.class)), new Object[0])));
	this.buttonList.add(new GuiButton(8, this.width / 2 + 5, this.height / 2 + 90, 60, 20,
			I18n.format(EntityList.getTranslationName(EntityList.getKey(EntityChicken.class)), new Object[0])));*/
	this.buttonList
			.add(playerDisguise = new GuiButton(30, this.width / 2 + 25, this.height / 2 + 80, 110, 20, "Player"));
	this.setButtons();

}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:51,代碼來源:GuiDisguiseKit.java


注:本文中的net.minecraft.entity.Entity.isNonBoss方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。