本文整理汇总了C#中CraftyServer.Core.World.entityJoinedWorld方法的典型用法代码示例。如果您正苦于以下问题:C# World.entityJoinedWorld方法的具体用法?C# World.entityJoinedWorld怎么用?C# World.entityJoinedWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CraftyServer.Core.World
的用法示例。
在下文中一共展示了World.entityJoinedWorld方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onBlockDestroyedByExplosion
public override void onBlockDestroyedByExplosion(World world, int i, int j, int k)
{
var entitytntprimed = new EntityTNTPrimed(world, i + 0.5F, j + 0.5F,
k + 0.5F);
entitytntprimed.fuse = world.rand.nextInt(entitytntprimed.fuse/4) + entitytntprimed.fuse/8;
world.entityJoinedWorld(entitytntprimed);
}
示例2: onBlockDestroyedByPlayer
public override void onBlockDestroyedByPlayer(World world, int i, int j, int k, int l)
{
if (world.singleplayerWorld)
{
return;
}
else
{
var entitytntprimed = new EntityTNTPrimed(world, i + 0.5F, j + 0.5F,
k + 0.5F);
world.entityJoinedWorld(entitytntprimed);
world.playSoundAtEntity(entitytntprimed, "random.fuse", 1.0F, 1.0F);
return;
}
}
示例3: performSleepSpawning
public static bool performSleepSpawning(World world, List list)
{
bool flag = false;
var pathfinder = new Pathfinder(world);
Iterator iterator = list.iterator();
do
{
if (!iterator.hasNext())
{
break;
}
var entityplayer = (EntityPlayer) iterator.next();
Class[] aclass = field_22213_a;
if (aclass != null && aclass.Length != 0)
{
bool flag1 = false;
int i = 0;
while (i < 20 && !flag1)
{
int j = (MathHelper.floor_double(entityplayer.posX) + world.rand.nextInt(32)) -
world.rand.nextInt(32);
int k = (MathHelper.floor_double(entityplayer.posZ) + world.rand.nextInt(32)) -
world.rand.nextInt(32);
int l = (MathHelper.floor_double(entityplayer.posY) + world.rand.nextInt(16)) -
world.rand.nextInt(16);
if (l < 1)
{
l = 1;
}
else if (l > 128)
{
l = 128;
}
int i1 = world.rand.nextInt(aclass.Length);
int j1;
for (j1 = l; j1 > 2 && !world.isBlockOpaqueCube(j, j1 - 1, k); j1--)
{
}
for (;
!func_21167_a(EnumCreatureType.monster, world, j, j1, k) && j1 < l + 16 && j1 < 128;
j1++)
{
}
if (j1 >= l + 16 || j1 >= 128)
{
j1 = l;
}
else
{
float f = j + 0.5F;
float f1 = j1;
float f2 = k + 0.5F;
EntityLiving entityliving;
try
{
entityliving = (EntityLiving) aclass[i1].getConstructor(new Class[]
{
typeof (World)
}).newInstance(new object[]
{
world
});
}
catch (Exception exception)
{
exception.printStackTrace();
return flag;
}
entityliving.setLocationAndAngles(f, f1, f2, world.rand.nextFloat()*360F, 0.0F);
if (entityliving.getCanSpawnHere())
{
PathEntity pathentity = pathfinder.createEntityPathTo(entityliving, entityplayer, 32F);
if (pathentity != null && pathentity.pathLength > 1)
{
PathPoint pathpoint = pathentity.func_22211_c();
if (Math.abs(pathpoint.xCoord - entityplayer.posX) < 1.5D &&
Math.abs(pathpoint.zCoord - entityplayer.posZ) < 1.5D &&
Math.abs(pathpoint.yCoord - entityplayer.posY) < 1.5D)
{
ChunkCoordinates chunkcoordinates = BlockBed.func_22021_g(world,
MathHelper.
floor_double(
entityplayer.
posX),
MathHelper.
floor_double(
entityplayer.
posY),
MathHelper.
floor_double(
entityplayer.
posZ), 1);
entityliving.setLocationAndAngles(chunkcoordinates.posX + 0.5F,
chunkcoordinates.posY,
chunkcoordinates.posZ + 0.5F, 0.0F,
0.0F);
world.entityJoinedWorld(entityliving);
func_21166_a(entityliving, world, chunkcoordinates.posX + 0.5F,
chunkcoordinates.posY, chunkcoordinates.posZ + 0.5F);
entityplayer.wakeUpPlayer(true, false);
//.........这里部分代码省略.........
示例4: func_21166_a
private static void func_21166_a(EntityLiving entityliving, World world, float f, float f1, float f2)
{
if ((entityliving is EntitySpider) && world.rand.nextInt(100) == 0)
{
var entityskeleton = new EntitySkeleton(world);
entityskeleton.setLocationAndAngles(f, f1, f2, entityliving.rotationYaw, 0.0F);
world.entityJoinedWorld(entityskeleton);
entityskeleton.mountEntity(entityliving);
}
else if (entityliving is EntitySheep)
{
((EntitySheep) entityliving).setFleeceColor(EntitySheep.func_21066_a(world.rand));
}
}
示例5: performSpawning
//.........这里部分代码省略.........
EnumCreatureType[] var34 = EnumCreatureType.values();
var6 = var34.Length;
for (int var35 = 0; var35 < var6; ++var35)
{
EnumCreatureType var36 = var34[var35];
if ((!var36.func_21103_d() || var2) && (var36.func_21103_d() || var1) &&
var0.countEntities(var36.getCreatureClass()) <=
var36.getMaxNumberOfCreature()*eligibleChunksForSpawning.size()/256)
{
Iterator var37 = eligibleChunksForSpawning.iterator();
while (var37.hasNext())
{
var var10 = (ChunkCoordIntPair) var37.next();
MobSpawnerBase var11 = var0.getWorldChunkManager().func_4066_a(var10);
Class[] var12 = var11.getEntitiesForType(var36);
if (var12 != null && var12.Length != 0)
{
int var13 = var0.rand.nextInt(var12.Length);
ChunkPosition var14 = getRandomSpawningPointInChunk(var0, var10.chunkXPos*16,
var10.chunkZPos*16);
int var15 = var14.x;
int var16 = var14.y;
int var17 = var14.z;
if (!var0.isBlockOpaqueCube(var15, var16, var17) &&
var0.getBlockMaterial(var15, var16, var17) == var36.getCreatureMaterial())
{
int var18 = 0;
for (int var19 = 0; var19 < 3; ++var19)
{
int var20 = var15;
int var21 = var16;
int var22 = var17;
byte var23 = 6;
for (int var24 = 0; var24 < 4; ++var24)
{
var20 += var0.rand.nextInt(var23) - var0.rand.nextInt(var23);
var21 += var0.rand.nextInt(1) - var0.rand.nextInt(1);
var22 += var0.rand.nextInt(var23) - var0.rand.nextInt(var23);
if (func_21167_a(var36, var0, var20, var21, var22))
{
float var25 = var20 + 0.5F;
float var26 = var21;
float var27 = var22 + 0.5F;
if (
var0.getClosestPlayer(var25, var26, var27,
24.0D) == null)
{
float var28 = var25 - var33.posX;
float var29 = var26 - var33.posY;
float var30 = var27 - var33.posZ;
float var31 = var28*var28 + var29*var29 + var30*var30;
if (var31 >= 576.0F)
{
EntityLiving var38;
try
{
var38 =
(EntityLiving)
var12[var13].getConstructor(new Class[] {typeof (World)})
.newInstance(new object[] {var0});
}
catch (Exception var32)
{
var32.printStackTrace();
return var3;
}
var38.setLocationAndAngles(var25, var26,
var27,
var0.rand.nextFloat()*360.0F, 0.0F);
if (var38.getCanSpawnHere())
{
++var18;
var0.entityJoinedWorld(var38);
func_21166_a(var38, var0, var25, var26, var27);
if (var18 >= var38.getMaxSpawnedInChunk())
{
continue;
}
}
var3 += var18;
}
}
}
}
}
}
}
}
}
}
return var3;
}
}
示例6: dropBlockAsItemWithChance
public virtual void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
{
if (world.singleplayerWorld)
{
return;
}
int i1 = quantityDropped(world.rand);
for (int j1 = 0; j1 < i1; j1++)
{
if (world.rand.nextFloat() > f)
{
continue;
}
int k1 = idDropped(l, world.rand);
if (k1 > 0)
{
float f1 = 0.7F;
double d = (world.rand.nextFloat()*f1) + (1.0F - f1)*0.5D;
double d1 = (world.rand.nextFloat()*f1) + (1.0F - f1)*0.5D;
double d2 = (world.rand.nextFloat()*f1) + (1.0F - f1)*0.5D;
var entityitem = new EntityItem(world, i + d, j + d1, k + d2,
new ItemStack(k1, 1, damageDropped(l)));
entityitem.delayBeforeCanPickup = 10;
world.entityJoinedWorld(entityitem);
}
}
}
示例7: onBlockRemoval
public override void onBlockRemoval(World world, int i, int j, int k)
{
var tileentitychest = (TileEntityChest) world.getBlockTileEntity(i, j, k);
for (int l = 0; l < tileentitychest.getSizeInventory(); l++)
{
ItemStack itemstack = tileentitychest.getStackInSlot(l);
if (itemstack == null)
{
continue;
}
float f = random.nextFloat()*0.8F + 0.1F;
float f1 = random.nextFloat()*0.8F + 0.1F;
float f2 = random.nextFloat()*0.8F + 0.1F;
do
{
if (itemstack.stackSize <= 0)
{
goto label0;
}
int i1 = random.nextInt(21) + 10;
if (i1 > itemstack.stackSize)
{
i1 = itemstack.stackSize;
}
itemstack.stackSize -= i1;
var entityitem = new EntityItem(world, i + f, j + f1, k + f2,
new ItemStack(itemstack.itemID, i1, itemstack.getItemDamage()));
float f3 = 0.05F;
entityitem.motionX = (float) random.nextGaussian()*f3;
entityitem.motionY = (float) random.nextGaussian()*f3 + 0.2F;
entityitem.motionZ = (float) random.nextGaussian()*f3;
world.entityJoinedWorld(entityitem);
} while (true);
}
label0:
base.onBlockRemoval(world, i, j, k);
}