Beispiel #1
0
        public override void OnBlockBroken(IWorldAccessor world, BlockPos pos, IPlayer byPlayer, float dropQuantityMultiplier = 1)
        {
            base.OnBlockBroken(world, pos, byPlayer, dropQuantityMultiplier);

            EntityProperties type   = world.GetEntityType(new AssetLocation("beemob"));
            Entity           entity = world.ClassRegistry.CreateEntity(type);

            if (entity != null)
            {
                entity.ServerPos.X   = pos.X + 0.5f;
                entity.ServerPos.Y   = pos.Y + 0.5f;
                entity.ServerPos.Z   = pos.Z + 0.5f;
                entity.ServerPos.Yaw = (float)world.Rand.NextDouble() * 2 * GameMath.PI;
                entity.Pos.SetFrom(entity.ServerPos);

                entity.Attributes.SetString("origin", "brokenbeehive");
                world.SpawnEntity(entity);
            }
        }