本文整理汇总了Java中net.minecraft.item.ItemMonsterPlacer类的典型用法代码示例。如果您正苦于以下问题:Java ItemMonsterPlacer类的具体用法?Java ItemMonsterPlacer怎么用?Java ItemMonsterPlacer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemMonsterPlacer类属于net.minecraft.item包,在下文中一共展示了ItemMonsterPlacer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEntity
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
public EntityLivingBase getEntity(ItemStack stack)
{
if(stack.getItem() == Item.getItemFromBlock(Blocks.AIR)
|| stack.equals(ItemStack.EMPTY))
{
this.entity = null;
return null;
}
try
{
this.entity = (EntityLivingBase) ForgeRegistries.ENTITIES.getValue((ItemMonsterPlacer.getNamedIdFrom(stack))).newInstance(world);
}
catch (NullPointerException e) {
}
return this.entity;
}
示例2: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
super.updateTick(worldIn, pos, state, rand);
if (worldIn.provider.isSurfaceWorld() && worldIn.getGameRules().getBoolean("doMobSpawning") && rand.nextInt(2000) < worldIn.getDifficulty().getDifficultyId())
{
int i = pos.getY();
BlockPos blockpos;
for (blockpos = pos; !World.doesBlockHaveSolidTopSurface(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
if (i > 0 && !worldIn.getBlockState(blockpos.up()).getBlock().isNormalCube())
{
Entity entity = ItemMonsterPlacer.spawnCreature(worldIn, 57, (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 1.1D, (double)blockpos.getZ() + 0.5D);
if (entity != null)
{
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例3: getSpawnEggColor
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
private static int getSpawnEggColor(ItemMonsterPlacer p_getSpawnEggColor_0_, ItemStack p_getSpawnEggColor_1_, int p_getSpawnEggColor_2_, int p_getSpawnEggColor_3_)
{
int i = p_getSpawnEggColor_1_.getMetadata();
int[] aint = p_getSpawnEggColor_2_ == 0 ? spawnEggPrimaryColors : spawnEggSecondaryColors;
if (aint == null)
{
return p_getSpawnEggColor_3_;
}
else if (i >= 0 && i < aint.length)
{
int j = aint[i];
return j < 0 ? p_getSpawnEggColor_3_ : j;
}
else
{
return p_getSpawnEggColor_3_;
}
}
示例4: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
super.updateTick(worldIn, pos, state, rand);
if (worldIn.provider.isSurfaceWorld() && worldIn.getGameRules().getBoolean("doMobSpawning") && rand.nextInt(2000) < worldIn.getDifficulty().getDifficultyId())
{
int i = pos.getY();
BlockPos blockpos;
for (blockpos = pos; !worldIn.getBlockState(blockpos).isFullyOpaque() && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
if (i > 0 && !worldIn.getBlockState(blockpos.up()).isNormalCube())
{
Entity entity = ItemMonsterPlacer.spawnCreature(worldIn, EntityList.func_191306_a(EntityPigZombie.class), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 1.1D, (double)blockpos.getZ() + 0.5D);
if (entity != null)
{
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例5: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
super.updateTick(worldIn, pos, state, rand);
if (worldIn.provider.isSurfaceWorld() && worldIn.getGameRules().getBoolean("doMobSpawning") && rand.nextInt(2000) < worldIn.getDifficulty().getDifficultyId())
{
int i = pos.getY();
BlockPos blockpos;
for (blockpos = pos; !worldIn.getBlockState(blockpos).isFullyOpaque() && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
if (i > 0 && !worldIn.getBlockState(blockpos.up()).isNormalCube())
{
Entity entity = ItemMonsterPlacer.spawnCreature(worldIn, EntityList.getEntityStringFromClass(EntityPigZombie.class), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 1.1D, (double)blockpos.getZ() + 0.5D);
if (entity != null)
{
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例6: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World world, int x, int y, int z, Random random) {
super.updateTick(world, x, y, z, random);
if (world.provider.isSurfaceWorld() && world.getGameRules().getGameRuleBooleanValue("doMobSpawning") && random.nextInt(2000) < world.difficultySetting.getDifficultyId()) {
int l;
for (l = y; !World.doesBlockHaveSolidTopSurface(world, x, l, z) && l > 0; --l) {
;
}
if (l > 0 && !world.getBlock(x, l + 1, z).isNormalCube()) {
Entity entity = ItemMonsterPlacer.spawnCreature(world, 57, (double)x + 0.5D, (double)l + 1.1D, (double)z + 0.5D);
if (entity != null) {
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例7: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
{
super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
if (p_149674_1_.provider.isSurfaceWorld() && p_149674_1_.getGameRules().getGameRuleBooleanValue("doMobSpawning") && p_149674_5_.nextInt(2000) < p_149674_1_.difficultySetting.getDifficultyId())
{
int var6;
for (var6 = p_149674_3_; !World.doesBlockHaveSolidTopSurface(p_149674_1_, p_149674_2_, var6, p_149674_4_) && var6 > 0; --var6)
{
;
}
if (var6 > 0 && !p_149674_1_.getBlock(p_149674_2_, var6 + 1, p_149674_4_).isNormalCube())
{
Entity var7 = ItemMonsterPlacer.spawnCreature(p_149674_1_, 57, (double)p_149674_2_ + 0.5D, (double)var6 + 1.1D, (double)p_149674_4_ + 0.5D);
if (var7 != null)
{
var7.timeUntilPortal = var7.getPortalCooldown();
}
}
}
}
示例8: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
{
super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
if (p_149674_1_.getSpigotConfig().enableZombiePigmenPortalSpawns && p_149674_1_.provider.isSurfaceWorld() && p_149674_1_.getGameRules().getGameRuleBooleanValue("doMobSpawning") && p_149674_5_.nextInt(2000) < p_149674_1_.difficultySetting.getDifficultyId()) // Spigot // Cauldron
{
int l;
for (l = p_149674_3_; !World.doesBlockHaveSolidTopSurface(p_149674_1_, p_149674_2_, l, p_149674_4_) && l > 0; --l)
{
;
}
if (l > 0 && !p_149674_1_.getBlock(p_149674_2_, l + 1, p_149674_4_).isNormalCube())
{
Entity entity = ItemMonsterPlacer.spawnCreature(p_149674_1_, 57, (double)p_149674_2_ + 0.5D, (double)l + 1.1D, (double)p_149674_4_ + 0.5D);
if (entity != null)
{
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例9: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
{
super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
if (p_149674_1_.provider.isSurfaceWorld() && p_149674_1_.getGameRules().getGameRuleBooleanValue("doMobSpawning") && p_149674_5_.nextInt(2000) < p_149674_1_.difficultySetting.getDifficultyId())
{
int l;
for (l = p_149674_3_; !World.doesBlockHaveSolidTopSurface(p_149674_1_, p_149674_2_, l, p_149674_4_) && l > 0; --l)
{
;
}
if (l > 0 && !p_149674_1_.getBlock(p_149674_2_, l + 1, p_149674_4_).isNormalCube())
{
Entity entity = ItemMonsterPlacer.spawnCreature(p_149674_1_, 57, (double)p_149674_2_ + 0.5D, (double)l + 1.1D, (double)p_149674_4_ + 0.5D);
if (entity != null)
{
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例10: func_71847_b
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
public void func_71847_b(World p_71847_1_, int p_71847_2_, int p_71847_3_, int p_71847_4_, Random p_71847_5_) {
super.func_71847_b(p_71847_1_, p_71847_2_, p_71847_3_, p_71847_4_, p_71847_5_);
if(p_71847_1_.field_73011_w.func_76569_d() && p_71847_5_.nextInt(2000) < p_71847_1_.field_73013_u) {
int var6;
for(var6 = p_71847_3_; !p_71847_1_.func_72797_t(p_71847_2_, var6, p_71847_4_) && var6 > 0; --var6) {
;
}
if(var6 > 0 && !p_71847_1_.func_72809_s(p_71847_2_, var6 + 1, p_71847_4_)) {
Entity var7 = ItemMonsterPlacer.func_77840_a(p_71847_1_, 57, (double)p_71847_2_ + 0.5D, (double)var6 + 1.1D, (double)p_71847_4_ + 0.5D);
if(var7 != null) {
var7.field_71088_bW = var7.func_82147_ab();
}
}
}
}
示例11: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.provider.isSurfaceWorld() && par5Random.nextInt(2000) < par1World.difficultySetting)
{
int l;
for (l = par3; !par1World.doesBlockHaveSolidTopSurface(par2, l, par4) && l > 0; --l)
{
;
}
if (l > 0 && !par1World.isBlockNormalCube(par2, l + 1, par4))
{
Entity entity = ItemMonsterPlacer.spawnCreature(par1World, 57, (double)par2 + 0.5D, (double)l + 1.1D, (double)par4 + 0.5D);
if (entity != null)
{
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例12: dispenseStack
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
double d0 = par1IBlockSource.getX() + (double)enumfacing.getFrontOffsetX();
double d1 = (double)((float)par1IBlockSource.getYInt() + 0.2F);
double d2 = par1IBlockSource.getZ() + (double)enumfacing.getFrontOffsetZ();
Entity entity = ItemMonsterPlacer.spawnCreature(par1IBlockSource.getWorld(), par2ItemStack.getItemDamage(), d0, d1, d2);
if (entity instanceof EntityLivingBase && par2ItemStack.hasDisplayName())
{
((EntityLiving)entity).setCustomNameTag(par2ItemStack.getDisplayName());
}
par2ItemStack.splitStack(1);
return par2ItemStack;
}
示例13: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
@Override
public void updateTick(World par1World, int par2, int par3, int par4,
Random par5Random) {
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.provider.isSurfaceWorld()
&& par5Random.nextInt(2000) < par1World.difficultySetting) {
int l;
for (l = par3; !par1World.doesBlockHaveSolidTopSurface(par2, l,
par4) && l > 0; --l) {
;
}
if (l > 0 && !par1World.isBlockNormalCube(par2, l + 1, par4)) {
Entity entity = ItemMonsterPlacer.spawnCreature(par1World, 57,
par2 + 0.5D, l + 1.1D, par4 + 0.5D);
if (entity != null) {
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例14: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
/**
* Checks to see if this location is valid to create a portal and will
* return True if it does. Args: world, x, y, z
*/
@Override
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.provider.isSurfaceWorld()
&& (par5Random.nextInt(2000) < par1World.difficultySetting)){
int l;
for (l = par3; !par1World.doesBlockHaveSolidTopSurface(par2, l, par4) && (l > 0); --l){
;
}
if ((l > 0) && !par1World.isBlockNormalCube(par2, l + 1, par4)){
Entity entity = ItemMonsterPlacer.spawnCreature(par1World, 57, par2 + 0.5D,
l + 1.1D, par4 + 0.5D);
if (entity != null){
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
示例15: updateTick
import net.minecraft.item.ItemMonsterPlacer; //导入依赖的package包/类
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.provider.isSurfaceWorld() && par5Random.nextInt(2000) < par1World.difficultySetting)
{
int l;
for (l = par3; !par1World.doesBlockHaveSolidTopSurface(par2, l, par4) && l > 0; --l)
{
;
}
if (l > 0 && !par1World.isBlockNormalCube(par2, l + 1, par4))
{
Entity entity = ItemMonsterPlacer.spawnCreature(par1World, 57, (double)par2 + 0.5D, (double)l + 1.1D, (double)par4 + 0.5D);
if (entity != null)
{
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}