本文整理汇总了C#中CraftyServer.Core.World类的典型用法代码示例。如果您正苦于以下问题:C# World类的具体用法?C# World怎么用?C# World使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
World类属于CraftyServer.Core命名空间,在下文中一共展示了World类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onEntityWalking
public override void onEntityWalking(World world, int i, int j, int k, Entity entity)
{
if (world.rand.nextInt(4) == 0)
{
world.setBlockWithNotify(i, j, k, dirt.blockID);
}
}
示例2: generate
public override bool generate(World world, Random random, int i, int j, int k)
{
worldObj = world;
long l = random.nextLong();
field_759_b.setSeed(l);
basePos[0] = i;
basePos[1] = j;
basePos[2] = k;
if (field_756_e == 0)
{
field_756_e = 5 + field_759_b.nextInt(field_748_m);
}
if (!func_422_e())
{
return false;
}
else
{
func_424_a();
func_421_b();
func_432_c();
func_428_d();
return true;
}
}
示例3: collisionRayTrace
public override MovingObjectPosition collisionRayTrace(World world, int i, int j, int k, Vec3D vec3d,
Vec3D vec3d1)
{
int l = world.getBlockMetadata(i, j, k) & 7;
float f = 0.15F;
if (l == 1)
{
setBlockBounds(0.0F, 0.2F, 0.5F - f, f*2.0F, 0.8F, 0.5F + f);
}
else if (l == 2)
{
setBlockBounds(1.0F - f*2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
}
else if (l == 3)
{
setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f*2.0F);
}
else if (l == 4)
{
setBlockBounds(0.5F - f, 0.2F, 1.0F - f*2.0F, 0.5F + f, 0.8F, 1.0F);
}
else
{
float f1 = 0.1F;
setBlockBounds(0.5F - f1, 0.0F, 0.5F - f1, 0.5F + f1, 0.6F, 0.5F + f1);
}
return base.collisionRayTrace(world, i, j, k, vec3d, vec3d1);
}
示例4: playBlock
public override void playBlock(World world, int i, int j, int k, int l, int i1)
{
var f = (float) Math.pow(2D, (i1 - 12)/12D);
string s = "harp";
if (l == 1)
{
s = "bd";
}
if (l == 2)
{
s = "snare";
}
if (l == 3)
{
s = "hat";
}
if (l == 4)
{
s = "bassattack";
}
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D,
(new StringBuilder()).append("note.").append(s).toString(), 3F, f);
world.spawnParticle("note", i + 0.5D, j + 1.2D, k + 0.5D, i1/24D, 0.0D,
0.0D);
}
示例5: onBlockRemoval
public override void onBlockRemoval(World world, int i, int j, int k)
{
byte byte0 = 4;
int l = byte0 + 1;
if (world.checkChunksExist(i - l, j - l, k - l, i + l, j + l, k + l))
{
for (int i1 = -byte0; i1 <= byte0; i1++)
{
for (int j1 = -byte0; j1 <= byte0; j1++)
{
for (int k1 = -byte0; k1 <= byte0; k1++)
{
int l1 = world.getBlockId(i + i1, j + j1, k + k1);
if (l1 != leaves.blockID)
{
continue;
}
int i2 = world.getBlockMetadata(i + i1, j + j1, k + k1);
if ((i2 & 4) == 0)
{
world.setBlockMetadata(i + i1, j + j1, k + k1, i2 | 4);
}
}
}
}
}
}
示例6: canPlaceBlockAt
public override bool canPlaceBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j - 1, k);
if (l == blockID)
{
return true;
}
if (l != grass.blockID && l != dirt.blockID)
{
return false;
}
if (world.getBlockMaterial(i - 1, j - 1, k) == Material.water)
{
return true;
}
if (world.getBlockMaterial(i + 1, j - 1, k) == Material.water)
{
return true;
}
if (world.getBlockMaterial(i, j - 1, k - 1) == Material.water)
{
return true;
}
return world.getBlockMaterial(i, j - 1, k + 1) == Material.water;
}
示例7: isIndirectlyPoweringTo
public override bool isIndirectlyPoweringTo(World world, int i, int j, int k, int l)
{
int i1 = world.getBlockMetadata(i, j, k);
if ((i1 & 8) == 0)
{
return false;
}
int j1 = i1 & 7;
if (j1 == 5 && l == 1)
{
return true;
}
if (j1 == 4 && l == 2)
{
return true;
}
if (j1 == 3 && l == 3)
{
return true;
}
if (j1 == 2 && l == 4)
{
return true;
}
return j1 == 1 && l == 5;
}
示例8: EntityFireball
public EntityFireball(World world, EntityLiving entityliving, double d, double d1, double d2)
: base(world)
{
xTile = -1;
yTile = -1;
zTile = -1;
inTile = 0;
inGround = false;
shake = 0;
ticksInAir = 0;
owner = entityliving;
setSize(1.0F, 1.0F);
setLocationAndAngles(entityliving.posX, entityliving.posY, entityliving.posZ, entityliving.rotationYaw,
entityliving.rotationPitch);
setPosition(posX, posY, posZ);
yOffset = 0.0F;
motionX = motionY = motionZ = 0.0D;
d += rand.nextGaussian()*0.40000000000000002D;
d1 += rand.nextGaussian()*0.40000000000000002D;
d2 += rand.nextGaussian()*0.40000000000000002D;
double d3 = MathHelper.sqrt_double(d*d + d1*d1 + d2*d2);
field_9199_b = (d/d3)*0.10000000000000001D;
field_9198_c = (d1/d3)*0.10000000000000001D;
field_9196_d = (d2/d3)*0.10000000000000001D;
}
示例9: getCollidingBoundingBoxes
public override void getCollidingBoundingBoxes(World world, int i, int j, int k, AxisAlignedBB axisalignedbb,
ArrayList arraylist)
{
int l = world.getBlockMetadata(i, j, k);
if (l == 0)
{
setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 1.0F);
base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
}
else if (l == 1)
{
setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 1.0F, 1.0F);
base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
}
else if (l == 2)
{
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 0.5F);
base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 1.0F, 1.0F);
base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
}
else if (l == 3)
{
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F);
base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F);
base.getCollidingBoundingBoxes(world, i, j, k, axisalignedbb, arraylist);
}
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
示例10: 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);
}
示例11: func_666_a
public override void func_666_a(World world, int i, int j, int k, int l, byte[] abyte0)
{
int i1 = rand.nextInt(rand.nextInt(rand.nextInt(40) + 1) + 1);
if (rand.nextInt(15) != 0)
{
i1 = 0;
}
for (int j1 = 0; j1 < i1; j1++)
{
double d = i*16 + rand.nextInt(16);
double d1 = rand.nextInt(rand.nextInt(120) + 8);
double d2 = j*16 + rand.nextInt(16);
int k1 = 1;
if (rand.nextInt(4) == 0)
{
func_669_a(k, l, abyte0, d, d1, d2);
k1 += rand.nextInt(4);
}
for (int l1 = 0; l1 < k1; l1++)
{
float f = rand.nextFloat()*3.141593F*2.0F;
float f1 = ((rand.nextFloat() - 0.5F)*2.0F)/8F;
float f2 = rand.nextFloat()*2.0F + rand.nextFloat();
releaseEntitySkin(k, l, abyte0, d, d1, d2, f2, f, f1, 0, 0, 1.0D);
}
}
}
示例12: updateTick
public override void updateTick(World world, int i, int j, int k, Random random)
{
if (world.singleplayerWorld)
{
return;
}
if (world.getBlockLightValue(i, j + 1, k) < 4 && world.getBlockMaterial(i, j + 1, k).getCanBlockGrass())
{
if (random.nextInt(4) != 0)
{
return;
}
world.setBlockWithNotify(i, j, k, dirt.blockID);
}
else if (world.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = (i + random.nextInt(3)) - 1;
int i1 = (j + random.nextInt(5)) - 3;
int j1 = (k + random.nextInt(3)) - 1;
if (world.getBlockId(l, i1, j1) == dirt.blockID && world.getBlockLightValue(l, i1 + 1, j1) >= 4 &&
!world.getBlockMaterial(l, i1 + 1, j1).getCanBlockGrass())
{
world.setBlockWithNotify(l, i1, j1, grass.blockID);
}
}
}
示例13: generate
public override bool generate(World world, Random random, int i, int j, int k)
{
for (int l = 0; l < 20; l++)
{
int i1 = (i + random.nextInt(4)) - random.nextInt(4);
int j1 = j;
int k1 = (k + random.nextInt(4)) - random.nextInt(4);
if (!world.isAirBlock(i1, j1, k1) ||
world.getBlockMaterial(i1 - 1, j1 - 1, k1) != Material.water &&
world.getBlockMaterial(i1 + 1, j1 - 1, k1) != Material.water &&
world.getBlockMaterial(i1, j1 - 1, k1 - 1) != Material.water &&
world.getBlockMaterial(i1, j1 - 1, k1 + 1) != Material.water)
{
continue;
}
int l1 = 2 + random.nextInt(random.nextInt(3) + 1);
for (int i2 = 0; i2 < l1; i2++)
{
if (Block.reed.canBlockStay(world, i1, j1 + i2, k1))
{
world.setBlock(i1, j1 + i2, k1, Block.reed.blockID);
}
}
}
return true;
}
示例14: onNeighborBlockChange
public override void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
int i1 = world.getBlockMetadata(i, j, k);
bool flag = false;
if (i1 == 2 && world.isBlockOpaqueCube(i, j, k + 1))
{
flag = true;
}
if (i1 == 3 && world.isBlockOpaqueCube(i, j, k - 1))
{
flag = true;
}
if (i1 == 4 && world.isBlockOpaqueCube(i + 1, j, k))
{
flag = true;
}
if (i1 == 5 && world.isBlockOpaqueCube(i - 1, j, k))
{
flag = true;
}
if (!flag)
{
dropBlockAsItem(world, i, j, k, i1);
world.setBlockWithNotify(i, j, k, 0);
}
base.onNeighborBlockChange(world, i, j, k, l);
}
示例15: createEntityFromNBT
public static Entity createEntityFromNBT(NBTTagCompound nbttagcompound, World world)
{
Entity entity = null;
try
{
var class1 = (Class) stringToClassMapping.get(nbttagcompound.getString("id"));
if (class1 != null)
{
entity = (Entity) class1.getConstructor(new Class[]
{
typeof (World)
}).newInstance(new object[]
{
world
});
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
if (entity != null)
{
entity.readFromNBT(nbttagcompound);
}
else
{
[email protected](
(new StringBuilder()).append("Skipping Entity with id ").append(nbttagcompound.getString("id")).
toString());
}
return entity;
}